Macrohax v2

(adapted from my old website)

I've finally implemented my most feared feature: A game save/load mechanism.

This feature was something I'd always been afraid of. I would start working on my game, and someone would say, "Your game sucks! You need save/load!", but that would require me to redo everything I've done in a serialisable way. A nightmare! Sure, the games had 'jump to level', but true saving and loading would allow you to save at any point.

Now, I use boost::serialisation coupled with NGF's 'forEachGameObject' and a 'GameObjectRecord' data structure to bring you... NGF::Serialiser! Here's what it looks like:-

    //Because NGF::GameObject doesn't know anything about your position 
    //and orientation, but gives it to you when you're created. Some 
    //GameObjects such as 'sound' might not need these.

    NGF_SERIALISE_AUTO(Real, mHealth);

Yup, that's all you need to make the Player GameObject persistent. You just throw that into the class definition. The 'properties' (loaded from the level file (which might be exported from Blender)) and the GameObject's name are saved too. Then, you can just do this:-

//For saving.

//For loading.

Beautiful, isn't it? :-)