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

Desync problem

Status
Not open for further replies.
I have no idea what is going on but for some reason every time I host my map at the very beginning it says everyone left the game. I assume it is a desync problem but I do not know much about them. What causes them? I have been disabling and editing triggers like mad but it still kicks everyone out in the beginning and tells them they have been disconnected. Is it my hosting, or something wrong with my map?
 

Attachments

  • OutpostOnslaught.w3x
    1 MB · Views: 55
The most common cause of disconnections in maps is GetLocalPlayer() and infinite loops. If it always does it initially, check for the triggers that run on map loading and as it begins. For infinite loops, make sure that you don't accidentally have functions that will trigger the event of that same trigger, or a loop where it doesn't reach it's condition to stop looping.

For GetLocalPlayer(), look for all functions that associate with it. I think if you have TESH (comes with JNGP), you can use the "find" tool to search for those functions. It's useful for debugging. Basically, if you create/destroy handles, have first usage of a string, assign a new random seed, a "Wait (or TriggerSleepAction)" function, change the gameplay (such as changing a unit's position or his move speed etc.), or generally anything along those lines, it will most likely cause a disconnection if it is in a "GetLocalPlayer()" block. Check those functions and hopefully you'll find a solution. If I get time later on, I'll try to check it as well.

Good luck. =D

EDIT:

I found this in your initialize function:
  • Camera - Pan camera as necessary for (Picked player) to (Position of (Last replaced unit)) over 0.00 seconds
I remember this function to be a very desync-associated function. Try to replace this function with a work around and hopefully your disconnections will be fixed.
 
Level 22
Joined
Dec 31, 2006
Messages
2,216
WhiteTrashBoy, don't spam please.

As for the map, you got some leaks, but I doubt that can kick them all at the beginning.
Things like (Position of (Last replaced unit)) or (Position of (Triggering unit)) leaks.
As for the camera thing, I don't think that is what's causing it. It does use GetLocalPlayer(), but in a safe way. Here's the definition for that function:
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
 
Last edited:
Hmm, kinda weird it was the camera, but at least it works now :D

Yeah, it is a weird function. Blizzard uses it properly, but there is something about it in multiplayer that causes desyncs. I haven't tested it to see what actually causes it, but I remember this one old map that I played which would disconnect all the time because it used that function constantly. After I removed it, it fixed the disconnects.
 
Level 22
Joined
Dec 31, 2006
Messages
2,216
Ye, it's really weird it desyncs. They putted this comment:
// Use only local code (no net traffic) within this block to avoid desyncs. inside it.
I think they have failed since it obviously desyncs.
 
Status
Not open for further replies.
Top