Easy Behavior Tree

I created a Unity package that allows designers to create CPU behaviors with minimal code! When a node is reached in the tree, any subroutine can be run!

Released Unity Package!

The full easy behavior tree package has been released on the Unity Asset Store for $10 CAD. You can find it there or contact me directly and I may give it to you for free!

How I Created It - Nodes

The BTNode class is the backbone of the behavior tree. It is the base class for all the different node types, and each one has an input and output port for controlling the logic flow from one node to another. Each node has a parent and children, as well as a status of IDLE, RUNNING, SUCCESS, and FAILURE. When the node is ticked, it will return one of these statuses depending on the type of node it is, and send that information back up the chain.

How I Created It - Editor

The behavior tree editor is a Unity window that a designed to be as user friendly as possible. You can load existing trees or create a new one, saved as a unity asset whenever a change is made. I decided a visual interface with drag and drop mechanics for setting the parent / child nodes would be the best way, because it does not require any coding for the user to make the tree. I also set up an interface so that when you right click, a menu pops up with all the different types of nodes you can create, and when you make a node a child of another node, it tells you the order that they are executed in.

Use Case!

Behavior tree of the enemy guard NPC in our capstone game Lumora! Many nodes have been renamed for clarity, but they are all the basic types listed above.

Previous
Previous

Cheese Factory

Next
Next

Dictator Simulator