• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

How do I solve the desync?

Status
Not open for further replies.
Level 12
Joined
Nov 3, 2013
Messages
989
My intention is to have a shop with categories to browse through, for this to work I thought of changing the shops content locally so that each player can browse from the same shop without interfering with each other.

As it is it desync after the 2nd purchase, I assume it's because a unit is purchased that isn't even available on the other clients. (I had hoped that it would not desync since the units bought are dummies that don't do anything and gets removed instantly)

The trigger I pulled together for the testing:

  • Untitled Trigger 003
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • (Triggering unit) Equal to Mercenary Camp (Black Citadel) 0011 <gen>
    • Actions
      • Set tempUnit = (Sold unit)
      • Set tempUtype = (Unit-type of tempUnit)
      • Unit - Remove tempUnit from the game
      • Set tempUnit = (Triggering unit)
      • Set tempPlayer = (Owner of (Buying unit))
      • -------- local player only --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • tempPlayer Equal to GetLocalPlayer
        • Then - Actions
          • -------- if unit type == return to categories tab then --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • tempUtype Equal to Return to the all catagories tab (dummy unit)
            • Then - Actions
              • -------- Clear --------
              • Neutral Building - Remove Return to the all catagories tab (dummy unit) from tempUnit
              • Neutral Building - Remove Berserk (dummy unit) from tempUnit
              • Neutral Building - Remove Channel (dummy unit) from tempUnit
              • Neutral Building - Remove Feedback (dummy unit) from tempUnit
              • -------- Add Categories --------
              • Neutral Building - Add No target abilities tab (dummy unit) to tempUnit with 0 in stock and a max stock of 1
              • Neutral Building - Add PBAoE abilities tab (dummy unit) to tempUnit with 0 in stock and a max stock of 1
              • Neutral Building - Add Passive abilities tab (dummy unit) to tempUnit with 0 in stock and a max stock of 1
              • Neutral Building - Add Single target abilities tab (dummy unit) to tempUnit with 0 in stock and a max stock of 1
              • Neutral Building - Add Summon abilities tab (dummy unit) to tempUnit with 0 in stock and a max stock of 1
              • Neutral Building - Add Target point AoE abilities tab (dummy unit) to tempUnit with 0 in stock and a max stock of 1
              • Neutral Building - Add Target point cone & projectile abilities tab (dummy unit) to tempUnit with 0 in stock and a max stock of 1
            • Else - Actions
              • -------- if unit type == no target active then --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • tempUtype Equal to No target abilities tab (dummy unit)
                • Then - Actions
                  • -------- Clear --------
                  • Neutral Building - Remove No target abilities tab (dummy unit) from tempUnit
                  • Neutral Building - Remove Summon abilities tab (dummy unit) from tempUnit
                  • Neutral Building - Remove Passive abilities tab (dummy unit) from tempUnit
                  • Neutral Building - Remove Target point AoE abilities tab (dummy unit) from tempUnit
                  • Neutral Building - Remove Target point cone & projectile abilities tab (dummy unit) from tempUnit
                  • Neutral Building - Remove PBAoE abilities tab (dummy unit) from tempUnit
                  • Neutral Building - Remove Single target abilities tab (dummy unit) from tempUnit
                  • -------- Add the no target activate abilities --------
                  • Neutral Building - Add Berserk (dummy unit) to tempUnit with 0 in stock and a max stock of 1
                  • -------- Return & Next page --------
                  • Neutral Building - Add Return to the all catagories tab (dummy unit) to tempUnit with 0 in stock and a max stock of 1
                • Else - Actions
                  • -------- if unit type == passive then --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • tempUtype Equal to Passive abilities tab (dummy unit)
                    • Then - Actions
                      • -------- Clear --------
                      • Neutral Building - Remove No target abilities tab (dummy unit) from tempUnit
                      • Neutral Building - Remove Summon abilities tab (dummy unit) from tempUnit
                      • Neutral Building - Remove Passive abilities tab (dummy unit) from tempUnit
                      • Neutral Building - Remove Target point AoE abilities tab (dummy unit) from tempUnit
                      • Neutral Building - Remove Target point cone & projectile abilities tab (dummy unit) from tempUnit
                      • Neutral Building - Remove PBAoE abilities tab (dummy unit) from tempUnit
                      • Neutral Building - Remove Single target abilities tab (dummy unit) from tempUnit
                      • -------- Add Passives --------
                      • Neutral Building - Add Feedback (dummy unit) to tempUnit with 0 in stock and a max stock of 1
                      • -------- Return & Next page --------
                      • Neutral Building - Add Return to the all catagories tab (dummy unit) to tempUnit with 0 in stock and a max stock of 1
                    • Else - Actions
        • Else - Actions
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
Nah, of course that would be invalid information for the other clients. I think the common solution to this problem is to redirect the selecting player to his personal invisible shop placed right in the same spot as the dummy. Maybe you could also work with Player - Limit Training.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,195
How do I solve the desync?
By improving determinism of the results.

As it is it desync after the 2nd purchase, I assume it's because a unit is purchased that isn't even available on the other clients. (I had hoped that it would not desync since the units bought are dummies that don't do anything and gets removed instantly)
It violates determinism as it alters the handle table state (used for mapping orders to objects) so that the two clients have objects with different handle values.

Let us not forget the result of the purchase has to be synchronized which cannot happen without net traffic (big delay) or that the purchase itself was deterministic.

You really should not be doing this as I do not see a easy solution to this. Even if there is a solution it is likely not worth the effort.

My recommendation is to just make 3 different shops, place them near each other and for convenience have some UI buttons to change target.
 
Status
Not open for further replies.
Top