Not logged inOpenClonk Forum
Up Topic Effects, Proplists, Arrays, Savegames

This board is threaded (i.e. has a tree structure). Please use the Reply button of the specific post you are referring to, not just any random button. If you want to reply to the topic in general, use the Post button near the top and bottom of the page.

Post Reply
In Response to Günther
Okay, thinking about this again, out loud (well, as loud as my keyboard is, which is not very.)

Requirements:
- I want arrays, pure proplists, objects, effects, and ideally everything else that has an identity stored in a similar way
- I don't want to store everything in a global list during the game just for the sake of savegames. While scripts occasionally profit from being able to serialize these things, we should replace APIs that require that with better ones.
- Not break in case the savegame gets loaded in a different order is nice, but we don't change the order often enough for that to be a must
- I'd like to avoid having to instantiate lots of tiny helper objects to hold the serialization in memory until denumeration

I think this pretty much requires a temporary map of number to data during load and data to number during save. And that the number is stored in the value until denumeration, in case the order got changed. One remaining question is whether to save the data inline or in a toplevel list. And if inline, whether all instances should have the data, with all but one instance ignored during load. Hm, no, recursive structures make that impractical. Also, if the data is stored inline, what format that should use. I'm now leaning slightly towards the everything-on-top-level method, because it makes the data format more uniform. Hm, but it does make putting the data into the map during serialization slightly more awkward, because the map would grow while it gets serialized. Well, that's probably easily solvable by using a queue in addition.

Last question is where to put the map. The "right" place is probably the StdCompiler, but that class structure is already complicated enough as it is...

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill