slash-framework
slash-framework copied to clipboard
There is a generic way to save and load the game
As we hold all our data inside the components, we basically just have to serialize the entity manager.
First you should serialize all entities with their id and the blueprint they were created from.
Than get all entities from the entity manager. For each entity:
- Get all properties of their components that may change during runtime
- Store those properties in an attribute table
- Serialize the property table with the entity id as a key
When deserializing:
- Create all entities with their former ids
- For each entity
- Deserialize the attribute table if it exists
- Init the enity from its blueprint and the attribute table (if it exists)
There is already a feature which was started (Slash.ECS.Features.Serialization), it should be extended, tested and documented.