RAIN is a visual Behavior Tree editor. The UI is composed of two main elements: the Behavior editor and the AI Rigs. The Behavior editor is where the nodes are added. The AI Rigs holds different parameters for the agents.
There are four things we have to create in order to have a basic AI environment setup:
- Navmesh
- Waypoint Paths
- Behavior Trees
- AI Rigs
The Behavior Editor is composed of two categories: Actions and Decisions. Before we start creating a Behavior Tree, we have to think of the behavior we expect from the agent. Then, we must prioritize some actions above the others. This is achieved by adding at the top of the tree the most critical of the actions, and adding down the less critical.
For instance: taking cover is more important than reloading. First aids is more important than reloading, but not as quite as important as taking cover, but almost. Moving is the less important of all.
Detect node
- Aspect Variable: I want to detect an enemy and shoot at him. I detect the “enemy” aspect. In this case, I’ll assume that I mounted the “enemy” aspect to a valid aimpoint, like the head or chest. I’ll want to use the Aspect Variable as my aim target, because it represents the exact position of the aspect.
- Form Variable: I want to detect an enemy and follow it around. I detect the “enemy” aspect. I probably want to use the Form Variable because I want to follow the root of the enemy, not whatever the aspect was attached to. (For all I know, the aspect was attached to a tail that is swinging around wildly.)
- Mount Point Variable: I want to examine individual objects related to a target. I detect the “right hand” aspect. The aspect is associated with the Enemy entity, so I don’t want the Form Variable – it would tell me about the root object and not the right hand. I also don’t want the Aspect Variable, because that will tell me about the aspect and its location, which may be offset from the right hand. In this case I’m assuming that the “right hand” aspect is mounted to the right hand joint of my model, and that’s what I want to work with. So I’ll use the Mount Point Variable.
- I’d say that 90% of the time I use the Aspect Variable. 10% of the time I use the Form Variable. Only in some rare cases do I use the Mount Point variable.