Bevy — Data-Driven Game Engine Built in Rust
Bevy is a refreshingly simple data-driven game engine built in Rust. Uses an Entity Component System (ECS), hot reloading, and a modular plugin architecture. The most popular Rust game engine and a new paradigm for game development.
What it is
Bevy is a data-driven game engine built in Rust. It uses an Entity Component System (ECS) at its core, where entities are IDs, components are plain data structs, and systems are functions that query and transform components. Bevy provides a modular plugin architecture, 2D and 3D rendering (via wgpu), asset loading, input handling, audio, UI, and scene management.
Bevy targets Rust developers who want a modern game engine with compile-time safety, fearless concurrency, and no garbage collector pauses. It is the most popular Rust game engine and appeals to developers building games, simulations, and interactive applications.
How it saves time or tokens
Bevy's ECS removes the inheritance hierarchies common in traditional game engines. You compose behavior by attaching components to entities and writing systems that query those components. Adding new functionality means writing a new system -- no refactoring existing code. Bevy's plugin system lets you enable or disable engine features (rendering, audio, physics) as independent modules.
For AI-assisted development, Bevy's functional system pattern (each system is a plain function with typed parameters) produces predictable, testable code that LLMs can generate from descriptions of desired behavior.
How to use
- Add Bevy to your Rust project:
cargo add bevy. - Define components as structs with
#[derive(Component)]and systems as functions. - Build the app with
App::new().add_plugins(DefaultPlugins).add_systems(...)and run it.
Example
use bevy::prelude::*;
#[derive(Component)]
struct Velocity(Vec3);
#[derive(Component)]
struct Player;
fn spawn_player(mut commands: Commands) {
commands.spawn((
Player,
Velocity(Vec3::new(0.0, 0.0, 0.0)),
Transform::default(),
));
}
fn move_players(
time: Res<Time>,
mut query: Query<(&Velocity, &mut Transform), With<Player>>,
) {
for (velocity, mut transform) in &mut query {
transform.translation += velocity.0 * time.delta_secs();
}
}
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_systems(Startup, spawn_player)
.add_systems(Update, move_players)
.run();
}
Related on TokRepo
- AI coding tools -- frameworks and tools for building software
- Featured workflows -- discover top curated assets on TokRepo
Common pitfalls
- Long compile times during development. Use dynamic linking (
bevy/dynamic_linkingfeature) to speed up incremental builds significantly. - Misunderstanding system ordering. Systems in the same schedule run in parallel by default; use
.before()and.after()to enforce order when systems depend on each other's output. - Expecting a visual editor like Unity or Godot. Bevy is code-first; community editor projects exist but are not yet mature.
Frequently Asked Questions
An ECS separates data from behavior. Entities are unique IDs. Components are plain data structs attached to entities (Position, Health, Sprite). Systems are functions that query entities by their components and transform the data. This architecture avoids deep inheritance trees, enables cache-friendly memory layouts, and makes parallelism straightforward because systems operate on independent data slices.
Bevy is under active development and has not reached version 1.0. The API changes between releases, which means you may need to update code when upgrading. However, several commercial and open-source games have shipped with Bevy. For hobbyist and indie projects, Bevy is usable today; for large commercial projects, evaluate the migration cost of API changes between versions.
Godot provides a visual editor, GDScript, and a stable API with a 1.0+ release history. Bevy is code-first, uses Rust, and is pre-1.0 with breaking API changes. Godot is easier to start with for non-programmers; Bevy appeals to developers who want Rust's performance and safety guarantees. Bevy's ECS architecture differs fundamentally from Godot's scene/node tree.
Yes. Bevy has built-in 2D sprites, tilemaps (via community plugins), and a 3D renderer using wgpu (which supports Vulkan, Metal, DX12, and WebGPU). Both 2D and 3D share the same ECS architecture, so you can mix them in the same application. The 3D renderer supports PBR materials, shadows, bloom, and tone mapping.
Yes. Bevy supports compiling to WebAssembly and running in the browser via WebGPU or WebGL2. The wasm32-unknown-unknown target works with trunk or wasm-pack for building and serving. Performance in the browser depends on the WebGPU support of the user's browser, with Chrome having the most mature implementation.
Citations (3)
- Bevy Official Website— Bevy is a data-driven game engine built in Rust
- Bevy ECS Documentation— Bevy uses an Entity Component System architecture
- wgpu GitHub Repository— Bevy renders via wgpu supporting Vulkan, Metal, DX12, and WebGPU
Related on TokRepo
Discussion
Related Assets
Responsively App — Mirrored Multi-Device Browser for Web Developers
A modified browser that displays a web page on multiple device viewports simultaneously with synchronized scrolling, clicking, and navigation for responsive web development.
Swagger UI — Interactive API Documentation from OpenAPI Specs
A browser-based tool that renders OpenAPI specifications as interactive API documentation where developers can explore endpoints and execute requests directly.
DevToys — Swiss Army Knife of Developer Utilities
A cross-platform desktop app bundling dozens of developer utilities like JSON formatting, Base64 encoding, hash generation, and regex testing in one tool.