• 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.

[Crash] Map crashes when the not-host player picks hero

Status
Not open for further replies.
Level 15
Joined
Nov 28, 2009
Messages
1,538
I am creating an adventure/hero arena map where you need to pick heroes from a tavern. You can play the map with 4 players, when alone you can pick 4 heroes, 2 players 2 heroes and 4 players each 1 hero.

So me and my friend were trying to test the map (so 2 players 2 heroes). We tested the map many times before and suddenly it crashes the not-host player when he picks his last hero (I tested around the triggers, its always the last hero that is picked that crashes the game for him). The player gets "Disconnected" while having internet just perfect.

Appearantly this is the trigger that causes it. When disabled, it doesn't crash (but the camera will be forever on the taverns and not on the hero spawn). You might want to know that I use food for each hero 1, and the max food depens on the player count (what I mentioned earlier).

So could anyone help me please :(

  • Hero Pick Count
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • ((Entering unit) is A Hero) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Entering unit)) Food used) Equal to ((Owner of (Entering unit)) Food cap)
        • Then - Actions
          • Selection - Select (Units owned by (Owner of (Triggering unit)) matching (((Matching unit) is A Hero) Equal to True)) for (Owner of (Triggering unit))
          • Camera - Set (Owner of (Entering unit))'s camera Distance to target to 2000.00 over 0.00 seconds
          • Camera - Set the camera bounds for (Owner of (Entering unit)) to NextWingVision
          • Camera - Pan camera for (Owner of (Entering unit)) to (Center of NextWing) over 0.00 seconds
          • Unit Group - Pick every unit in (Units owned by (Owner of (Entering unit)) of type Hero Pick) and do (Actions)
            • Loop - Actions
              • Unit - Remove (Picked unit) from the game
        • Else - Actions
          • Game - Display to (All players matching ((Owner of (Entering unit)) Equal to (Matching player))) for 5.00 seconds the text: |cff00BFFF- Hint - ...
 
Last edited:
I might not help but here are a few efficiency tricks.
(Owner of Triggering/Entering Unit) -> Triggering Player; (Entering Unit) -> Triggering Unit.

Use
JASS:
set bj_wantDestroyGroup = true
right before the group pick where you remove Hero Pickers.

  • Selection - Select (Units owned by (Owner of (Triggering unit)) matching (((Matching unit) is A Hero) Equal to True)) for (Owner of (Triggering unit))
->
Selection - Select (Triggering Unit) for (Player)

Display to (All players matching ((Owner of (Entering unit))
->
Set TempPlayerGroup = PlayerGroup(Player)
Display to TempPlayerGroup ...
JASS:
call DestroyForce(udg_TempPlayerGroup)

Lastly, cache Triggering Player into a temp player variable since it is used more than twice. Null it afterwards.
 
(Owner of Triggering/Entering Unit) -> Triggering Player; (Entering Unit) -> Triggering Unit.
Actually TriggeringPlayer doesn't work for the event "A Unit Enters Region", so he is doing fine here.

Lastly, cache Triggering Player into a temp player variable since it is used more than twice. Null it afterwards.
Player variables are not needed to null in any case, they will never be destroyed.
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
Game crashes when last hero is picked, or when a non-host player picks a hero?

Also when you are saying "crashes the game for him", does only his game close without an error or he disconnects from game?
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
the non host players are crashing when the pick their last hero, that means all user players that dont host the match.

By "crashing", you mean their game is closed completely or they just dropped/disconnected from your game and still in warcraft?
 
Level 15
Joined
Nov 28, 2009
Messages
1,538
Makes no sense since the host runs a client identical to all others.

Are the clients all Windows version of WC3? Are they all playing with maximum visual settings? Are you playing with maximum visual settings?

We all use Windows versions on our Windows 7 computers, and I think we play both on maximum settings but I am not sure.

By "crashing", you mean their game is closed completely or they just dropped/disconnected from your game and still in warcraft?

Warcraft shuts down and you land on the desktop, with no warning.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,255
What if they host and you join? Do you crash and the host still does not? Is the host always a specific slot? Try different slots?

Try disabling the camera actions to see if it still crashed. Try disabling random actions until you find the one causing the crash.
 
Level 15
Joined
Nov 28, 2009
Messages
1,538
Okay I've testing this shit again, disabling trigger by trigger and nothing seems to work. But when I disable the trigger it doesn't crash or lag (it lags seconds before crashing).

also I lied a little, it doesn't go to my desktop without a warning. It just leaves the match with the match "Disconnected" sorry bro's, my memory failed me :'(

*changed the discription*
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,255
(it lags seconds before crashing).
That is because you choose a hero with assets that were not pre-loaded. The game is forced to drop frames while the assets are loaded.

A disconnect is due to out of sync error. Two clients end up with different results so their sessions diverge. This usually happens by introducing a source of non-determinism into the deterministic state of the game (one client does one thing, another something else).

The host client almost never disconnects as the game usually picks his state as the actual results and any divergents are dropped (you have been disconnected error).

This is not a crash, it is perfectly possible for clients to continue playing well after an out of sync error occurred as long as some host supports them. Some robots do this and other times a new host can be established by the game divergent game clients.
 
Level 15
Joined
Nov 28, 2009
Messages
1,538
That is because you choose a hero with assets that were not pre-loaded. The game is forced to drop frames while the assets are loaded.

A disconnect is due to out of sync error. Two clients end up with different results so their sessions diverge. This usually happens by introducing a source of non-determinism into the deterministic state of the game (one client does one thing, another something else).

The host client almost never disconnects as the game usually picks his state as the actual results and any divergents are dropped (you have been disconnected error).

This is not a crash, it is perfectly possible for clients to continue playing well after an out of sync error occurred as long as some host supports them. Some robots do this and other times a new host can be established by the game divergent game clients.

So how can I fix this?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,255
So how can I fix this?
By doing what I told you several days ago at post #7 that you seemed to have ignored?

There is a chance one of those camera pan actions is causing a out of sync split. I forget which one does it but it is a notorious problem that has plagued hundreds of map makers of they years.
Seeing how this turned out to be exactly the problem it sounds like a good thing to look into. Someone recently even emphasised this...

So it is caused by desynchronizing the game state. Try to remove the camera things and see if it crashes again

Specifically if you are using "Smart Camera Pan".
JASS:
function SmartCameraPanBJ takes player whichPlayer,location loc,real duration returns nothing
    local real dist
    if (GetLocalPlayer() == whichPlayer) then
        set dist = DistanceBetweenPoints(loc, GetCameraTargetPositionLoc())
        if (dist >= bj_SMARTPAN_TRESHOLD_SNAP) then
            call PanCameraToTimed(GetLocationX(loc), GetLocationY(loc), 0)
        elseif (dist >= bj_SMARTPAN_TRESHOLD_PAN) then
            call PanCameraToTimed(GetLocationX(loc), GetLocationY(loc), duration)
        else
        endif
    endif
endfunction
This BJ creates a non-deterministic location on the specified client player and leaks it, which will obviously mess up the deterministic state of the game. The distance should have been captured in a local in the deterministic part of the function while the value used in the non-deterministic part. This is another of the thousands of bugs WC3 has to annoy poor map makers with.

The solutions are simple. Either write your own version of the function and use that (you could outsource the non-deterministic part to other BJs or use a custom JASS version where the bug and leak are fixed) or you can just not use the function and instead hard-code either a long distant jump or a short distant pan.
 
Level 15
Joined
Nov 28, 2009
Messages
1,538
By doing what I told you several days ago at post #7 that you seemed to have ignored?


Seeing how this turned out to be exactly the problem it sounds like a good thing to look into. Someone recently even emphasised this...

Told you that I messed with the triggers and deleted them one by one, also the camera pan action and it still 'crashed'. But I am now gonna check your advice and see if it helps.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,255
Is it crashing or just falling out of sync? A crash is when you get ejected to the desktop usually with a error message where as an out of sync error will cause clients to disconnect from the host or robots to mention that an out of sync error has occurred.

Told you that I messed with the triggers and deleted them one by one, also the camera pan action and it still 'crashed'. But I am now gonna check your advice and see if it helps.
But when I disable the trigger it doesn't crash or lag (it lags seconds before crashing).
also I lied a little, it doesn't go to my desktop without a warning. It just leaves the match with the match "Disconnected" sorry bro's, my memory failed me :'(
This is all very contradictory stuff... You said you disabled the trigger and it was fixed yet now you are saying that deleting all actions inside the trigger makes no difference at all.
 
Level 15
Joined
Nov 28, 2009
Messages
1,538
Is it crashing or just falling out of sync? A crash is when you get ejected to the desktop usually with a error message where as an out of sync error will cause clients to disconnect from the host or robots to mention that an out of sync error has occurred.




This is all very contradictory stuff... You said you disabled the trigger and it was fixed yet now you are saying that deleting all actions inside the trigger makes no difference at all.

I meant to say, deleting the triggers one by one. To see what trigger causes it, but trying this it still disconnects all the times but didn't try a few stuff out cuz I had some other stuff to do.
 
Status
Not open for further replies.
Top