[Solved] What's leaking

Status
Not open for further replies.
Level 14
Joined
Jul 25, 2011
Messages
1,065
My trigger is leaking I don't know what's leaking in my trigger please help me.
[TRIGGER=Shoot]Shoot
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Shoot
Actions
Set TP1 = (Position of (Triggering unit))
Unit - Create 1 Bullet for (Owner of (Triggering unit)) at TP1 facing (Facing of (Triggering unit)) degrees
Unit - Add a 0.80 second Generic expiration timer to (Last created unit)
Unit Group - Add (Last created unit) to Bullets
Custom script: call RemoveLocation(udg_TP1)
[/TRIGGER]
  • Shoot Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Bullets and do (Actions)
        • Loop - Actions
          • Set Bullet = (Picked unit)
          • Set TP1 = (Position of (Picked unit))
          • Set TP2 = (TP1 offset by 50.00 towards (Facing of (Picked unit)) degrees)
          • Unit - Move (Picked unit) instantly to TP2
          • Set TG = (Units within 50.00 of TP1)
          • Custom script: call RemoveLocation(udg_TP1)
          • Custom script: call RemoveLocation(udg_TP2)
          • Unit Group - Pick every unit in TG and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Owner of (Picked unit)) Equal to (Owner of Bullet)
                • Then - Actions
                • Else - Actions
                  • Unit - Cause Bullet to damage (Picked unit), dealing (Random real number between 50.00 and 60.00) damage of attack type Spells and damage type Normal
                  • Unit - Kill Bullet
                  • Special Effect - Create a special effect attached to the chest of (Picked unit) using Objects\Spawnmodels\Human\HumanBlood\HumanBloodKnight.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Unit Group - Remove Bullet from Bullets
          • Set Bullet = No unit
          • Custom script: call DestroyGroup(udg_TG)
  • Bullet Death
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Bullet
    • Actions
      • Unit Group - Remove (Triggering unit) from Bullets
PS:It leaks when a bullet is alive.
 
Level 7
Joined
Apr 30, 2011
Messages
359
first . . . . it's not called a leak, it's called a lag
second . . .
the lag occurs because of those unit picking thing i suppose . . .
unit group loop in a unit group loop @.@
make it 2 group loops instead . . .

1.
replace this
  • Set TG = (Units within 50.00 of TP1)
with
  • Unit Group - Add group to unit group . . blablabla . . .
2.
place that second unit group loop outside the first one . . .
then do necessary changes

enjoy :D
 
Level 14
Joined
Jul 25, 2011
Messages
1,065
No leaks.

Make sure the dummy's death type is Can't raise, does not decay.

ok. I'll try it.

EDIT : Still leaks. Are you sure my trigger doesn't have leaks?

first . . . . it's not called a leak, it's called a lag
second . . .
the lag occurs because of those unit picking thing i suppose . . .
unit group loop in a unit group loop @.@
make it 2 group loops instead . . .

1.
replace this
  • Set TG = (Units within 50.00 of TP1)
with
  • Unit Group - Add group to unit group . . blablabla . . .
2.
place that second unit group loop outside the first one . . .
then do necessary changes

enjoy :D

It doesn't lag. It has a minor leak. Like 1 leak every 0.03 seconds per bullet alive.

I'm using this trigger to check leaks.
[trigger=Leak Checker]Leak Checker
Events
Time - Every 0.03 seconds of game time
Conditions
Actions
Custom script: local location L = Location(0,0)
Custom script: call BJDebugMsg(I2S(GetHandleId(L)-0x100000))
Custom script: call RemoveLocation(L)
Custom script: set L = null
[/trigger]
 
Last edited by a moderator:
Level 7
Joined
Apr 30, 2011
Messages
359
but you should do what i have suggested . .
i'll explain this shortly . . . .

JASS:
// your trigger has an O(nO(n)) complexity, it's slow
// example:
loop // through unit group, O(n) n = number of units in group
    // another loop here
    loop // trough another unit group
    // become O(nO(n)) because this other loop

// this is better, this have an 2O(n) complexity, faster
// example
loop // through a unit group
    // there's no other loops here
    // still O(n) here :D
// run the other loop outside the first one
loop // through a unit group
    // nothing more
    // result: 2 * O(n) or simply 2O(n) . . .

if you don't understand . . .
just ask more ~

and btw, what do you mean by leaking?
there's no leak at all, it should be your leak detection problems ~.~
 
Level 14
Joined
Jul 25, 2011
Messages
1,065
but you should do what i have suggested . .
i'll explain this shortly . . . .

JASS:
// your trigger has an O(nO(n)) complexity, it's slow
// example:
loop // through unit group, O(n) n = number of units in group
    // another loop here
    loop // trough another unit group
    // become O(nO(n)) because this other loop

// this is better, this have an 2O(n) complexity, faster
// example
loop // through a unit group
    // there's no other loops here
    // still O(n) here :D
// run the other loop outside the first one
loop // through a unit group
    // nothing more
    // result: 2 * O(n) or simply 2O(n) . . .

if you don't understand . . .
just ask more ~

and btw, what do you mean by leaking?
there's no leak at all, it should be your leak detection problems ~.~

Maybe you are right. I'll post this syetem in the spells. +rep to you.
 
Level 5
Joined
Sep 19, 2006
Messages
152
I'm using this trigger to check leaks.
[trigger=Leak Checker]Leak Checker
Events
Time - Every 0.03 seconds of game time
Conditions
Actions
Custom script: local location L = Location(0,0)
Custom script: call BJDebugMsg(I2S(GetHandleId(L)-0x100000))
Custom script: call RemoveLocation(L)
Custom script: set L = null
[/trigger]

Hmm. I'm curious: How does that trigger "detect" leaks?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,243
first . . . . it's not called a leak, it's called a lag
No its not...

Lag is a measurement of responsiveness of user input. When something lags it can be that the framerate on the target system is very low (as the minimum response times in 1 frame), the network is suffering from latency (takes most of a second for packets to arrive) or even that a client in a session is not able to keep up with the server (so the game is constantly having to pause to let him catch up and when the game is paused no responses can occur).

Although it is perfectly correct to say that something that causes your game to run at 1-2 FPS is creating lag, it is not very helpful as computers in the future may not suffer lag from it.

Lag is dominated by the largest source. As long as your game is above 15 FPS this will almost always be dominated by network latency. If your game is running at 1 FPS but network latency is 10 seconds then the fact that the minimum order rate is 1 frame (1 second) makes little difference compared to the 10 seconds the network adds to delay.
 
Status
Not open for further replies.
Top