Saving: When and where

Saving and loading is the task of the day.  I’m rapidly becoming comfortable with rapidXML (harr) now that I’m using it a lot in a short period of time.

The question in terms of design, though, is save types.  Exactly how much needs to be saved, and at what times should the player be able to save?  Only allowing saves on planets would probably simplify the task, but I’ve decided to just go all out and allow the player to save anywhere.  So, before me is the task of writing save and load functions for every piece of data which can change over the course of the game.  It’s not as bad as I feared, however- the functions I’ve written to wrap around rapidXML have let me turn whole swaths of the task into a sort of copy+paste+change two words+repeat operation.  If C++ supported reflection, I could probably eliminate even that, and automate the process of adding new data types too.  Anyway, since I’m already loading all my data from XML, I’ve settled on a suitable XML structure for most everything, so there’s really not much design or thought required.  The downside of using XML as a save format is that a lot of data is wasted in repetitive formatting in the XML file itself, but I’m sure all that waste will disappear if I compress it, should it ever become a problem.  In any case, keeping save games user-editable is something I might as well keep in until I have a good reason not to.

This entry was posted in Design. Bookmark the permalink.

Comments are closed.