Optimization¶
Only read this after your game works
Premature optimization is the root of all evil. Get your abilities, effects, and cues working correctly first. Then profile. Then optimize what the profiler says is slow. Don't guess.
If you're here because you've profiled and identified GAS as a bottleneck (or you're planning for large player counts), this section covers the main optimization levers.
What to Optimize, and When¶
| Symptom | Likely Cause | Page |
|---|---|---|
| High bandwidth per player | Too much GE replication | Replication Optimization |
| RPC saturation / dropped cues | Too many cue RPCs | Cue Batching |
| Bandwidth scales badly with player count | Need minimal replication + proxy | Attribute Proxy |
| Hitches when cues first play | Sync loading cue notifies | Lazy Loading |
| Long initial load times | Loading all cues at startup | Lazy Loading |
The Optimization Hierarchy¶
In rough order of impact and ease of implementation:
-
Choose the right replication mode. Mixed for most games, Minimal for large-scale. This is the biggest single win.
-
Batch cue RPCs. Use
FScopedGameplayCueSendContextwhenever applying multiple effects. -
Make cues unreliable. They already are by default -- don't override to reliable unless you have a specific need.
-
Reduce active effect count. Combine effects where possible. An effect with 3 modifiers is cheaper than 3 effects with 1 modifier each.
-
Pre-allocate cue actors. Set
NumPreallocatedInstanceson frequently used Actor/Looping cues to avoid runtime spawning. -
Async load cues. Don't sync-load missing cues at runtime. Configure the manager for async loading.
-
Implement the replication proxy. For 50+ player games, move replication to a proxy actor with better relevancy control.
Profiling GAS¶
Network Profiler¶
The built-in network profiler shows RPC counts and bandwidth per actor. Look for:
GameplayCueRPCs (should be batched, unreliable)AbilitySystemRPCs (activation, prediction)FActiveGameplayEffectreplication bandwidth
Stat Commands¶
stat net // General network stats
stat game // Game thread time
stat AbilitySystem // GAS-specific stats (if available)
Unreal Insights¶
Use Unreal Insights for detailed CPU profiling of GAS operations:
- Effect application and removal
- Modifier evaluation
- Cue routing and spawning
- Attribute aggregation
In This Section¶
- Replication Optimization -- choosing and configuring replication modes
- Cue Batching -- reducing cue RPC overhead
- Attribute Proxy -- the replication proxy for large player counts
- Lazy Loading -- async loading cue notifies and ability classes