Advertisement

fps? right or wrong?

Started by March 21, 2000 08:30 PM
5 comments, last by +AA_970+ 24 years, 8 months ago
can someone please tell me if my method for getting the fps of my game is correct. I have a function called Get_FPS that i call at the end of my game loop (after everything has finished drawing to the screen). The function is as follows (I inserted the comments to make it easier to understand what i''m doing): void Get_FPS(void) { //1 frame has been drawn, increment the fps counter fps_count++; //get time to see if 1 second has elapsed fps_time2=GetTickCount(); //If 1 second has elapsed...then if(fps_time2-fps_time1 >= 1000) { //set time1 to the current tick count fps_time1=GetTickCount(); //"Give" another int the value so the //display does not show 0 when fps_count is //reset. fps=fps_count; //Reset fps_count and get fps for the next //second that elapses fps_count=0; } } Am i getting an accurate fps value?
AA,

I suggested one method of finding the FPS in another post by ''Psychoprog''. I think you can find it if you do a search for ''FPS'' or ''FPS Control'' on this forum. That will save me typing it again.

Regards,
Paulcoz.
Advertisement
i''ll look into your method but is my method right or wrong?
It looks to me like that code should work fine
It looks to me like your version looses something. You are counting the number of frames every (1000 + x) milliseconds and then throwing away the ''x''. I would reset fps_time1 to fps_time1 + 1000 make sure that the extra time above a second doesn''t get lost.

- Brad Pickering
http://home.earthlink.net/~uubp/
Home for organically grown games
- Brad Pickeringhttp://home.earthlink.net/~uubp/Home for organically grown games
What you have there is fine. For more acuracy, you may want to let it go for 5 seconds before you calculate.

But most importantly, don''t even worry about framerate. If your game looks good, fine. If not, change your code.

-Michael
Advertisement
So, Michael, if I have a game running at 0.1 fps on a Cray, and it looks photographic, everybody''s going to buy it?

Say whatever you want, but people hate games that only run at 5 fps out of even fast processors. Watch the frame counter carefully. And test it on somewhat slower computers, also. Consider carefully what you want your audience to be. Also consider giving the user a way to control the detail of your game. Trust me, they''ll be much happier.

-CobraA1

This topic is closed to new replies.

Advertisement