dots-roguelike icon indicating copy to clipboard operation
dots-roguelike copied to clipboard

Saving/Loading

Open sarkahn opened this issue 4 years ago • 0 comments

While it is a roguelike and permadeath is a thing, we should be able to a quit and resume a game in progress. Two options for saving

1 - Just use SerializeWorld. I've tested it and it actually works very well - it's fast and simple as long as we don't try to serialize the terminal (due to the hybrid component). The file size is a little large but compresses well. The biggest issue would be that "saves" between versions would likely be incompatible.

2 - Custom solution. Per entity serialization is possible as per this post from DreamingImLatios https://forum.unity.com/threads/serialization-how-to-iterate-over-all-components-of-a-given-entity.524553/#post-6735454:

var types = EntityManager.GetChunk(entity).Archetype.GetComponentTypes(Allocator.Temp);

From the ComponentType you can get the system type, which should open up plenty of approaches to tackle this.

Big downside here is...it would be really tedious to write!

sarkahn avatar Jan 19 '21 14:01 sarkahn