What is the best way to allow for changing a [SaveGame object](http://(since dictionaries are flexible structures that can hold anything)) in the future? I would like my users to be able to load their old savegames even after I push out an update that changes the savegame format.
In my business-logic life of Python scripting, I would do this by using a dictionary (since Python dictionaries are flexible structures that can hold pretty much anything, and they can be serialized to disk):
saved_stuff = {
"id" : 1,
"name" : "Bob"
}
And then future versions of my business logic could easily load the structure (regardless of what version it was) and have logic that would look for anything missing in case what was loaded was an old version. For example, if I added a “answers” member that stored a list of booleans, my parsing pseudocode would be:
saved_stuff = load_savegame()
if not saved_stuff.has_key("answers"):
# Must be an old version of the savegame. Give it the default answers
saved_stuff"answers"] = [True, False, False, True]
(and saved_stuff would end up looking like)
{
"id" : 1,
"name" : "Bob",
"answers" : [True, False, False, True]
}
And voila! Choosing that initial structure allowed me to simply update the loading logic whenever I updated the savegame format, and old savegame info is never lost, and I have forever-backwards-compatibility.
**Is there anything like that for UE4 SaveGames?
**If not, then what is the best (or alternately, most common) way that people deal with it? (Other than just nuking all SaveGames)
I suppose one strategy would be to create an entirely new SaveGame object each time the format needs to change, and then write a separate set of loading stuff that tries loading from the oldest format to the newest until it hits one that works, and make graphs translating from older objects to newer objects. I’m just hoping there’s something more elegant than that.