Replicating Target Data To Server Can Clobber Previous Data

The Gameplay Ability System provides a way to send client-predicted data to the Server via `UAbilitySystemComponent::ServerSetReplicatedTargetData`. This has been very helpful for us when creating Abilities with lots of predicted data.

The downside of this is that the predicted TargetData is saved in a map that is keyed off the `AbilitySpecHandle` and the `AbilityOriginalPredictionKey` -- NOT the scoped prediction key. This means that subsequent calls to `ServerSetReplicatedTargetData` from the same Ability will override each other in the map.

This is usually not an issue, and we can probably work around it in most cases, however we have seen cases where this data gets clobbered because the map got overwritten with a call to `ServerSetReplicatedTargetData` before the previous call was fully processed.

I’ve seen some comments in the ASC about batching, which sounds like it could help mitigate this issue significantly. But according to the comments that feature is considered “work in progress”.

Is batching the recommended approach to handling this problem? Or is there another approach that Epic recommends?

Is there a reason that the replication map is keyed off the `AbilityOriginalPredictionKey` rather than the scoped key?

Thank you for your help!

Steps to Reproduce

Hello there,

I’d like to just make sure I’m across this issue. Reading the code and your question, it seems as though this is an issue when a client is modifying the target data frequently enough to clobber the map. Given the abilities you are seeing this on, does that sound correct?

Would it be possible to create a minimal repro project or provide a set of steps or more information to construct one? I would like to reproduce the issue on my side as this would appear to something the system should be able to handle.

Best regards,

Chris

One thing i am curious of here is, ServerSetReplicatedTargetData is a reliable RPC, meaning it will be set of instantly (Reliable RPC’s are sent instantly they are called) The only way i can see this being an issue is if it all happened in the same frame (but again that seems odd). And reliable RPC’s are ordered. I have never seen this issue before, but maybe my use cases have ne required sending a ton of TargetData for a single ability activation? We tend to split our stuff into reusable abilities that do the one thing they do.