Jump to content
  • Advertisement
Sign in to follow this  
chadsxe

What is a better way to govern FPS

This topic is 3806 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

I am trying to figure out if eaither of these methods are a better way to govern FPS. Each sits in a function that is called every cycle through the main loop. Method 1: bool cApp::Frame(){ static DWORD starting_point = GetTickCount(); while ((GetTickCount() - starting_point) < MIN_ELAPSED_MS); //.... } Method 2: bool cApp::Frame(){ static DWORD UpdateTimer = timeGetTime(); if(timeGetTime() < UpdateTimer + 33) return true; UpdateTimer = timeGetTime(); //.... } Regards Chad [Edited by - chadsxe on January 15, 2008 6:42:40 PM]

Share this post


Link to post
Share on other sites
Advertisement
I want a steady frame-rate.

EDIT - I don't "have" to do it the ways I demonstrated. This is the only methods that I know well enough. The main requirement is that it can reside with-in one function.

Share this post


Link to post
Share on other sites
If you do cap your frame rate - and it's not a particularly bad idea, especially if you want to have movie-like cutscenes at 24fps - make sure the only thing you skip is rendering. I would avoid skipping AI/Physics/sound/animation/input etc if you do skip a frame of rendering.

Share this post


Link to post
Share on other sites
You may have already tried something along these lines, but try a search on gamedev for:

variable frame rate

It turned up a few good threads.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!