Jump to content
Sign in to follow this  
Indomitus

question for the devs about Timers vs Delay loops

Recommended Posts

Lately I've been using the Delay command to create timed loops that are completely internal to an object, no external code needed.  I know that it would still not be good to have a loop timed to 0.03 or anywhere near it, just like with the timers.  My question is this:  Under the same conditions, would one method be better than the other?  Would it, for example, be more resource intensive to have a loop built into an Entity Storage that is attached to every player, or a single timer object that sends a command to each player's ES to run the same logic in a FOR EACH loop.  I've heard that Timers are currently considered unreliable in online MP, but I haven't done much testing of my logic online (yet).

Not to get too technical, but I worry about how it might affect the stack if the loop runs for too long with a procedure essentially calling itself each time, even if it is the very last line in the sequence.

(And just to make sure I mention this:  My Delay loops normally have some way to activate and deactivate them, built in.)

Share this post


Link to post
Share on other sites

Hi, in fact "delay" internally creates Time trigger and after it triggers it is "destroyed" (used by another Delay instruction) Time triggers are probably little more effective (because delay is "Something" + Time trigger) but I would not choose between them from the view of performance. I would use the one which would make code clearer.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×