Core Architecture
Documentation Unreal Engine AI Architecture
The mental model: how the plugin separates strategy from execution, and how a decision flows from perception to movement.
Two layers: strategy and execution
The plugin splits the AI into a layer that decides and a layer that acts. The decision layer picks what to do; the execution layer carries it out. The two talk through components, never directly, so you can change either side without touching the other.
Architecture
Content>Plugins>SoulslikeEnemyCombat
StateTree: Strategic Layer
- Evaluates combat context
- Scores available actions
- Manages state transitions
- Controls movement strategy
- Handles target acquisition
Action Execution: Tactical Layer
- Option A: Gameplay Ability (simple: play montage, apply damage)
- Option B: Behavior Tree Sequence (complex: multi-step, branching)
The strategic layer drives decisions. Actions run through Gameplay Abilities or Behavior Tree sequences.
Two ways to run an action. A Gameplay Ability suits a self-contained move: play a montage, apply damage. A Behavior Tree Sequence suits a multi-step move with branches: close the gap, check stamina, commit to a heavy or light finisher. You pick per action in the ActionSet.
The pieces
An enemy is a pawn and an AI controller, each carrying components.
EnemyCharacterBase and EnemyControllerBase create them for you. Getting Started covers setup, including how to reparent your own classes.On the pawn:
| Component | Job |
|---|---|
AbilitySystemComponent | Runs the gameplay abilities that actions trigger |
SECMeleeTraceComponent | Melee hit detection |
SECActionSetComponent | Holds and replicates the action set |
SECReactionSetComponent | Holds and replicates the reaction set |
SECCombatRoleComponent | Replicates the assigned combat role |
On the controller:
| Component | Job |
|---|---|
SECCombatControllerComponent | The hub: config resolution, role registration, death teardown |
SECBrainComponent | Runs a StateTree or the native combat loop (see below) |
ActionEvaluationComponent | Scores and runs actions |
ReactionEvaluationComponent | Runs event-driven reactions |
MovementEvaluatorComponent | Tactical positioning |
ThreatDetectionComponent | Player attention tracking, disabled by default |
AwarenessComponent | Perception memory: sight, hearing, damage |
SECCombatControllerComponent is the one piece every setup needs. Add it to any AAIController and the combat system works; the other controller components are opt-in. Its full API lives in the API Reference.How a decision flows
Every evaluation runs the same loop:
- Perceive. Awareness and Threat Detection update what the AI knows about its target.
- Decide. The brain builds a decision context (distance, angle, health, stamina, tags), and
ActionEvaluationComponentscores every action in the set against it. - Act. The highest-scoring valid action runs, as a Gameplay Ability or a Behavior Tree sequence.
- Move.
MovementEvaluatorComponentscores directions in parallel and strafes, approaches, or retreats.
Architecture
Content>Plugins>SoulslikeEnemyCombat
SECBrain
reads AIConfig on possession
DefaultStateTree set, or empty
StateTree
graph-authored
Native loop
C++, no StateTree
either path drives the combat loop
Action Evaluation
scores actions through scorers and gates
executes the chosen action as
Behavior Tree
multi-step sequences
Gameplay Ability
single GAS action
One brain, chosen from the config. A StateTree adds graph structure; the native loop runs the same combat cycle without one.
The brain: StateTree or native loop
SECBrainComponent reads the AI config on possession and picks how the AI runs:- A StateTree is set (
DefaultStateTree): the brain creates a StateTree at runtime and runs it. Use this for graph-authored structure such as patrol, investigate, or boss phases. - No StateTree: the brain runs a native C++ loop: build the decision context, move, then score and run an action each tick. This covers combat on its own.
The scoring and movement components do the same work in both modes. See StateTree Tasks for the graph nodes, and the API Reference for the brain's properties.
Scope
The plugin provides:
- Enemy AI decision-making and tactical movement
- Melee hit detection, usable on player characters too
- Action scoring and execution
- Event-driven reaction evaluation and execution
- Replicated pawn-side state (
SECActionSetComponent,SECReactionSetComponent) - Multi-enemy coordination through combat roles
- Multiplayer support on listen and dedicated servers
- A modular component set you mix per enemy type
- Data-driven configuration with full Blueprint access
- A showcase enemy to study and extend
You still build:
- UI and HUD: health bars, lock-on indicators, damage numbers
- Level design and encounter placement
- Progression and difficulty balancing