VDrift / vdrift

VDrift source code
http://vdrift.net/
GNU General Public License v3.0
355 stars 97 forks source link

Normalizing serialization format #131

Open logzero opened 10 years ago

logzero commented 10 years ago

Currently we are using 4 different text serialization formats: graphics gl3: nested tables and lists, ordered, hard to read/modify graphics gl2: tables (sections), table lists (multiple sections with the same name), unordered(sections and section entries order doesn't matter) car and gui and settings: nested tables, no table lists, unordered track objects list: table list with implicit keys, no nesting, ordered

Additionally there is also a binary format used for replays, a binary version of gl3 config format.

I'd like to see a single text and binary format to contain the proliferation listed above.

If it wasn't for the poor readability I'd go for gl3 format. My current preference is thus to extend car/gui/settings format to support table lists, but also enforce element order like in the gl3 format, as this massively simplifies serialization.

There is also the issue of default values. Should it be allowed to leave out entries, like it is right now with car and gui and gl2 configs? It allows more compact configs but hides elements.

I am using comments in gl2 files to track the defaults for example: ;[pass] ;light = sun ;camera = default ;cull = true ;clear_color = false ;clear_depth = false ;write_color = true ;write_alpha = true ;write_depth = postprocess ? false : true ;depthtest = postprocess ? disabled : lequal ;blendmode = disabled