Goal
Let a game save and restore its EcsWorld. Storage backends already exist on dev: #722 added StorageBackend, the localStorage and memory backends, and createPersistentState for flat, typed records such as settings. What's missing is serializing the world itself, so every game still has to write its own save-game code.
Scope (suggested)
- Serialize and deserialize
EcsWorld state (entities and component data) to plain data. JSON is the obvious default for a browser engine.
- Handle component data that refers to other entities, such as the parent link and joints that reference other bodies. Entities are generational handles, so their IDs need a stable remapping across save and load.
- Decide how component data that isn't plain data is saved, for example anything holding a texture or other asset handle.
- Write saves through the existing
StorageBackend abstraction, so game code doesn't change when the backend does (localStorage, IndexedDB or a remote endpoint).
- Version saved data and plan how to migrate it as a game's components change.
Why this is a milestone, not a single issue
Serializing arbitrary ECS state correctly, especially entity references and component data that isn't plain data, is a real design problem rather than a small utility. Expect sub-issues for core world serialization, reference remapping and versioning.
Acceptance criteria (top-level)
Goal
Let a game save and restore its
EcsWorld. Storage backends already exist ondev: #722 addedStorageBackend, thelocalStorageand memory backends, andcreatePersistentStatefor flat, typed records such as settings. What's missing is serializing the world itself, so every game still has to write its own save-game code.Scope (suggested)
EcsWorldstate (entities and component data) to plain data. JSON is the obvious default for a browser engine.StorageBackendabstraction, so game code doesn't change when the backend does (localStorage, IndexedDB or a remote endpoint).Why this is a milestone, not a single issue
Serializing arbitrary ECS state correctly, especially entity references and component data that isn't plain data, is a real design problem rather than a small utility. Expect sub-issues for core world serialization, reference remapping and versioning.
Acceptance criteria (top-level)
localStorage) is provided out of the box (#722)EcsWorld's state can be serialized and later restored, keeping relationships between entitiesdocumentation-site/docs/docs, with a demo showing save and load