slash-framework icon indicating copy to clipboard operation
slash-framework copied to clipboard

There is a generic way to save and load the game

Open coeing opened this issue 8 years ago • 1 comments

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:

  1. Get all properties of their components that may change during runtime
  2. Store those properties in an attribute table
  3. Serialize the property table with the entity id as a key

When deserializing:

  1. Create all entities with their former ids
  2. For each entity
  • Deserialize the attribute table if it exists
  • Init the enity from its blueprint and the attribute table (if it exists)

coeing avatar Feb 12 '17 19:02 coeing

There is already a feature which was started (Slash.ECS.Features.Serialization), it should be extended, tested and documented.

coeing avatar Feb 12 '17 19:02 coeing