Archived

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

fps - more or less...

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

Speaking of framerate, sometimes its a good idea to lock it at a certain value (to prevent screen artifacts, etc). But what''s a good way to go about this? Currently, I am using the system (performance) timer to update the screen at a set time interval to keep the FPS under control. Once every frame, it calculates the FPS based on the current time and the previous time (when the function was last called) and if it finds that the framerate is too fast, it goes into a loop until the fps is under control, and then returns so that the frame can be rendered. It works just fine, but if I lock the framerate to anything less than 175 (depending on how many triangles are drawn), I notice a jerky movement of the geometry. Its just not as smooth as it is without the limitation... there is some clipping of polygon edges and the like. Anyone know of a good algorithm for locking the framerate that doesn''t exhibit this problem?

Share this post


Link to post
Share on other sites
u should only have a fixed frame rate on a fixed system eg psx never on a pc. render the frames as fast as possible u might though wanna update the logic at a certain number of fps though

http://members.xoom.com/myBollux

Share this post


Link to post
Share on other sites
OK. I''ll skip on the FPS limit then. But how do I get rid of the clipping without turning on V-Sync? If I have a simple scene, the framerate goes through the roof and everything looks messed up b/c the monitor cannot refresh that fast!

Share this post


Link to post
Share on other sites
What i''ve always done is base your movement calculations on the performance counter. That way the computer will crank out the frames as fast as possible, but everything will move at a consistent rate. This would also free up time that would be wasted in a "do nothing" loop, leaving time for more realistic physics and AI calculations.

Use the WriteCoolGame() function
Works every time

Share this post


Link to post
Share on other sites
I know this doesn''t answer your question but is there a reason why you don''t want to use V-Sync?

175 FPS is overkill. There was a good article on flipcode about this recently. Studies have shown that the human eye cannot distinguish more than 72 frames per second. It was originally believed to be around 30ish but that was based on the fact that most movies are made at less than 30fps and TV signals come through at around 30fps. But they use motion blur which makes it seem smoother. In games you want everything to be crisp each frame since it is interactive, but striving for framerates above 100fps does nothing more than give you the right to say ''it runs at over 100fps!!''... nobody will ever know the difference unless you have a FPS counter on the screen.

But basically if you want to limit the framerate yourself and want it to be as smooth as possible, first query your hardware to find out the refresh rate of your monitor at the resolution you will be running at, and lock your framerate to a multiple of your refresh rate. So if your refresh rate is 70Hz, you can get away with locking it at 70, 140, 210, etc... and escape with minimal artifacts (regardless there will be SOME minor artifacts if you go over the refresh rate...basically you are drawing to the framebuffer at the same time the framebuffer is being converted to screen data which causes what you are drawing now to appear partially over what should be displayed.


Seeya
Krippy

Share this post


Link to post
Share on other sites
Wow, I go away for a couple days b/c I thought this thread was dead, and then it just springs back to life one day

Thanks for all the replies so far!

Krippy, its not really that I don''t want to use V-Sync, its just that I don''t know how to turn it on from my program. Its a pain turning it on and off from my card''s settings. I''d leave it on, but there are some games where I like the FPS to run free... not that I can notice the difference like you said, but staring at the FPS counter makes me feel good! The state of mind is: "gimme what I paid for, dammit!"

My movement is time based, nothing more I can really do about that. I always use glFinish() - (I don''t know what, but I''ve got something against using glFlush()-- is it bad?) So I guess I''ll try to keep in tune with the monitor.

Share this post


Link to post
Share on other sites
Ok, so high frame rates are good. But I personally think that the aim of the games programmer is not necessarily to achieve high frame rates.

If you write a level renderer that runs at 160fps, that''s great, but for me the idea of writing fast, optimized code is that it allows you to add more features. For example, mirrors, particle systems etc.

At the end of the day I would be more impressed with a game that has more features and eye-candy than one with a high frame rate. Besides, as the average system spec rises, the frame rate for that game will increase.

Share this post


Link to post
Share on other sites
Indeed, that is quite true. But its also a problem. If you have a scene that is very simple (only a few polygons), then your framerate is going to be progressively excessive as system specs change.. which causes problems (at least for me).

I''m thinking of writing a small utility to toggle V-Sync for my hardware and keep it handy on my desktop. If only I knew the right function calls to make ;(

Share this post


Link to post
Share on other sites
Hi!!

Just thought i''d pop in...

We are using a FPS lock to control the model animation in our
game engine....

That way the animation won''t look good on a slow fps (<60),
but we don''t have to worry about the animation going trough
the roof on a super computer!! Cause when the fps passes 60 fps,
the model interpolation stoppes there! (making animation syncronized with speed and sound!!)!!!

Hope this could help a little...

Take Care!

- -- ---[XaOs]--- -- -

Share this post


Link to post
Share on other sites