Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Marc Flerackers edited this page Aug 20, 2025 · 2 revisions

Currently state (which models an event driven fsm) has a few drawbacks:

  • You can't define a state machine and use it for several objects. The state machine needs to be constructed for each object. It also can't be serialized.
  • There are no sub-state machines (it's not an hsm). You can emulate them using "state_substate" states, but you need to manually forward unhandled events to the parent state. An example where you use them would be a following camera. The parent state "move" would handle camera following. The "move" state would have a sub-state machine with "walk", "jump" and "dive" states.
  • There is no way to return to the previous state (like a pushdown automaton). An example would be a barrier state where the player is invulnerable in stasis for 2 seconds. When leaving this state, the machine needs to go back to the state the player was in before going into the barrier state.
Clone this wiki locally