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

Will this leak/cause lag?

Status
Not open for further replies.

EdgeOfChaos

E

EdgeOfChaos

Could someone help me figure out the leak here?
  • Black Hole
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in BlackHolesGroup and do (Actions)
        • Loop - Actions
          • Set TempPoint2 = (Position of (Picked unit))
          • Set TempGroup = (Units within 1400.00 of TempPoint2 matching ((Owner of (Matching unit)) Not equal to Player 12 (Brown)))
          • Unit Group - Pick every unit in TempGroup and do (Actions)
            • Loop - Actions
              • Set TempPoint3 = (Position of (Picked unit))
              • Set TempPoint = (TempPoint3 offset by ((1400.00 - (Distance between TempPoint3 and TempPoint2)) / 150.00) towards (Angle from TempPoint3 to TempPoint2) degrees)
              • Set X = (Integer((X of TempPoint)))
              • Set Y = (Integer((Y of TempPoint)))
              • Custom script: call SetUnitX(GetEnumUnit(), udg_X)
              • Custom script: call SetUnitY(GetEnumUnit(), udg_Y)
              • Custom script: call RemoveLocation(udg_TempPoint)
              • Custom script: call RemoveLocation(udg_TempPoint3)
          • Custom script: call DestroyGroup(udg_TempGroup)
          • Custom script: call RemoveLocation(udg_TempPoint2)
When this happens ingame, it permanently causes lag for everyone. I don't know why :(. X and Y are integers, the rest are points/groups. BlackHoleGroup is initiated at the start of the map and units are added to it.
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
Do you remove the units from the group at any time or do Set BlackHolesGroup = units in range ? (or any variation of that.)

You should also store anything used twice or more into a variable and use the variable.
If you use X and Y coordinates you should use real variables not integers.
I don't see any leaks in this trigger though.
If you never remove the units though it could be running such a big unit group loop that it is causing lag.
 

EdgeOfChaos

E

EdgeOfChaos

This is the init for BlackHolesGroup:
  • Black Hole Set
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • Unit Group - Add Black Hole Enemy 0041 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0042 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0043 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0048 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0049 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0046 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0044 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0045 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0064 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0065 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0066 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0067 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0068 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0081 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0088 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0089 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0094 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0109 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0115 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0116 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0115 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0115 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0115 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0122 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0121 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0123 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0118 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0112 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0120 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0125 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0124 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0119 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0128 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0129 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0127 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0130 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0126 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0131 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0140 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0137 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0141 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0142 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0143 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0145 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0149 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0148 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0150 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0147 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0146 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0151 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0156 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0155 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0157 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0154 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0152 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0153 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0180 <gen> to BlackHolesGroup
      • Unit Group - Add Black Hole Enemy 0179 <gen> to BlackHolesGroup
      • Custom script: call DestroyTrigger(GetTriggeringTrigger())
I know about putting uses 2+ times into a variable, and I do plan to do that in the future, but that wouldn't cause this type of lag.

I asked a friend to go through and type /fps. It was around 60 fps until we got to the first black hole screen. It then dropped to around 40. Next one, it dropped to 15, and finally it went down to around 5 fps and kept going down. It never got any better, not even when we walked away from the unit, if this helps at all. (note: the trigger is only enabled when you reach first black hole)

I thought it was a leak because it wasn't getting any better; maybe not though.

I never set the group equal to anything.

Do you think it's going through too many units?
 

EdgeOfChaos

E

EdgeOfChaos

I am using a custom model, but I tried replacing it with a moon well and my friend still lagged.

No other triggers using anything related to black hole.
 

EdgeOfChaos

E

EdgeOfChaos

Is there any alternative I can do?
@deathismyfriend I don't think so

edit: Would something like this be more or less efficient?
  • Black Hole
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • Set TempGroup = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Escaper))
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Set TempUnit = (Picked unit)
          • Set TempPoint = (Position of TempUnit)
          • Set TempGroup2 = (Units within 1400.00 of TempPoint matching ((Unit-type of (Matching unit)) Equal to Black Hole Enemy))
          • Unit Group - Pick every unit in TempGroup2 and do (Actions)
            • Loop - Actions
              • Set TempUnit2 = (Picked unit)
              • Set TempPoint2 = (Position of TempUnit2)
              • Set TempReal = ((1400.00 - (Distance between TempPoint and TempPoint2)) / 150.00)
              • Set TempPoint3 = (TempPoint offset by TempReal towards (Angle from TempPoint to TempPoint2) degrees)
              • Set X = (X of TempPoint3)
              • Set Y = (Y of TempPoint3)
              • Custom script: call SetUnitX(udg_TempUnit,udg_X)
              • Custom script: call SetUnitY(udg_TempUnit,udg_Y)
              • Custom script: call RemoveLocation(udg_TempPoint3)
              • Custom script: call RemoveLocation(udg_TempPoint2)
          • Custom script: call DestroyGroup(udg_TempGroup2)
          • Custom script: call RemoveLocation(udg_TempPoint)
      • Custom script: call DestroyGroup(udg_TempGroup)
There are only ever 9 escapers whereas there were a lot of black holes.
 
Last edited by a moderator:
Status
Not open for further replies.
Top