Baltor Get started

Gallery / Godot components

Finite state machine with child-node states

In your harnessGodot componentMIT

Run one active state at a time from child nodes, with ordered exit and enter calls, an optional transition table, queued requests and a bounded history. Use it for characters, menus, doors and game flow.

Files, names only

  • ATTRIBUTION.md
  • LICENSE
  • README.md
  • baltor_test.gd
  • component.json
  • example.tscn
  • finite_state_machine.gd
  • inspect_gdscript.py
  • run_tests.gd
  • test_package.py
  • tests/test_finite_state_machine.gd
  • verification/native.json

Full files in your harness.

What it takes and gives

Class
BaltorStateMachine, extends Node
Methods
start(data: Dictionary = {}) -> bool; stop() -> void; transition_to(state_name: StringName, data: Dictionary = {}) -> bool; go_back(data: Dictionary = {}) -> bool; has_state(state_name: StringName) -> bool; get_state_node(state_name: StringName) -> Node; get_current_state() -> StringName; get_state_names() -> PackedStringArray; and 2 more
Signals
state_changed, transition_refused
Exports
initial_state, auto_start, allowed_transitions, history_size
Placement
res://baltor/godot_components/finite_state_machine/

Limits. One active state; no parallel or nested states (see the hierarchical state machine). States are found by node name among direct children. Queued requests are checked when they are applied, not when they are made. Input reaches the active state through _unhandled_input only. 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
12 files, 84.9 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 example scene, godot readme usage compiles
Techniques
finite state machine, state pattern with duck-typed callbacks, transition table, bounded history stack
Tags
state machine, fsm, ai, gameplay, node, transitions
Identity
library.supply.creative_originals.743969abfb8ee07af24b1dbb.dbeba9f11d533c6b
Version
dbeba9f11d533c6bd655e8f4b1c77d9beab280e76577bfa842e279c90893dc7e

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.