Unreal Engine 4 – Call Behavior Node : Idea and Code

Developing the AI for a simulation game, my friend and I noticed that behavior trees tend very fast to become quite complex and unmanageable. We also noticed that we need to repeat several times the same nodes in the same order with different parameters, which leads to the necessity of several cut and paste operations that are not only boring, but also prone to error.

We started to look how we could reduce the extent of our behavior trees using the tools provided by the engine. The “Run Behavior” node is the nearest to what we were looking for, but it doesn’t allow to pass parameters and needs the same blackboard as the calling tree. This implies that to have the exact same behavior  with 2 different objects (for example transporting an object from one place to another, verifying that the 2 places are free from other bots and eventually waiting in a queue), we should write 2 different “Run Behavior” nodes. In a complex world with a lot objects to manage and different actions to accomplish this isn’t an optimal solution. Continue reading “Unreal Engine 4 – Call Behavior Node : Idea and Code”