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

[Solved] Desync & Weird unit behaviour

Status
Not open for further replies.

SpasMaster

Hosted Project: SC
Level 23
Joined
Jan 29, 2010
Messages
1,969
Hello, Hive!

As I was working on the newest version of Sunken City I tried to do a test and something very weird happened.

In multiplayer people got disconnected almost immediately after the game has started with units that attempt to move acting very weird.
I launched the game in singleplayer and I have this video here that would best describe this...


So, umm... does anyone know what the hell is going on?
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
Well, no doubt a trigger of some kind is the issue.

It sort of looked like the Peon and Grom's PropWindow were set to 0, meaning they were pseudo rooted.

As for what is causing the moving in seemingly random directions and distances, I again assume something that shouldn't be affecting these units is.
 

SpasMaster

Hosted Project: SC
Level 23
Joined
Jan 29, 2010
Messages
1,969
It sort of looked like the Peon and Grom's PropWindow were set to 0, meaning they were pseudo rooted.
Grom was randomly selected in the video, no specific changes were made to him. Any other hero would react the same way. And no, I did not mess with the unit's values in the object editor.
big map pathing problem comes to my mind or maybe huge amount of units blocking movement?
Sure, if caused by a trigger. My first thought was a huge amount of invisible units, but it seems not to be the issue, because I immidiately made a test after discovering this bug - I picked all units in that region and displayed their names. There was nothing out of the ordinary.
Keep in mind that the map was running just fine the day before, which means that if "big map pathing problem" was the issue, then it would've been like that for a long time.
As a test, disable/delete all triggers (in a backup map so it can be reverted!) and see if the issue still persists. This will pin the cause as either with the terrain pathing, or with triggers.
After deleting all triggers, the issue was gone.
I did also check for triggers with broken events/conditions, they tend to mess things like that. There are none.

Now that the issue is most likely trigger related (tho I am not entirely sure what I could have done since the last time I played without the problem that could cause such a bug) how can I narrow it down considering I have ~900 triggers and map loading time is... too long for me to test each trigger 1 by 1?
 
Level 13
Joined
Nov 7, 2014
Messages
571
how can I narrow it down considering I have ~900 triggers and map loading time is... too long for me to test each trigger 1 by 1?

Because the problem seems to be that units are moved incorrectly if you are using GUI you can go to the Object Manager (F11) then open the Functions tab, then the Actions directory and then after finding it open the action "Unit - Move Unit (Instantly)" or one of the other move unit functions, this should show you all the triggers that use that action. You could also try to narrow it down by using the "Time - Periodic Event" because it seemed like the unit movement problem happens continuously.

If you are not using GUI I guess you can dump the map script via "File/Export Script..." and using a text search program find all the calls to the natives SetUnitX|Y, SetUnitPosition, SetUnitPositionLoc, SetUnitPositionLocFacingBJ and SetUnitPositionLocFacingLocBJ.
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
Now that the issue is most likely trigger related (tho I am not entirely sure what I could have done since the last time I played without the problem that could cause such a bug) how can I narrow it down considering I have ~900 triggers and map loading time is... too long for me to test each trigger 1 by 1?
I would seperate the triggers into folders. Delete a handful of folders until you find the issue again. Continue to seperate them into sections until you narrow it down to something easy to work with, then go 1 by 1. It's going to take a lot of time, but the sooner you start, the faster you can fix the issue.
 
Level 18
Joined
Nov 21, 2012
Messages
835
besides SetUnitPosition Aniki posted, you can make fast test for IssueOrder, here is the code
  • checkOrder
    • Events
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Unit-type of (Ordered unit)) Equal to Blademaster
    • Actions
      • Custom script: local integer h = GetHandleId(GetTriggerEventId())
      • Custom script: local integer ord = GetIssuedOrderId()
      • Custom script: if h==38 then
      • Custom script: call DisplayTextToPlayer(GetLocalPlayer(), 0.00, 0.00, "instant " + I2S(ord) + ", " + OrderId2StringBJ(ord))
      • Custom script: elseif h==39 then
      • Custom script: call DisplayTextToPlayer(GetLocalPlayer(), 0.00, 0.00, "point " + I2S(ord) + ", " + OrderId2StringBJ(ord))
      • Custom script: elseif h==40 then
      • Custom script: call DisplayTextToPlayer(GetLocalPlayer(), 0.00, 0.00, "target " + I2S(ord) + ", " + OrderId2StringBJ(ord))
      • Custom script: endif
you can see if there are unwanted orders on Grom and then you may search for related triggers
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
Someone recently reported that too many "unit enters region" events can result in stupid and erratic unit movement. In his case it was units would literally walk into walls and hug edges instead of taking a reasonably logical path. It is possible that your case is so extreme the units just bug out entirely, although the symptoms to seem very different.

Disable triggers in batches as KILLCIDE suggested. A good place to start is to delete all custom abilities, just leaving the core game triggers. Especially if imported custom abilities are used it is possible some of them have bugs or interact with each other. The more triggers you rule out, the easier it becomes to find. As a rough guess it might involve an issued order event. Do remember to backup the map first, once the problematic trigger is identified you can go back to the backup without losing all other triggers.
 

SpasMaster

Hosted Project: SC
Level 23
Joined
Jan 29, 2010
Messages
1,969
Someone recently reported that too many "unit enters region" events can result in stupid and erratic unit movement.
As soon as I read this, I immediately knew this was the issue, because the main changes I've been doing since the last game before the one that caused the issue, were triggers with that event. I initially counted them out since they are in no way related to unit movement, but as you report, it seems to have been problematic to others.

Well, guess what? I deleted all the recent triggers I added that have that event (~10 of them) and the issue is gone.
Now, my triggers were using "A unit enters (Playable map area)". I do not know if the issue would still happen if a specific region is selected, but it very well might.

As a solution to my problem, I will try to merge triggers that use this event to reduce their count. I will update if any other issues come up.

+rep to everyone who tried to help. Thank you.
 
Last edited:
Level 14
Joined
Jul 1, 2008
Messages
1,314
hey SpasMaster,

Just to add a note for you. I had the exact same problem, and when I tested it, it was gone when I used a smaller rect then the whole map. Even if the very same units entered the map at the same position in both cases.

Merging the events is the only really stable work-around to this, I guess, though
 
Status
Not open for further replies.
Top