caves icon indicating copy to clipboard operation
caves copied to clipboard

Stop Depending on Framerate

Open sunjay opened this issue 7 years ago • 0 comments

Right now everything, including animation, walking speed, etc. depend on the framerate. This is not great because it makes everything quite fragile and it means we can't really adjust our rendering framerate or our physics framerate, etc. Depending on time elapsed is bad in general because time is not always reliable to see how many steps should occur (e.g. if the computer goes to sleep in the middle of a frame).

Some options: https://gafferongames.com/post/fix_your_timestep/

http://gameprogrammingpatterns.com/game-loop.html

May require more research. Better to do this earlier than later when everything already depends on frames.

  • [x] add a debug mode (press "d") that renders the FPS in the top corner. (Measure the time it took to execute the current frame in ms/frame and convert it to FPS)

sunjay avatar Nov 01 '18 22:11 sunjay