We discussed this briefly with @Eugene
A very cool feature would be automatic serialization of attributes that point to
Serializable or it’s subclass.
My proposed implementation of this is to have
Serializer track serialization of objects by their pointer. Object would be serialized when it is encountered for the first time. If any other objects reference same object - a reference entry should be serialized instead.
Deserialization would happen in similar manner: deserialized objects are put to the map and pointer is served from the map when object reference entry is encountered.
- A bit of extra state is added to
Deserializer. Not perfect, but on the other hand
Deserializeralready has some state.
- Attributes may store any instance of
RefCountedwhile we can serialize only instances of
- Proposed scheme gets in a way of parallel (de)serialization. On the other hand engine does not do any of that.
If implemented, this would give us automagic serialization of objects referenced engine attributes. Even circular references would work. Imagine that - entire game state could be saved/loaded in one swoop with a bit of care.
What are your thoughts? Maybe anyone has a better idea how this could be implemented? or maybe we do not want this at all?