Baltor Get started

Gallery / Godot components

Hierarchical state machine with event bubbling and history

In your harnessGodot componentMIT

Define nested states in code with event transitions that bubble from the leaf to its ancestors, guards, entry and exit in hierarchy order and shallow history, so shared behavior lives in parent states.

Files, names only

  • ATTRIBUTION.md
  • LICENSE
  • README.md
  • baltor_test.gd
  • component.json
  • hierarchical_state_machine.gd
  • inspect_gdscript.py
  • run_tests.gd
  • test_package.py
  • tests/test_hierarchical_state_machine.gd
  • verification/native.json

Full files in your harness.

What it takes and gives

Class
BaltorHierarchicalStateMachine, extends RefCounted
Methods
add_state(state_name: StringName, parent_name: StringName = &"", on_enter: Callable = Callable(), on_exit: Callable = Callable(), on_update: Callable = Callable()) -> bool; set_initial(parent_name: StringName, child_name: StringName) -> bool; set_history(state_name: StringName, enabled: bool) -> bool; add_transition(from_state: StringName, event: StringName, to_state: StringName, guard: Callable…
Signals
state_entered, state_exited, transitioned
Placement
res://baltor/godot_components/hierarchical_state_machine/

Limits. A subset of statecharts: no orthogonal (parallel) regions, no deep history, no internal transitions and no delayed events. Callbacks run synchronously; sending an event from inside a callback is not queued and runs immediately. Verified with Godot 4.7.2 headless; written against the Godot 4.3 API.

Details

Kind
Godot component
Engine
Godot 4.3 or later
Files
11 files, 83.5 KB
Licence
MIT
Declared effects
reads files, runs commands
Checked with
Godot 4.7.2, headless
Checks
godot parse check only, godot gdscript tests, godot tests reject gutted component, godot editor import, godot contract reflection, godot readme usage compiles
Techniques
hierarchical finite state machine, lowest common ancestor exit and entry, event bubbling, shallow history
Tags
state machine, hsm, statechart, ai, hierarchy, events
Identity
library.supply.creative_originals.214bdc15f022d4d2d971f05b.f833f31c13a169e8
Version
f833f31c13a169e81e69e0e22884a3ea398230a407b8b16235866bff224414a6

The version is the SHA-256 of the item your harness downloads; every file in it names its own checksum.

Something wrong with this item, its rights or its safety? Report it on the support page, or from your harness after a download.