Any ideas how to limit DX9 FPS?

Started by
35 comments, last by Ilankt 20 years ago
quote:Original post by Kafeen
Somehow I''ve managed to lock mine to my monitor refresh rate without even trying. Any idea what I''ve done and how I can undo it so I can check how my app''s running?


Yes, you followed the advice I posted way back at the beginning of this thread. ie: setting the present interval.
Advertisement
quote:Original post by Fuzztrek

I've found that most people don't know about anything other than limiting the frame-rate. Even I thought that was the only way to go about it, and after posting here many people told me to do that. However, other made valid points against doing so, and I think everyone learned from that post. Educating people about other (better) methods seems more worthwhile, to me at least. Theory is a large part of programming. You could argue that it is against my ethics to blindly give out solutions (not saying that I have all the answers, not at all.)

[edited by - Fuzztrek on March 30, 2004 5:38:52 PM]


Agreed. I was just casually stating that since his true reason of wanting to limit the FPS, and it's ultimate purpose wasn't stated, to conclude or theorize on his motive for doing so is generally bad. If he did want to limit it to some locked number (say, 15fps) he would have to use some sort of time-dependent stalling procedure. Hell, I did and it pointed out a huge flaw in my collision code that I probably wouldn't have found until much later. It would have taken me a while just to troubleshoot the reason too had I not known what I did to cause that jump in error. If he wanted to be in frame synch or scale movement speed,etc. then yes, it would be more sound to use time based movement control. It's a little tricky in some cases, and he/she may want to research the fixed time step based physics algorithms too if he/she feels so inclined.

This is one of those times where it's necessary to include a reason for doing what you're asking, so that the people here can properly understand your predicament and remedy it without inner-arguing

[edited for clarity]

[edited by - sordid on March 31, 2004 12:59:47 PM]
quote:Original post by Namethatnobodyelsetook
quote:Original post by Kafeen
Somehow I''ve managed to lock mine to my monitor refresh rate without even trying. Any idea what I''ve done and how I can undo it so I can check how my app''s running?


Yes, you followed the advice I posted way back at the beginning of this thread. ie: setting the present interval.


Cheers, I hadn''t set it in the present parameters so it defaulted to that.
Here''s what I do...

Use as much CPU power as I need with time based movement. At the end of the loop I do sleep(0). This gives only as much time to other threads as they need (which isn''t much if it''s just minimizing a window or something) but never more than their alotted space.
____________________________________________________________AAAAA: American Association Against Adobe AcrobatYou know you hate PDFs...
quote:Original post by Raloth
Here''s what I do...

Use as much CPU power as I need with time based movement. At the end of the loop I do sleep(0). This gives only as much time to other threads as they need (which isn''t much if it''s just minimizing a window or something) but never more than their alotted space.

I do that too, but Sleep(0) only gets called when my game isn''t the foreground window. It works pretty well.
In general, as long as your game has focus, you should eat every last cycle that CPU has. You should, however, detect when your app is no longer the focused one, and at that point back off. The best way to do this is to fall away from PeekMessage and use GetMessage instead, listening primarily for a WM_ACTIVATE or WM_ACTIVATEAPP. This will tell you that you''re ready to go again, and at that point you can go back to PeekMessage and 100% CPU.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Well, judging from how the game industry handles this, i have come to the following sollution.

1. If the game can run in windowed mode, manage the fps so other apps can run fine at the same time.
2. If the game is turnbased, then it is ok to manage the fps.
3. If the game is a realtime game, then dont manage the fps, let the system manage processor resources instead with your app
set at the highest priority.

Other than that i pretty much think it is up to everyone how they want to handle it for their app. Using the Sleep(0) at the
end of the gameloop is ok as long as it dont degrade the quality of the game. Otherwise use timers to decide animation
speed and other things that must happen on even intervals.

Allmight.
-------------------------------------------------Founder and DirectorAllSoft Studios

This topic is closed to new replies.

Advertisement