Unity's journey from the beginning to the behavior tree (3) combination node

Use Behavior Tree in Unity

In the easiest way, bring everyone to know and use the behavior tree, this series is updated for a long time, I hope everyone likes it!

Your support is my motivation for writing.


table of Contents:

1. Make the behavior tree parallel Parallel nodes

2. Other combination nodes


In the previous section, we knew and understood the Sequence and Selector in the combined node

In this section we take a look at other commonly used combination nodes.

1. Make the behavior tree parallel Parallel nodes

Establish the following behavior tree:

Analysis: All nodes under Parallel are executed at the beginning of the behavior tree, output A, and the object is disabled, but the wait is not executed successfully.

So parllel has the following characteristics

  • Parallel all its children
  • All nodes succeed, return success (if any child node fails, fail)
  • If any child node is running, it must be in running

You can try the following examples to integrate the two kinds of combination nodes learned before:

Under the parallel node, the sequence of output A to find objects and wait for output B is executed in order.

2. Other combination nodes

name legend effect
Parallel Selector In parallel until success
Random Sequence Randomly choose to execute the node until it fails
Random  Selector Randomly choose to execute from random nodes until successful
Untity Selector Selector, select the branch with the largest weight to execute, and switch at any time (even if other nodes are running)

Related Reading:

Unity's behavior tree from scratch (1)

Unity's behavior tree from scratch (2)

 

Published 25 original articles · Likes6 · Visits 10,000+

Guess you like

Origin blog.csdn.net/qq_37446649/article/details/89630272