Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

bevy

БесплатноБез исполняемых скриптовНе проверен

Bevy is a data-driven game engine for Rust built on an Entity Component System (ECS), for 2D and 3D games on desktop and other platforms. Use when asked to…

TerminalSkillsот TerminalSkills★ 221 звезда на GitHub

Об этом скилле

Bevy — a data-driven game engine for Rust

Overview

Bevy builds games from three ideas. Components are plain Rust structs attached to entities (just IDs). Systems are ordinary functions whose parameters (Query, Res, ResMut, Commands, Single) say what data they read and write; the scheduler runs them in parallel where it is safe. Resources are global singletons such as score or settings. An App collects plugins and systems and runs them in schedules (Startup once, Update every frame).

Bevy releases a new minor version every few months and breaks APIs each time. Always pin the exact version, read the migration guide at https://bevy.org/learn/migration-guides/ before upgrading, and take example code from the git tag that matches your version (for example https://github.com/bevyengine/bevy/tree/v0.20.0/examples). Code from tutorials for 0.14 or earlier will often not compile.

This skill targets Bevy 0.20.0 (released 2026-10-08 on crates.io).

Instructions

Installation

rustup update stable
rustc --version        # Bevy 0.20 needs 1.97.1 or newer
cargo new dodge_game
cd dodge_game
cargo add bevy@=0.20.0

On Ubuntu the build needs system packages; install them once (this needs root, so ask the user to run it):

sudo apt-get install g++ pkg-config libx11-dev libasound2-dev libudev-dev libxkbcommon-x11-0 libwayland-dev libxkbcommon-dev

The two wayland packages are needed because the default features include Wayland support; without them the build stops in wayland-sys. You also need a Vulkan driver (mesa-vulkan-drivers for most GPUs). Other distros: see docs/linux_dependencies.md in the Bevy repository.

The first build compiles the whole engine and takes minutes; later builds are fast.

Faster compiles

Add to Cargo.toml so your code stays quick to rebuild but dependencies run optimised (the officially recommended dev profile):

[profile.dev]
opt-level = 1

[profile.dev.package."*"]
opt-level = 3

For much faster incremental links during development, enable dynamic linking:

cargo run --features bevy/dynamic_linking

Do not ship a build with dynamic_linking: it needs a separate shared library next to the executable. Using the lld or mold linker through .cargo/config.toml gives a further speed-up; see https://bevy.org/learn/quick-start/getting-started/setup/.

Minimal app

use bevy::prelude::*;

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

fn setup(mut commands: Commands) {
    commands.spawn(Camera2d);
    commands.spawn(Sprite::from_color(Color::srgb(0.2, 0.7, 0.9), Vec2::new(64.0, 64.0)));
}

DefaultPlugins opens a window and adds rendering, input, assets and audio. A Camera2d entity is needed to see 2D content. Entities are spawned from tuples of components; there are no SpriteBundle-style bundles any more.

Components, resources and systems

#[derive(Component)]
struct Player;

#[derive(Component)]
struct Hazard;

#[derive(Resource, Default)]
struct Score(u32);

fn move_player(
    keys: Res<ButtonInput<KeyCode>>,
    time: Res<Time>,
    mut player: Single<&mut Transform, With<Player>>,
) {
    let mut dir = 0.0;
    if keys.pressed(KeyCode::ArrowLeft) { dir -= 1.0; }
    if keys.pressed(KeyCode::ArrowRight) { dir += 1.0; }
    player.translation.x += dir * 300.0 * time.delta_secs();
}
  • Single<D, F> is a system parameter for exactly one matching entity; the system is skipped on frames when zero or several match.
  • Iterate a query with for (a, mut b) in &mut query { ... }.
  • Register resources with .init_resource::<Score>() (needs Default) or .insert_resource(Score(0)).
  • A component can declare dependencies: #[derive(Component)] #[require(Sprite, Transform)] struct Wall; spawns the required components automatically with their defaults.

Ordering, sets and run conditions

App::new()
    .add_plugins(DefaultPlugins)
    .add_systems(Startup, setup)
    .add_systems(Update, (move_player, spawn_hazards, check_hits).chain());

Systems in a tuple run in parallel unless you call .chain() (strict order) or use .after(other) or a SystemSet with .configure_sets. Run conditions such as .run_if(in_state(AppState::InGame)) skip a system when false.

Messages (formerly events)

Buffered, frame-to-frame communication uses Message, MessageWriter and MessageReader; register each type with add_message:

#[derive(Message)]
struct PlayerHit;

fn check_hits(mut writer: MessageWriter<PlayerHit>) {
    writer.write(PlayerHit);
}

fn on_hit(mut reader: MessageReader<PlayerHit>, mut score: ResMut<Score>) {
    for _ in reader.read() { score.0 = 0; }
}
// app.add_message::<PlayerHit>()

Exiting the app is also a message: app_exit.write(AppExit::Success) with a MessageWriter<AppExit> parameter. Older code using EventWriter and `EventReade

Полный SKILL.md на GitHub

Установить bevy в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

_scores.json

FAQ

Что делает скилл bevy?

Bevy is a data-driven game engine for Rust built on an Entity Component System (ECS), for 2D and 3D games on desktop and other platforms. Use when asked to "make a game in Rust", "set up a Bevy project", "write a Bevy system", "fix a Bevy compile error after upgrading", "add keyboard input or states to a Bevy game", or "speed up Bevy compile times". Written against Bevy 0.20, where Message and required components replace older Event and Bundle APIs.

Как установить скилл bevy?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл bevy запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить bevy с