Performance

Documentation Unreal Engine AI Performance

What each system costs, how often it runs, and how to read stat SEC on your own hardware.


MovementEvaluatorComponent direction sampling dominates SEC CPU time. Role assignment, action polling, awareness and reactions run on timers, on events, or only while a feature is active.

Cost Model

Every SEC system runs on a known cadence over a known loop. What that costs in milliseconds depends on your CPU, so the shape is documented here and the numbers come from your own machine through stat SEC.
The slider models linear scaling from a per-enemy figure you supply. Read one enemy's cost from stat SEC in PIE, put it in, and the model tells you where a crowd lands.
Output Log
20 enemies
1 duel50 horde150 stress
Illustrative scaling — run stat SEC in your level for real numbers
MovementEvaluator - Total
0.070 ms
MovementEvaluator - Direction Scoring
0.063 ms
MovementEvaluator - Avoidance
0.004 ms
RoleSubsystem - Role Distribution
0.001 ms
ThreatDetection - Tick
0.008 ms
Estimated SEC overhead
0.083 ms
Share of 60 fps frame budget (16.6 ms)0.50%

Low share at this count

At 60 fps you have 16.6 ms per frame. Movement direction sampling dominates the plugin's share; everything else runs on a timer, on an event, or only while a feature is active.

What Runs When

Cadence is how often the work happens. The multiplier is what makes one pass more expensive.
SystemCadenceWork each passMultiplier
Movement evaluatorEvery tick while EvaluateAndMove or AI Movement runsScores one direction per sample and picks a winnerNumSamples (default 16)
AvoidanceInside the movement pass, overlap refresh at 10 HzSphere overlap, then a penalty per neighbour foundPawns packed inside the avoidance radius
Nav samplingInside the movement pass, cache refresh every NavCheckInterval (0.1 s), staggered across NavStaggerStride (4) framesProjects sampled directions onto the navmeshNumSamples, navmesh density
Detour queryOn the detour recheck interval while hybrid movement runsOne path query compared against straight-line distancePath length
Action scoringEvaluationCooldown (0.1 s) on the native brain, or each Poll ActionHard gates, then a score for every action still standingActions on the set, times scorers per action
Reaction scoringOnce per trigger rule that matches an incoming stimulus and clears its own interval, conditions and chance rollGates and scores the reactions that rule allowsRules matched per stimulus, times reactions per rule
AwarenessTimer at EvaluationInterval (0.1 s)Advances a meter per remembered actor and ages the restActors perceived at once
Brain tickEvery tick, gated inside by EvaluationCooldownPicks a phase, then drives movement and action scoringContains both, see the warning below
Role subsystemRoleReassignmentInterval (8 s)Fitness score per combatant per candidate roleCombatants, times roles
Threat detectionEvery tick by defaultOne dot product against the focus actorFixed small cost
Melee traceEvery tick between StartTracing and StopTracingSwept trace per socket per frameActive trace sockets
Approach windowEvery tick while an approach window is openSteers the pawn toward its approach targetOne pawn at a time
TerritoryOnly when something asksRoute arithmetic, or one navmesh query for a wander spotPosts on the route
Combat tokensOn claim and releaseSlot bookkeeping on the targetFixed small cost
Territory, tokens and reactions do no work until something calls them, and the brain skips its own movement pass while it is walking a leg, waiting out a post's dwell, or looking around a spot it just reached, so an idle enemy at a post costs only the brain tick.

Tuning for Scale

Details
Movement Evaluator Component (MovementEvaluatorComponent)
Movement Evaluator
Num Samples
16
Enable Avoidance
Enable Nav Aware Sampling
Nav Sampling
Nav Check Interval
0.1
Num Samples scales the direction-scoring loop. Avoidance and nav sampling both refresh at 10 Hz by default.
Num Samples: Range 4–32. Halving samples roughly halves direction-scoring work. Start at 8 for horde crowds if strafing still looks acceptable.
bEnableAvoidance: Turn off when enemies never pack tightly (solo bosses, sparse open fields).
bEnableNavAwareSampling: Turn off only when you accept ledge/hazard blind spots. Keeps NavCheckInterval and NavStaggerStride from doing nav probes.
Hybrid movement: Distant enemies pathfind; close enemies use tactical sampling. HybridSwitchDistance (default 800 cm) controls the handoff. See Movement System.
Project-wide timers
Role and target timing live in Project Settings → Soulslike Enemy Combat → Combat Roles → Timing:
Timing
Role Reassignment Interval
8
Min Time In Role
8
Re-evaluate Targets On Reassignment
Role Reassignment Interval: How often UAICombatRoleSubsystem re-runs global assignment. Default 8 s. Set 0 to drive reassignment manually.
Native brain / Poll Action: EvaluationCooldown on USECBrainComponent or STTask_PollAction (default 0.1 s) spaces action picks. Raise it for background grunts that do not need 10 Hz decisions.
Threat: Call SetTickInterval on UThreatDetectionComponent to skip frames when you only need coarse player-look reactions.

Built-in Profiling

Open the console (~) and run:
stat SEC
Registered cycle stats (from STATGROUP_SEC):
StatScope
MovementEvaluator - TotalFull per-AI movement pass, containing the four below it
MovementEvaluator - Direction ScoringSample loop over NumSamples
MovementEvaluator - AvoidanceThrottled overlap scoring
MovementEvaluator - Nav SamplingNav validity cache refresh
MovementEvaluator - Detour QueryPath-length detour check
ActionEvaluation - ScoringGates and scores every candidate action
ReactionEvaluation - ScoringGates and scores reactions for one stimulus
Awareness - EvaluateOne pass over remembered actors
Brain - TickNative brain tick, containing action scoring and the movement pass
RoleSubsystem - Role DistributionGlobal role assignment pass
ThreatDetection - TickPer-tick threat level
Two of these are totals rather than separate costs. MovementEvaluator - Total contains the four movement stats under it, and Brain - Tick contains ActionEvaluation - Scoring and the whole movement pass whenever the native brain drives the enemy. Adding the column up counts that work two or three times. Under a StateTree the same functions run with no enclosing brain tick, so Brain - Tick reads zero and the rest stand on their own.
Melee tracing and the approach window carry no cycle stat. Measure them in Unreal Insights on USECMeleeTraceComponent and USECApproachComponent tick.
Unreal Insights: filter CPU trace events SEC_MovementEvaluator, SEC_DirectionScoring, SEC_Avoidance, SEC_NavSampling, SEC_DetourQuery, SEC_ActionScoring, SEC_ReactionScoring, SEC_Awareness, SEC_BrainTick, SEC_RoleDistribution, SEC_ThreatDetection.
For log-based diagnosis, see Debugging & Troubleshooting.

Optimizations Already in Code

  1. Unit-circle sample cache: trigonometry for direction samples is precomputed when NumSamples changes.
  2. Throttled avoidance: overlap queries run at 10 Hz, not every frame.
  3. Throttled nav cache: NavCheckInterval plus NavStaggerStride spread nav sweeps across frames in a pack.
  4. Timer-based roles: reassignment runs on RoleReassignmentInterval, not per frame.
  5. Hybrid movement: strategic pathfinding only past HybridSwitchDistance (or while detour escalation is active).
  6. Conditional melee tick: USECMeleeTraceComponent starts with tick disabled; tracing enables tick only for active swings.
  7. Conditional action tick: ActionEvaluationComponent ticks only during action execution (hook dispatch), not while idle.

Scaling Guide

What dominates changes with the crowd, and that decides where tuning pays off.
ScenarioActive SEC enemiesWhat dominates
Soulslike duel1 to 5Nothing worth tuning. One enemy's movement pass is noise against a frame.
Action RPG pack10 to 20Direction sampling, with avoidance climbing as they close on you.
Horde50 to 100Direction sampling across the pack. Cutting NumSamples to 8 is the largest single lever.
Stress test150+Direction sampling and nav probes. Raise NavStaggerStride, and slow action polling for enemies out of the fight.
Cost scales roughly linearly with enemies running movement every frame. An enemy standing at a post, waiting out a dwell, or dead costs a fraction of one in a fight.