Skills

Ability System

Use when building character abilities, Resource-based abilities with...

Install

npx skills add jame581/GodotPrompter --skill ability-system -g -a claude-code -y
Category
Engineering
Updated
3d ago
License
MIT
Context cost
Mediumabout 2,986 tokens
Runs scripts
No, instructions only

What it does

Use when building character abilities, Resource-based abilities with cost/cooldown/cast, buffs/debuffs, stat modifiers, gameplay tags, and HUD binding

Ability System

Build a data-driven ability system from Godot-native parts: abilities are Resources, an AbilityComponent node owns and runs them, and effects/stats/tags compose on top. No third-party addon required.

Related skills: resource-pattern for the Resource data containers, component-system for the component node pattern, event-bus for cross-system ability events, state-machine for caster states (e.g. casting/stunned), hud-system for cooldown UI.


1. Architecture overview

An ability system in Godot 4.x is built from three collaborating layers:

  • Data layer, Ability (Resource): Each ability is a Resource subclass with exported fields (ability_name, cost, cooldown, cast_time) and two methods: can_activate(caster) -> bool to validate preconditions, and activate(caster) -> void to execute the effect. Storing abilities as Resources lets designers create and balance them in the Godot editor without touching code.

  • Behaviour layer, AbilityComponent (Node): A single node added to any entity that should use abilities. It holds the granted ability set, enforces cost/cooldown, and drives the Ability.activate() call. Four signals keep the rest of the game informed without coupling: ability_activated(ability), ability_failed(ability, reason), cooldown_started(ability, duration), and cooldown_finished(ability). Grant new abilities at runtime with grant(ability) and trigger them with try_activate(ability_name).

Read the whole SKILL.md on GitHub

More in Engineering