4 releases (2 breaking)
0.3.1 | Aug 23, 2024 |
---|---|
0.3.0 | Aug 23, 2024 |
0.2.0 | Mar 8, 2024 |
0.1.0 | Jan 6, 2024 |
#309 in Game dev
64KB
1.5K
SLoC
bevy_generative
bevy_generative
is a plugin written for the bevy engine that allows real-time procedural generation of maps, textures, terrain, planets and more!
Features
- Allows procedural generation of assets which can be directly integrated in your bevy game
- Handles real-time updating of image and mesh data as configuration for the asset changes
- Builds on native as well as wasm targets
- Allows saving generated assets (uses
rfd
for native, javascript blob for wasm) - Serializes and deserializes components using
serde
Showcase
Check out Procedra [Source], a procedural generation web application that allows you to experiment with all the parameters and generate assets in real-time!
Installation
Add bevy_generative
to your rust project
cargo add bevy_generative
Examples
Maps and Textures
use bevy::prelude::*;
use bevy_generative::map::{MapBundle, MapPlugin};
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugins(MapPlugin)
.add_systems(Startup, setup)
.run();
}
fn setup(mut commands: Commands) {
commands.spawn(Camera2dBundle::default());
commands.spawn(MapBundle::default());
}
Terrain
use bevy::prelude::*;
use bevy_generative::terrain::{TerrainBundle, TerrainPlugin};
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugins(TerrainPlugin)
.add_systems(Startup, setup)
.run();
}
fn setup(mut commands: Commands) {
commands.spawn(PointLightBundle {
transform: Transform::from_xyz(-2.0, 2.5, 5.0).looking_at(Vec3::ZERO, Vec3::Y),
..default()
});
commands.spawn(Camera3dBundle {
transform: Transform::from_xyz(-2.0, 2.5, 5.0).looking_at(Vec3::ZERO, Vec3::Y),
..default()
});
commands.spawn(TerrainBundle::default());
}
Planets
use bevy::prelude::*;
use bevy_generative::planet::{PlanetBundle, PlanetPlugin};
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugins(PlanetPlugin)
.add_systems(Startup, setup)
.run();
}
fn setup(mut commands: Commands) {
commands.spawn(PointLightBundle {
transform: Transform::from_xyz(-2.0, 2.5, 5.0).looking_at(Vec3::ZERO, Vec3::Y),
..default()
});
commands.spawn(Camera3dBundle {
transform: Transform::from_xyz(-2.0, 2.5, 5.0).looking_at(Vec3::ZERO, Vec3::Y),
..default()
});
commands.spawn(PlanetBundle::default());
}
Bevy Compatibility
bevy | bevy_generative |
---|---|
0.14 | 0.3, main |
0.13 | 0.2 |
0.12 | 0.1 |
Contributing
Contributions are welcome! Issues, pull requests, feature requests and bug reports are appreciated. If you'd like to contribute to this project, please follow these steps:
- Fork the repository.
- Create a new branch with a descriptive name.
- Make your changes or additions.
- Test your changes.
- Submit a pull request with a clear description of your work.
Please ensure your code passes all CI checks and includes relevant tests if applicable. Thank you for helping improve bevy_generative
!
Your contribution will be dual-licensed as mentioned in the License section below.
License
All code in this repository is dual-licensed under either:
- MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
at your option. This means you can select the license you prefer! This dual-licensing approach is the de-facto standard in the Rust ecosystem and there are very good reasons to include both.
Dependencies
~42–83MB
~1.5M SLoC