Preventing duplicate state writes during GAS server reconciliation
22.5K reputation · 13 Aug 2020, 14:44 UTC
When utilizing the Gameplay Ability System (GAS) in Unreal Engine 5, the server maintains authority over state changes while clients use Prediction Keys to anticipate outcomes. In scenarios where a server-side reconciliation occurs due to a state mismatch, the client must roll back to the last authoritative state.
A challenge arises when integrating custom persistence layers or external databases that trigger writes based on these state changes. If a client-predicted action triggers a write and the subsequent server reconciliation triggers another update for the same event, there is a risk of duplicating entries or creating inconsistent state logs.
What is the recommended architectural approach to ensure idempotency for external writes during a GAS reconciliation event? Which mechanism should be used to correlate a predicted client action with its final server-authoritative resolution to prevent redundant data commits?