# Minimal Enemy

> The smallest enemy the plugin can drive: a plain Character, a plain AI Controller, six components, one action, no StateTree.

Markdown version of https://rigbak.com/docs/universal-combat-framework/enemy/minimal-enemy, a page of the Universal Combat Framework documentation. Link that page when citing it.

> Six components on two actors you already own. It walks toward its target and swings. No base class to inherit from, no StateTree to author, no perception to configure.

## Set it up (3 minutes)

1. **Add four components to your AI Controller**

   Open your existing AI Controller Blueprint and add these four. Nothing here is replicated; they run on the server and decide.

   Components panel of **BP_MyEnemyController**:

   - UCF Combat Controller (add)
   - Action Evaluation (add)
   - Movement Evaluator (add)
   - UCF Brain (add)
2. **Add two components to your pawn**

   Open your Character Blueprint and add these two. The Capsule and Mesh are already there.

   Components panel of **BP_MyEnemy**:

   - Capsule Component (inherited)

     - Mesh (inherited)
   - UCF Action Set Component (add)
   - Ability System Component (add)
3. **Make an Enemy AI Config**

   Right-click in the Content Browser, **UCF**, **AI**, **Enemy AI Config**.

   Create the asset: right-click in the Content Browser, choose **UCF > AI > Enemy AI Config**, and name it **DA_AIConfig_Grunt**.

   *Right-click in the Content Browser, UCF, AI, Enemy AI Config.*

   Give it an Action Set holding one action and a Movement Behavior Profile. Leave **Default State Tree** empty: that empty field is what runs the native brain instead.

   In **DA_AIConfig_Grunt**, under Behavior, set:

   | Property | Value |
   | --- | --- |
   | Default Action Set | DA_ActionSet_Grunt |
   | Default Movement Profile | DA_Movement_Grunt |

   *Two assets in. Default State Tree stays empty.*
4. **Have the pawn use that controller**

   On the Character's Class Defaults, point it at your controller and let it possess itself. Without both, nothing possesses the pawn and none of the components above ever run.

   In **BP_MyEnemy**, under Pawn, set:

   | Property | Value |
   | --- | --- |
   | AI Controller Class | BP_MyEnemyController |
   | Auto Possess AI | Placed in World or Spawned |

   *The pawn names its controller and asks to be possessed.*
5. **Point the controller at the config**

   Select the **UCF Combat Controller** component on the controller and hand it the asset you made.

   In **UCF Combat Controller**, under AI, set:

   | Property | Value |
   | --- | --- |
   | Default AI Config | DA_AIConfig_Grunt |

   *A plain Character provides no config of its own, so this field is the one that answers.*
6. **Give it something to fight**

   From your player Blueprint on Begin Play, get the **AI Combat Role Subsystem** and call **Register Combat Target** with the player pawn, **Auto Assign Unassigned** ticked.

## When to Use This

You have a Character and an AI Controller of your own that you cannot reparent, because they already inherit from something in your project. Nothing here asks you to.

You want to know what the plugin requires, separated from what the demo content happens to ship with.

Something stopped working and you want to find out what. Strip an enemy to this list, confirm it fights, then add your pieces back one at a time until it stops.

## The components

Four on the controller, two on the pawn. Everything else in the plugin is an addition to this.

- **UCF Combat Controller** resolves the config and hands the settings out.
- **UCF Brain** decides what the enemy is doing at any moment.
- **Movement Evaluator** works out which way to walk and walks it.
- **Action Evaluation** scores the actions and runs the winner.
- **UCF Action Set Component** holds which Action Set is live, so clients can read it.
- **Ability System Component** runs the ability the winning action names. Adding it is the whole step; no initialization call, no C++.

<details>
<summary>What each component would do without the others (Advanced)</summary>

The components are tools, so each one answers on its own and none of them drives another.

Drop **UCF Brain** and nothing calls the other two. The enemy sits still with a perfectly good Action Set and a perfectly good Movement Evaluator, because neither acts unless something asks it to. That is the shape of the whole plugin: a decider calls, components answer.

Drop **Movement Evaluator** and the enemy attacks whatever wanders into range without ever closing distance. Drop **Action Evaluation** and it walks to its preferred range and stands there.

Drop **UCF Combat Controller** and the config never resolves, so the other three run on their own defaults and the Action Set stays empty.

</details>

## The config

One Data Asset carries the enemy's whole setup, and three of its fields matter here by staying empty.

**Default State Tree** empty is what selects the native brain, and the native brain is what makes this list short.

**Target Selector** empty falls back to a built-in one that takes the first target the enemy may fight, even for a target registered long after the enemy started running. Name a real selector once several enemies share a fight or several players are registered. See [Targeting](https://rigbak.com/docs/universal-combat-framework/enemy/targeting-system).

Leave **Awareness Config** empty. Without perception settings the brain reads the controller's focus actor, and a focus actor is enough to fight.

> **Note**
>
> Setting **Default AI Config** on the controller works here because a plain Character does not provide a config of its own. A pawn that provides one wins, and the controller's field is then unreachable.

## Give it a target

**Register Combat Target**, from the last QuickStart step, sets the focus actor the brain reads. Until it happens the enemy stands still, which is correct rather than broken. **Auto Assign Unassigned** ticked makes an idle enemy pick from the pool on the spot instead of waiting for the reassignment timer.

For the call to reach the enemy it has to be registered with the subsystem, which **Auto-Register for Combat Roles** on the config does by default. Leave it on.

The player's targeting picks and locks onto an enemy carrying a **UCF Enemy Targetable** component. Add one to the pawn for the player to aim at this enemy.

## What this enemy does not do

It lands no damage, because it has no melee trace. It answers no hits, because it has no Reaction Set. It knows nothing it cannot see through its focus actor, because it has no perception. It fights anything registered, including other enemies, because nothing has told it who its friends are.

The next four things to add:

- **UCF Melee Trace** on the pawn, to land hits. See [Melee Trace](https://rigbak.com/docs/universal-combat-framework/melee-trace-and-damage).
- **UCF Reaction Set Component** on the pawn, to answer them. See [Reaction System](https://rigbak.com/docs/universal-combat-framework/enemy/reaction-system).
- **UCF Team** on both, so enemies leave each other alone. See [Targeting](https://rigbak.com/docs/universal-combat-framework/enemy/targeting-system).
- **UCF Awareness** on the controller, for sight, hearing and memory. See [Awareness](https://rigbak.com/docs/universal-combat-framework/enemy/awareness-system).

<details>
<summary>Combat roles, and why they are absent here (Advanced)</summary>

Roles let several enemies share a fight: one presses while others circle and wait. They are worth adding the moment you have a second enemy.

A single enemy does not need them. Without **UCF Combat Role** the pawn's role reads as none, the config's **Default Action Set** and **Default Movement Profile** apply for every role, and both the Action Set resolution and the action scoring run as normal.

Add the component and per-role overrides on the config start working. See [Combat Roles](https://rigbak.com/docs/universal-combat-framework/enemy/combat-roles).

</details>

<details>
<summary>Class names (C++)</summary>

The six are `UUCFCombatControllerComponent`, `UActionEvaluationComponent`, `UMovementEvaluatorComponent` and `UUCFBrainComponent` on the controller, plus `UUCFActionSetComponent` and `UAbilitySystemComponent` on the pawn. The pawn is a plain `ACharacter` and the controller a plain `AAIController`; neither inherits from `AEnemyCharacterBase` or `AEnemyControllerBase`.

`UUCFCombatControllerComponent::ResolveAIConfig` branches on whether the pawn implements `IEnemyAIConfigProvider`. A plain `ACharacter` does not, which is what leaves the controller's `DefaultAIConfig` live.

`UUCFBrainComponent::ReconcileBrain` selects a StateTree when the config names one and the native loop when it does not. `ResolveDesiredPhase` falls back to the focus actor when there is no awareness component, or when the one present has neither settings nor recorded data.

`UAbilitySystemComponent::InitAbilityActorInfo` carries no `UFUNCTION`, so the handover reaches Blueprint through no node. `AEnemyCharacterBase` makes the call in `PostInitializeComponents`, and every ability lookup in the plugin runs through `UAbilitySystemGlobals::GetAbilitySystemComponentFromActor`, which finds a plain component without an interface.

Two edge cases hold for this setup: with no ability system on the pawn the enemy picks an action but runs none, and an ability system nothing initialized by hand still runs it.

</details>

---

Previous page: [Step-by-Step Enemy Creation](https://rigbak.com/docs/universal-combat-framework/enemy/step-by-step-enemy). Next page: [Movement System](https://rigbak.com/docs/universal-combat-framework/enemy/movement-system)
