Performance

Documentation Unreal Engine AI Performance

Benchmark results, profiling tools, and optimization guidance for Soulslike Enemy Combat.


Overview

The Soulslike Enemy Combat plugin is highly optimized for performance. All calculations are primarily simple vector math, resulting in negligible overhead even with large numbers of enemies.


Benchmark Results

Use the interactive tool below to see how the performance 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.

MetricValue
Default samples16 directions
Cost per AI~0.004ms
ScalingLinear with enemy count

Optimization options:

  • Reduce NumSamples property (default 16, can go as low as 8)
  • Disable avoidance if not needed

Avoidance System

Prevents AI from bunching up. Already optimized with throttling.

MetricValue
Update rate10Hz (every 0.1s)
CostNegligible
ConfigurableAvoidanceRadius, bEnableAvoidance

Role Assignment Subsystem

Manages combat roles (Attacker, Waiter, Flanker, etc.)

MetricValue
Update rateTimer-based (configurable interval)
CostNegligible
NoteNot per-frame

Threat Detection

Tracks player look direction to influence AI behavior.

MetricValue
Update ratePer-tick
Cost~0.0004ms per AI
NoteSimple 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 NameDescription
MovementEvaluator - TotalFull per-AI movement cost
MovementEvaluator - Direction Scoring16-sample scoring loop
MovementEvaluator - AvoidanceOverlap queries and avoidance
RoleSubsystem - Role DistributionRole assignment algorithm
ThreatDetection - TickPer-tick threat calculation

Unreal Insights

All stats are also visible in Unreal Insights. Filter for SEC_* trace events:

  • SEC_MovementEvaluator
  • SEC_DirectionScoring
  • SEC_Avoidance
  • SEC_RoleDistribution
  • SEC_ThreatDetection

Scaling Recommendations

Use CaseExpected EnemiesPerformance Impact
Soulslike (typical)3-5Negligible (<0.05ms)
Action RPG10-20Negligible (~0.1ms)
Horde mode50-100Low (~0.2-0.4ms)
Stress test150+Acceptable (~0.6ms+)

Key Optimizations Built-In

  1. Precomputed trigonometry - Sample directions cached at startup
  2. Throttled avoidance - Overlap queries run at 10Hz, not every frame
  3. Timer-based roles - Role reassignment doesn't run per-frame
  4. Hybrid movement - Distant AI use cheaper pathfinding, close AI use tactical sampling
  5. 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 SEC command for real-time profiling