FSM
From GameStudio Wiki
Finite State Machines (FSM), in their simplest form, are made up of states and transitions between those states.
Contents |
[edit]
Advantages
- Easy to use and understand on a small scale.
[edit]
Disadvantages
- Does not scale nicely. As new states are added or removed, all the other states need to be updated to reflect this (exploding complexity).
[edit]
Implementation
[edit]
Hard-Coded FSM
FSM can be implemented directly in the code (known as Hard-Coding). This can be done by representing each state as a function which is responsible for behavior and handling transitions to other states. Or the transitions can all be stored in a single function which is responsible for calling the correct state.
[edit]
Data-Driven FSM
If you can abstract the states and transition conditions into simple values, you can use those values to represent your FSM rather than code.
