godot-state-machine-advanced
БесплатноЗапускает вложенные скриптыНе проверенExpert blueprint for hierarchical finite state machines (HSM) and pushdown automata for complex AI/character behaviors. Covers state stacks, sub-states…
от thedivergentai★ 1 019 звёзд на GitHubОб этом скилле
Available Scripts
hsm_hierarchical_base.gd
Advanced HSM base delegator for propagating physics and input to sub-states.
hsm_pushdown_stack.gd
Professional Pushdown Automata for interruptive state (Pause/Menu) stacking.
hsm_state_context.gd
Decoupled context object pattern for passing persistent data between states.
hsm_transition_guard.gd
Expert transition validation logic to prevent illegal state changes.
hsm_animation_syncer.gd
Automated Logic-to-AnimationTree syncing with state-based travel logic.
hsm_concurrent_logic.gd
Orchestration for parallel state machines (e.g., Move + Attack).
hsm_resource_state_loader.gd
Data-driven state definition using custom Godot Resources (.tres).
hsm_reentry_aware_state.gd
Handling resume-from-stack logic vs fresh entry events.
hsm_state_history_logger.gd
Debug ring-buffer for tracking state transition history and stack depth.
hsm_state_timer_component.gd
Auto-transition component for finite states like Stun or Dash.
MANDATORY: For hierarchy / pushdown / guards read hsm_hierarchical_base.gd, hsm_pushdown_stack.gd, hsm_transition_guard.gd (plus hsm_logic_state.gd for leaf behaviors).
Decision Tree — Which Machine?
| Need | Choose | MANDATORY scripts |
|---|---|---|
| Few exclusive states, no nesting | Flat FSM | hsm_logic_state.gd + thin parent |
| Nested sub-states (Move/Air/Attack children) | HSM | hsm_hierarchical_base.gd |
| Interrupt overlays (stun/menu/dialogue) then resume | Pushdown | hsm_pushdown_stack.gd + hsm_reentry_aware_state.gd |
| Parallel concerns (locomotion + weapon) | Concurrent | hsm_concurrent_logic.gd |
| Pick best action by score each tick | Utility cost polling | Expert pattern §3 + hsm_transition_guard.gd |
NEVER Do (Expert State Rules)
Hierarchy & Delegation
- NEVER forget to propagate physics/input to children — In an HSM, failing to call
child.physics_update()from the parent's_physics_processorphans child logic. - NEVER use deep nesting (>3 levels) — Extreme hierarchy creates "State Spaghetti." If logic is that complex, consider a Behavior Tree or Utility AI.
Transitions & Lifecycle
- NEVER call enter() without a preceding exit() — Skipping exit logic leaves timers, tweens, or audio loops running in the background, causing resource leaks.
- NEVER modify state during a transition frame — Re-entrant
transition_to()calls insideenter()cause recursion crashes. Usecall_deferredif immediate sub-transitioning is required. - NEVER hardcode state names as strings — Typos like
transition_to("Idel")are silent killers. Useclass_namebased checks OR Constants.
Architecture & Context
- NEVER use global singletons for state data — Coupling states to
GameManager.player_healthmakes them non-reusable. Pass aContextobject. - NEVER push states indefinitely — In a Pushdown Automaton, every
push_stateMUST have a retirement plan (pop_state) to avoid stack overflow. - NEVER assume state re-entry is always a fresh start — Resuming from a stack pop should often bypass "Entry SFX/VFX"; use re-entry flags.
Implementation — Scripts Are Source of Truth
Do NOT copy inline HierarchicalState / push_state samples. Prior body double-
exit()ed and ignored resume messages.
MANDATORY route:
- Hierarchy / physics-input forward: hsm_hierarchical_base.gd
- Push / pop with
enter({"is_resume": true}): hsm_pushdown_stack.gd - Illegal transition blocking: hsm_transition_guard.gd
- Context payload: hsm_state_context.gd
Pushdown contract (from script — single exit, resume msg):
# See hsm_pushdown_stack.gd — do not reimplement
func push_state(state_path: String, msg: Dictionary = {}) -> void: ...
func pop_state() -> void:
# old.exit(); stack.back().enter({"is_resume": true})
pass
Expert State Machine Patterns
1. HSM Visualizer (Debug Tool)
Use a specialized Control node with _draw() to visualize the current state stack/hierarchy in the viewport for immediate debugging [3, 11].
class_name HSMVisualizer extends Contro
Установить godot-state-machine-advanced в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл godot-state-machine-advanced?
Expert blueprint for hierarchical finite state machines (HSM) and pushdown automata for complex AI/character behaviors. Covers state stacks, sub-states, transition validation, and state context passing. Use when basic FSMs are insufficient OR implementing layered AI. Keywords state machine, HSM, hierarchical, pushdown automata, state stack, FSM, AI behavior.
Как установить скилл godot-state-machine-advanced?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл godot-state-machine-advanced запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic