Ninja Bear Studio Plugins Help

First Steps with Ninja Bot

This page guides you through the first steps for Ninja Bot. Make sure to check the Bot Setup instructions before continuing.

The following steps aim to provide a functional AI agent that can roam, detect the player, and chase a sensed target.

This page uses a simple behavior with three states: Idle, Roam, and Chase. The main trigger between these states is whether the player is sensed or not.

It is recommended that your Gameplay Debugger is configured, so you can inspect the Bot's perception data and evaluate its active AI states during gameplay.

Perception Configuration

Ninja Bot uses a Perception Sense Profile to define how bots sense the world. For this first setup, we will create a simple Sight configuration that allows the bot to detect the player.

Create the Perception Configuration

  1. In your Perception Data folder, create a new Perception Sense Profile using the Content Browser contextual menu: Ninja Bear StudioNinja BotSense Profile.

  2. Add the Sight sense to the list of senses. Configure Sight Radius to 1200 and Lose Sight Radius to 1400.

  3. Mark Enemies, Neutrals, and Friendlies in Detection by Affiliation.

  4. Set Sight as the Dominant Sense.

  5. Perception Sense Profile

Roaming Query

The roaming behavior uses an Environment Query to find random reachable locations from the Navigation Mesh.

Create the Roaming Environment Query

  1. Create an Environment Query that retrieves random locations from the Navigation Mesh.

  2. Add a Pathing Grid Generator with Grid Half Size set to 1000 and Space Between set to 100.

    EQS, Roam Generator
  3. Add a Distance Test with Float Value Min set to 300 and Float Value Max set to 1200.

    EQS, Distance Test

AI Logic

Ninja Bot can expose perception and awareness data to either Behavior Trees or State Trees. Choose the option that matches the decision system used by your project.

Create the Blackboard

  1. In your AI folder, create a new Blackboard that will be used to store contextual data available to the AI agent.

  2. Create an entry for SensedActor, setting the Key Type to Object and the Base Class to Actor. Create a new Entry Category named Perception.

    Blackboard, Sensed Actor
  3. Create three new float Key Types: CandidateScore, NormalizedCandidateScore, and AccumulatedAwareness. Add them to the Perception category.

  4. Create an entry for AwarenessLevel, setting the Key Type to Enum. Set the Enum Name to EBotPerceptionAwarenessLevel. Add this entry to the Perception category.

    Blackboard, Awareness Level
  5. Create three new Vector Key Types: FirstPerceivedLocation, CurrentTargetLocation, and LastKnownLocation. Add them to the Perception category.

  6. Create one additional Vector Key Type, RoamLocation. Add it to a new category named Roam.

Create the Behavior Tree

  1. Create a Behavior Tree and assign the Blackboard to it.

  2. From the Root node, create a Selector composite node and add the Update Perception Service to it. Match each property to the correct blackboard key.

    Behavior Tree, Update Perception Service
  3. From the top Selector node, create a Sequence composite node for Combat. Add a Blackboard Decorator to check whether the SensedActor key is set. This Decorator should be configured to abort both itself and lower priority nodes.

    Behavior Tree, Combat Branch 1
  4. Add a Move To Task, using the SensedActor key as the Target Location and an Acceptable Radius of 50. Add an Is At Location decorator using the same parameters, followed by a Force Success decorator. Lastly, add a Wait task set to 1 second with a Random Deviation of 0.2.

    Behavior Tree, Combat Branch 2
  5. From the top Selector node, create another Sequence composite node for Roam. Add a Run EQS Query task using the Environment Query created earlier, and configure it to write its result to the RoamLocation key. Add another Move To task using the RoamLocation key as the Target Location.

    Behavior Tree, Roam Branch
  6. Complete the Behavior Tree with another Sequence composite node for Idle. Add a Wait task set to 5 seconds.

    Behavior Tree, Idle Branch

Create the State Tree

  1. Create a State Tree using the State Tree AI Component Schema.

  2. Add the Update Perception evaluator.

    State Tree, Update Perception Evaluator
  3. From the Root node, add a Child State named Combat. Add an Object Is Valid Enter Condition, checking UpdatePerception.SensedActor.

    State Tree, Combat State 1
  4. From the Combat state, add a Child State named Move to Target. Add a Distance Compare Enter Condition comparing the Bot and Target locations, a Move To task targeting UpdatePerception.SensedActor, and a State Completed transition to the Next State.

    State Tree, Combat State 2
  5. Add another state named Wait. Add a Delay task with a Duration of 1.0 and a Random Deviation of 0.2.

    State Tree, Combat State 3
  6. From the Combat state, add a Sibling State named Roam. Create a Vector Parameter named Roam Location.

    State Tree, Roam State 1
  7. From the Roam state, add a Child State named Find Location. Add a Run EQS Query task, bind the Result to the Roam Location parameter, bind the Query Owner to the Context Actor, and set the Query Template. Add an On State Completed transition to Next State.

    State Tree, Roam State 2
  8. Add another state named Move to Location, and from the Roam state add another sibling named Idle. For Move to Location, add a Move To task and bind the AI Controller from the Context, and the Destination to Parameters.RoamLocation. Add an On State Completed transition to Idle.

    State Tree, Roam State 3
  9. From the Idle state, add a Child State named Wait. Add a Delay task with a Duration of 5.0.

    State Tree, Idle

Bot Setup Data

The Bot Setup Data Asset connects the bot's perception configuration with the decision system used by the AI Controller.

Create the Bot Setup

  1. In your Bot Setup Data folder, create a new Bot Setup using the Content Browser contextual menu: Ninja Bear StudioNinja BotBot Setup.

  2. Set the Brain Type to Behavior Tree and assign your Behavior Tree asset.

    Bot Setup with Behavior Tree

Create the Bot Setup

  1. In your Bot Setup Data folder, create a new Bot Setup, using the Content Browser contextual menu: Ninja Bear StudioNinja BotBot Setup.

  2. Set the Brain Type to State Tree and add your State Tree asset.

    Bot Setup with State Tree

Bot Character

The Bot Character provides the Bot Setup Data and uses the Ninja Bot AI Controller.

Create the Bot Character

  1. Create a new Character and add the Bot Setup Provider Interface.

    Adding the Bot Setup Provider Interface
  2. Double-click GetBotSetupData from the list of Interface Functions. Drag from the Return Value and Promote it to a Variable. Set the Bot Setup as its default value.

    Configuring the Bot Setup data
  3. In the Character Defaults, locate the AI Controller Class and set it to NinjaBotAIController.

    Configuring the Bot Controller

Next Steps

At this point, you should have a Bot that roams around the environment until it detects the player. Once the player is sensed, the Bot transitions into a chase behavior and actively pursues the target.

From here, you can:

22 May 2026