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


Use the local player's change as the merge result.


Use remote change as the merge result.


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

  1. Obtain oldLocalHP, newLocalHP, and remoteHP from the SWSyncConflict object

  2. 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.

  3. If player HP is not 0, we should apply damage to the remoteHP instead of oldLocalHP.

void OnDamageConflict(SWSyncConflict conflict, SWSyncedProperty property)
    // 1
    int newLocalHP = (int)conflict.newLocalValue;
    int oldLocalHP = (int)conflict.oldLocalValue;
    int remoteHP = (int)conflict.remoteValue;
    // 2
    // check if player is already killed
    if (remoteHP == 0) {
    // 3
    // should use remoteHP instead of oldLocalHP to apply damage
    int damage = oldLocalHP - newLocalHP;
    int resolvedHP = remoteHP - damage;
    if (resolvedHP < 0) {
        resolvedHP = 0;

Last updated