OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Resources Beta Testing & Submission => Topic started by: LeeHunt on 21 Apr 2007, 15:15:43

Title: Exploding Triggers- a way to reduce lag in your mission (ACCEPTED)
Post by: LeeHunt on 21 Apr 2007, 15:15:43
Armed Assault Version 1.05

Armed Assault has a new set of "SetTrigger" commands  (see http://ofpec.com/COMREF/index.php?action=list&game=All&letter=s) that allow you to create a trigger midmission, instead of just by hitting F3 in the Mission Editor as we usually do.  This midmission creation is useful because you can create a trigger for a brief specific purpose and then delete it, thereby reducing the lag you could have in a mission with an overload of triggers.  So you get the best of both worlds, very cool  :).

At first I was confused by how to put the multiple new commands together to get a result (you need to use about half a dozen, otherwise they are useless obviously), but I figured it out and thought others might want a sample to use for their missions as well:

The readme and comments on the script are written in the "ExplodingTrigger.sqs" file at the top.  The sample mission shows you two platoons of soldiers fighting and counts the survivors on the EAST side, using a trigger that comes and goes every 10 seconds, instead of a constantly running, lag inducing trigger.  Enjoy and I hope you find it useful!


Title: Re: Exploding Triggers- a way to reduce lag in your mission
Post by: ViperMaul on 15 May 2007, 03:12:28
This is quite fascinating.
How do you measure lag?
Is it Server FPS that you can see from the #monitor command?

Has anyone tried this technique and observed a before and after effect?
I would love to hear success stories about this and other lag reducing techniques.
Title: Re: Exploding Triggers- a way to reduce lag in your mission
Post by: JasonO on 15 May 2007, 18:19:03
If you use a lot of triggers in a map it can be noticeable.

But its mainly common sense. If you have tonnes of loops of triggers that are only usually needed for 2 seconds. Having them check their conditions every 0.5 seconds (I believe that's how fast they loop) is just a waste of resources.
Title: Re: Exploding Triggers- a way to reduce lag in your mission
Post by: LeeHunt on 01 Jun 2007, 21:39:53
I have noticed an effect.  Let's say you load up Sahrani map and just run around with the only the player on the map.  The game can run quite seamlessly.  If you throw a hundred bad guys and a dozen or so triggers the game is still fine, but the exploding triggers allows you to use potentially dozens of triggers without any effect. In the mission I'm working on I do just that to check various troop levels around the map.  So I can check the garrison levels at 5 different bases without any lag essentially, while most people's missions have a trigger checking the garrison every .5 seconds etc.
Title: Re: Exploding Triggers- a way to reduce lag in your mission
Post by: Cheetah on 02 Jun 2007, 11:31:13
Be sure to notice that you can set the timeout of trigger, the waiting time to check again.

I don't know what is faster, a trigger with a timeout or triggers which get created and deleted - this process takes up CPU power. You could test it, but there is probably no good way to test it other than an intrinsic one - actually giving a score is impossible.

Anyway, this is particularly usefull when you want a lot of triggers to be created and deleted during the mission. It won't hurt in my opinion, but I don't think that they need to be deleted every second. I think that making them and deleting them once they are redundant is the best way. Can't test it though ;).
Title: Re: Exploding Triggers- a way to reduce lag in your mission
Post by: Mr.Peanut on 02 Jun 2007, 20:09:51
Ack. I thought timeout was how long the trigger condition had to be true...
Title: Re: Exploding Triggers- a way to reduce lag in your mission
Post by: LeeHunt on 04 Jun 2007, 23:16:32
yeh i thought timeout meant that as well, that all triggers are checking their status every .5 seconds until they are deleted... i could be wrong though.

i am working on an exploding savegame trigger to get around the inability to have multiple saves (without alt-tabbing and renaming old saves)
Title: Re: Exploding Triggers- a way to reduce lag in your mission
Post by: bedges on 27 Jun 2007, 13:20:15
hmmm... just for the avoidance of doubt:

countdown delays the reaction of a trigger for a certain length of time, determined by the min, max and mid values. thus if the triggering unit walks into the area then leaves, the trigger will fire after the countdown is complete, regardless of whether the triggering unit is present or not.

timeout requires that the condition of the trigger must be met for a certain length of time, determined by the min, max and mid values. thus if the triggering unit walks into the area then leaves before the timeout is complete, the trigger will not fire.