Bevy Easy Database
A persistent storage solution for the Bevy game engine that automatically serializes and persists your components to disk using fjall as the underlying database.
Features
- 🚀 Seamless integration with Bevy ECS
- 💾 Automatic component persistence
- 🔄 Hot-reloading of component data
- 🎯 Selective persistence with ignore markers
- 🛠 Simple setup and configuration
Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
= "0.15.2" # Or your Bevy version
Quick Start
use *;
use ;
Usage Guide
Basic Setup
- Add the
DatabasePluginto your Bevy app - Register components you want to persist using
add_database_mapping - That's it! Your components will now automatically persist between sessions
Custom Database Location
By default, the database is stored in ./database. You can customize this by adding the DatabaseLocation resource:
Excluding Entities from Persistence
Some entities (like cameras or temporary effects) shouldn't be persisted. Add the DatabaseIgnore component to exclude them:
Working with Components
Components are automatically saved when they change:
Hot Reloading
The plugin automatically loads persisted components when your app starts. This means you can:
- Start your app
- Modify entities and components
- Stop your app
- Start it again - all your changes will be restored!
Technical Details
- Components must implement
SerializeandDeserializefrom serde - Entity IDs are mapped between sessions
- Changes are persisted immediately by default
- The database uses fjall for reliable storage
Example: Game with Persistent Transforms
Here's a complete example showing how to create a simple game with persistent entity positions:
use *;
use ;
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT + Apache License
Credits
Built with ❤️ for the Bevy community. Uses fjall for database operations.