Crate bevy_save

source ·
Expand description

Bevy_save

A framework for saving and loading game state in Bevy.

Features

bevy_save is primarily built around extension traits to Bevy’s World.

Serialization and Deserialization

While Bevy’s DynamicScene only allows you to save entities and components, bevy_save enables you to save everything, including resources.

  • World.serialize<S>() and World.deserialize<D>() allow you to serialize and deserialize game state with your own serializer / deserializer.

Save file management

bevy_save automatically uses your app’s workspace name to create a unique, permanent save directory in the correct place for whatever platform it is running on.

Supports Windows, Linux, and MacOS.

  • World.save() and World.load() uses your app’s save directory to save and load your game state to disk, handling all serialization and deserialization for you.

Snapshots and Rollback

bevy_save is not just about save files, it is about total control over game state. Rollback allows you to keep multiple snapshots of game state in memory and scroll through them in real time.

  • World.snapshot() captures a snapshot of the current game state, including resources.
  • World.checkpoint() captures a snapshot for later rollback / rollforward.
  • World.rollback() rolls the game state backwards or forwards through any checkpoints you have created.

License

bevy_save is dual-licensed under MIT and Apache-2.0.

Compatibility

NOTE: We do not track Bevy main.

Bevy VersionCrate Version
0.90.1, 0.2, 0.3

Modules

Prelude: convenient import for all the user-facing APIs provided by the crate

Structs

A rollback snapshot of the game state.
The global registry of snapshots used for rollback / rollforward.
The global registry of types that should be tracked by bevy_save.
A complete snapshot of the game state.
A deserializer for Snapshot that uses reflection.
A serializer for Snapshot that uses reflection.

Traits

Extension trait that adds save-related methods to Bevy’s App.
Clone-like trait for duplicating Reflect-related types.
Extension trait that adds save-related methods to Bevy’s World.

Functions

Returns the absolute path to a save file given its name.