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

Is this trigger causing my map to lag so hard?

Status
Not open for further replies.
Level 6
Joined
Jul 12, 2017
Messages
139
So my map has been lagging from time to time, probably due to a lot of enemies at once and this trigger moves the certain type of enemies. I suspect as this is the only periodic time trigger I have which moves a lot of unit at once, it may cause the massive lag but how do I fix it? Is this trigger really the problem?

Thank you in advance.

  • Enemies Attack Move
    • Events
      • Time - Every 30.00 seconds of game time
    • Conditions
    • Actions
      • Set VariableSet UnitGroup1 = (Units in (Playable map area) matching (((Matching unit) belongs to an ally of Player 21 (Coal).) Equal to True))
      • Set VariableSet UnitGroup2 = (Units in (Playable map area) matching (((Matching unit) belongs to an enemy of Player 21 (Coal).) Equal to True))
      • Set VariableSet Point1 = (Position of (Random unit from UnitGroup2))
      • Unit Group - Pick every unit in UnitGroup1 and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Picked unit)) Not equal to Player 17 (Wheat)
              • (Owner of (Picked unit)) Not equal to Player 24 (Peanut)
            • Then - Actions
              • Unit - Order (Picked unit) to Attack-Move To Point1
            • Else - Actions
              • Do nothing
      • Custom script: call RemoveLocation(udg_Point1)
      • Custom script: call DestroyGroup(udg_UnitGroup1)
      • Custom script: call DestroyGroup(udg_UnitGroup2)
 

Uncle

Warcraft Moderator
Level 63
Joined
Aug 10, 2018
Messages
6,457
Your trigger would only cause a performance issue when it runs which is once every 30.00 seconds. If your performance issue is happening more often than that then it's something else. That being said, you can make this trigger more efficient by manually Adding/Removing units from the Unit Groups as the units enter/leave the map instead of doing it all at once. You're also not using filters to prevent things like Dead units from being added to the Unit Groups. Point1 could be the position of a dead unit, a structure, a ward, etc...

Regarding triggers that can cause performance issues, I believe Attack/Damage Events are the major cause for performance issues when large numbers of units are on the map.

Anyway, I think you can answer your own question pretty easily, when you disable the trigger does the map performance improve?
 
Level 38
Joined
Feb 27, 2007
Messages
4,951
My best guess is they have waaaaaay too many units trying to move at once and pathfinding is breaking down. When pathfinding for units get slow they seem delayed and it looks a lot like the game is lagging even though it's not. Could you post a video of the behavior you see in your map, or confirm that it's not just pathfinding from too many units doing it at once?
 
My best guess is they have waaaaaay too many units trying to move at once and pathfinding is breaking down. When pathfinding for units get slow they seem delayed and it looks a lot like the game is lagging even though it's not. Could you post a video of the behavior you see in your map, or confirm that it's not just pathfinding from too many units doing it at once?
Its literal lag where players screens freeze or stutter, though there is a solution for that too which is making cannon fodder aka weak type units have no unit collision where they behave like air units but still have ground pathing. Unit delay still happens around 300+ units at once or 150+ units trying to navigate around cliffs/blocked pathing or attacking units.
 
Status
Not open for further replies.
Top