New savedgame format

Started by Crimson Wizard, Mon 06/05/2013 22:44:15

Previous topic - Next topic

Crimson Wizard

While redesigning the engine (slowly) I got to the point when it would be highly beneficial to change savedgame format. While my primary concern is the amount and order of data, stored there (a lot of problems arise simply because some things could not be initialized before others were read), new format could be useful to improve extensibility and error detection... at least a little.

Does anyone have any ideas and suggestions on what it may look like?

I remember Nefasto once mentioned having savegame as (an encoded) XML, but I have certain doubts about this, because XML tends to increase size of data pretty much. Also it probably will load slower. Of course there's a strong temptation to have a data that you may both easily read from program and edit by hand. Plus it is... well, most extensible.

If that does not fit, I had an idea about simple binary format built of blocks in a (imaginary) form of a tree, with a table of contents placed at the beginning of the file. Well, actually, coded it last day. But still unsure what to choose.

//-------------------------------------------------------
UPD: What I mean is a file (or dedicated part of file) that has following information about its parts in the header:
- id (numeric or string)
- version/format tag (in case reader needs to know it)
- offset (related to header)
- length
- list of subparts (recursive)

Since there's a table of contents, the reader may search only for blocks it needs or knows how to read. This will ease random extraction of wanted data. Also, this will help backward compatibility, and provide minimal forward compatibility (meaning older versions of engine could still try to read data, skipping parts they don't know).

SMF spam blocked by CleanTalk