-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Saving and loading game state #23
Comments
The general idea: Saving be triggered by sending a
As for loading - just add new |
Each entity type will have to declare its save strategy. I imagine three strategies (names TBD):
I'm tempted to just have a single boolean field on the entity type (unsaved/saved) and distinguish between the second and third strategy by the existence or lack of the identifier component. But I think I'll make them explicit (with a 3-options |
The common conception about saving and loading game state in Bevy (or ECS in general) is that you just have to do serialize all the components of all the entities into a file, and when loading just rebuild the scene from that component data. That, however, is very similar to the common conception about editors for Bevy - the very conception that Yoleck is trying to be an alternative to. So I figure Yoleck can offer a similar alternative to. Since Yoleck already has a concise representation of the level, one that does not have to store every single component because it can build them from
YoleckEntityType
s andYoleckComponent
s, it shouldn't be that much more work to save just the changed data.Advantages over entire-scene save:
Yoleck itself is not going to handle the storage medium for the saved files. Doing that will lock users to a specific persistence solution. Instead, when initiating a save Yoleck will send an event with a
serde_json::Value
that represents the state, and when loading the user will have to provide thatserde_json::Value
. Note thatserde_json::Value
is not an actual JSON - it's just an in-memory data type with JSON semantics. It can be stored as a more compact and less human-readable format.The text was updated successfully, but these errors were encountered: