HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

I got wierd problem in my map.

04-14-2006, 08:38 PM#1
Exilus
In my halo map, the game start correctly, all triggers are working. only problem, some people are lagging..

but, afther like 10-15 mins, problems start to occur: some triggers stop functionning, or funcion half of the time, and the longer the game last,more triggers are being screwed up. plus, this seems to cause alot of lag to some players.

afther like 30 mins: shield regenerates only 1/4 of the time, sometime players dont respawn when killed, sometime reloading dont give you any ammos, sometime you can equip 2 weapons at the same time(in the same hand, giving you abilities of both), then, overheat totaly stop functionning,and, like if it wasn;t enough, lag make the game unplayable (not for me but for alot of players)

the first 10 mins is perfect,all triggers are working, all functions are 100 % operative(but lag).

ive heard leak cannot disable triggers.
if its not leak, then what is it?


id be glad if anyone could help me
04-14-2006, 09:06 PM#2
mmx2000
Leak shouldn't stop triggers from occuring, but if they are clogging your computer's resources so badly that its choking and sputtering, I would think it's possible for periodic events/checks/etc. to start getting missed...
This is just speculation though :|
04-14-2006, 09:28 PM#3
Exilus
Quote:
Originally Posted by mmx2000
Leak shouldn't stop triggers from occuring, but if they are clogging your computer's resources so badly that its choking and sputtering, I would think it's possible for periodic events/checks/etc. to start getting missed...
This is just speculation though :|


exactly, triggers in wich i have the MOST problems are the triggers with Event: Every 0.0X Seconds of game time
04-14-2006, 09:47 PM#4
Vuen
Periodic event triggers do not leak by themselves. The reason for this is not the trigger itself that is leaking, but the code that it runs leaks memory. So in periodic events, your code leaks again and again every 0.0X seconds, which adds up pretty quickly.

Post your code, and people will be able to help you figure out where your memory leaks are occuring.
04-14-2006, 10:01 PM#5
Exilus
[quote=Vuen]Periodic event triggers do not leak by themselves. The reason for this is not the trigger itself that is leaking, but the code that it runs leaks memory. So in periodic events, your code leaks again and again every 0.0X seconds, which adds up pretty quickly.QUOTE]

main problem is not the LEAK, its the fact of having my triggers disable or only half-functionning.



as for my code, i have absolutly no clue what's causing leak, and i have many 0.0x triggers. all of them use variables, and "call DestroyXXXX (udg_variable)" to avoid leak.
04-14-2006, 10:16 PM#6
Captain Griffen
Quote:
i have many 0.0x triggers

That is...bad...very bad. I have none, in any of my maps (ok, in some cinematic maps). Sometimes I use 0.0x temp triggers for pushback type effects, but they use timers which are paused when not needed.
04-14-2006, 11:32 PM#7
Vuen
Quote:
Originally Posted by Exilus
main problem is not the LEAK, its the fact of having my triggers disable or only half-functionning.

Yes, and I'm telling you they become half-functional or disabled because they leak.

When you leak too much memory, your computer starts churning away trying to sort it all, which takes a lot of CPU power. So it can't run your triggers every 0.0X seconds anymore because it just doesn't have enough power; they get ran when Warcraft gets the chance, which could take many seconds since you're leaking so much memory. It quite simply can't keep up, because it's too busy pageing leaked memory.

Fix the leaks, and your triggers will keep working.
04-14-2006, 11:52 PM#8
Exilus
Mine ARE needed. for all AMMO-MOVING triggers,flag detection and all shield-detection triggers.
04-15-2006, 12:44 AM#9
TaintedReality
Yes...but you need to make sure all your leaks are cleaned up. That's what's causing your problems, as Vuen just explained..
04-15-2006, 12:55 AM#10
Taur
it's not always leaks, I suggest if you find all leaks are cleared and this is driving you nuts, just try and find another way to do it, more than likely the second way will fix the problem, just dont make it similar. You don't always have to know what a problem is to fix it.

The method is a bit crude but much better than waiting for one us to help you :P
04-15-2006, 01:44 AM#11
Exilus
Quote:
Originally Posted by Taur
it's not always leaks, I suggest if you find all leaks are cleared and this is driving you nuts, just try and find another way to do it, more than likely the second way will fix the problem, just dont make it similar. You don't always have to know what a problem is to fix it.

The method is a bit crude but much better than waiting for one us to help you :P


ive fixed all leaks. this is an example of one of my triggers

Trigger:
Flame Move
Collapse Events
Time - Every 0.05 seconds of game time
Conditions
Collapse Actions
Set TempGroup = (Units of type Missile - Flames)
Collapse Unit Group - Pick every unit in TempGroup and do (Actions)
Collapse Loop - Actions
Set TempPoint1 = (Position of (Picked unit))
Set TempPoint2 = (TempPoint1 offset by (Random real number between 16.00 and 22.00) towards (Facing of (Picked unit)) degrees)
Unit - Move (Picked unit) instantly to TempPoint2
Set BulletOwner = (Owner of (Picked unit))
Set TempGroup2 = (Units within 75.00 of TempPoint2 matching ((((Matching unit) is Mechanical) Equal to False) and ((((Matching unit) is alive) Equal to True) and (False Equal to False))))
Collapse Unit Group - Pick every unit in TempGroup2 and do (Actions)
Collapse Loop - Actions
Set TempPoint3 = (Position of (Picked unit))
Unit - Cause (Random unit from (Units within 75.00 of TempPoint3 matching ((Unit-type of (Matching unit)) Equal to Missile - Flames))) to damage (Picked unit), dealing 5.00 damage of attack type Spells and damage type Fire
Trigger - Run Shield Get hit <gen> (checking conditions)
Unit - Create 1 Trigger Caster for (Owner of (Random unit from (Units within 80.00 of TempPoint3 matching ((Unit-type of (Matching unit)) Equal to Missile - Flames)))) at (Position of (Picked unit)) facing Default building facing (270.0) degrees
Unit - Add Test2 to (Last created unit)
Unit - Order (Last created unit) to Undead Necromancer - Unholy Frenzy (Picked unit)
Custom script: call DestroyGroup (udg_TempGroup2)
Custom script: call RemoveLocation (udg_TempPoint1)
Custom script: call RemoveLocation (udg_TempPoint2)
Custom script: call RemoveLocation (udg_TempPoint3)
Custom script: call DestroyGroup (udg_TempGroup)

This is another example.


Trigger:
Shield regeneration
Collapse Events
Time - Every 1.00 seconds of game time
Collapse Conditions
Collapse Or - Any (Conditions) are true
Collapse Conditions
Shield[1] Less than or equal to 1
Shield[2] Less than or equal to 1
Shield[3] Less than or equal to 1
Shield[4] Less than or equal to 1
Shield[5] Less than or equal to 1
Shield[6] Less than or equal to 1
Shield[7] Less than or equal to 1
Shield[8] Less than or equal to 1
Shield[9] Less than or equal to 1
Shield[10] Less than or equal to 1
Shield[11] Less than or equal to 1
Shield[12] Less than or equal to 1
Collapse Actions
Set TempForce = (All players matching (((Matching player) slot status) Equal to Is playing))
Collapse Player Group - Pick every player in TempForce and do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Shield[(Player number of (Picked player))] Equal to 1
(Mana of GUY[(Player number of (Picked player))]) Less than 100.00
Collapse Then - Actions
Unit - Set mana of GUY[(Player number of (Picked player))] to 100.00
Special Effect - Create a special effect attached to the origin of GUY[(Player number of (Picked player))] using Abilities\Spells\Human\Defend\DefendCaster.mdl
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Shield[12] Less than or equal to 0
Shield[11] Less than or equal to 0
Shield[10] Less than or equal to 0
Shield[9] Less than or equal to 0
Shield[8] Less than or equal to 0
Shield[7] Less than or equal to 0
Shield[6] Less than or equal to 0
Shield[5] Less than or equal to 0
Shield[4] Less than or equal to 0
Shield[3] Less than or equal to 0
Shield[2] Less than or equal to 0
Shield[1] Less than or equal to 0
Collapse Then - Actions
Trigger - Turn off (This trigger)
Else - Actions
Custom script: call DestroyForce (udg_TempForce)


theyre all like that. all used variables, and then custom scripts to destroy them.Also using second triggers to ONLY turn on the 0.0X Triggers when required, then turning them off instantly afther. it should NOT leak...
04-15-2006, 02:51 AM#12
Vuen
Actually, you still have several bad leaks in there:

Trigger:
Unit - Cause (Random unit from (Units within 75.00 of TempPoint3 matching ((Unit-type of (Matching unit)) Equal to Missile - Flames))) to damage (Picked unit), dealing 5.00 damage of attack type Spells and damage type Fire

You're leaking a unit group there, with the "Units within ..." command. Unit groups are the worst kind of leaks; this is the kind that will make Warcraft crawl. You handled the other groups perfectly. Don't forget this one.

Here's another leak:

Trigger:
Unit - Create 1 Trigger Caster for (Owner of (Random unit from (Units within 80.00 of TempPoint3 matching ((Unit-type of (Matching unit)) Equal to Missile - Flames)))) at (Position of (Picked unit)) facing Default building facing (270.0) degrees

Another bad unit group leak (Units within 80.00...), with a location leak (Position of...) to boot.


The second trigger leaks a special effect. Special effects attached to units leak very little actual memory, but the meshes hang around, so as they add up they make your graphics card crawl. A good way to do this would be to attach the handle of the special effect to the unit with a gamecache, that way when you create a second special effect on the same unit you can destroy the first one.


Fix those up, and check your other triggers for leaks again (mainly the "Units within range" function) and try it out again to see if your triggers still stop working after a while.
04-15-2006, 09:36 AM#13
Captain Griffen
Also, in the first trigger you set TempPoint3 inside the second loop, but don't destroy it within the loop. Also, it might be very useful to try and convince someone to convert those into JASS and make them more efficient, because you are doing a hell of a lot every 0.05 seconds in that one trigger alone.
04-15-2006, 01:52 PM#14
Exilus
Quote:
Originally Posted by Captain Griffen
you are doing a hell of a lot every 0.05 seconds in that one trigger alone.


i have 7 triggers like that, some have a 0.02 delay too..(sniper)

BUT! the trigger is turned ON everytimes a unit shoot, and OFF when the last unit of type "Missile - Flames" Die. so its ONLY used when required.
04-15-2006, 02:22 PM#15
Exilus
what about now?


Trigger:
Flame Move
Collapse Events
Time - Every 0.05 seconds of game time
Conditions
Collapse Actions
Set TempGroup = (Units of type Missile - Flames)
Collapse Unit Group - Pick every unit in TempGroup and do (Actions)
Collapse Loop - Actions
Set TempPoint1 = (Position of (Picked unit))
Set TempPoint2 = (TempPoint1 offset by (Random real number between 16.00 and 22.00) towards (Facing of (Picked unit)) degrees)
Unit - Move (Picked unit) instantly to TempPoint2
Set BulletOwner = (Owner of (Picked unit))
Set TempGroup2 = (Units within 75.00 of TempPoint2 matching ((((Matching unit) is Mechanical) Equal to False) and ((((Matching unit) is alive) Equal to True) and (False Equal to False))))
Collapse Unit Group - Pick every unit in TempGroup2 and do (Actions)
Collapse Loop - Actions
Set TempPoint3 = (Position of (Picked unit))
Set TempGroup5 = (Units within 75.00 of TempPoint3 matching ((Unit-type of (Matching unit)) Equal to Missile - Flames))
Unit - Cause (Random unit from TempGroup5) to damage (Picked unit), dealing 5.00 damage of attack type Spells and damage type Fire
Trigger - Run Shield Get hit <gen> (checking conditions)
Set TempPoint5 = (Position of (Picked unit))
Unit - Create 1 Trigger Caster for (Owner of (Random unit from TempGroup5)) at TempPoint5 facing Default building facing (270.0) degrees
Unit - Add Test2 to (Last created unit)
Unit - Order (Last created unit) to Undead Necromancer - Unholy Frenzy (Picked unit)
Custom script: call RemoveLocation (udg_TempPoint3)
Custom script: call DestroyGroup (udg_TempGroup5)
Custom script: call RemoveLocation (udg_TempPoint5)
Custom script: call DestroyGroup (udg_TempGroup2)
Custom script: call DestroyGroup (udg_TempGroup5)
Custom script: call RemoveLocation (udg_TempPoint1)
Custom script: call RemoveLocation (udg_TempPoint2)
Custom script: call RemoveLocation (udg_TempPoint3)
Custom script: call RemoveLocation (udg_TempPoint5)
Custom script: call DestroyGroup (udg_TempGroup)