Skills

Bevy Ability System

Bevy ECS skill for abilities.

Install

npx skills add thedivergentai/Game-Dev-Agentic-Skills --skill bevy-ability-system -g -a claude-code -y
Category
Engineering
Updated
19d ago
License
LGPL-3.0
Context cost
Mediumabout 2,158 tokens
Runs scripts
No, instructions only

What it does

Bevy ECS skill for abilities. Keywords: Bevy, ability, cooldown, ECS, gameplay.

Bevy ability system

When to use

Load this when an actor grants, cools down, or spends an ability. Combat resolution stays on bevy-combat-system.

ECS shape

  • Components: ability id, charges, and cooldown remaining on the caster.
  • Resources: run-wide tables live in a resource (bevy-data-resources).
  • Systems: mutate those components on Update or the fixed timestep. Use .chain() when damage must land before death.
  • Messages: one-shot facts (hit, pickup, quest advance) go through bevy-events-messaging. This file does not add a new event type name.

Ability choices

NeedBevy idiom
Ability definitionA Resource catalog plus a component row on the caster.
Cooldownremaining stepped with Time<Fixed>::delta_secs in FixedUpdate.
CastMessageWriter<CastAccepted> after the cooldown and charge gates pass.

Scope

  • Cooldowns, charges, and catalogs are components and resources. Combat damage stays on bevy-combat-system.
  • Stacking status effects is a component list you tick on FixedUpdate.

Examples

[package]
name = "abilities"
version = "0.1.0"
edition = "2021"

[dependencies]
bevy = "0.20"

Cooldown and charges share the caster. Tick, then accept the cast, on FixedUpdate.

#[derive(Component)]
struct Cooldown {
    remaining: f32,
    duration: f32,
}

#[derive(Component)]
struct Charges {
    current: u32,
    max: u32,
}

#[derive(Message)]
struct CastAccepted {
    caster: Entity,
}

fn tick_cooldowns(time: Res<Time<Fixed>>, mut query: Query<&mut Cooldown>) {
    let dt = time.delta_secs();
    for mut cooldown in &mut query {
        cooldown.remaining = (cooldown.remaining - dt).max(0.0);
    }
}
Read the whole SKILL.md on GitHub

More in Engineering