1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[Wurst] Desync Issue

Discussion in 'Triggers & Scripts' started by Jaccouille, Jun 25, 2019.

  1. Jaccouille

    Jaccouille

    Joined:
    Feb 1, 2019
    Messages:
    82
    Resources:
    2
    Icons:
    2
    Resources:
    2
    I am currently working on this map : Island Troll Tribes
    github Link : island-troll-tribes/island-troll-tribes

    Since 1st december, we lost our bot and got alot of desync issue, we "fixed" some of them, blizzard update fixed others, from time to time, 1 player still desync, but recently, on the latest version I made, I got issue where half/every player in the game just desync, happens on 1 game out of 3.

    Desync happens "randomly", they can happen at 5, 10, 17, 23min into the game, but it doesn't seem really consistent. I watched some replays and didn't find any leads.

    Last version without much desync, is the Beta 34, it was compiled before last blizzard update, to make sure issue comes from the update or my code, I'll have to revert the current version(Beta 36) and re-compile, good thing I use git, will do that when I have the time to test with players.

    I've read some Hive thread about desync, here's some information I got out of it and compared with my issues :
    -Mac user can be the only one to desync.
    -We got custom constant & interface, haven't tried to reset them yet.
    -We got alot of items spawning randomly on the map.
    -I got lot of custom models, don't know if it can cause a desync.

    There are several uses of GetLocalPlayer(), I kinda trust the guy who made those, but I'll share a few just in case:

    Code (vJASS):

    public function ZoomSetCamera takes integer i returns nothing
         if GetLocalPlayer()==Player(i) then
            call SetCameraField(CAMERA_FIELD_ZOFFSET,ZOOM_DISTANCE[i],1)
            call SetCameraField(CAMERA_FIELD_FARZ,5000,0)
        endif
    endfunction
     

    Code (WurstScript):

    package SimError

    sound error

    public function simError(player forPlayer, string msg)
    let redMsg = "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n|cffffcc00" + msg +"|r"
    if GetLocalPlayer() == forPlayer
         ClearTextMessages()
         DisplayTimedTextToPlayer(forPlayer, 0.52, 0.96, 5.00, redMsg)
         StartSound(error)

    init
         error = CreateSoundFromLabel("InterfaceError", false, false, false, 10, 10)
     


    I also have 2 short replays, one desynced whole game at 4:22m, the others desynced 3 players at 4:30m, I didn't desync on the second one. I got more replays, but they're longer, like 17 or 30min.

    So I am asking for clues, at this moment I am kinda lost, I need player to test and try to find a pattern, feels bad to fill a lobby just to look for crashes.
     

    Attached Files:

  2. Cokemonkey11

    Cokemonkey11

    Wurst Reviewer

    Joined:
    May 9, 2006
    Messages:
    3,240
    Resources:
    18
    Tools:
    1
    Maps:
    5
    Spells:
    3
    Tutorials:
    2
    JASS:
    7
    Resources:
    18
    Code snippets above look fine.

    One thing to know is that interface changes and other map metadata seems to cause desyncs.

    To make matters worse, desync can happen just because the player was in a previous game where interface changes were applied.

    I can't confirm those last two points on 1.31.x though.

    Can you provide war3map.j?
     
  3. Jaccouille

    Jaccouille

    Joined:
    Feb 1, 2019
    Messages:
    82
    Resources:
    2
    Icons:
    2
    Resources:
    2
    Here's the file.
     

    Attached Files:

  4. Cokemonkey11

    Cokemonkey11

    Wurst Reviewer

    Joined:
    May 9, 2006
    Messages:
    3,240
    Resources:
    18
    Tools:
    1
    Maps:
    5
    Spells:
    3
    Tutorials:
    2
    JASS:
    7
    Resources:
    18
    Here's some more uses:

    Code (vJASS):

    function texttag_setVisibility takes texttag this_2, boolean flag_2 returns nothing
        call SetTextTagVisibility(this_2, flag_2)
    endfunction

    function canPlayerSeeDamageText takes player p_2, unit target_2, string stackPos returns boolean
        local boolean stackTrace_tempReturn
        set wurst_stack[wurst_stack_depth] = stackPos
        set wurst_stack_depth = wurst_stack_depth + 1
        set stackTrace_tempReturn = dispatch_LinkedList_LinkedList_LinkedList_has(DamageTexts_damageTextPlayers, playerToIndex(p_2), "when calling has in DamageTexts, line 29") and IsUnitVisible(target_2, p_2)
        set wurst_stack_depth = wurst_stack_depth - 1
        return stackTrace_tempReturn
    endfunction

    call texttag_setVisibility(receiver_8, canPlayerSeeDamageText(GetLocalPlayer(), u_2, "when calling canPlayerSeeDamageText in DamageTexts, line 25"))
     


    Code (vJASS):

    function player_getTribe takes player this_2, string stackPos returns integer
        local integer stackTrace_tempReturn
        set wurst_stack[wurst_stack_depth] = stackPos
        set wurst_stack_depth = wurst_stack_depth + 1
        set stackTrace_tempReturn = Tribe_ofPlayer(this_2, "when calling ofPlayer in PlayerExtensions, line 10")
        set wurst_stack_depth = wurst_stack_depth - 1
        return stackTrace_tempReturn
    endfunction

                    set display = player_getTribe(GetLocalPlayer(), "when calling getTribe in Respawn, line 83") == player_getTribe(owner_2, "when calling getTribe in Respawn, line 83")
                    call timerdialog_setTitle(timerDialog_2, string_format_1("{0} Respawn", player_getName(owner_2)))
                    call timerdialog_display(timerDialog_2, display)
     


    Code (vJASS):

    function pingMinimap_6691 takes real pos_x_2, real pos_y_2, real duration_2 returns nothing
        call PingMinimap(pos_x_2, pos_y_2, duration_2)
    endfunction

    function pingMinimap_6692 takes real pos_x_2, real pos_y_2 returns nothing
        call pingMinimap_6691(pos_x_2, pos_y_2, PingMinimap_DEFAULT_DURATION)
    endfunction

    function Hint_display takes integer this_2 returns nothing
        if force_containsPlayer(Hint_playersF, Player_localPlayer) then
            call printTimed(LegacyColors_GOLD_COLOR + "Hint: |r" + LegacyColors_GENERAL_COLOR + Hint_message[this_2] + "|r", 10.)
            if Hint_ping_x[this_2] != 0. or Hint_ping_y[this_2] != 0. then
                call pingMinimap_6692(Hint_ping_x[this_2], Hint_ping_y[this_2])
            endif
        endif
    endfunction
     


    Code (vJASS):

    function TeleportBeacon_onSelected takes integer this_2, string stackPos returns nothing
        local player whichPlayer
        local unit beacon
        local integer level
        local real range_2
        local real beaconPos_x
        local real beaconPos_y
        local integer list
        local string path
        local string cond_result
        local integer degs
        local real angle_radians_3
        local real pos_x_2
        local real pos_y_2
        local real tuple_temp
        local real tuple_temp_2
        local real tuple_temp_3
        local real tuple_temp_4
        local real tuple_temp_5
        set wurst_stack[wurst_stack_depth] = stackPos
        set wurst_stack_depth = wurst_stack_depth + 1
        set whichPlayer = GetTriggerPlayer()
        if dispatch_HashMap_HashMap_HashMap_has(TeleportBeacon_effects[this_2], playerToIndex(whichPlayer), "when calling has in TeleportBeacon, line 51") then
            set wurst_stack_depth = wurst_stack_depth - 1
            set whichPlayer = null
            set beacon = null
            return
        endif
        set beacon = dispatch_UnitEntity_UnitEntity_UnitEntity_getUnit(this_2, "when calling getUnit in TeleportBeacon, line 54")
        set level = unit_getAbilityLevel(beacon, TeleportBeacon_SPELL_TELEPORT_BEACON)
        set range_2 = TeleportBeacon_RANGE[level]
        set tuple_temp = unit_getPos(beacon)
        set tuple_temp_2 = unit_getPos_return_y
        set beaconPos_x = tuple_temp
        set beaconPos_y = tuple_temp_2
        set list = new_LinkedList("when calling new_LinkedList in TeleportBeacon, line 58")
        if Player_localPlayer == whichPlayer then
            set cond_result = TeleportBeacon_rangeCheckModFirst
        else
            set cond_result = ""
        endif
        set path = cond_result
        set degs = 0
        loop
            exitwhen degs > 340
            set tuple_temp_3 = real_fromDeg(int_toReal(degs))
            set angle_radians_3 = tuple_temp_3
            set tuple_temp_4 = vec2_polarOffset(beaconPos_x, beaconPos_y, angle_radians_3, range_2)
            set tuple_temp_5 = vec2_polarOffset_return_y
            set pos_x_2 = tuple_temp_4
            set pos_y_2 = tuple_temp_5
            call dispatch_LinkedList_LinkedList_LinkedList_add_1(list, effectToIndex(addEffect(path, pos_x_2, pos_y_2)), "when calling add in TeleportBeacon, line 64")
            set degs = degs + 20
        endloop
        call dispatch_IterableMap_HashMap_IterableMap_put(TeleportBeacon_effects[this_2], playerToIndex(whichPlayer), list, "when calling put in TeleportBeacon, line 66")
        set wurst_stack_depth = wurst_stack_depth - 1
        set whichPlayer = null
        set beacon = null
    endfunction
     


    @Jaccouille does your desync happen when a debug stack trace appears?
     
  5. Jaccouille

    Jaccouille

    Joined:
    Feb 1, 2019
    Messages:
    82
    Resources:
    2
    Icons:
    2
    Resources:
    2
    Nope, desync doesn't happen when a debug stack trace appear, as for the code above, I don't think desync happens due to those, I've started reverting and reworking stuff, mostly custom models, so far I haven't seen another desync, maybe it fixed itself who knows, for now I'll just host more game to see if it happen again.
     
  6. Cokemonkey11

    Cokemonkey11

    Wurst Reviewer

    Joined:
    May 9, 2006
    Messages:
    3,240
    Resources:
    18
    Tools:
    1
    Maps:
    5
    Spells:
    3
    Tutorials:
    2
    JASS:
    7
    Resources:
    18
    How's this going?
     
  7. Jaccouille

    Jaccouille

    Joined:
    Feb 1, 2019
    Messages:
    82
    Resources:
    2
    Icons:
    2
    Resources:
    2
    I rolled back the commit until I found the one causing the desync issue, then I gave up.
     
  8. Cokemonkey11

    Cokemonkey11

    Wurst Reviewer

    Joined:
    May 9, 2006
    Messages:
    3,240
    Resources:
    18
    Tools:
    1
    Maps:
    5
    Spells:
    3
    Tutorials:
    2
    JASS:
    7
    Resources:
    18
    Can you provide the diff at that commit
     
  9. Ricola3D

    Ricola3D

    Joined:
    Feb 27, 2019
    Messages:
    217
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Yes, please can we see the diff from this commit you unmade ? I also have issues with mac/linux users..