Page 1 of 1

Timer

Posted: Tue May 04, 2010 10:36 pm
by y offs et
Is this a bug?

Posted: Wed May 05, 2010 1:53 pm
by VilleK
I don't get it, is the timer not executing once per frame? Since the fps-interval setting isn't guaranteed to take exactly 1 second per frame (there will always be small deviations depending on Windows timer resolution), the timer will probably sometimes skip one frame and execute the next. If you want it to execute once per frame, try setting it to 0.95 or something like that.

Posted: Wed May 05, 2010 2:45 pm
by Kjell
:!:

You shouldn't use the Timer Component for precision critical behavior. Attached is a example of a frame-independent timer ( top ) versus the Timer Component ( bottom ) both running at a interval of 0.125. The framerate is automatically varied in the 10-30 range.

K

Posted: Wed May 05, 2010 3:20 pm
by y offs et
OK, whatever. I just came across this while trying to fine tune my animation.
It doesn't matter how many frames per second - at timer 1 second interval, it updates once for every 10 position updates. Here it is running at 5 frames per second. It just looked like a misplaced decimal point somewhere.

Posted: Wed May 05, 2010 3:48 pm
by Kjell
:roll:

ZGameEditor's time delta has a limit of 0.1. This means that as soon as the framerate drops below 10 fps your application starts slowing down* So it's not a bug .. although it would be nice if the threshold was a property of App ( so you can increase it for debugging purposes like yours ).

*For example, your character itself doesn't move as fast as it does with any framerate above 10 either.

K

Posted: Wed May 05, 2010 5:12 pm
by y offs et
Well, I kinda understand.
The fix appears to be don't debug below 11 FPS.

EDIT - With this you can

timer.interval x 4
steeringController.maxSpeed / 4

or something like that

and get a close look to get the best possibility under these circumstances.