I like to use a delta with a limit. For example:
frameTime = thisTick - lastTick;
delta = (frameTime > 50 ? 50 : frameTime) / 1000.0f; //minimum 20 fps
That way, there''s no frame rate limit, but it will slow down rather than move large amounts every frame when the frame rate gets low.
-Deku-chan
DK Art (my site, which has little programming-related stuff on it, but you should go anyway^_^)
What do you think?
Here''s a link discussing this topic. It was a "tip of the day" a while back on FlipCode. It''s pretty long, with lots of code, and the people talk about lots of different aspects:
Main Loop with Fixed Time Steps.
Alistair Keys
"There are two kinds of people, those who finish what they start and so on."
-- Robert Byrne
Main Loop with Fixed Time Steps.
Alistair Keys
"There are two kinds of people, those who finish what they start and so on."
-- Robert Byrne
I was developing a game on a Pentium 90. I locked everything - physics, game loop - to the framerate.
I then gave a copy to a friend who had a P3 800. He played it, and hit me.
Superpig
- saving pigs from untimely fates
- sleeps in a ham-mock at www.thebinaryrefinery.cjb.net
I then gave a copy to a friend who had a P3 800. He played it, and hit me.
Superpig
- saving pigs from untimely fates
- sleeps in a ham-mock at www.thebinaryrefinery.cjb.net
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement