RAIN node types

For the RAIN implementation of behavior trees, the behavior nodes are split into two categories: decisions and actions. Actions tell the AI system to actually do something; it is where the actual work of the AI is done. The most common action is the one we saw in the previous chapters, move, which tells the AI system to move a character. Besides move, here is a list of the current actions RAIN supports:

  • The Choose patrol path and Choose path waypoints: These nodes help to move the AI through a network of waypoints.
  • Detect: This finds other AI entities and areas marked in a scene. This node will be covered in Chapter 6, Sensors and Activities.
  • The Evaluate expression: This node evaluates some logic, using RAIN's custom logic system. We will be discussing this node more in this chapter.
  • Animate and Mechanism: These animation nodes manage different animations playing on the entity. We'll look at this node type more in Chapter 10, Animation and AI.
  • Play audio: Plays an audio sound for the entity.
  • Wait for timer: A timer that will pause for a given number of seconds.
  • Yield: This node stops executing the behavior tree in the frame. This is useful for spreading expensive AI computation over several frames.
  • Custom action: This is used to create an action that can't be defined with the other nodes.

Note

Custom actions and decisions nodes are very useful to define AI behaviors that are unavailable with the default node types. We will look at an example of a custom action later in this chapter. Although creating custom nodes is more work, don't hesitate to use one if needed; part of making good AI is customizing things specific for your game.

Decision nodes, as the name suggests, are used to decide how we traverse the tree. Actions are the final things the AI does, and decisions are used to determine which child nodes should be run:

  • Sequential: This is the most straightforward decision node; it updates its children in an order until one of them fails.
  • Priority: This is an action node that lets you set a priority, both when it's running and before it starts. A priority node will choose a child to run based on the different priorities of its children.
  • Selector: This node keeps running through child nodes until one of them returns true.
  • Parallel: This states to have its children nodes run at the same time. This is a common and useful node, and for cases such as a character walking to a goal and moving and animating the walk cycle, the entity needs to have a move and animate decision node running at the same time.
  • Iterator: This is a repeat node; it lets you specify that you want its children updated, not just once in an update, but a specified number of times.
  • Constraint: This node lets us define a logical expression, a statement that returns true or false, to control the tree flow.
  • Custom decision: Like a custom action, this lets you define a decision node specific to your game.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.46.109