How do I get a constant FPS?

Started by
4 comments, last by LilBudyWizer 21 years ago
Hi! My FPS is a bit too jumpy... How should I do to get a steady FPS? /lazy
Advertisement
Fix it.
ahh thats helpful ap.

you could vsync your output, or just clamp it to it''s lowest value (by not rendering until a certain time has passed)


This room is green
Why do you want a constant FPS?

Surely you're better off letting things run as fast as possible.

Or were you asking how to do time based (frame rate independant) movement, rather than relying on a steady FPS to acheive a similar effect?

Regards

[edited by - Shag on April 1, 2003 8:11:33 AM]
Yeah, you can''t achieve a constant FPS (unless you have it constant at around 0.1fps, which all machines can achieve - albeit turning your game into a very boring slideshow in the process).

What do you mean by ''jumpy?'' If things keep moving at different speeds, then you need to uncouple the game''s physics from the framerate (''framerate-independent movement''); if things are moving ok but the game just appears jerky, then you need to optimise your graphics system (cut down the number of polys you are drawing, and make the ones you''re still drawing simpler to draw e.g. by batching your triangles).

People here should be able to help you out with either one...

Superpig
- saving pigs from untimely fates, and when he''s not doing that, runs The Binary Refinery.

Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse

Unless you mean it drops into unacceptable ranges. If so then profiling is the best path. Add a structure of counters. One of the main things you count is time and use the performance counter to do that, i.e. QueryPerformanceCounter. When you enter a routing get the time, at the end get it again and add the differance to the counter for that routine. You don''t want to get carried away and do every trivial function. Rather start at the frame time then add additional ones to break that time down, i.e. update, render, etc. There are major things you do in a program. Count those as well, i.e. polygon counts, number of objects, etc. Just keep accumulating the count.

Then periodically log that structure to disk. The frame gives a logical time to do that. You then use a seperate program to calculate the differances and detect wraps. If one reading is less than the previous one then you wrapped and you have adjust the count accordingly. Finally load that data into a database like Access. Split your data according to a threshold on frame rate/time. Then compare and contrast the same groups. As an example do the slower frames have a significantly higher average number of polygons or objects.

Done right it is a trivial amount of work added to a program. So you always leave it running and it is just a matter of whether you actually log the information or not. You can add a mailbox for turning it on and off as you are running along with a simple console application to send a message to that mailbox saying which and where.
Keys to success: Ability, ambition and opportunity.
It''s better to leave it normal and use time based movement. Don''t worry about it, except if you don''t want to use time based(which is not to complicated) it''s better to leave the FPS as is.

This topic is closed to new replies.

Advertisement