Be aware of timer! (similar to a bug)

All topics about ZGameEditor goes here.

Moderator: Moderators

Post Reply
kattle87
Posts: 402
Joined: Wed Sep 26, 2007 9:06 am
Location: Italy

Be aware of timer! (similar to a bug)

Post by kattle87 »

Suppose one of you wanted to use a timer for moving an object at a certain speed.
JUST DON'T DO IT.

The reason is: if you have a timer event let's say every 0.01 secs (means 100 times/sec) and you have the VSync turned on, the max FPS is 60. Actually, the timer seems to be called only once for every frame even if it has expired 2 times.

EG:
-you are playing at 50 FPS;
-you expect your timer doing something 100 times per seconds;
-you get your timer triggered only 50 times per second;
-speed is divided by 2 :( or whatever else like adding scores, every kind of calculations and so on.

This should be fixed by calling the timer untill he has been triggered all the times it should have. I know that it is risky because you can fill the CPU, but this should be the way it was intended to work I think :P :P
However it is not high priority: I was using this kind of speed only for testing a project.

And I wasted something like 35 mins on it :/ :P
Post Reply