Behavior trees can be seen as a synthesis of a number of other artificial intelligence techniques, such as finite-state machines, planning, and decision trees. In fact, they share some resemblance to FSMs, but instead of states, we think in terms of actions spanned across a tree structure.
Implementing behavior trees
Getting ready
This recipe requires us to understand coroutines.
How to do it...
Just like decisions trees, we will create three pseudo-abstract classes for handling the process:
- First, let's create the Task base class, as shown in the following code...