Download

Question about optimising with timers vs. ticks

I’m going through my project trying to optimise, and trying to take everything I possibly can off tick, mostly by using looping timers set to loop on a time interval that seems to make no discernible visual/mechanical difference.

For example:

Ticks_v1.jpg

What I’m wondering though, is whether setting them all to loop on 0.02 seconds means all these 3 events will fire on the same frame, or whether the tiny amount of time between the timers starting (am I even right about that?!) means that they will fire on slightly different frames (which is what I want, so that I can spread out the updates over a few frames)?

If I want to spread things out, is it necessary (or just better) to do it like this:

Ticks_v2.jpg

So instead of everything having a 0.02 second loop, it’s 0.02, 0.021, 0.022 etc.

The problem with doing what you’re doing is that they will eventually overlap with each other (think frequency harmonics). So every X number of loops through, the 0.02 and the 0.021 will overlap and so on so forth. If you really want to add a slight delay between them all firing off, add in a delay of ZERO between each one of them. Delays of zero give you a single frame delay.