godot-state-machine-advanced

Implement hierarchical state machines and pushdown automata in Godot GDScript.

Updated Aug 8, 2026
One-click install
npx skills add https://github.com/kimgea/agent-kit --skill godot-state-machine-advanced-kimgea
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: godot-state-machine-advanced
Source: https://github.com/kimgea/agent-kit/tree/main/skills/godot-state-machine-advanced
Command: npx skills add https://github.com/kimgea/agent-kit --skill godot-state-machine-advanced-kimgea

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Hierarchical state machines and pushdown automata enable complex AI behaviors that outgrow flat FSMs, providing structured layers, context passing, and clean transition management.

Core Features & Use Cases

  • Hierarchical state machines with a stack to manage sub-states and interrupts.
  • Pushdown automata for pause, cutscenes, and interrupt-resume flows.
  • Explicit transitions with validation and shared context ownership to prevent invalid state changes.
  • Use Case: Build layered NPC behavior where Combat overrides Movement but restores prior states after an interruption.

Quick Start

Create a HierarchicalState root, attach child state nodes, and wire transitions using the provided base and pushdown scripts.

Frequently Asked Questions about godot-state-machine-advanced

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build hierarchical state machines in Godot for complex game AI?

Hierarchical state machines in Godot use a stack to manage layered AI states and interruptions. You create a HierarchicalState root, attach child state nodes, and wire transitions using base and pushdown scripts to handle complex behaviors cleanly.

What is a pushdown automaton and when do I need it for Godot AI behaviors?

A pushdown automaton uses a stack to manage state history, enabling pause, cutscene, and interrupt-resume flows in Godot AI. You need it when behaviors must remember and restore prior states after an interruption ends.

Can I handle NPC combat interruptions that restore prior movement states in Godot?

Yes, you can build layered NPC behavior where Combat overrides Movement but restores prior states after an interruption. Stack-based transitions and shared context ownership ensure the previous state resumes cleanly once the interrupt ends.

How do I validate state transitions and pass context like stuns or pauses in Godot?

You validate state transitions using explicit enter and exit contracts with validated state registration. Shared context ownership passes data for pauses, stuns, and cutscenes, preventing invalid state changes during complex AI behavior shifts.

What's the best way to manage layered game AI states without a flat FSM in Godot?

Hierarchical state machines and pushdown automata provide structured layers and clean transition management that outgrow flat FSMs. They use stack-based transitions and explicit contracts to manage sub-states and interrupts in GDScript.