Save games

One of the biggest nightmares for me in MMORPG Tycoon 1 and 1.1 was that of save game support.  In version 1, there was well over a megabyte of binary data that had to be saved and loaded successfully, to resume a game in progress.  In version 1.1, that size was growing drastically, as all sorts of new configurable settings and a new, much more complicated subscriber AI model were added.  But even worse than simply maintaining those save files, I needed to support loading in save games saved in earlier versions, and converting that data to a new format so that it could be used by the new game (as happened between versions 1.0.6 and 1.0.7, for example)

Those save files are going to be getting much, much larger again in version 2.0, and I imagine that the save file format will continue changing even after release, as I add further new features.  So I’m spending a little time investigating strategies which will hopefully ease the burden of managing those save files..  I was already using serialisation (which basically allows one to write a single piece of code which handles both saving and loading, instead of having to write two separate functions and manually keep the two in synch), but even that wasn’t helping enough.  Now I’m looking into moving to a property-based system, or possibly even to a full-blown reflection-type system, either of which would essentially be able to understand their own data well enough to write their own save/load routines automatically, at the expense of a slightly more complicated codebase, and perhaps some small amount of lost performance.

But I’m not sure.  I’m still thinking it over.  Designing and implementing something like a reflection system in C++ (which is not at all designed to support that type of language feature) can be rather brain-melting, I’m finding.  Especially since I’m so picky about what my code needs to look like.