Problem:
My game currently lags pretty bad at some points.
The game is still getting 60FPS meaning that the actual speed of the game slows.
I think this is making the lag appear worse than it actually is (I hope).
I know I have to time the frames and somehow drop frames.
What I want is the frame rate to drop to allow the processing to catch up.
How do I go about doing this?
I have something to regulate FPS >60 down to 60: while (fps->get_ticks() < 1000 / FRAMES_PER_SECOND)
{
while (world0->taskPerform()==false) {}
}
Now I need something to check weither or not the time has went over 1000 / FRAMES_PER_SECOND right?
while (app_is_running)
{
// the condition must be chacked each frame because the application is already a loop.
if ( (get_ticks() - last_ticks) > 1000/FPS)
{
update_state_without_drawing(); // Updates whatever data
last_ticks = get_ticks();
}
draw_either_scene_changed_or_not(); // Draws everything each frame, if it didn't change it'd look the same for some milliseconds.
}
I let the program render flat out and regulate things by checking the time since last frame.
So, on a basic scene my rig can put out 8000 FPS and another PC might do 1000 to 2000 FPS but the timing is still fine and objects move at the same rate on any system.
I let the program render flat out and regulate things by checking the time since last frame.
So, on a basic scene my rig can put out 8000 FPS and another PC might do 1000 to 2000 FPS but the timing is still fine and objects move at the same rate on any system.
I have noticed dropping frames really causes no speed-up what-so-ever.
Can you elaborate more on your method, or post some source?