• Advertisement

Archived

This topic is now archived and is closed to further replies.

Slow down, man!

This topic is 6531 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How d'you keep a game playing at a constant speed, regardless of the computer it's running on? I saw some sort of explanation in the Allegro doc, but that doesn't communicate much to my gray load. I also thought of checking the CPU speed and then timing the rendering to get a consistent speed... Comments? Edited by - abe_bcs on 4/6/00 1:50:30 AM

Share this post


Link to post
Share on other sites
Advertisement
Please, search this forum. This topic has been explained several time before.

============================
Daniel Netz, Sentinel Design
"I'm not stupid, I'm from Sweden" - Unknown

Share this post


Link to post
Share on other sites
um...at the beginning of a frame/game loop start a timer/collect the system time:
start_time = getSystemtime()

At the end of the frame/game loop:
time_passed = (getSystemTime() - start_time)
while(time_passed < num_of_miliseconds_per_frame)
{}

note: I made up those variables and functions, so don''t try to just type in getSystemTime().....unless I made a great guess.

you can figure out how many miliseconds by deciding on how many frames per second you want. For example, 30 fps would be 1,000,000 miliseconds / 30 = num_of_miliseconds_per_frame.

Of course, for this to work, you need a timer that is accurate in miliseconds.....



"Why am I the only one on the away team with a red shirt!?"

BASSOFeeSH
><>

Share this post


Link to post
Share on other sites

  • Advertisement