knowledge/technology/dev/programming/frameworks/Bevy.md
2025-06-13 11:32:52 +02:00

1.2 KiB

obj website repo
concept https://bevyengine.org https://github.com/bevyengine/bevy

Bevy Engine

Bevy is a modern, open-source game engine built in Rust. It emphasizes simplicity, modularity, and performance, making it an attractive choice for game developers looking for a data-driven, Entity-Component-System (ECS) architecture combined with modern rendering capabilities.

Entity Component System (ECS)

  • Entity: Unique identifier representing a game object.
  • Component: Plain data attached to entities.
  • System: Logic operating on entities with matching components, executed in parallel where possible.

This design promotes separation of data and logic, enabling highly efficient, cache-friendly processing.

Basic Example

A simple example creating a window and spawning a 2D sprite:

use bevy::prelude::*;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_startup_system(setup)
        .run();
}

fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
    // Camera
    commands.spawn(Camera2dBundle::default());

    // Sprite
    commands.spawn(SpriteBundle {
        texture: asset_server.load("branding/icon.png"),
        ..Default::default()
    });
}