Oddly enough, these dry bits of engine development are often the most exciting to me, since they open up all sorts of exciting new possibilities, and make development substantially easier in the future.
I’ve been doing further development on the “automatic save/load” system that I’ve talked about before; the system which automatically handles loading and saving of game data, without me having to write custom code for everything the way that I did back in previous games. For comparison, in MMORPG Tycoon 1, nearly half of my total development time went into the save/load functionality — it’s extremely complicated, and extremely bug-prone, so anything that I can do to make the saving/loading process easier and safer is going to be a huge win, overall!
This “how do we load and save large amounts of data” issue, incidentally, is one that professional game development teams everywhere have struggled with forever, and I’ve seen a lot of different solutions to it. But I’ve gotta say, this solution I’ve been working on is by far the best that I’ve ever seen within the C++ language; it imposes few restrictions on the code I write, and can just automatically figure out how to save files out based upon inspecting the saveable variables I expose within each class.
What I’ve done today is to make this system recursive. That is, you can now have an object which contains other objects, which contain other objects. Or to give a more concrete example:
In MMORPG Tycoon 2, there’s an object for each of a character class’s abilities. So if he has three different types of attack, that’s three code objects which store information about how much damage those types of attack do, etc. Those three ability objects are stored inside another object, an “Ability Set”, which lists all the abilities available to one character class.
With this new stuff I’ve written today, it’s now possible for me to simply call “AbilitySet->Save(“Filename”)”, and have the AbilitySet save itself out, plus all of the Abilities which are inside of it, into a single neat data file. Similarly, “AbilitySet->Load(“Filename”)” loads that data file from disk, recreating the AbilitySet object itself and all of the abilities that it should contain. This is all typesafe — the AbilitySet can only contain objects of “Ability” type (or derived from that type), and no typecasting is required at any point during the process.
Of course, the next step is going to be to have the CharacterClassPrototype have an AbilitySet inside itself, so that when I load a class prototype from disk, it automatically loads the abilityset, and the abilityset’s contents. And then a ClassManager will be set to contain ClassPrototypes, so that when I save the ClassManager, it automatically saves out all of the class prototypes inside it, and so forth and so on. Eventually, everything in the game should be included within this data hierarchy, so a single call to “Save()” or “Load()” at the top level will be able to automatically handle saving or loading the complete game state, all from a single line of code.
So I’m pleased. :)