Jump to content
  • Advertisement
Sign in to follow this  
LamerGamer

Frame Rate Qualms

This topic is 4814 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'm creating a game in Dev-CPP using the allegro library. My game has a framerate of 400 fps, unless I add a rest() function; I'd like to regulate fps to 60. My concern is that if this game is played on different computers w/ different graphics cards, RAM, processor speed, etc., the value passed to the rest() function would have to change, based on the computer the game is being played on. What's the procedure for determining the value to be passed to the rest() function? Is there a way to read the computer's processor speed, graphics card type, RAM, etc, then calculate the value needed to pass to rest() to ensure fps remains at 60?

Share this post


Link to post
Share on other sites
Advertisement
[pseudocode]
time_per_frame=1.0/60.0;

time=Get_Current_Time();

while(gameloop)
{

while(Get_Current_Time()<time+time_per_frame)
{do_nothing()}

Render_Scene();

time+=time_per_frame;

}
[/pseudocode]

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!