본문으로 건너뛰기
Skillpedia
일반 코딩6.6k · #13832

bevy-ecs

하는 일

이 스킬은 엔티티 컴포넌트 시스템을 사용해 Rust로 작성된 Bevy 게임을 구성하는 방법을 설명합니다. Bevy로 게임을 만드는 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓Rust로 작성된 Bevy 앱을 시작하거나 변경할 때.
  • ✓쿼리를 사용해 게임 객체를 읽거나 바꾸는 시스템을 작성해야 할 때.
  • ✓Bevy가 빌림 충돌 오류를 보이거나, 프레임 속도에 따라 이동이 달라질 때.

스킬 링크

https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/other-engines/bevy-ecs/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/other-engines/bevy-ecs/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“방향키로 움직이는 Bevy 플레이어를 만들어 주세요. 어떤 컴퓨터에서든 같은 속도로 움직여야 합니다.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

플러그인으로 앱을 만드는 방법, 데이터를 컴포넌트와 리소스로 정의하는 방법, 정해진 순서로 실행되는 시스템을 작성하는 방법, 시간 리소스로 부드러운 움직임을 만드는 방법을 보여 줍니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Bevy ECS

Structure a Bevy game in Rust around the Entity Component System: the App and plugins, components and resources, systems with queries, scheduling, and frame-rate-independent updates. New examples target Bevy 0.20. If the project already pins another release, keep that release and use its matching migration guide.

When to use

  • Use when wiring a Bevy App, defining Component/Resource types, writing systems that query entities, ordering/filtering systems, or fixing borrow-conflict panics and frame-dependent movement.
  • Use when Cargo.toml depends on bevy and code calls App::new(), add_systems, Query, or Commands.

When not to use: this is the ECS core. Deep rendering, custom shaders/ pipelines, UI layout, and audio are separate concerns. For engine-agnostic AI or procedural algorithms, pair with game-ai / procedural-gen.

Core workflow

  1. Detect and pin the version. Read Cargo.toml and Cargo.lock first. For a new project use bevy = "0.20"; never silently migrate an existing project across a Bevy minor release. Treat the matching docs and migration guides as truth.
  2. Build the App. App::new().add_plugins(DefaultPlugins) gives windowing, input, rendering, time, etc. Register systems into schedules: Startup (once) and Update (every frame).
  3. Model data as components, globals as resources. #[derive(Component)] for per-entity data; #[derive(Resource)] for one-of-a-kind data (score, settings, the Time clock). Since 0.19 Resource extends Component and each resource is stored on its own entity, so do not derive both.
  4. Write systems as plain functions. Parameters declare data access: Query<...> for entities, Res<T>/ResMut<T> for resources, Commands for deferred spawn/despawn. Systems run in parallel when their accesses don't conflict.
  5. Drive motion by time.delta_secs() so speed is frame-rate independent.
  6. Order only what must be ordered with .chain() or explicit constraints; gate systems with run_if. Group related setup into Plugins. Build with cargo run and read the panics — Bevy reports conflicting queries at startup.

Patterns

1. Cargo.toml + minimal App

# Cargo.toml — pin the version; the API differs across minor releases.
[dependencies]
bevy = "0.20"
// main.rs
use bevy::prelude::*;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)            // window, input, render, time, ...
        .add_systems(Startup, setup)            // runs once at startup
        .add_systems(Update, move_players)      // runs every frame
        .run();
}

2. Components, resources, and spawning

#[derive(Component)]
struct Player;

#[derive(Component)]
struct Velocity(Vec2);

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

fn setup(mut commands: Commands) {
    commands.insert_resource(Score(0));

    // Camera2d is a component with required components (bundles removed in 0.16);
    // spawning it pulls in Transform, Camera, etc. automatically.
    commands.spawn(Camera2d);

    // Spawn an entity as a tuple of components.
    commands.spawn((
        Player,
        Velocity(Vec2::new(150.0, 0.0)),
        Transform::from_xyz(0.0, 0.0, 0.0),
    ));
}

3. A system with a query + the Time resource

// Iterate every entity that has BOTH Velocity and Transform; mutate Transform.
fn move_players(time: Res<Time>, mut query: Query<(&Velocity, &mut Transform)>) {
    for (velocity, mut transform) in &mut query {
        // delta_secs() is f32 seconds (renamed from delta_seconds() in 0.16).
        transform.translation += velocity.0.extend(0.0) * time.delta_secs();
    }
}

4. Query filters (With / Without / Changed)

// Only entities tagged Player (the Player component itself isn't read).
fn aim_player(mut q: Query<&mut Transform, With<Player>>) { /* ... */ }

// Disjoint two mutable Transform queries so they don't conflict at runtime.
fn separate(
    mut players: Query<&mut Transform, With<Player>>,
    mut enemies: Query<&mut Transform, Without<Player>>,
) { /* ... */ }

// React only when Health changed since last run (change detection).
fn on_health_change(q: Query<&Health, Changed<Health>>) {
    for health in &q { /* update the HUD, etc. */ }
}

5. Resources: read and write

fn add_points(mut score: ResMut<Score>) {
    score.0 += 10;                 // ResMut = write access
}

fn
자주 묻는 질문

엔티티 컴포넌트 시스템이란 무엇인가요?

객체를 데이터가 붙은 단순한 ID로 보고, 시스템이 로직을 처리하는 방식으로 게임을 만드는 방법입니다.

이 스킬이 Bevy 버전을 업그레이드하나요?

아니요. 이 스킬은 프로젝트가 이미 사용 중인 Bevy 버전을 몰래 올리지 말고 그대로 유지하라고 말합니다.

렌더링이나 셰이더도 다루나요?

깊게 다루지는 않습니다. 렌더링, 셰이더, UI, 오디오는 별도의 주제입니다.

상세 정보

작성자의 원본 설명

Structure a Bevy app around its Entity Component System: build the App with plugins, define Component/Resource types, write systems with Query/Res/Commands, filter and order systems, and use the Time resource for frame-rate-independent motion. Use when building or debugging a Bevy game in Rust — when the user mentions Bevy, ECS, App::new, add_systems, Query, Commands, components/systems, or a Cargo.toml depending on bevy.

repo: gamedev-skills/awesome-gamedev-agent-skills

인기도

GitHub 스타
6.6k
순위
#13832
라이선스
Apache-2.0
업데이트
2026. 10. 28.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬