Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[Solved] Profligacy Desync

Discussion in 'World Editor Help Zone' started by Swan, Aug 20, 2016.

Tags:
  1. Swan

    Swan

    Joined:
    Jan 13, 2013
    Messages:
    127
    Resources:
    1
    Maps:
    1
    Resources:
    1
    So I'm updating the old Profligacy ORPG but I seem to have introduced a desync bug somehow. It occurs as soon as the map starts if any players have played something other than Profligacy without restarting Warcraft. I've also had reports of delayed desyncs in other maps after having played Profligacy without restarting. The fact that it can be resolved by restarting Warcraft before and after playing points me towards map data being damaged somehow but I don't know what it is. Old versions of Profligacy did not desync (I don't have access to their source unfortunately). I had thought it was something to do with the way I optimized/protected the map but it happens in this unprotected version as well.
    Edit: I forgot to mention that it seems to occur with any other map played before but it is confirmed to happen with Dota or Twilight's Eve ORPG.
     
  2. Swan

    Swan

    Joined:
    Jan 13, 2013
    Messages:
    127
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Does anyone have suggestions or ideas about what might be a good path to pursue in fixing this?
     
  3. pOke

    pOke

    Joined:
    Mar 24, 2013
    Messages:
    1,103
    Resources:
    1
    Maps:
    1
    Resources:
    1
    What causes desync problem?

    Take a look at this post potentially, although it seems the problem would be the other way around.

    Also if you use GetLocalPlayer() anywhere consider looking over those triggers or even posting them here. It might be an edge case that occurs only occasionally and the fact that some players have said they were playing X,Y and Z before might just be a coincidence.

    Edit: Here is another post, just trying to give you some information that might make you think of where the problem is originating.
    [Trigger] - Desync Detect : Somebody Help Me

    Edit2: I have no idea if it's the case, but I just read that "Large Dice Rolls" can cause issues.
    Edit3: Are you using vanilla WE? JNGP? Just saw something about the old WEU being behind some problems.
     
    Last edited: Aug 25, 2016
  4. Swan

    Swan

    Joined:
    Jan 13, 2013
    Messages:
    127
    Resources:
    1
    Maps:
    1
    Resources:
    1
    My worldeditor/jassnewgen is from here. all the getlocal players are for displaying text or saving and haven't changed. Besides it is consistently reproducible by playing another map before Profligacy to cause it or restarting beforehand to never have it. Large dice rolls may have something to do with it, though I haven't touched any of that and older versions of Profligacy did not have the bug. I'm leaning towards the world editor being the source of the bug. What version is recommended?
    The fact that it only occurs when the map starts, never later into it, and that it only occurs when other games have been played before hand makes it seem like something weird is going on with warcraft memory to me.
     
  5. Emm-A-

    Emm-A-

    Joined:
    Jul 1, 2008
    Messages:
    1,312
    Resources:
    0
    Resources:
    0
    does it always happen, no matter what map has been played before? Does it happen, if a normal melee map has been played before?
     
  6. Swan

    Swan

    Joined:
    Jan 13, 2013
    Messages:
    127
    Resources:
    1
    Maps:
    1
    Resources:
    1
    I'll test that.
     
  7. Swan

    Swan

    Joined:
    Jan 13, 2013
    Messages:
    127
    Resources:
    1
    Maps:
    1
    Resources:
    1
    It did occur with melee.

    Edit:
    Would someone else opening and saving it with their own Jassnewgen pack fix something that mine has bugged if it is my Jassnewgen that is causing this?
     
    Last edited: Aug 26, 2016
  8. pOke

    pOke

    Joined:
    Mar 24, 2013
    Messages:
    1,103
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Well I am at a loss and don't really have much more to offer.
    Maybe @Dr Super Good can help as both of the posts I linked are from him. :p
     
  9. Swan

    Swan

    Joined:
    Jan 13, 2013
    Messages:
    127
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Well thanks a ton for trying. I'll update this thread if I get it fixed but I'd still love help if anyone has any ideas.

    Edit: Might have found it, following the advice in this thread there were tons of black squares.
    Chronic Desync Problem | The Helper
     
    Last edited: Aug 29, 2016
  10. Swan

    Swan

    Joined:
    Jan 13, 2013
    Messages:
    127
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Fixed it, I just had to delete one of the tiles so that I was only using 15 tiles instead of 16 tiles. I don't know how previous versions of Profligacy didn't have this desync but oh well.
    Fixed it hopefully. I actually had another desync after this fix though it may have been due to some other map.
     
    Last edited: Aug 30, 2016
  11. Swan

    Swan

    Joined:
    Jan 13, 2013
    Messages:
    127
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Still having the desyncs. I had thought it was fixed but it seems to have just been a fluke. Another weird thing that happened was one player desynced while the rest of us received a quest when clicking on a unit. Normally clicking a quest giver automatically gives you the quest, but the wrong unit was providing the quest. I've never seen this bug occur and it hasn't since.
     
  12. pOke

    pOke

    Joined:
    Mar 24, 2013
    Messages:
    1,103
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Can you show the quest trigger?
     
  13. Swan

    Swan

    Joined:
    Jan 13, 2013
    Messages:
    127
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Sure I'll just upload the map again. Theres a whole quest system not written by me. My personal guess would rather be that its something to do with unit-ids getting screwed up by whatever is causing the desyncs but I dunno. I'll probably upload tomorrow.
     
  14. Emm-A-

    Emm-A-

    Joined:
    Jul 1, 2008
    Messages:
    1,312
    Resources:
    0
    Resources:
    0
    that quest thing points towards GetLocalPlayer(). You should check all local blocks in this quest system
     
  15. Swan

    Swan

    Joined:
    Jan 13, 2013
    Messages:
    127
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Code (vJASS):

    function PlaySoundForPlayer takes sound snd, player p returns nothing
        if(GetLocalPlayer() == p) then
            call StartSound(snd)
        endif
    endfunction
     

    Code (vJASS):

    function AddSpecialEffectTargetPlayer takes string sfx, unit target, string attach, player p returns effect
        local string s = sfx
        if GetLocalPlayer() != p then
            set s = ""
        endif
        return AddSpecialEffectTarget(s,target,attach)
    endfunction
     

    Code (vJASS):

    private function UpdateQuestDialog takes nothing returns nothing
        local real trans = 100
        local integer i = 0
        loop
            exitwhen i >= MAXPLAYERS
            if Player(i) == GetLocalPlayer() then
                if dialogDisplay[i] then
                    set trans = 0
                endif
            endif
            set i = i + 1
        endloop
        call CinematicFilterGenericBJ(0,BLEND_MODE_BLEND,"QuestBox.blp",0,0,0,100,100,100,100,trans)
    endfunction
     

    Code (vJASS):

    function UpdateQuestInfo takes Quest q returns nothing
        local integer i = 0
        call QuestSetEnabled(q.questInfo,false)
        loop
            exitwhen i >= MAXPLAYERS
            if Player(i) == GetLocalPlayer() then
                if q.stage[i] == QUEST_STAGE_ACTIVE or q.stage[i] == QUEST_STAGE_COMPLETE  then
                    call QuestSetEnabled(q.questInfo,true)
                    call QuestSetDescription(q.questInfo,Objectives2String.evaluate(q,i))
                endif
            endif
            set i = i + 1
        endloop
    endfunction
     

    Code (vJASS):

    private function ShowChestForPlayer takes unit chest, player p returns nothing
        if GetLocalPlayer() != p then
            call SetUnitScale(chest,0,0,0)
        endif
    endfunction
     

    Code (vJASS):

    function DropChestItem takes integer itemId, string name, real x, real y, rect r returns nothing
        local ItemType iT = GetItemTypeStruct(itemId)
        local ChestData c
        local unit hero
        local unit chest
        local integer i = 0
        local integer count = 0
        call GroupEnumUnitsInRange(G,x,y,LOOTRANGE,Condition(function CreditFilter))
        if r != null then
            call GroupEnumUnitsInRect(G2,r,Condition(function CreditFilter))
            loop
                set hero = FirstOfGroup(G2)
                exitwhen hero == null
                call GroupAddUnit(G,hero)
                call GroupRemoveUnit(G2,hero)
            endloop
        endif
        set count = CountUnitsInGroup(G)
        if count > 0 then
            set c = ChestData.create()
            loop
                set hero = FirstOfGroup(G)
                exitwhen hero == null
                set c.x = x+GetRandomReal(-75,75)
                set c.y = y+GetRandomReal(-75,75)
                set chest = CreateUnit(GetOwningPlayer(hero),CHESTID,c.x,c.y,270)
                set c.chests[GetPlayerId(GetOwningPlayer(hero))] = chest
                call SetUnitX(chest,c.x)
                call SetUnitY(chest,c.y)
                call ShowChestForPlayer(chest,GetOwningPlayer(hero))
                set Chests[GetUnitId(chest)] = c
                set i = 0
                loop
                    exitwhen i >= ITEMSLOTS
                    if iT.itemType == i then
                        call UnitAddAbility(chest,iT.abilId)
                    else
                        call UnitAddAbility(chest,EmptySlotAbil[i])
                    endif
                    set i = i + 1
                endloop
                call GroupRemoveUnit(G,hero)
            endloop
            set c.ticks = CHESTHP
            set c.rollText = CreateTextTag()
            call SetTextTagText(c.rollText,"-Roll-",0.024)
            call SetTextTagPos(c.rollText,c.x-32,c.y+60,0)
            set i = 0
            call SetTextTagVisibility(c.rollText,false)
            loop
                exitwhen i >= MAXPLAYERS
                if GetUnitTypeId(c.chests[i]) != 0 then
                    if GetLocalPlayer() == Player(i) then
                        call SetTextTagVisibility(c.rollText,true)
                    endif
                endif
                set i = i + 1
            endloop
            call SetTextTagPermanent(c.rollText,false)
            set c.itemId = itemId
            set c.name = name
            set c.chestCount = count
            call TT_StartEx(function ChestCore,c,1)
        endif
        set chest = null
    endfunction
     

    Code (vJASS):

        if GetLocalPlayer() == GetTriggerPlayer() then
            call PreloadGenClear()
            call PreloadGenStart()
           
            // The line below creates the log
            // Right now, this is:
            //      Hero: (hero name)
            //      Level: (hero level)
            //      Code: -load XXXX
            call Preload("\r\n\t\t\t\tHero: " + heroName + "\r\n\t\t\t\t" + "Level: " + I2S(heroLevel) + "\t\t\r\n\t\t\t\t" + "Code: -load " + SaveCode[her.pNum] + "\r\n\n\t\t    ")
           
            // The line below creates the file at the specified location
            // Right now, this is:
            //      "Warcraft III\Profligacy\(hero name) - (hero level)"
            call PreloadGenEnd("Profligacy\\0.21b\\" +  GetPlayerName(GetLocalPlayer()) + "-" + heroName + " - " + I2S(heroLevel) + ".txt")
            endif
     


    Those are all the get local player references. They play sounds, display images and text and change the scale of a chest as a hacky way to make it invisible for players that shouldn't see it (which I'm not sure even works). The last one is for the save to .txt system which can be disabled or removed without effecting the desync.
     
    Last edited: Sep 12, 2016
  16. Emm-A-

    Emm-A-

    Joined:
    Jul 1, 2008
    Messages:
    1,312
    Resources:
    0
    Resources:
    0
    hmm, does this create or destroy any handles?

    Code (vJASS):
    call QuestSetDescription(q.questInfo,Objectives2String.evaluate(q,i))
     
  17. pOke

    pOke

    Joined:
    Mar 24, 2013
    Messages:
    1,103
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Can you switch your tags to [/jass]?

    Code (vJASS):
    native QuestSetDescription takes quest whichQuest, string description returns nothing


    Appears to be no?
     
  18. Emm-A-

    Emm-A-

    Joined:
    Jul 1, 2008
    Messages:
    1,312
    Resources:
    0
    Resources:
    0
    sry p0ke I did not mean the native, I thought, maybe Objectives2String.evaluate(q,i) may do?
     
  19. pOke

    pOke

    Joined:
    Mar 24, 2013
    Messages:
    1,103
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Hmm. The I don't have much experience with .evaluate. Maybe take a read of this from the manual.

    JassHelper 0.A.0.0

    It talks about not using .evalute with any sync native. I'm not sure, but that might mean that GetLocalPlayer() calls cannot be used with .evaluate?
     
    Last edited: Sep 13, 2016
  20. Swan

    Swan

    Joined:
    Jan 13, 2013
    Messages:
    127
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Is turning off a trigger enough to prevent it from desyncing or would it have to be entirely deleted/rewritten? I could just turn off all the triggers and test for desyncs after that.