team-eternity / eternity

The Eternity Engine
http://eternity.youfailit.net/wiki/Main_Page
GNU General Public License v3.0
230 stars 36 forks source link

Make savegames robust without needing version #596

Open ioan-chera opened 1 year ago

ioan-chera commented 1 year ago

I think a way to make saves more robust and perhaps even forget about versioning is to store them with named fields instead of purely sequential. Kinda like JSON but maybe simplified to be quickly readable and writable as binary without all the silly syntactic baggage. This way when loading you search for the fields by string, leaving default if not found, and there’ll be no problem of the wrong value getting into the wrong field and crashing. If the save file gets too big, we can use zlib to compress it. Care must be taken when we refactor the code, because we shouldn’t rename the field save names.