Skip to main content
GameDev.net gamedev.net
🔒 Locked

Frame Rate Qualms

Started by LamerGamer Jun 12, 2005 at 2:45 AM 2 replies 1.3k views
Original Post
LamerGamer
LamerGamer
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?
xor
xor
[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]
LamerGamer
LamerGamer
What would the Get_Current_Time() function do?
xor
xor
It would Get the Current Time.

You may want to look up GetTickCount().

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.