--- name: bevy-ecs-expert description: Master Bevy's Entity Component System (ECS) in Rust, covering Systems, Queries, Resources, and parallel scheduling. risk: safe source: community --- # Bevy ECS Expert ## Overview A guide to building high-performance game logic using Bevy's data-oriented ECS architecture. Learn how to structure systems, optimize queries, manage resources, and leverage parallel execution. ## When to Use This Skill - Use when developing games with the Bevy engine in Rust. - Use when designing game systems that need to run in parallel. - Use when optimizing game performance by minimizing cache misses. - Use when refactoring object-oriented logic into data-oriented ECS patterns. ## Step-by-Step Guide ### 1. Defining Components Use simple structs for data. Derive `Component` and `Reflect`. ```rust #[derive(Component, Reflect, Default)] #[reflect(Component)] struct Velocity { x: f32, y: f32, } #[derive(Component)] struct Player; ``` ### 2. Writing Systems Systems are regular Rust functions that query components. ```rust fn movement_system( time: Res