ConfigsApr 12, 2026·1 min read

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.

AI
AI Open Source · Community
Quick Use

Use it first, then decide how deep to go

This block should tell both the user and the agent what to copy, install, and apply first.

cargo install bevy_cli    # Optional: Bevy CLI
cargo init my_game
cd my_game

Add to Cargo.toml:

[dependencies]
bevy = "0.15"
// src/main.rs
use bevy::prelude::*;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_systems(Startup, setup)
        .add_systems(Update, move_player)
        .run();
}

#[derive(Component)]
struct Player;

fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
    commands.spawn(Camera2d);
    commands.spawn((
        Sprite::from_image(asset_server.load("player.png")),
        Transform::from_xyz(0.0, 0.0, 0.0),
        Player,
    ));
}

fn move_player(
    time: Res<Time>,
    keys: Res<ButtonInput<KeyCode>>,
    mut query: Query<&mut Transform, With<Player>>,
) {
    let speed = 200.0;
    for mut t in &mut query {
        if keys.pressed(KeyCode::ArrowRight) { t.translation.x += speed * time.delta_secs(); }
        if keys.pressed(KeyCode::ArrowLeft)  { t.translation.x -= speed * time.delta_secs(); }
    }
}
cargo run
Intro

Bevy is a refreshingly simple data-driven game engine built in Rust. Created by Carter Anderson in 2020, Bevy uses an Entity Component System (ECS) as its core architecture, making it fast, modular, and composable. Despite being relatively young, Bevy has become the most popular Rust game engine and one of the fastest-growing game engines overall.

What Bevy Does

  • ECS — Entity Component System for data-driven logic
  • Rendering — 2D sprites, 3D PBR, post-processing (wgpu-based)
  • Audio — spatial audio via rodio
  • Input — keyboard, mouse, gamepad, touch
  • UI — built-in reactive UI system
  • Scenes — serializable scene format
  • Asset loading — async, hot-reloadable
  • Plugins — modular, composable plugin architecture
  • States — app state machine for menus, gameplay
  • WebGPU — via wgpu (Vulkan/Metal/DX12/WebGPU backends)

Architecture

Bevy ECS:

  • Entities — unique IDs
  • Components — data structs attached to entities
  • Systems — functions that query components and execute logic
  • Resources — global singleton data
  • Events — message passing between systems

All systems run in parallel by default (Bevy schedules them based on data access). This makes Bevy inherently multi-threaded.

Self-Hosting

Rust project — build and distribute:

cargo build --release
# Export to WebAssembly
cargo build --release --target wasm32-unknown-unknown
wasm-bindgen target/wasm32-unknown-unknown/release/my_game.wasm --out-dir web

Key Features

  • Data-driven ECS
  • Automatic parallelism
  • Hot asset reloading
  • 2D + 3D rendering (wgpu)
  • Plugin architecture
  • WebGPU/Vulkan/Metal/DX12 backends
  • WebAssembly export
  • Scene serialization
  • Reactive UI
  • Active community and rapid releases

Comparison

Engine Language Architecture 3D
Bevy Rust ECS Growing
Godot GDScript/C# Scene tree Good
Unity C# MonoBehaviour (+ DOTS ECS) Excellent
Amethyst Rust (archived) ECS Basic
Macroquad Rust Immediate mode Basic

常见问题 FAQ

Q: 能发布商业游戏吗? A: 能。MIT + Apache 双授权,完全自由。目前已有 Bevy 做的独立游戏在 Steam 上架。

Q: 稳定了吗? A: API 还在快速迭代(每个版本有 breaking changes)。但核心已经可用于中等规模项目。v1.0 预计还需一到两年。

Q: 学习曲线? A: Rust 本身有门槛(borrow checker),ECS 思维方式需要适应。但 Bevy 文档和社区示例越来越丰富。

来源与致谢 Sources

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets