Download

All about Behaviour Trees

In this excellent explanation of decision vs behaviour trees, a decision tree is evaluated root to leaf, every relevant conditional is checked, and the outcome is the selection of one outcome after the logical exclusion of all other outcomes.

4 ways in which the UE4 behaviour trees differ from a simple decision tree:

  • Event driven - only traverses the nodes with conditionals that pass.
  • Priority based ordering
  • Observer aborts
  • Failing / Succeeding up the chain - no need for “did it work” checks

Something that’s interesting to note about this, is that behaviour trees aren’t all that different to decision trees. So at the end of the day, you’re building a decision tree, and the behaviour tree functionality just makes it more performance friendly and powerful by letting you encode decisions implicitly in where you place the nodes on the graph (priority), and not having to check if something worked or failed.

The behaviour tree image from the stackexchange thread shows a 5th way that behaviour trees are meant to differ from decision trees. Nodes can be listed as “running”, and will be rechecked every tick until they either succeed or fail. In the event driven model, the node could throw events on either succeed or fail, and then be evaluated. As far as I can tell, this feature isn’t present in UE4 behaviour trees. Is that the case?

Are the any other ways in which UE4 behaviour trees differ from decision trees and other behaviour tree implementations?

4c222ddba5624ea46b8336ee4e2dd3af7822e103.png

I whipped up an example in paint. This kind of node could be used for tasks which push an action onto the AI’s task queue, and are evaluated outside the behaviour tree.