Find a way to bring FPS to exactly 70
Opened this issue · 1 comments
soulweaver91 commented
Right now, the core timer is based on QTimer
. It only supports intervals rounding to whole milliseconds, so effectively there is a new frame every 14 ms instead of the desired ~14.29 ms, resulting in an effective FPS of ~71.43.
There should be a way to bring this to exactly 70 FPS. (Ideally, game logic loop should be separated at some level from the graphics loop anyway – right now they are tied together very closely.)
soulweaver91 commented
Attempted some approaches:
- Custom while loop, instead of relying on a
QTimer
, and sleeping withQThread::usleep
with timekeeping byQElapsedTimer::nsecsElapsed()
. The loop ended up going from too fast to too slow. - Altering the
QTimer
between 14 and 15 ms, again keeping time withQElapsedTimer
. It managed to slightly drop the FPS to a relatively stable ~71 (14.05 ms/frame), but that still isn't good enough to claim it runs at 70 FPS.