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

Random desyncs

Level 5
Joined
Apr 22, 2022
Messages
55
Was working on my map which is sort of like a PvE spin off of Zerg Wars in SC2.. but I seem to keep getting at least 1-2 desyncs randomly throughout the game. I've checked the desyncs list and I don't think I've got anything really crazy. Would anyone be interested in taking a look?
 

Remixer

Map Reviewer
Level 31
Joined
Feb 19, 2011
Messages
1,957
Was working on my map which is sort of like a PvE spin off of Zerg Wars in SC2.. but I seem to keep getting at least 1-2 desyncs randomly throughout the game. I've checked the desyncs list and I don't think I've got anything really crazy. Would anyone be interested in taking a look?
I can try to see what might lead to it but I am not exactly expert in this regard.
 
Level 5
Joined
Apr 22, 2022
Messages
55
I think it may be tied to Orc?? Idk the last two times I desynced I was playing Orc but as far as I know I don't have anything specifically for orcs. The most recent desyncs seem to be happening a couple minutes in but I've had it happen as late as the final boss as well.
 

Attachments

  • Northrend Assault Beta 1.6.w3m
    63.3 MB · Views: 7

Remixer

Map Reviewer
Level 31
Joined
Feb 19, 2011
Messages
1,957
I cannot spot anything certain that would seem like the exact cause of the desyncs. However, I do notice that your triggers have numerous memory leaks which is bad considering you are running very many periodic timers. However, none of your timers seem to be running superly rapid, so I doubt they are the cause, but I guess it could be.

You might want to read about Memory Leaks and Things That Leak to get some insight into what I am talking about. Since you are running a lot of periodic timers as well as some unit events that trigger an action, it is very important to clear references and objects that are no longer used. Otherwise they are 'left behind' and remain in the memory of the game while you are unable to reference them to clean them up afterwards.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
I think it may be tied to Orc?? Idk the last two times I desynced I was playing Orc but as far as I know I don't have anything specifically for orcs. The most recent desyncs seem to be happening a couple minutes in but I've had it happen as late as the final boss as well.
Also, are you sure it's an actual desync and not a crash?

The two most common crashes I've encountered are:
1) Infinite Loops. IE: Event: A unit takes damage / Action: Deal damage.
2) Dividing by zero.

I'll update this if I can think of anymore.
 

Remixer

Map Reviewer
Level 31
Joined
Feb 19, 2011
Messages
1,957
Also, are you sure it's an actual desync and not a crash?

The two most common crashes I've encountered are:
1) Infinite Loops. IE: Event: A unit takes damage / Action: Deal damage.
2) Dividing by zero.

I'll update this if I can think of anymore.
I can add to this that I tried the map and my game crashed out of it even though I was playing alone, so at least we know the map also has at least one crash.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
Some issues I see glancing through:

You're using (Last created unit) after creating multiple units. It will only apply to ONE of those units (which is basically random):
  • Unit - Create 2 Ghoul (Forsaken) for Player 19 (Mint)...
  • AI - Ignore (Last created unit)'s guard position
You can rely on (Last created unit group) to reference all of the created units:
  • Unit - Create 2 Ghoul (Forsaken) for Player 19 (Mint)...
  • Unit Group - Pick every unit in (Last created unit group) and do (Actions)
    • Loop - Actions
You use this Event very often:
  • Unit - A unit Begins casting an ability
This happens before the ability actually executes. This may be desirable in certain situations, but most of the time you want to use Starts The Effect.

The way you're destroying this Unit Group looks troubling:
  • Portals 2
    • Events
      • Time - Every 4.90 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Portal
            • Then - Actions
              • Unit - Create 2 Zombie for Player 11 (Dark Green) at (Position of (Picked unit)) facing Default building facing degrees
              • Unit - Order (Last created unit) to Attack-Move To (Random point in Base <gen>)
              • Unit - Create 1 Ghoul for Player 11 (Dark Green) at (Position of (Picked unit)) facing Default building facing degrees
              • Unit - Order (Last created unit) to Attack-Move To (Random point in Base <gen>)
              • Unit - Create 2 Skeleton Archer for Player 11 (Dark Green) at (Position of (Picked unit)) facing Default building facing degrees
              • Unit - Order (Last created unit) to Attack-Move To (Random point in Base <gen>)
              • Custom script: call DestroyGroup( GetLastCreatedGroup() )
            • Else - Actions
              • Do nothing
And again, you're relying on (Last created unit) in response to creating multiple units - this doesn't work.

Your Dummy units should most likely have their Movement Type set to None and Speed Base set to 0 if you want them to cast spells "instantly", otherwise, using Flying Movement like you are now will interfere with their spellcasting. I always base my Dummy unit on the Locust and work from there - it has most of the fields you want already. But if you want your Dummy units to move around then my suggested movement change may interfere.

I can't imagine this is a very smart thing to do every 1 second:
  • Undead Attack
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • AI - Ignore the guard positions of all Player 9 (Gray) units
      • AI - Ignore the guard positions of all Player 22 (Snow) units
      • AI - Ignore the guard positions of all Player 10 (Light Blue) units
      • AI - Ignore the guard positions of all Player 11 (Dark Green) units
      • AI - Ignore the guard positions of all Player 21 (Coal) units
      • AI - Ignore the guard positions of all Player 14 (Navy) units
      • AI - Ignore the guard positions of all Player 19 (Mint) units
Perhaps removing weather when no weather exists could cause an issue:
  • Environment - Remove Weather
Also, nowhere do I see you setting this Weather variable.

Otherwise, everything else SEEMS okay. Maybe the crash or crashes are related to a custom model.
 
Last edited:
Level 5
Joined
Apr 22, 2022
Messages
55
Thank you guys for the feedback :) I had learned some lessons earlier this week on last created unit lol. I planned on going back through and hopefully fixing most of the leaks but games typically don't go long enough for them to become a huge issue and I wanted to make sure I got the core game working before optimizing. I was starting to wonder if maybe it is a model.. but I can't think of any models that would spawn early enough that would cause it unless a faulty model can cause a desync even when not on the map? Far as I know it's not a crash or anything, the desyncs I see myself in the chat from others when they desync or even in my own case I see it pop up in the chat for half a second before I'm taken back to the main menu. I have not seen a legit full crash out and an error myself. I always play HD though but use the editor in SD.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
Thank you guys for the feedback :) I had learned some lessons earlier this week on last created unit lol. I planned on going back through and hopefully fixing most of the leaks but games typically don't go long enough for them to become a huge issue and I wanted to make sure I got the core game working before optimizing. I was starting to wonder if maybe it is a model.. but I can't think of any models that would spawn early enough that would cause it unless a faulty model can cause a desync even when not on the map? Far as I know it's not a crash or anything, the desyncs I see myself in the chat from others when they desync or even in my own case I see it pop up in the chat for half a second before I'm taken back to the main menu. I have not seen a legit full crash out and an error myself. I always play HD though but use the editor in SD.
I would try to address all of the Unit Group leaks plus everything else I mentioned in my last post.

A good strategy is to store units inside of Unit Group variables that you maintain throughout the game using these Add/Remove actions:
  • Unit Group - Add (some unit) to UnitGroupVariable
  • Unit Group - Remove (some unit) from UnitGroupVariable
There's also an Action for Adding a group of units into another group which you could use instead of (Last created unit).

This way you can reference the exact units you want at any time instead of referencing every single unit with a filter. It also allows you to avoid the memory leak issue since you aren't creating a new Unit Group each time.

I'd be surprised if you didn't see some performance improvements afterwards.
 
Last edited:
Level 5
Joined
Apr 22, 2022
Messages
55
I'll go through and give it a shot. :) As far as if it was a model, does it have to be on the map to cause issues or would just being imported as a file be enough to mess things up?
 
Level 5
Joined
Apr 22, 2022
Messages
55
So whenever I'd set a point or a unit group variable I need a custom script to destroy it? Is that all I'm looking for?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
So whenever I'd set a point or a unit group variable I need a custom script to destroy it? Is that all I'm looking for?
Yeah, you're destroying/removing (same thing) the object of your Unit Group or Point variable. The idea is to do this before you Set the variable again. So it's a pretty simple pattern -> Set, Remove, Set, Remove, etc. You create a permanent memory leak when you break this pattern by doing Set, Set for example.

But like I said, you can avoid a lot of this stuff and optimize the map by designing things in a more structured way. Premade Unit Groups that are managed throughout the game solve this issue and also improve map performance. The same can done with Points in a lot of cases.
 
Level 5
Joined
Apr 22, 2022
Messages
55
Alrighty I think I got most of them.. I'll fire it up and see if I get any desyncs after I finish up those Undead spawning changes :p
 
Level 5
Joined
Apr 22, 2022
Messages
55
Overhauled all the leaks I think that I could find and the game seems to run a little smoother for sure, instead of two desyncs it seems like it's only one per game now. xD I can attach the updated map file if anyone is interested in taking a look.
 
Level 5
Joined
Apr 22, 2022
Messages
55
Hmmm... always at least one desync around the 5 minute mark I think? But I can't tell what would cause it.
 

Attachments

  • Northrend Assault Beta 3.2.w3m
    63.7 MB · Views: 1
Top