DX7 framerate problem.
I wrote a simple tetris app with DirectDraw7. In my main loop i keep a frames counter, and also calculate the time since the last call to the main game loop. Everytime the it''s been more than a second, do a simple:
float fps = 1000*totalFrames/accumulatedTicks;
(the multiplication time 1000 is because accumulatedTicks is in milleseconds)
Anyway, i run my program and it spits out a number around 75 fps. After exiting my program i look at task manager and noticed my program took 100% processor usage during it''s duration. Thinking that was strange i was only getting 75 fps using 100% of my P3 600 i put a sleep into my loop. I told it to sleep for 10 milliseconds, and ran my program again. My program remained at 75 fps, and my processor usage dropped to about 50%. Any more than 10 millisecond sleep started slowing down my fps.
My question is why is my fps so low, am i even calculating the fps correctly, and what should i do about this rather unsatisfactory performance?
-Terrax
Hello,
It seems that you have vsync on (it''s on by default I think)..
So, it caps to 75fps because your monitor''s refresh rate is at 75 - try increasing the refresh rate from windows or disabling vsync, that should give you much better results
It seems that you have vsync on (it''s on by default I think)..
So, it caps to 75fps because your monitor''s refresh rate is at 75 - try increasing the refresh rate from windows or disabling vsync, that should give you much better results
This is a programming a dos game in windows issue...
Windows programs are message based, and if you''re making somethere where if you don''t have a message, you go to your gameloop, then you will suck up a lot of processing power that does nothing.
It doesn''t mean You''re actually using a lot of CPU power, it just means that it''s not in the idle loop most of the time, like normal windows programs...
For your particular app, you''re wasting a lot of time waiting for screen refreshes, as stated above, but disabling vsync is not the answer. Sure, you can get a few hundred fps, but what would be the point in a tetris game? What would be better for your computer and such a ''simple'' app would be to get rid of the game loop and instead, use a timer message to control your game speed.
G''luck,
-Alamar
Windows programs are message based, and if you''re making somethere where if you don''t have a message, you go to your gameloop, then you will suck up a lot of processing power that does nothing.
It doesn''t mean You''re actually using a lot of CPU power, it just means that it''s not in the idle loop most of the time, like normal windows programs...
For your particular app, you''re wasting a lot of time waiting for screen refreshes, as stated above, but disabling vsync is not the answer. Sure, you can get a few hundred fps, but what would be the point in a tetris game? What would be better for your computer and such a ''simple'' app would be to get rid of the game loop and instead, use a timer message to control your game speed.
G''luck,
-Alamar
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement