For what it's worth, the original 13kb JS only version[1] does not have these problems.
I was confused for a second why this game made its way to HN again (there's a making of for the game itself from 2018[2]). This seems to be a port of the game to D[3] as a demo for a WASM runtime, Spasm, which is also written in D[4].
[1] https://phoboslab.org/underrun/
[2] https://news.ycombinator.com/item?id=18031024
[3] https://github.com/skoppe/spasm/tree/master/examples/underru...