Team Tree
The Team behavior tree has the same structure as the Solo behavior tree. The main difference between the two is that the Team behavior tree allows agents to request and respond to backup as well as create a formation when searching for the target. The Team behavior tree looks like:
Since this tree is so similar to the Solo behavior tree we’ll just go over the differences. The first difference is within the Can See Target branch:
As indicated by the highlighted Request Backup task at the top, when the agent can see a target the agent will request for backup. This will allow the agent’s teammates to respond and come to help. The Request Backup task notifies the agent’s teammates by sending the “RequestBackup” event using the Behavior Designer event system. If the Is Target In Sight check returns a new target then the Update Backup Request task will run to notify all of the interested teammates that there is a new target. This task is highlighted at the bottom of the above image.
Immediately following the Search For Lost Target branch is the new team branch which responds to backup requests:
The Has Received Event task will receive events sent by the Request Backup task. The Has Received Event task is being reevaluated using a Lower Priority conditional abort so it will be triggered when the agent is not running a branch with a higher priority than the backup branch. If the agent has received a backup request event they can decide to ignore with the Random Probability task. Notice there is a Sequence task directly underneath the top Sequence task. This will ensure the Lower Priority conditional abort is only triggered by the Has Received Event task.
After the Random Probability task has run the Should Provide Backup task will run. This task determines if the agent should provide backup. One reason the agent won’t want to provide backup is if the backup requester is too far away. Assuming the agent does want to provide backup a Parallel task will run which runs two branches:
The first branch, on the left, will continuously check to ensure the backup target is up to date. Within the Can See Target branch from earlier the agent may update the target with the Update Backup Request task so the agent responding to backup should ensure that they are always responding to the correct backup target.
The second branch that runs in parallel is the branch that will actually move the agent to the backup target with the Seek task. At any point the backup request may be cancelled (such as if the target dies) so a Self conditional abort is used to continuously reevaluate the Has Received Event task. This task monitors the “CancelBackupRequest” event rather than the “RequestBackup” event like the previous Has Received Event task monitored.
The last difference between the Solo and Team behavior trees is the lowest priority branch, the Search For Target branch:
The team-specific tasks are indicated in red. When an agent goes to search for the target they can either start their own search or join an existing search. If they want to start their own search then the Should Lead Search task will return Success. The Should Lead Search task will communicate with the Team Manager component to determine if the agent should start its own search. If the agent should not start its own search then the Find Leader and V Formation tasks will run. Find Leader will also communicate with the Team Manager only this time it’ll return the leading agent that the current agent should create a formation with. As soon as this leading agent has been returned the V Formation task will then have the current agent follow the leading agent in a formation.