Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#1 FPS too fast = super slow game

open
nobody
None
5
2015-03-13
2010-04-18
pocdn
No

The Game_main loop runs so fast that FPS is is incorrect -- appears that game runs super slow.

Fix on Linux: sleep so 60FPS ie 1/60*1e6=16666

in game.c:
#include <unistd.h> // ADDED to fix FPS problem

void Game_main ( void )
{
while ( Handle_events() )
{
/* get start-time of current frame */
gv->msec = Timer_msec ( gt );
gv->ftime = (double)gv->msec/1000L;
gv->fps = 1.0 / gv->ftime;
gv->fadjust = gv->rfps / gv->fps;
usleep(16666); // ADDED to fix FPS problem

(*Game_actionfn)();

Update_display ();
}
}

Discussion

  • Indeed, the game runs super slow.