This thread is a quick introduction to Behavior Trees (presented as a FAQ).
What are Behavior Trees?
Behavior Trees are a commonly used way to direct behaviors for AI in a game. They can be used for any decision-making (in systems that aren’t just AI), but this documentation will focus primarily on AI usage.
Why use Behavior Trees?
Behavior trees offer a good balance of supporting goal-oriented behaviors and reactivity.
Why not use State Machines?
While state machines are reasonably intuitive for simple cases, as they become more complex they are hard to keep goal-oriented. As the number of states increases, the transitions between states become exponentially more complex. Hierarchical state machines help a little, but many of the same issues remain.
What about other solutions?
There are innumerable ways to implement AI or other decision making systems. If you believe behavior trees aren’t the best solution for your specific problem, please search for other solutions! Behavior Trees aren’t necessarily always best, but they are frequently great for games.
Is this yet another scripting system I need to learn? I already have to learn Blueprints!
Don’t worry, Behavior Trees aren’t really another scripting or coding system. They’re a way of organizing all of the behaviors you can use to control AI through blueprints (or code). The two systems work very well together: you can build your behavior tree out of Blueprint nodes entirely, or you can write C++ nodes if you prefer. The behavior tree then structures the nodes you’re using to organize decision-making about what actions to take.
More info coming here soon. (I intend to link to a few more key resources for folks just getting started soon, but I have to post the other information first!)
Please also see the hub for all Behavior Tree Documentation.