Delta Time Bug-Fix


I noticed an interesting bug in the HTML5 build while I was switching tabs in chrome. The player seemed to be falling through the floor when the tab was out of focus. My first reaction was to sit and wait for the player to fall, which of course was futile. I then realized the bug had to do with the way I was handling Delta time. The game's speed is frame-rate independent, so the game uses the length in time of the last frame to determine how far the player should move. What I didn't anticipate is that when you switch to another tab in chrome the game automatically pauses, and gamemaker interprets this as one long frame, so when you switch back the Delta time value is way higher than it would ever be if you were playing normally. To fix this issue, I simply placed a cap on the Delta time value using a minimum acceptable frame rate which I determined to be 45 (raised from the original 30) based on testing with the current player gravity etc. In future updates the game will calculate this value itself on start, but it works for now.

Files

hex_HTML5.zip Play in browser
Jun 25, 2020
hex_WIN.zip 1 MB
Jun 25, 2020

Get hex

Leave a comment

Log in with itch.io to leave a comment.