FrameRate Control
I am using D3D8.1 to draw 2d primitives, the frame rate
varying from 42 to 60 fps(display refresh rate is 60Hz),
I wish to make it constantly at 30 fps, How to realize it?
I draw many line strips, how to make the line wider than
one pixel?
Hui
(please also reply to huili0154@163.net)
Why do you want to limit the framerate?
In D3D, there is no way to set line width. You can either draw lines as polygons or draw many lines slightly offset from each other.
In D3D, there is no way to set line width. You can either draw lines as polygons or draw many lines slightly offset from each other.
I assume this is something like your code:
while(NoQuitAction)
{
GetPlayerInput();
AdjustEnvironment();//Move character based on input, do ai
Render();
}
Two solutions:
Change AdjustEnvironment() so that it is frame indpendent
(Check
Achieving Frame Rate Independent Game Movement ).
Or put a frame limiter:
int lastRender=GetTickCount();
while(NoQuitAction)
{
while(GetTickCount()-lastRender<1000 div 33) {};
lastRender=GetTickCount();
GetPlayerInput();
AdjustEnvironment();
Render();
}
Edited by - Michalson on February 8, 2002 10:12:41 AM
while(NoQuitAction)
{
GetPlayerInput();
AdjustEnvironment();//Move character based on input, do ai
Render();
}
Two solutions:
Change AdjustEnvironment() so that it is frame indpendent
(Check
Achieving Frame Rate Independent Game Movement ).
Or put a frame limiter:
int lastRender=GetTickCount();
while(NoQuitAction)
{
while(GetTickCount()-lastRender<1000 div 33) {};
lastRender=GetTickCount();
GetPlayerInput();
AdjustEnvironment();
Render();
}
Edited by - Michalson on February 8, 2002 10:12:41 AM
G''day!
Please don''t use a frame limiter. Using a time scale (Frame Independant) is much better. For example, if someone runs your game on a system that''s slower than your test system (periodically gets LOWER than 30FPS) then you game will not run properly since your timing is locked to the frame rate.
Stay Casual,
Ken
Drunken Hyena
Please don''t use a frame limiter. Using a time scale (Frame Independant) is much better. For example, if someone runs your game on a system that''s slower than your test system (periodically gets LOWER than 30FPS) then you game will not run properly since your timing is locked to the frame rate.
Stay Casual,
Ken
Drunken Hyena
aw man! I just fixed the bloody ship movement and now I have to re-write it again!!!!!
Everything is measured in frames, which is 10 minutes in game time! and each starsysyem has a different pixel sacle too
maybe i will just use all floats, where 1 = 1000 KM and have a time scale as suggested
now I have to re-write the game and editor, and scale everything. sounds like fun
I like using lines, it looks sorta retro...
Everything is measured in frames, which is 10 minutes in game time! and each starsysyem has a different pixel sacle too
maybe i will just use all floats, where 1 = 1000 KM and have a time scale as suggested
now I have to re-write the game and editor, and scale everything. sounds like fun
I like using lines, it looks sorta retro...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement