Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Teaches state machine patterns in Godot 4.3+ (enum-based, node-based, resource-based) with trade-offs for choosing one.
50% 91%+41 ptsof test cases passed
Passed 20 of 22 test cases with the skill, and 11 of 22 without it.
This test ran on v1. v2 is the current version and hasn’t been tested on gemini-3.6-flash yet.
3 of 3 safety checks passed
Not used yet
Choose the right FSM pattern for your complexity level. All examples target Godot 4.3+ with no deprecated APIs.
Related skills: player-controller for movement state integration, ai-navigation for AI state patterns, resource-pattern for resource-based state configuration, animation-system for AnimationTree states driven by FSM, dialogue-system for dialogue flow as a state machine, ability-system for caster state gating (casting/stunned), limboai for the LimboAI addon's HSM (
BTState) if you need a behavior tree alongside your FSM, beehave for a GDScript-only BT alternative.
When to reach for an addon: This skill covers the built-in FSM patterns (enum, node-based, resource-based). If your agent needs a full behavior tree, see limboai (C++ + HSM, Godot 4.6+) or beehave (pure GDScript, Godot 4.1+) instead.
| Approach | Complexity | Best For |
|---|---|---|
| Enum-Based | Low | Simple objects, fewer than 5 states |
| Node-Based | Medium | Characters with complex behavior |
| Resource-Based | High | Data-driven or editor-configurable AI |
When you recommend one, name the approach you rejected and the factor that decided it (state count, independent concerns, designer editing) — "node-based, not an enum with match, because seven states with their own enter/exit logic outgrow one script". A pick with no named alternative cannot be overruled.
Use when you have a small number of states and no significant enter/exit logic.
extends CharacterBody2D
enum State { IDLE, PATROL, CHASE, ATTACK }
@export var patrol_range: float = 200.0
@export var chase_range: float = 300.0
@export var attack_range: float = 50.0
@export var speed: float = 80.0
var current_state: State = State.IDLE
var patrol_target: Vector2 = Vector2.ZERO
Next to this one in the catalogue, plus more from the same author.