Save/Load

While working on switching the new game/instant action/tutorials over to reading data from xml files instead of being hard coded into the executable I needed some more info added to the save game file – now that research was being read in via xml I needed the save game file to have a link to the research file. So as usual I added it in to the save game file as plain text, predictably the game crashed on a load, my method of saving and loading is very primitive and relies on an exact sequence. The crash was caused due to me not obeying the exacting rules, usually I’d look through the code and mirror the save/load, or find some typo, but this time I decided to do away with the primitive method and switch over to the xml tags method as I’ve been doing for quite a while now.

And after two days of fairly boring coding in between spending time with relatives, I’m to the point that saving and loading work again, but are most likely very buggy. The good news is that crashing on loading should be mostly a thing of the past, however having the game crash during this stage of development isn’t always bad, it immediately told me there was a problem, and usually led me to where the problem is fairly quickly. Still this method is better, is much more flexible, easier to manage and will even lead to save games not being incompatible with every little change I make – which will be very handy during testing.

Now that the save game files are xml they are very human readable and thus editable, I’m not sure if I’ll throw in some protections against editing the save game files, all the other data files are easily editable for modding so there may not be much point, but we’ll see.

I’m itching pretty bad to add something substantial (and more creative coding wise) to the project, once the holiday season is over and I still have some days before another semester starts I’ll focus on the AI upgrades.