Home   Help Search Login Register  

Author Topic: Performance Questions  (Read 1566 times)

0 Members and 1 Guest are viewing this topic.

Kammak

  • Guest
Performance Questions
« on: 09 Mar 2004, 01:05:05 »
Just wondering if BIS ever gave any guidance on performance for scripting items?

Specifically, which is better?

Triggers with specific conditions (in the condition field), or scripting a "@" with the same condition, or scripting a loop that exits on the condition, or (if applicable) an event handler?

Are they all just plugging into the same routines (in the .exe)  eventually, or is one more efficient than the others?

Example: Say I want to know when eight specific tanks have been destroyed.

I could name each tank, then create a trigger with the condition that all eight are dead. - How is this trigger implemented by the game?  Is it a timer, checking all eight sub-conditions every x time units?

OR

I could make eight triggers, each one checking for !(alive) on one tank, and flip a boolean.  Then create a ninth trigger that does nothing but check for all eight booleans to be true.

OR

I could create eight eventhandlers that do the same, and add one trigger that checks for all 8 booleans to be true.

OR

Instead of using 8 booleans, just increment a "DeadTank" counter and have one trigger check the value of the counter

OR

I could skip triggers all together and do this with scripts, using either loops or "@" commands....

So is there any difference between all these options in terms of perfomance?  Has anyone ever done some load testing to see how the various options perform with ridiculous numbers of units in a scenario?

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Performance Questions
« Reply #1 on: 09 Mar 2004, 01:48:10 »
A trigger with condition "this" polls every 0.5 seconds or so.  In other words its equivalent to a loop with a delay of 0.5s.    Otherwise a trigger polls as often as an @ condition in a script, which is like a loop with no delay.

I don't know about eventHandlers in this context.

In any case, checking to see whether a vehicle is "dead" tends to give problems:  they have a knack of looking destroyed when they are not.  Much better is to use

(not canFire tank1) and (not canMove tank1) etc

tied up in a count command to save typing.    Personally, I'd do it with a slow loop (maybe 3s) unless you really, really need the consequence of the 8th one blowing up to happen instantaneously.
« Last Edit: 09 Mar 2004, 10:57:28 by macguba »
Plenty of reviewed ArmA missions for you to play

Kammak

  • Guest
Re:Performance Questions
« Reply #2 on: 09 Mar 2004, 05:22:25 »
The tank example is irrelevent - just used it to show various ways of doing the same thing.  I'm not actually doing anything with 8 tanks, just trying to understand how the script loops, triggers, and event handlers interact with the game.

But I don't understand the line: "A loop with condition 'this'..."

What is that?  By loops I just meant:

    #loop
    ~1
    ? ![some condition] goto "loop"

Is there something else I don't know about?

RE: Triggers and "@" - you say they are just loops with no delay - are you speaking about effect or the actual implementation?

If they are really just a loop with no delay, it would seem prudent to NOT use them as much, and rather go ahead and write a loop as above with delays to save some cycles?  In that sense they are just a scripter's shortcut?  I had hoped one or the other or both (@ / triggers) would actually plug into some kind of event system through the .exe to gain some efficiencies over scripted loops.

Can you elaborate?

Thanks,

Kevin





Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Performance Questions
« Reply #3 on: 09 Mar 2004, 10:57:05 »
Sorry, I meant a trigger with condition "this".

You are correct that it is prudent to be careful when using @.

Never be afraid of using triggers - they are the standard controller in the game.  However, you should of course use as few as possible.

Scripts are an alternative to triggers, however it is sometimes better to use a gamelogic with waypoints.  For example in MP.

As far as I know there is no fundamental difference between @, loop and trigger.   If lag is a problem the answer is slow loops.

Plenty of reviewed ArmA missions for you to play