Persisting/serializing entities
See original GitHub issueI am currently looking into a good way to persist all my entities. The main use case is saving&loading the game.
Now I could iterate over every entity and check for every possible component and store everything in some way. Then on loading I would have to reverse this process. But at the very best I don’t want to do this too “game specific” and would prefer a more generic way of doing this that other people can benefit from. (That also works with a pooled engine and hopefully on all plattforms too!)
At the end I want something like this:
data persistEntities(Engine/PooledEngine)
loadEntities(data, Engine/PooledEngine)
or
data Engine.persistEntities()
Engine.loadEntities(data)
I think it would be good if one could mark every component that should be persisted with an annotation and/or interface and exclude fields with transient or an annotation. (e.g. a SpriteComponent with TextureRegions)
Maybe allow the components to handle the serialization by itself. (onSave, onLoad - similar to the android bundle concept))
I hope I get some input on this. And I intend to contribute this to Ashley or the community in some way.
Issue Analytics
- State:
- Created 7 years ago
- Comments:28 (22 by maintainers)
Top GitHub Comments
I know! I’m finding it hard to find the time. I would really appreciate some help on this.
Will there be any further improvement on this branch ? That would be such an interesting feature to be found in the master !