โ† All examples

godot components

Data-driven state machine from a JSON transition table

Load states and event transitions from a Dictionary or JSON file, with wildcard rows, named guards and named actions registered in code, validation that refuses malformed tables, and signals for taken and ignored events.

What this component contains

  • ATTRIBUTION.md
  • LICENSE
  • README.md
  • baltor_test.gd
  • component.json
  • door_table.json
  • event_transition_table.gd
  • inspect_gdscript.py
  • run_tests.gd
  • test_package.py
  • tests/test_event_transition_table.gd
  • verification/native.json

How it works

Class
BaltorTransitionTable, extends RefCounted
Methods
register_guard(guard_name: StringName, guard: Callable) -> void; register_action(action_name: StringName, action: Callable) -> void; load_table(table: Dictionary) -> bool; get_errors() -> PackedStringArray; fire(event: StringName, payload: Dictionary = {}) -> bool; get_state() -> StringName; reset() -> void; available_events() -> PackedStringArray
Signals
transitioned, event_ignored
Placement
res://baltor/godot_components/event_transition_table/

Recorded checks

godot 4.7.2.stable.official.ed1daf0bf

  • godot_parse_check_only
  • godot_gdscript_tests
  • godot_tests_reject_gutted_component
  • godot_editor_import
  • godot_contract_reflection
  • godot_readme_usage_compiles

Limits to consider

Flat states only. Guards and actions must be registered before load_table(). The first matching row wins; there are no priorities beyond table order and exact-before-wildcard. door_table.json is sample data. Verified with Godot 4.7.2 headless; written against the Godot 4.3 API.