Behavior Integration {{ currentPage ? currentPage.title : "" }}

Behavior Manager Component

In order to add behavior and perception scoring functionalities to you agent, first you will need to add behavior component to your character class.

Add Behavior Component to you Agent Class.

Once added, you can click on it and check the available settings category. NPC Settings is where you can assign the global behavior (and perception) customizable options for your agent.

Behavior Manager Settings

While in behavior manager you can customize affiliation and targetting settings as well, we explain in detail those systems and its parameters in the next sections. Here we describe how to set and customize purely behavior related settings.

Under behavior settings we can modify:

  • Init Mode: Four methods are available to initialize behavior component, you can choose the one you required based on the situation or requirements.

    • FullTemplate Override Settings: Let a Full Template (See Here) assigned to your character init Behavior component and overrides its settings with those set in the Full Template.

    • FullTemplate Maintain Settings: Same as before, but maintains the settings you have on Behavior Manager.

    • Automatic: Inits as soon as begin play reaches the component, uses settings in this component.

    • Manual: Let the user init this component.

  • NPC Settings: Main DataAsset that contains the root and sub behaviors this agent will support

  • Overrided Root Behaviors: In case you need to override or set the root behavior directly from behavior manager itself you can use this and assign the desired root behavior as you would from the Data Asset.

  • Overrided Sub Behaviors: In this variable you can assign sub behaviors that will override those set inside the NPC Settings Data Asset.

Behavior Templates

We provide in our plugin behavior templates already configured by our team, you can find them in the TemplateExamples Folder and assign one of them in NPC Settings variable explained previously.

TemplateExample Folder with our current templates configurated.

We will continue to update and add more templates as needed and where we see interest (you can participate in our discord to request new templates)

Parallel Brains (Root Behavior) and Sub behaviors

You can control different parts of your agent simultaneously by setting a brain in charge of that part. For example you can control the movement independantly from the actions and so on. By Default there are three possible brains you can set, these being a planning brain, a movement brain, and an action brain, but you can define your own set of brains in case you need more or less.

NPC Settings: Root and sub behavior map for each brain, found in one of our DA templates.

Root-SubBehavior Compatibility and Label Match

To assign a sub behavior, first of all you must check the root behavior supports its label. Below we show how one of our premade root behaviors tries to execute the labeled sub behavior, which is assigned in the NPC Settings data asset (or in the overrided sub behavior map inside behavior manager), and the labels must match.

Root Behavior supported sub behaviors example.

Now, while you may be tempted to assign any sub behavior to be controlled by the root behavior, if you don’t check the compatibility between the root and sub behavior assigned the result behavior will result, in the best case, into useless behavior or, in the worst case, it could provoke unnecessary calculations or even a crash.

To be clearer, if you try to assign behavior that executes actions inside Movement brain, it will only cause confusion and misbehavior if your other brain (action brain) also executes actions at the same time, to avoid these kind of bad assignment we named each of our sub behaviors based on whether they are meant to be used as a sub behavior or as a root behavior, and whether they should be used as movement, action or planning behavior. Below some examples:

Movement BTs examples: Those with a prefix of "Sub" are meant to be used as sub behaviors, the others are meant to be used as root behaviors.

On the same note, some sub movement behaviors are Pure Nav Based (uses only nav path to move), then there are steering based sub movement behaviors and there are even mixed ones.In this case, if you assign a steering or mixed sub behavior but you don’t have a steering behavior component set in your agent, the sub movement will only fail its execution, causing the agent not to move at all. We decided then, to separate and name differently those sub behaviors that use nav path only with the prefix “Nav“ in its name. Those sub behaviors that don’t have “Nav“ as prefix are assumed to use some kind of steering behavior functionality.

Overriding Sub Behaviors

In the same you can override (or setup) actions in motion component, you can also override sub behaviors directly from behavior component, as shown below:

Overriding Sub behaviors assigned in Data Assets.

This is useful to give variety per instance in case if needed, for things such as combos or movements, and it can be updated at runtime, which is useful for changing behaviors at some point of the lifetime of the agent.

Tasks, Services and Blueprint Communication

We have prepared tasks and services that communicate to our animation system and you can use in your custom behavior trees, specially in designing enemies combos.

Categorized Plugin Services.
Categorized Plugin Tasks.

Here you have a description of the functionalities of our different tasks and services:

Plugin Tasks.
  • Try Labeled Action: Given a group and action label it will try to start the defined action, provided you set it up in agent’s action settings data asset. Can abort Immediatly: if enabled will allow other more prioritary tasks to abort this tasks, no matter if the action is still active as a montage. Note: Interrupting Behavior will always abort immediatly action tasks. Enable Manual Start: Allows you to init task outside from behavior tree task context, otherwise its automatic, setting expected fiinish time on action playlenght duration. (See below in blueprint communication for an example)

  • Update Locomotion Settings: Update To Desired Locomotion.

  • Update Movement Stage:Try update to desired movement stage on active locomotion settings

  • Update Rotation Policy: Try update rotation policy on active locomotion settings.

  • Select Sub Behavior: Load and sync with new blackboard stored behavior tree in npc settings.

Plugin Services.
  • Update Focus: On enter the task it will focus on desired target, when exiting the task it will clear focus.

  • Override Movement Settings: Allow for Overriding Movement setting in active locomotion settings, resume when leaving task.

  • Strafe Movement: Calculate and updates strafing goal location based on Strafing Threshold Variable while this service is active.

  • Reposition Movement: Calculate and updates reposition goal location based on Reposition Threshold Variable, while this service is active.

Blueprint communication is done through dispatchers and callable functions in you behavior manager owner’s class, similar as Motion Manager does. This lets programmers special validations out of behavior context when starting an action.

Blueprint Callable Functions.

  • Interrupt Behavior: Lets you interrupt current tasks no matter if an action task has disabled “can abort immediatly“. Optional resume in time value.

  • Resume Behavior: Resumes interrupted behavior on call.

  • Try Complete Action Task With Message: Allows you to complete success action task with finish message (finish message its a blackboard key in our base blackboard). Immediate, if enable will finish success immediatly, otherwise it will wait until action finishes on set expected time.

  • Setup Action Task Success: if Action Task enables manual init you can call this function to pass an expected duration time of your action task. Also you can bind an event when it finishes. (Note: If you manually init action task, you’ll need to set expected finish time and in your binded event you’ll need to call OnLabeledActionCompleted dispatcher with your custom finish message)

Setting expected success time from a manually initialized action task, and binding success message.

Furthermore, You can rely on behavior dispatchers that communicate updates in your agent’s behavior.

Behavior Manager Component Dispatchers.

Linked Animation Design

Given the layered design in our behavior system, you can create and override any behavior type in NPC Settings, such as linked animations, more known as combos. With our system you can design any combo sequences taking advantage of the behavior tree user interface. We have prepared tasks already integrated with our animation system, using motion manager component.

These are some examples that currently exists in our plugin, and given the capabilities and characteristics of your agents you probably will need to create a custom combo.

Simple Combo.
More complex Combo.

Like this you can generate any type of combos or linked actions, you only need to set them up with in NPC Settings.

Assigning a combo in NPC Settings.

Important Notes

It is mandatory to add AIPerceptionComponent in AI Controller Class, as it was designed by epic team that way, adding it in any other class, such as character class, will result in unexpected behavior or bugs.

Add AIPerception and configure normally, on AIController Class.

Movement Root behavior shall always be at the top of the settings, otherwise nav based movements will be ignored. image below will show how they should be ordered and how not:

Bad assignment on the left Good assigment on the right

{{{ content }}}