• 🏆 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!

Suddenly, server splits!

Status
Not open for further replies.
Level 7
Joined
Aug 31, 2006
Messages
132
Im not sure if it belongs here or trigger section buuuuut

As of late, a map I have been working on has started to randomly disconnect people I tested it with, sometimes as soon as 30 sec in the game. It has a number of custom skills coded with GUI and right now I wonder, what could possibly cause a server split in the first place.
 
Level 13
Joined
Jun 1, 2008
Messages
360
Did you use the GetLocalPlayer function?
This leads to desyncs if you don't use it the right way (see link).
Also:
Kitabatake said:
Using GetLocationZ to detect terrain height while/after making terrain deformations with either spells (shockwave/etc) or triggers can cause a multiplayer map to desync and have a server split during game.
Here is a list of crash and desync reasons.

€: Too late :)
 
Level 7
Joined
Aug 31, 2006
Messages
132
All the code is GUI, so I have no clue if I've used it.

Also, the problem is not crashing, but rather that people get disconnected at random/are desynched into a separate game.

The 2 abilities I suspect have to do with wait function, but they seem fine to me. (Periodic wait/WaitPolled)
 
Level 7
Joined
Jul 3, 2011
Messages
251
Waits will not cause desyncs, but you shouldn't use them anyway, they make spells non-MUI and they are unreliable. Look at the link kleinerhauck linked, the reason for the crash will most likely be there.
 
Level 8
Joined
Apr 26, 2011
Messages
403
  • Camera - Pan camera as necessary for Player 1 (Red) to (Center of (Playable map area)) over 0.50 seconds
That one is well known for server split . this function is design for single player, so never use it for multiple player game.

also, look for any of your GUI that have "for Player 1 (x)", and post full line in here, they may help you identify if that line cause server split.

sometime import vJASS library can cause server split for unknown reason, they will blame you for wait(x second) action .... but wait() is fine and never have problem before import vJASS. one example of those vJass is W3MMD
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
Only this one.

JASS:
function SmartCameraPanBJ takes player whichPlayer, location loc, real duration returns nothing
    local real dist
    if (GetLocalPlayer() == whichPlayer) then
        // Use only local code (no net traffic) within this block to avoid desyncs.

        set dist = DistanceBetweenPoints(loc, GetCameraTargetPositionLoc())
        if (dist >= bj_SMARTPAN_TRESHOLD_SNAP) then
            // If the user is too far away, snap the camera.
            call PanCameraToTimed(GetLocationX(loc), GetLocationY(loc), 0)
        elseif (dist >= bj_SMARTPAN_TRESHOLD_PAN) then
            // If the user is moderately close, pan the camera.
            call PanCameraToTimed(GetLocationX(loc), GetLocationY(loc), duration)
        else
            // User is close enough, so don't touch the camera.
        endif
    endif
endfunction

That's the jass code for it. It checks the distance in order to do different camera movements/not do them. But calculating the distance, it creates a location object by GetCameraTargetPositionLoc() in the local block, does not remove it again etc, desyncing the main handle stack which needs to be in sync.
 
Level 7
Joined
Aug 31, 2006
Messages
132
HungryBlade
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Hungry Blade
Actions
Unit - Create 1 Hungry Blade for (Owner of (Casting unit)) at ((Position of (Casting unit)) offset by 96.00 towards (Facing of (Casting unit)) degrees) facing Default building facing degrees
Unit - Order (Last created unit) to Move To ((Position of (Last created unit)) offset by 500.00 towards (Facing of (Casting unit)) degrees)
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
Wait until ((((Last created unit) is dead) Equal to True) or ((Number of units in (Units within 96.00 of (Position of (Last created unit)) matching ((((Owner of (Matching unit)) is an enemy of (Owner of (Last created unit))) Equal to True) and ((((Matching unit) is A st, checking every 0.10 seconds
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Last created unit) is dead) Equal to False
Then - Actions
Unit - Cause (Casting unit) to damage (Random unit from (Units within 96.00 of (Position of (Last created unit)) matching (((((Matching unit) is A structure) Equal to False) and (((Matching unit) is alive) Equal to True)) and (((Owner of (Matching unit)) is an enemy of (Owner of (Last created uni, dealing (85.00 x (Real((Level of Hungry Blade for (Casting unit))))) damage of attack type Chaos and damage type Normal
Unit - Set life of (Casting unit) to ((Life of (Casting unit)) + (85.00 x (Real((Level of Hungry Blade for (Casting unit))))))
Special Effect - Create a special effect at (Position of (Random unit from (Units within 96.00 of (Position of (Last created unit)) matching (((((Matching unit) is A structure) Equal to False) and (((Matching unit) is alive) Equal to True)) and (((Owner of (Matching unit)) is an enemy of (Owner of (Las using Objects\Spawnmodels\Human\HumanLargeDeathExplode\HumanLargeDeathExplode.mdl
Special Effect - Destroy (Last created special effect)
Unit - Remove (Last created unit) from the game
Else - Actions
Unit - Remove (Last created unit) from the game


I had my suspicion on this skill, since one of the games got split the moment it got cast, but since then games have been disconnected even if it was not used at all.
 
Level 7
Joined
Aug 31, 2006
Messages
132
Ok, after some more testing, the desynch happens right after any hero damages any creep for first time. Its always random as to who/how many players it desynchs and I have no clue what could be causing it.
 
JASS:
function SmartCameraPanBJ takes player whichPlayer, location loc, real duration returns nothing
    local real dist
    if (GetLocalPlayer() == whichPlayer) then
        // Use only local code (no net traffic) within this block to avoid desyncs.

        set dist = DistanceBetweenPoints(loc, GetCameraTargetPositionLoc())
        if (dist >= bj_SMARTPAN_TRESHOLD_SNAP) then
            // If the user is too far away, snap the camera.
            call PanCameraToTimed(GetLocationX(loc), GetLocationY(loc), 0)
        elseif (dist >= bj_SMARTPAN_TRESHOLD_PAN) then
            // If the user is moderately close, pan the camera.
            call PanCameraToTimed(GetLocationX(loc), GetLocationY(loc), duration)
        else
            // User is close enough, so don't touch the camera.
        endif
    endif
endfunction

Holy Shit! Blizzard did this?
The irony is that they called the function SmartCameraPanBJ :p
 
Level 7
Joined
Aug 31, 2006
Messages
132
It seems that whatever is causing this, takes "Unit takes damage" as an event. It may thus have to do with the 2-part scripts Im using to make some skills that require "Takes damage" on "Generic unit" event.

Basically. (Following is a skill, that if cast on an ally, nullifies damage it takes and transfers a part of it to Heavenly King hero)






GuardianOfTheNorthAdd
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Guardian of the North
Actions
Trigger - Add to GuardianOfTheNorthNullify <gen> the event (Unit - (Target unit of ability being cast) Takes damage)





GuardianOfTheNorthNullify
Events
Conditions
((Triggering unit) has buff Guardian of the North ) Equal to True
Actions
Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + (Damage taken))
Unit - Cause (Damage source) to damage Heavenly King 0035 <gen>, dealing ((Damage taken) x ((2.50 - (0.50 x (Real((Level of Guardian of the North for Heavenly King 0035 <gen>))))) / 3.00)) damage of attack type Chaos and damage type Normal

Could those sort of scripts be responsible?
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
Unprobable (maybe as an event to other triggers). If it always occurs in the mentioned scenario, I should be able to find it. Give map/version containing the problem please.

And consider that your event registration action is performed always the ability is cast and can be done several times for the same unit, triggering GuardianOfTheNorthNullify multiple times in a row.
 
Level 13
Joined
Jun 1, 2008
Messages
360
Ok, after some more testing, the desynch happens right after any hero damages any creep for first time. Its always random as to who/how many players it desynchs and I have no clue what could be causing it.

Then how about you post all triggers that refer to the "takes damage" event.

But there can be some reasons in the object editor too.
Did you use shift+click values for your hero?
What spells does he have?
Does it also happen with other units than your hero?
Does it also happen when you damage other units?
 
Level 7
Joined
Aug 31, 2006
Messages
132
  • DivineArmamentStart
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacking unit) has buff Divine Armament ) Equal to True
    • Actions
      • Trigger - Add to DivineArmamentMain <gen> the event (Unit - (Attacked unit) Takes damage)
  • DivineArmamentMain
    • Events
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • ((Damage source) has buff Divine Armament ) Equal to True
          • (Damage source) Equal to God of Weapons 0000 <gen>
          • (Current order of (Damage source)) Not equal to (Order(thunderbolt))
    • Actions
      • Unit - Remove Divine Armament buff from (Damage source)
  • IronMaiden
    • Events
      • Unit - Maiden Servo 0032 <gen> Takes damage
    • Conditions
      • (Level of Iron Maiden (2) for (Triggering unit)) Greater than 0
    • Actions
      • Unit - Cause (Triggering unit) to damage (Random unit from (Units owned by (Owner of (Damage source)) matching (((Matching unit) is A Hero) Equal to True))), dealing ((Damage taken) x (0.02 + (0.06 x (Real((Level of Iron Maiden for (Triggering unit))))))) damage of attack type Chaos and damage type Universal
  • DecrepifyAdd
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Decrepify
    • Actions
      • Trigger - Add to DecrepifyDamage <gen> the event (Unit - (Target unit of ability being cast) Takes damage)
  • DecrepifyDamage
    • Events
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • ((Triggering unit) has buff Decrepify ) Equal to True
          • (Owner of (Damage source)) Equal to (Owner of Time Lord 0033 <gen>)
          • (Damage source) Not equal to Dummeh 0036 <gen>
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Life of (Triggering unit)) Less than or equal to 2.00
        • Then - Actions
          • Unit - Cause Dummeh 0036 <gen> to damage (Triggering unit), dealing 1337.00 damage of attack type Chaos and damage type Universal
        • Else - Actions
          • Unit - Cause Dummeh 0036 <gen> to damage (Triggering unit), dealing ((Damage taken) x 0.10) damage of attack type Chaos and damage type Universal
  • GuardianOfTheNorthAdd
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Guardian of the North
    • Actions
      • Trigger - Add to GuardianOfTheNorthNullify <gen> the event (Unit - (Target unit of ability being cast) Takes damage)
  • GuardianOfTheNorthNullify
    • Events
    • Conditions
      • ((Triggering unit) has buff Guardian of the North ) Equal to True
    • Actions
      • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + (Damage taken))
      • Unit - Cause (Damage source) to damage Heavenly King 0035 <gen>, dealing ((Damage taken) x ((2.50 - (0.50 x (Real((Level of Guardian of the North for Heavenly King 0035 <gen>))))) / 3.00)) damage of attack type Chaos and damage type Normal
That's all of them.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Also, try to post triggers into a [HIDDEN=""] TRIGGERS [/HIDDEN] tag.

NOTE: Please, don't read me as a bad-ass idiot that tries to harm you or something. I'm just being 'realistic' I offer my help, if you want it. I think all the map makers have been in the place you're right now, at least once (I've been there a lot of times, and have had to rework all my triggers (about... 100/145) 4 or 5 times.

Ok... I see no reason to make a web of triggers working this way, adding events and else. BTW, using a Damage Detection System (like Weep's GUI friendly damage detection system) is WAY MORE BETTER (Use that or one of the other system. No one will ever help you doing something 'sofisticated' that involves 'damage' or 'Attacked unit' if you don't have a DSS).

If you want to run another trigger just use 'Run (Trigger <gen>)' :S... They way i see it... Rmk all those triggers in a more efficient way, trying to make the less quantity of trigger, with the major quality, less actions, using variables to handle units that are called more than three times, not adding Events to other triggers that are connect, but a simple 'If/Then/Else' or, as said before, 'Run Trigger <gen>'.

If you want, you can add me in Garena Messenger (Spartipilo) and I'll try to help you there; I don't like to work these stuff in forum.

You are using 7 Triggers, and you could be using... maybe 3 or 4...

Btw... i'm wondering if there are more "systems" working this way... xD
 
Level 13
Joined
Jun 1, 2008
Messages
360
I see no problem except: (Random unit from (Units owned by (Owner of (Damage source)).
This leaks a unit group.

If you have many leaks like this (especially in periodic triggers) people with lower RAM may drop from the game/get serious lags.
So look through the linked tutorial and remove your leaks.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
Have broken it quite down, yet no final result (problem does not occur monotonously and seems to be removed from a few places). I do not have the time now nor the original version (cannot download a valid file from mediafire atm), so you may test yourself. It's not trigger related. The suspicious place I currently see is the relative high amount of damage dices your heroes possess.

In the test map, I use to move the spellbreaker rightwards and attack the runner. Problem may occur in like 70% of the cases.
 

Attachments

  • UFFAoS_2.w3x
    57.4 KB · Views: 25
Level 7
Joined
Aug 31, 2006
Messages
132
I think reducing hero damage dice has solved the problem. Im not very sure, but sofar no desynchs for last 5 games.

Still noticed that using 2 scripts for damage detection made them cumulate as you said. Will replace.
 
Status
Not open for further replies.
Top