Create a Tree
Last updated
Last updated
Add a tree to the project assets (Create->BadgerHTN->Tree) and choose a fitting name.
Select the new project hierarchy and select "Open". We can leave the Blackboard field empty for now.
This will open a new "Tree View" that contains our tree. The tree starts with a root node that will be our entry node to this behavior.
You can create new nodes by pressing space to bring up the node creation menu or by right-clicking and selecting "Create Node".
You can connect nodes together by dragging a line from one node's output port to another one's input port. Connecting the nodes will make the search explore them in a depth-first order.
The search will start at the topmost node and work its way down.
After you've connected a node, a traversal index will show up in the top right node corner. The nodes in the picture below are marked 1, 2, and 3 and this will be the search route if all conditions are met (sequence->log->wait.
Using selector and sequence nodes are two ways to traverse the tree. The selector node will execute its child nodes until the first one succeeds. The sequence node will only execute if it can execute all its children in order.
Debugging your behaviors is an important part of AI development and it's easy to do in the tree view. Selecting an agent in the scene hierarchy will show the debug information for its search.
The green and red node border will highlight which route the search traversed and if it failed to validate any conditions. Pressing "Show Agent" will bring up a window where we can view the agents' blackboard.