User Tools
Sidebar
Using RAIN
AI Characters
Environment
Table of Contents
Creating Behavior
In RAIN, behavior can range from simple to highly sophisticated. To build behavior in RAIN, you will be using the Behavior Tree Editor.
Be sure to also read Behavior Trees Overview.
Behavior Trees are the primary feature for doing Behavior in RAIN. Building behavior has been dramatically simplified, however, it still requires an understanding of logic and is still only a tool. Building complex behavior still requires an understanding of how Behavior Trees work. This section will introduce you to some of the basic concepts of Behavior Trees, and get you started making Behavior Trees of your own.
Intro to Behavior Trees
Behavior Trees are based on the concept that decision making for an AI can usually be broken down into a set of hierarchically organized tasks. Higher level tasks near the root of the hierarchy usually define a mechanism for choosing between or organizing the execution of lower level tasks. Tasks at the bottom or edge of the tree (usually “leaf nodes” in programming parlance) are typically specific actions that can be carried out by game logic. In RAIN, these tasks take the form of behavior tree nodes.
Creating Behavior
To Start:
- Open the Behavior Tree Editor by selecting from the menu RAIN » Behavior Tree Editor. You can also access a shortcut from the AI Mind.
- Create a new behavior tree by selecting it from the drop down. This will create a basic tree with a sequencer container in it.
From this point, you now need to make a decision on what behavior you want to build. Here are some tips on constructing your behavior tree logic:
- What end result do you want to accomplish with this AI?
- Break out each specific behavior into its own branch or separate behavior tree asset.
- Use constraint and expression nodes to help make decisions that will determine whether a branch or node is executed.
- Use sequence nodes when you need tasks to execute successfully one after the other until one fails.
- Use selector nodes when you need it to execute nodes until it returns a success on one.
- You can open the active behavior tree for your character and review it as it runs.
- Red = failed, orange = running/failed, yellow = running, green = success
- Drag the behavior tree nodes around while running for real time updates to better understand the execution process.
- Check out Behavior Trees for more information about the actual usage of behavior trees.
If you have followed this Getting Started series, you should now be able to:
- Create the AIRig that will be used to manage your AI motion, animation, mind (behavior), etc..
- Create a Navigation Mesh used to graph the playing area and provide the AI Navigator with information it can use to perform path searches and routing.
- Create a behavior tree where you can define self contained behaviors much like a HFSM without transitions.
- Create waypoint path sets that will be used by Navigator in conjunction with the Navigation Mesh to define a route to a vector position defined by each waypoint. Once the target position is defined, the Navigator can provide the AI Motion element with the target to move to.
These are all essential steps in creating functional AI. You should now be ready to investigate the specifics on how to accomplish the desired goals for movement and behavior. Continue from here by reviewing RAIN Elements and Components to learn more about managing your AI.
Next Steps
- Next steps RAIN Elements and Components