-
Notifications
You must be signed in to change notification settings - Fork 146
Description
I 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.