-
Notifications
You must be signed in to change notification settings - Fork 18
Quick Start
This page serves as a super quick summary of the main points of the Behavior system. The details of each part are detailed on their respective pages (check out the menu on the right).
For the purposes of this tutorial we'll assume you have an entity / creature you want to bring to life. If you don't, check out this tutorial to learn how to create one.
To specify the behavior tree your entity will use, go into its .prefab
file, and find (or create) the Behavior
entry in the JSON.
The correct format is:
"Behavior" : {
"tree" : "<module>:<behavior>"
}
To create your own Behavior tree, which is what defines the behavior of an entity, go into the assets/behaviors
folder of your module and create a new <name>.behavior
file.
You can learn how to create your own Behavior here, but if you want to use a premade behavior, you can - e.g. engine:stray
for the built-in stray
behavior.
Nodes, implementing the BehaviorNode
interface, are the building blocks of behavior trees. Every Node is denoted in the tree files using the name it returns through getName()
.
There are two main types of nodes:
For a general writeup about TreeNodes, see here.
To see how a behavior tree can respond to events and changes in the entity, see here
F5 opens the GUI editor for behavior trees, which lets you inspect trees for individual entities as they execute, tweak parameters and assign new ones. For a more detailed look, see here.