-
Notifications
You must be signed in to change notification settings - Fork 15
Performance
Important
Push Pawn activates abilities whenever two pawns come into contact
This means that ability activations can be numerous
As of 2.0.0 abilities with lightweight implementations and C++ only are available for this reason.
For the sake of maximizing performance, classes have been marked with final
Note
You may want to fork Push Pawn and remove this yourself, but your final Push Ability should always be final
Important
Using C++ ability classes goes a very long way to improving performance with higher player counts
Subclass as blueprints only to change properties at no meaningful cost
Avoid overriding functions and implementing logic to bypass the expensive blueprint virtual machine
Tip
The simplest thing you can do to improve performance is reduce the scan rate, which will result in less abilities being fired off, and at a lower rate.
Tip
Use varying collision size between character types, so that two overlaps don't occur simultaneously.
Tip
Advanced users seeking maximum optimization may consider adding behaviour to IPusheeInstigator::GetPusheeCollisionShape() that adds minor variations to collision size for identical characters, but you will need to ensure this is net synced!
Push Pawn implements TRACE_CPUPROFILER_EVENT_SCOPE() where appropriate, so you will get meaningful traces to observe in Unreal Insights.
Note
There is no real limitation with large character counts and PushPawn
However, it should be factored in and some additional work will be required to manage this
How you handle this will depend entirely on your project and use-case
Warning
The scan ability keeps the UAbilitySystemComponent ticking at all times due to it's WaitForPushTargets task
You should pause or resume the scanning based on significance and other such factors using using IPusheeInstigator::GetPushPawnScanPausedDelegate()
Caution
Even when you pause the scanning, task iteration occurs, and with significant character counts there can be significant task counts
In this case, it is recommended that you remove the PushPawn_Scan ability from dormant characters, and then give the ability back when they wake
This will depend on your own project and own use-case
There is no need to search for nearby characters if:
- We're an AI-Controlled Character and no players are aware of us at all
- No one is close enough to collide within thresholds defined by potential latency and movement capabilities
Tip
When reactivating, Pawns will smoothly eject each other if overlapping, this won't cause teleports