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

Heavy Lag (?)

Status
Not open for further replies.
Level 7
Joined
Jul 14, 2006
Messages
292
Ok, here's the point. I made a map. It's a Maze Maker. 3 player make, 9 player run.
Really simple and a lot of ability in it. I tested it with a friend and some random player and, what happenned?
HEAVY LAGS

So I came here with some questions on Memory leaks. Questions like:
What need a variable?

As I think, only some things need variable:

Unit Group
Player Group
Item Group
(Any group)
Those have to be removed if they are to be used again. Removed this way:
call DestroyGroup(udg_unitorelseGroup)
call DestroyForce(udg_playerGroup)

Point
call RemoveLocation(udg_THEPoint)

Region
(I place my region on the map so I don't use this variable.)

And that's all!

In my map there are some laggy trigger like this one by exemple:
  • Events
  • Unit - A unit is Issued an order targeting a point
  • Conditions
  • (Unit-Type of (Ordered unit)) Equal to Mortar Volcano Team
  • Actions
  • Wait 0.05 seconds
  • Unit - Order (Ordered unit) to Stop
  • Unit - Order (Ordered unit) to face ((Facing of (Ordered unit)) + 10) over 0.00 seconds
  • Wait 0.20 seconds
  • Set VolcanoPoint = ((Position of (Ordered unit)) offset by 400.00 towards (Facing of (Ordered unit)) degrees)
  • Unit - Order (Ordered unit) to Attack Ground VolcanoPoint
  • Custom script: call RemoveLocation(udg_VolcanoPoint)
Any hint on what type of leak it represent? Cause I really need help to kill those lags...
 
Level 32
Joined
Oct 23, 2006
Messages
5,291
According to Leak Check v2

Total lines: 12

Location Leak Detection ON
Unit Group Leak Detection ON
Special Effect Leak Detection ON
Variable Removal Detection ON

(Line: 10 ) (Word: 4 ) Position Leak in setting of variable
Set VolcanoPoint = ((Position of (Ordered unit)) offset by 400.00 towards (Facing of (Ordered unit)) degrees)
Set VolcanoPoint = ^Leak


Completed
Total amount of leaks: 1
Leak Rating: Good

There's your leaky leak... it's the: ((Position of (Ordered unit))
 
Level 16
Joined
Oct 30, 2004
Messages
1,277
Create another variable.

....
Set VolcanoPoint1 = (Position of (Ordered unit)
Set VolcanoPoint2 = VolcanoPoint1 offset by 400.00 towards (Facing of (Ordered unit)) degrees)
...
Custom script: call RemoveLocation(udg_VolcanoPoint1)
Custom script: call RemoveLocation(udg_VolcanoPoint2)
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
you can remove the need for locations almost entirly by using XY cordinates instead.

function PolarProjectionBJ takes location source,real dist,real angle returns location
local real x = GetLocationX(source) + dist * Cos(angle * bj_DEGTORAD)
local real y = GetLocationY(source) + dist * Sin(angle * bj_DEGTORAD)
return Location(x, y)
endfunction

BY using XYs you can totaly remove the need for locations in such an opperations since a locations basicly is a variable that links one to a X and a Y cordinate.

Alost on actions that loop alot (more than 2 times a second) you can try lowering the rate they fire since the more they fire, the more lag is generated.
Also make sure thoes triggers DO NOT leak since leaking is the most common issue of lag building up quickly.^

Also optimizing your script can reduce the demmand of a trigger.
The easiest way for a beginner like you is using vexorians optimizer.
If you know jass then rewrite all commonused GUI triggers in jass and remove unescary BJ calls and actions and lame "IF" functions that GUI makes.

For ultra efficency, use a combination of both since that IS what good map makers do.
 
Level 11
Joined
Jul 12, 2005
Messages
764
Yeah, it's what Mini-Me said, BUT location leaks don't really make the game noticibly laggy. It makes you wait mor when the game has ended and you see that awful black screen for a time. That wait time is influenced by the leaks.

The game becomes laggy when you create many special effects at the same time, or you have a periodical trigger with complex actions. (Or when you use handle vars / cache)

And btw doc, what do you mean by this:
For ultra efficency, use a combination of both since that IS what good map makers do.
 
Level 7
Joined
Jul 14, 2006
Messages
292
Yeah, it's what Mini-Me said, BUT location leaks don't really make the game noticibly laggy. It makes you wait mor when the game has ended and you see that awful black screen for a time. That wait time is influenced by the leaks.

The game becomes laggy when you create many special effects at the same time, or you have a periodical trigger with complex actions. (Or when you use handle vars / cache)

And btw doc, what do you mean by this:

Ok, lol I have a 0.25 second periodic trigger with ±104 lines with a lot of pick group actions. Can it be the problem?

Or I have this one too:

  • Terrain
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Set RunnerPick = (Units of type Human Runner)
      • Unit Group - Add all units of RunnerPick to Runner
      • Custom script: call DestroyGroup(udg_RunnerPick)
      • Set RunnerPick = (Units of type Night Elf Runner)
      • Unit Group - Add all units of RunnerPick to Runner
      • Custom script: call DestroyGroup(udg_RunnerPick)
      • Set RunnerPick = (Units of type Orc Runner)
      • Unit Group - Add all units of RunnerPick to Runner
      • Custom script: call DestroyGroup(udg_RunnerPick)
      • Set RunnerPick = (Units of type Undead Runner)
      • Unit Group - Add all units of RunnerPick to Runner
      • Custom script: call DestroyGroup(udg_RunnerPick)
      • Set RunnerPick = (Units of type Test Runner)
      • Unit Group - Add all units of RunnerPick to Runner
      • Custom script: call DestroyGroup(udg_RunnerPick)
      • Unit Group - Pick every unit in Runner and do (Actions)
        • Loop - Actions
          • Set RunnerUnit = (Picked unit)
          • Set RunnerPoint = (Position of RunnerUnit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Terrain type at RunnerPoint) Equal to Cityscape - Dirt
              • (Hydras Stomach <gen> contains RunnerPoint) Equal to False
            • Then - Actions
              • Unit - Kill (Picked unit)
            • Else - Actions
              • Do nothing
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Terrain type at RunnerPoint) Equal to Cityscape - Round Tiles
            • Then - Actions
              • Unit - Make RunnerUnit Invulnerable
            • Else - Actions
              • Unit - Make RunnerUnit Vulnerable
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Terrain type at RunnerPoint) Equal to Ashenvale - Vines
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of RunnerUnit) Not equal to Night Elf Runner
                • Then - Actions
                  • Unit - Add Slow Vines to RunnerUnit
                • Else - Actions
                  • Unit - Remove Slow Vines from RunnerUnit
            • Else - Actions
              • Unit - Remove Slow Vines from RunnerUnit
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Terrain type at RunnerPoint) Equal to Sunken Ruins - Sand
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of RunnerUnit) Equal to Night Elf Runner
                • Then - Actions
                  • Unit - Add Slow Sand to RunnerUnit
                • Else - Actions
                  • Unit - Remove Slow Sand from RunnerUnit
            • Else - Actions
              • Unit - Remove Slow Sand from RunnerUnit
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Terrain type at RunnerPoint) Equal to Felwood - Poison
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of RunnerUnit) Not equal to Poison Cloud
                • Then - Actions
                  • Unit - Add Poison (Ground) to RunnerUnit
                • Else - Actions
                  • Unit - Remove Poison (Ground) from RunnerUnit
            • Else - Actions
              • Unit - Remove Poison (Ground) from RunnerUnit
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Terrain type at RunnerPoint) Equal to Dungeon - Lava
              • (RunnerUnit has buff Frost ) Equal to False
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of RunnerUnit) Not equal to Undead Runner
                • Then - Actions
                  • Unit - Add Burning (Normal) to RunnerUnit
                • Else - Actions
                  • Unit - Add Burning (Undead) to RunnerUnit
            • Else - Actions
              • Unit - Remove Burning (Normal) from RunnerUnit
              • Unit - Remove Burning (Undead) from RunnerUnit
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Terrain type at RunnerPoint) Equal to Icecrown Glacier - Dark Ice
            • Then - Actions
              • Set IcePoint = ((Position of RunnerUnit) offset by 6.00 towards (Facing of RunnerUnit) degrees)
              • Unit - Pause RunnerUnit
              • Unit - Move RunnerUnit instantly to IcePoint
              • Custom script: call RemoveLocation(udg_IcePoint)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Terrain type at RunnerPoint) Equal to Northrend - Ice
                • Then - Actions
                  • Set IcePoint = ((Position of RunnerUnit) offset by 6.00 towards (Facing of RunnerUnit) degrees)
                  • Unit - Move RunnerUnit instantly to IcePoint
                  • Custom script: call RemoveLocation(udg_IcePoint)
                • Else - Actions
                  • Do nothing
              • Unit - Unpause RunnerUnit
          • Set RunnerUnit = No unit
          • Custom script: call RemoveLocation(udg_RunnerPoint)
As most of you guessed, it's a maze making map.
 
Level 11
Joined
Jul 12, 2005
Messages
764
Yeah that's it. :D:D Lol, nice one :D
A loop, and more than 20 If-then-else structures in a 0.3 perodical trigger, well, you have to recreate it in jass, or i don't know what to say, indeed... I've never seen any trigger like this :D

EDIT
Oh and i have just noticed that it is not 0.3 but 0.03 ... Set it to 1 and try again.
 
Level 7
Joined
Jul 14, 2006
Messages
292
Then how do I make units slide??
It's a maze... I think I need help XD
If I put the timer to 1 it won't be called a maze anymore lol.
And I'm dumb at JASS. I know completely nothing except the Custom Script :call RemoveLocation(udg_YOURPoint) etc.
 
Level 11
Joined
Jul 12, 2005
Messages
764
look at the totorals
Man.. He knows how to slide a unit! That's not the problem.


You should make a separate trigger for the ice ground, with 0.1 timer.
The normal one that adds the abilities should run only every 1 or 2 seconds.
And i bet (i can't see through the trigger clearly), the if-then-else structures could be done better, to increase efficiency.
 
Level 7
Joined
Jul 14, 2006
Messages
292
Man.. He knows how to slide a unit! That's not the problem.


You should make a separate trigger for the ice ground, with 0.1 timer.
The normal one that adds the abilities should run only every 1 or 2 seconds.
And i bet (i can't see through the trigger clearly), the if-then-else structures could be done better, to increase efficiency.

Ok but I'd have to slow the ice movement because it will look ugly otherwise.
And thanks very much, you are a great help for me and my map.
 
Status
Not open for further replies.
Top