The Deathmatch AI Kit provides ready-to-customize enemy behavior trees for team and free-for-all combat. Agents can search for targets, choose weapons, take cover, respond to damage and grenades, request backup, and regroup in formations.

Requirements

Import these packages in order:

  1. Behavior Designer.
  2. Behavior Designer – Movement Pack.
  3. Ultimate Character Controller, UFPS, or Third Person Controller.
  4. The Behavior Designer / Character Controller integration.
  5. Deathmatch AI Kit.

The kit uses the original Behavior Designer and Movement Pack APIs; it is not a Behavior Designer Pro add-on.

Import the dependencies before the kit so Unity can deserialize every behavior-tree task. If a tree was imported with missing task references, restore the missing package and then reimport the Deathmatch AI Kit.

The Behavior Designer and Ultimate Character Controller integration on the Opsive downloads page.

Start here

  1. Follow Getting Started to import the project settings and run the demo.
  2. Use the Agent Manager to create a Solo or Team agent.
  3. Configure its targets and weapons on Deathmatch Agent.
  4. Add and validate Cover Points if the agent may take Cover.
  5. Read the Behavior Tree Overview before rearranging priorities or replacing subtrees.

Choose a starting tree

  • Solo is for agents that act independently.
  • Team adds backup requests, responses, and formation-based searching to the Solo behavior.

Both are External Behavior Trees that reuse shared subtrees. Duplicate the source assets before making project-specific changes so a package reimport cannot overwrite your customized trees.

Included behavior overview

Branch or system Role
Near Grenade Interrupts lower-priority behavior to evade an immediate explosive threat.
Damaged Responds to an attacker by fleeing or switching targets.
Can See Target Acquires a visible target, selects a weapon, and enters the Attack subtree.
Attack Coordinates attack movement, cover choice, weapon selection, firing, and grenades.
Search For Health Finds health when the configured need is active.
Can Hear Target Records a heard position and starts investigation.
Search For Lost Target Searches around the last-known position for a limited time.
Is Ammo Low Retrieves ammunition when the current inventory needs it.
Cover Finds, enters, and changes cover while coordinating attack permission.
Search For Target Patrols search waypoints when no higher-priority need is active.
Team coordination Adds backup requests, responses, and formation-based searching to the Solo behavior.

The table describes the kit’s authored behavior branches. The trees also use Behavior Designer, Movement Pack, and character-controller integration tasks inside those branches; follow each linked branch page to see their execution order and shared data.

Configure a real combat scenario

  1. Build a Solo agent first and verify its navigation, target layers, one weapon, and one enemy before enabling teams.
  2. Add reachable search waypoints and cover points. Test no-target patrol, sight acquisition, hearing, target loss, and reacquisition separately.
  3. Configure every Available Weapons entry on Deathmatch Agent so its class, likelihood curve, minimum range, maximum range, and group-damage flag match the actual item.
  4. Apply controlled damage, low health, low ammunition, and a nearby grenade one at a time. Confirm the higher-priority branch interrupts the current search, cover, or attack behavior.
  5. After Solo succeeds, create Team agents, assign team indices, and verify backup, cancellation, and formation searching without mixing enemy and friendly target layers.

Use the live Behavior Designer task highlight to find the first branch that returns an unexpected status. A visible target with no movement is different from a movement destination with no attack, and those failures belong to different integrations.

Runtime data and API

The kit’s trees communicate through Behavior Designer shared variables. Project code can update a custom variable through the owning BehaviorTree. For example, a customized branch can define and read a GameObject variable named MatchObjective:

using BehaviorDesigner.Runtime;
using UnityEngine;

public class DeathmatchObjectiveDriver : MonoBehaviour
{
    [SerializeField] private BehaviorTree m_BehaviorTree;

    public void SetObjective(GameObject objective)
    {
        m_BehaviorTree.SetVariableValue("MatchObjective", objective);
    }
}

Create MatchObjective in the duplicated tree and wire a custom conditional or action to consume it; the default graphs do not read this example variable. They acquire Target through Is Target In Sight and reset it when the attack branch ends, so assigning Target externally does not select or retain a priority target. Review every branch that reads or resets a variable before integrating external state.

See Accessing Variables from non-Task Objects for the complete Behavior Designer variable API. Use Deathmatch Agent for runtime component responsibilities and Behavior Tree Overview for branch ownership. A custom priority-target feature must also define how its target bypasses or cooperates with detection, switching, search, and reset logic.

Folder structure

  • Opsive/DeathmatchAIKit/BehaviorTrees contains the Solo and Team trees plus their shared subtrees.
  • Opsive/DeathmatchAIKit/Demo contains the demo scene and assets. Retain it while the kit’s editor SetupManager is present: that manager references the demo namespace and Startup type. Removing only Demo leaves compile errors. A project that removes demo code must also remove or conditionally exclude the dependent editor code.
  • Opsive/DeathmatchAIKit/Editor contains the Agent Manager and other editor tooling.
  • Opsive/DeathmatchAIKit/Scripts contains the runtime AI components and tasks.