• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Desyncs 15 minutes into game

Status
Not open for further replies.
Level 4
Joined
Jul 24, 2008
Messages
108
Ok, hey everyone again. After i keep changing my map to attempt to fix desyncs and leaks, they keep appearing. So, i assume this usually happens with repeating triggers and I do not see any leaks here. I have narrowed it down to these few repeating triggers, however i still do not see any sources of leaks. Could someone take a qquick look at point out leaks?

JASS:
function TrueFilter takes nothing returns boolean
    return GetUnitTypeId(GetFilterUnit()) != 'eC06' //Jail unit
endfunction

function RunnerFilter takes nothing returns boolean
    return GetUnitTypeId(GetFilterUnit()) == 'uC01' //runner
endfunction


function PlayerFilter takes player whichPlayer returns group
    local group g = CreateGroup()
    call GroupEnumUnitsOfPlayer(g, whichPlayer, Filter(function RunnerFilter))
    return g
endfunction

function kodoattacktarget takes nothing returns nothing
    local group g = CreateGroup()
    local group g2 = CreateGroup()
    local integer i
    local unit u
    local unit r
    local group t
    call GroupEnumUnitsOfPlayer(g,Player(10),Filter(function TrueFilter))
    loop
        set u = FirstOfGroup(g)
        exitwhen u == null
        loop
            set i = GetRandomInt(0,9)
            set t = PlayerFilter(Player(i))
            if CountUnitsInGroup(t) == 1 then
//repeats loop until player has an active runner, avoid having kodos attack a player with no units
                exitwhen IsPlayerSlotState(Player(i),PLAYER_SLOT_STATE_PLAYING)
            else

            endif

        endloop
        call GroupEnumUnitsOfPlayer(g2,Player(i),Filter(function TrueFilter))
        set r = GroupPickRandomUnit(g2)
        call IssuePointOrder(u,"attack",GetUnitX(r),GetUnitY(r))
//        call PingMinimap(GetUnitX(r),GetUnitY(r),1)
        call GroupRemoveUnit(g,u)
    endloop
    call DestroyGroup(g)
    call DestroyGroup(g2)
    set r = null
    set g = null
    set g2 = null
endfunction

function InitTrig_attacktrig takes nothing returns nothing
    set gg_trg_attacktrig = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( gg_trg_attacktrig, 21.00 )
    call TriggerAddAction( gg_trg_attacktrig, function kodoattacktarget )
endfunction
I'm pretty sure this is leak free and doesn't cause desyncs but im not to sure about the filter and create group(t) part.

JASS:
function checkifunit takes nothing returns boolean
return IsUnitOwnedByPlayer (GetEnteringUnit() , Player(10)  )
endfunction

function InitTrig_removejail takes nothing returns nothing
    set gg_trg_removejail = CreateTrigger()
    call TriggerRegisterEnterRectSimple( gg_trg_removejail, Rect(-1200.00, -800.00, 700.00, 700.00) )
    call TriggerAddCondition(gg_trg_removejail, Condition(function checkifunit))
    call TriggerAddAction(gg_trg_removejail, function kodoattacktargetwithtimer)

endfunction
basically just runs the above function with an alternate event. Again, i do not see any sources of leaks

  • unitdiesremove
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Wait 0.75 seconds
      • Unit - Remove (Dying unit) from the game
I do not think this causes leaks either nor does it happen enough to cause problems. Only a few hundred times per game.

  • Rescue
    • Events
      • Unit - A unit enters Jail <gen>
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Runner
      • (Number of units in (Units of type Flag)) Not equal to 0
    • Actions
      • Trigger - Turn off (This trigger)
      • Player - Set (Owner of (Triggering unit)) Current gold to (((Owner of (Triggering unit)) Current gold) + (50 x (Number of units in (Units of type Flag))))
      • Game - Display to (All players) the text: ((Name of (Owner of (Triggering unit))) + ((( received + ((String(((Number of units in (Units of type Flag)) x 50))) + gold for rescuing )) + (String((Number of units in (Units of type Flag))))) + player(s) from jail!!!))
      • Set playercreate = (All players matching ((Number of units in (Units owned by (Matching player) of type Flag)) Equal to 1))
      • Player Group - Pick every player in playercreate and do (Actions)
        • Loop - Actions
          • Set rescuepoint = (Random point in Runners Start <gen>)
          • Unit - Create 1 Runner for (Picked player) at rescuepoint facing Default building facing degrees
          • Camera - Pan camera for (Picked player) to rescuepoint over 0.00 seconds
          • Custom script: call RemoveLocation (udg_rescuepoint)
      • Custom script: call DestroyForce (udg_playercreate)
      • Set flaggroup = (Units of type Flag)
      • Unit Group - Pick every unit in flaggroup and do (Unit - Remove (Picked unit) from the game)
      • Custom script: call DestroyGroup (udg_flaggroup)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • lastperson Equal to True
        • Then - Actions
          • Trigger - Turn off last one left <gen>
          • Sound - Stop Doom <gen> After fading
          • Sound - Play music <gen>
          • Set lastperson = False
        • Else - Actions
      • Sound - Play escape <gen>
      • Trigger - Turn on (This trigger)
I destroyed every group, so the leaks shouldn't be hear, even then, this trigger only happens under 20 times a game. I wouldnt think this would be enough to cause problems even if it did leak.

These are the only triggers that happen quite often and I do not believe any of them leak. I noticed that leaks seem to happen faster with more players. I would be super greatful for anyone to help me stop these leaks, I've been having troulbe with this for the last few weeks
 
Level 3
Joined
Jul 20, 2008
Messages
41
Even with the leaks I dont think it should desync:/ Most times its LocalPlayer that does it
 
Level 4
Joined
Jul 24, 2008
Messages
108
Is LocalPlayer only using JASS? If it is, i'm not using LocalPlayer. I cannot think of anything that would cause a desync then.
Can custom models desync?
This is really pissing me off, Its been happening to much :(
It seems like that in a 10 player map, 3 people till leave at the same time, into their own server, then over the next minute several others get disconnected in groups of 2 until there is only 2 or 3 people left in my server. Then we end up loosing.

How would you all suggest finding the cause of desyncs?
 
As the very first action in EVERY trigger (not just those you suspect) type the JASS "call BJDebugMsg("<trigger name>") then whenever a trigger runs you can see which one is running. When it desynchs, the last trigger to run is the one that caused the desynch. When you have found which trigger causes the desynch, post that trigger here and we should be able to resolve your problem.
 
Level 4
Joined
Jul 24, 2008
Messages
108
As the very first action in EVERY trigger (not just those you suspect) type the JASS "call BJDebugMsg("<trigger name>") then whenever a trigger runs you can see which one is running. When it desynchs, the last trigger to run is the one that caused the desynch. When you have found which trigger causes the desynch, post that trigger here and we should be able to resolve your problem.


  • Flag
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Triggering unit)) Not equal to Player 11 (Dark Green)
      • (Owner of (Triggering unit)) Not equal to Player 12 (Brown)
      • (Unit-type of (Triggering unit)) Equal to Runner
    • Actions
      • Custom script: call DisplayTimedTextToPlayer(Player(0),0,0,60,"Flag")
      • Set deathgroup = (Units owned by (Owner of (Triggering unit)))
      • Unit Group - Pick every unit in deathgroup and do (Unit - Kill (Picked unit))
      • Custom script: call DestroyGroup (udg_deathgroup)
      • Set temppoint = (Random point in Flag <gen>)
      • Unit - Create 1 Flag for (Owner of (Triggering unit)) at temppoint facing Default building facing degrees
      • Game - Display to (Player group((Owner of (Triggering unit)))) the text: |c00cc3399You died!
      • Camera - Pan camera for (Owner of (Triggering unit)) to temppoint over 0.00 seconds
      • Custom script: call RemoveLocation (udg_temppoint)
      • Game - Display to (All allies of (Player((Player number of (Triggering player))))) the text: (((Name of (Player((Player number of (Triggering player))))) + has been captured. ) + (Jail bonus at + ((String(((Number of units in (Units of type Flag)) x 50))) + gold!)))
this is the last trigger before a guy got disconnected. It seems desyncs dont happen all to often, but disconnects happen a lot more often, and now that i think of it they all seem to happen shortly after someone dies
 
Level 4
Joined
Jul 24, 2008
Messages
108
so
  • Game - Display to (Player group((Owner of (Triggering unit)))) the text: |c00cc3399You died!
this causes a desync too?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Camera - Pan camera for (Picked player) to rescuepoint over 0.00 seconds

Some camera actions are split prone.

Leaks never cause desyncs, only unsafe code or code that causes some important value to lose sync does. Such code is over abuse of GetLocalPlayer() resulting in handle values or important objects losing consistacy (where a player has a different handle value for the same object or a different combat result) which could cause problems. Also anything that causes net traffic can cause an out of sync if it fails to syncronise which may occur on a computer to computer bases (some are more prone than others).

Check if others hosts suffer the same problem, if so then its triggers. If its just you or seldomly then its caused by triggers being incomplatable with your computer or other PCs (like being unable to process the trigger fast enough or a file is curropt).
 
Level 4
Joined
Jul 24, 2008
Messages
108
It also happens when the rescue trigger goes off, happened in 26 seconds of the game 3 people dced half a second after it went off. Trigger is in my origenal post, i turned off the pan camera too but it still happens
 
Level 4
Joined
Jul 24, 2008
Messages
108
Sorry for double post but, to solve this i decided to recode the entire jail capturing and rescueing to avoid using the GetLocalPlayer() in the text display, so here is my JASS version of the captured, it works, but some reason loops a few hundred times and locks my computer up 15 seconds when it procs.

JASS:
function filterunit takes nothing returns boolean
    return GetUnitTypeId(GetFilterUnit()) == 'uC01' //Jail unit 
endfunction

function death takes nothing returns nothing
    local group g = CreateGroup()
    local unit u
    local integer i
    local player p = GetOwningPlayer(GetDyingUnit())
    local integer goldbonus
    set g = GetUnitsOfPlayerAll(p)
    loop
        set u = FirstOfGroup(g)
        exitwhen u == null
        call RemoveUnit(u)
        call GroupRemoveUnit(g, u)
    endloop
    call CreateUnit(p,'eC06',-500.,-100.,0.)
    set udg_jailcount = ( udg_jailcount + 1 ) 
    set goldbonus = (50 * udg_jailcount)
    call DisplayTextToPlayer(p, 0,0,"|c00cc3399You died!")
    loop
        set i = 0
        exitwhen i == 11
        call DisplayTextToPlayer(Player(i), 0,0, GetPlayerName(p) + " has been captured. Jail Bonus at " + I2S(goldbonus))
        set i = (i + 1)
    endloop
    call DestroyGroup(g)
    set g = null
    set u = null
    set p = null
endfunction

function InitTrig_deathtrig takes nothing returns nothing
    set gg_trg_deathtrig = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_deathtrig, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition(gg_trg_deathtrig, Condition(function filterunit))
    call TriggerAddAction(gg_trg_deathtrig, function death)
endfunction
what happens is the text

call DisplayTextToPlayer(Player(i), 0,0, GetPlayerName(p) + " has been captured. Jail Bonus at " + I2S(goldbonus))

This repeats a few hundred times, it doesn't make sence since it should only happen 10 times
 
Level 4
Joined
Jul 24, 2008
Messages
108
You set i = 0 INSIDE the loop... lmao it should be outside thats why :grin:

EDIT: and if you want it to loop ten times, use exitwhen i >= 10, not 11

omg!!! im sooo stupid, its so obvious....+rep to you for quick answer at 4 in the morning....god i shouoldnt code this late at night...
 
Level 4
Joined
Jul 24, 2008
Messages
108
I have tested my map several times and I think the server desyns are gone! Just had to rewrite my main triggers in jass. Another question has arised tho, are server desyns and player disconnections the same thing? or caused by the same thing? I've had several people loose connection throughout the 2-3 games ive played with the fixed version.
 
Level 10
Joined
Jun 26, 2005
Messages
236
Well, it depends. If it's just one person, no. If 4 or so people disconnect at the same time, it's referred to as a "server split".
 
Level 4
Joined
Jul 24, 2008
Messages
108
server split and desyncs are the same thing right? So is having one player disconnect their fault with their connection, or is it my connection? I'll be super happy to hear that it's not my maps fault for disconnecting them. :)
 
Level 11
Joined
Feb 18, 2004
Messages
394
server split and desyncs are the same thing right? So is having one player disconnect their fault with their connection, or is it my connection? I'll be super happy to hear that it's not my maps fault for disconnecting them. :)
One player disconnecting may or may not be a map's problem. The complexities of sync in WC3 are numerous.

Server split is not desync. Server split is where the host of a game leaves or disconnects, and multiple new hosts are selected. (Essentially splitting the game in to multiple games, sometimes to the extent of each player becoming their own host) It's a rare phenomenon that isn't easy to consistently recreate. (I've tried, believe me...)
 
Level 10
Joined
Jun 26, 2005
Messages
236
Server split is where the host of a game leaves or disconnects, and multiple new hosts are selected.

If it's the host that leaves/disconnects, how come in certain maps the host doesn't leave/disconnect but half of the maps players do (and those players are rejected into a game with a different host)?
 
Level 11
Joined
Feb 18, 2004
Messages
394
.. Ok, time for a more in-depth explanation.

Every game has one host. The host basically acts as the game server. Players connect to the host, and all is good.

Two things can go wrong:
- One player says a value is x, another says it is y. It seems the host is considered authoritative in the relationship, so anyone who's data doesn't match that of the host gets kicked out of the game by the host. This is desync. GetLocalPlayer() is essentially a controlled form of desync, as the value is different for each and every player. Note that not all values in a map's script are synced. For instance, camera position isn't synced, fog colour isn't synced, etc, etc.

- The host can emo quit the game, or disconnect. In this case, it seems the game will automagically select a new host, and the game will generally continue. This won't happen if everyone in the game is firewalled, as then no one can act as the host, and thus there is no server, and thus no game. Sometimes, it seems the automated host selection routine fucks up. God only knows why. Occasionally, more than one player is selected as the new host. Players split off to go with one or the other, or just completely disconnect from the cluster-fuck. This is a server split: Where one game, on one host, acting as one server, splits in to multiple games, on multiple hosts, acting as multiple servers.
 
Level 5
Joined
Jan 15, 2007
Messages
199
- The host can emo quit the game, or disconnect. In this case, it seems the game will automagically select a new host, and the game will generally continue. This won't happen if everyone in the game is firewalled, as then no one can act as the host, and thus there is no server, and thus no game. Sometimes, it seems the automated host selection routine fucks up. God only knows why. Occasionally, more than one player is selected as the new host. Players split off to go with one or the other, or just completely disconnect from the cluster-fuck. This is a server split: Where one game, on one host, acting as one server, splits in to multiple games, on multiple hosts, acting as multiple servers.

The host doesn't have to leave/drop/get disconnected/whatever for a server split to occur.
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
Well have been through many times that a server split occured, while I still was the host with 3 other people, and the next 3 people was split to another host in-game.
Somehow I feel that this is related to desyncs since I cleared up some of the triggers in the map, and it stopped splitting
 
Level 4
Joined
Jul 24, 2008
Messages
108
Ok, heres my problem now, i know for a fact that a certain trigger has a chance to disconnect players. anywhere from 0-3 people during the course of the game get disconnected after this trigger happens. (only 1 person per trigger tho, it happens multiple times). This is what happens when a player dies

JASS:
function isrunner takes nothing returns boolean
    return GetUnitTypeId(GetTriggerUnit()) == 'uC01'  //runner
endfunction


//================Death Function===========================
function death takes nothing returns nothing
    local group g = CreateGroup()
    local unit u
    local integer i
    local player p = GetOwningPlayer(GetDyingUnit())
    local integer goldbonus
    
    set g = GetUnitsOfPlayerAll(p)
    loop
        set u = FirstOfGroup(g)
        exitwhen u == null
        call GroupRemoveUnit(g, u)
        call RemoveUnit(u)
    endloop
    
    call CreateUnit(p,'eC06',-500.,-100.,0.)
    set udg_jailcount = ( udg_jailcount + 1 ) 
    set goldbonus = (50 * udg_jailcount)
    call DisplayTextToPlayer(p, 0,0,"|c00cc3399You died!")
    set i = 0
    loop
        exitwhen i == 10
        call DisplayTextToPlayer(Player(i), 0,0, GetPlayerName(p) + " has been captured. Jail Bonus at " + I2S(goldbonus))
        set i = (i + 1)
    endloop
    call DestroyGroup(g)
    set g = null
    set u = null 
    set p = null
endfunction
//=====END DEATH FUNCTION========================

function InitTrig_deathtrig takes nothing returns nothing
    set gg_trg_deathtrig = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_deathtrig, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition(gg_trg_deathtrig, Condition(function isrunner))
    call TriggerAddAction(gg_trg_deathtrig, function death)
endfunction

It doesn't alwayts happen but it seems like a 1-2% chance on happening per death. I'm really at a loss now :( unless does banlist ever mistake leavlers for disconnects?
 
Status
Not open for further replies.
Top