Conflict Resolution
Conflicts occur when competing changes are made to the same Sync Property. SocketWeaver game servers deliver Sync Property changes at very low latency. However, Sync Property conflicts are hard to eliminate. SWNetwork has an easy-to-use and flexible API to help you resolve the conflicts.
Conflict Resolution Rules
Mine
Use the local player's change as the merge result.
Their
Use remote change as the merge result.
Custom
On Conflict Event
Invoked when conflict occurs and Conflict Resolution is set to Custom.
In this example, a conflict was detected when the local player tried to modify the "hp" sync property.
To resolve the conflict
Obtain oldLocalHP, newLocalHP, and remoteHP from the SWSyncConflict object
Check if the player HP is already 0. If it is true, we should not apply damage to the dead player. We can just resolve the conflict by calling Resolve(Object resolvedValue) on the SWSyncProperty Object.
If player HP is not 0, we should apply damage to the remoteHP instead of oldLocalHP.
Last updated