Performance
Documentation Unreal Engine AI Performance
Benchmark results, profiling tools, and optimization guidance for Soulslike Enemy Combat.
Overview
At 150 enemies, the plugin consumes less than 4% of a 60fps frame budget. Calculations are simple vector math: direction samples, dot products, and distance checks.
Benchmark Results
The chart below shows how cost scales with enemy count.
Benchmarks are performed on a Ryzen 9950x.
🚀 Live Performance Preview
Adjust the enemy count to see the estimated Game Thread overhead.
20 Enemies
1 (Duel)50 (Horde)150 (Stress Test)
Output Log - stat SEC
Authenticated user: Client 1
SEC_MovementEvaluator
0.070 ms
SEC_DirectionScoring (16 samples)
0.063 ms
SEC_Avoidance
0.004 ms
SEC_RoleDistribution
0.001 ms
SEC_ThreatDetection
0.008 ms
Total SEC Overhead
0.083 ms
Frame Budget Usage (60fps target)0.50% of 16.6ms
✅ Negligible Impact
Context: At 60fps, you have 16.6ms per frame. Even with 150 enemies, the plugin uses less than 4% of your frame budget.
System Breakdown
MovementEvaluatorComponent
The main per-frame cost. Handles tactical positioning via direction sampling.
| Metric | Value |
|---|---|
| Default samples | 16 directions |
| Cost per AI | ~0.004ms |
| Scaling | Linear with enemy count |
Optimization options:
- Reduce
NumSamplesproperty (default 16, can go as low as 8) - Disable avoidance if not needed
Avoidance System
Prevents AI from bunching up. Already optimized with throttling.
| Metric | Value |
|---|---|
| Update rate | 10Hz (every 0.1s) |
| Cost | Negligible |
| Configurable | AvoidanceRadius, bEnableAvoidance |
Role Assignment Subsystem
Manages combat roles (Attacker, Waiter, Flanker, etc.)
| Metric | Value |
|---|---|
| Update rate | Timer-based (configurable interval) |
| Cost | Negligible |
| Note | Not per-frame |
Threat Detection
Tracks player look direction to influence AI behavior.
| Metric | Value |
|---|---|
| Update rate | Per-tick |
| Cost | ~0.0004ms per AI |
| Note | Simple dot product math |
Built-in Profiling
The plugin includes custom stat groups for real-time profiling.
Console Command
Open the console (~) and run:
stat SEC
Stats Available
| Stat Name | Description |
|---|---|
| MovementEvaluator - Total | Full per-AI movement cost |
| MovementEvaluator - Direction Scoring | 16-sample scoring loop |
| MovementEvaluator - Avoidance | Overlap queries and avoidance |
| RoleSubsystem - Role Distribution | Role assignment algorithm |
| ThreatDetection - Tick | Per-tick threat calculation |
Unreal Insights
All stats are also visible in Unreal Insights. Filter for
SEC_* trace events:SEC_MovementEvaluatorSEC_DirectionScoringSEC_AvoidanceSEC_RoleDistributionSEC_ThreatDetection
Scaling Recommendations
| Use Case | Expected Enemies | Performance Impact |
|---|---|---|
| Soulslike (typical) | 3-5 | Negligible (<0.05ms) |
| Action RPG | 10-20 | Negligible (~0.1ms) |
| Horde mode | 50-100 | Low (~0.2-0.4ms) |
| Stress test | 150+ | Acceptable (~0.6ms+) |
Key Optimizations Built-In
- Precomputed trigonometry - Sample directions cached at startup
- Throttled avoidance - Overlap queries run at 10Hz, not every frame
- Timer-based roles - Role reassignment doesn't run per-frame
- Hybrid movement - Distant AI use cheaper pathfinding, close AI use tactical sampling
- Conditional ticking - Melee traces only tick during active attacks
Summary
- <0.1ms for typical Soulslike scenarios (3-10 enemies)
- ~0.2ms for medium-scale encounters (50 enemies)
- ~0.6ms for extreme stress tests (150 enemies)
- Linear scaling with enemy count
- Built-in
stat SECcommand for real-time profiling