Patrol and Attack Bot

ExamplePatrolAndAttackBot

Purpose

Demonstrates autonomous agents using behavior trees (BT) in order to make decisions about patrolling and attacking.

How to Use

  • Reset: Returns agents to default positions. 
  • Show Wall: Toggles visibility of the wall object.
  • Accuracy field: Enter a range from 0 (least) to 1 (most) to set bot accuracy. Default, 0.2. 
  • 1v0, 1v1, 3v3: Sets mode:
    • 1v0: BLUFOR uses BT logic; OPFOR no behavior logic
    • 1v1: BLUFOR and OPFOR both use BT logic
    • 3v3: BLUFOR and OPFOR both use BT logic

Scene Location & Name

Assets/Ride/Examples/Behaviours/SeekAndDestroyBot/ExamplePatrolAndAttackBot.unity

Setup Requirements 

Utilize AI bots for your scenes by adding the ExamplePatrolAndAttackBots script, waypoints, objects and Canvas prefab. 

ExamplePatrolAndAttackBot script

First, add this script to an object in your scene to enable AI bots. 

Waypoints, objects, and Canvas prefab

Next, add plane and cube objects to the scene.

Adjust the cube to create a wall that bisects the plane.

Instance Waypoint_AutoAddToRide prefabs on the plane. Reference hierarchy in example scene for setup.

Import Canvas prefab. Reference prefab in example scene for creation and setup of UI options.

Behavior Tree

PatrolAndAttackBot

PatrolAndAttackBot.drawio