Making decisions with FSMs
We explored the concept of FSMs in the past when we used them in the Animator. We learned that an FSM is a collection of states, each one representing an action that an Object can be executing at a time, and a set of transitions that dictates how the states are switched. This concept is not only used in Animation but in a myriad of programming scenarios, and one of the common ones is in AI. We can just replace the animations with AI code in the states and we have an AI FSM.
- Creating the FSM
- Creating transitions
Let's start creating our FSM skeleton.
Creating the FSM
To create our own FSM, we need to recap some basic concepts. Remember that an FSM can have a state for each possible action it can execute and that only one can be executed at a time. In terms of AI, we can be Patrolling, Attacking, Fleeing, and so on. Also, remember that there are transitions between...