Jump to content
  • Advertisement

Archived

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

colinisinhere

limiting frames per second

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

In some games like MoH:A, It limits the fps to a certain number so it wont overheat... well, i was wondering how i can achive that, i want my program to run anywhere under 150, how can this be done?

Share this post


Link to post
Share on other sites
Advertisement
if(CurrentTime-LastTime >= LimitTime)
{
Render();
LastTime = CurrentTime;
}

where LimitTime is LengthOfSecondAccordingToTimer/MaxFPS.

You can do physics, ai, input, etc. outside this if. Otherwise this loop will likely occur hundreds of times without it ever doing anything.

[edited by - Erzengeldeslichtes on September 21, 2003 7:16:20 PM]

Share this post


Link to post
Share on other sites
''overheat'' ?


I do it like this:

Have a counter that is incremented by the time between frames... When the counter hits a certain number (say 1/60) you carry out your actions and reset the timer.

I only use this for updates/renders, giving me spare ticks to do other things, like VMs and AIs

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!