Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You'll have small variations at higher framerates too. Why not just avoid variation in this altogether? It's almost no extra work, and it makes things more consistent.


You're also using floats to store the values. This seems silly and looks like it will be slightly slower to calculate.

Unless your game is running like garbage this will not matter. You are talking about a dt of something like 1/30 or 1/60


There's a large difference in feel between 30 Hz and 60 Hz. So much so that some devs will be absolutely inflexible about dropping below 60.

Also, it's very important to people's perceptions of performance (whoa) to maintain a consistent frame-rate. The variations are much more noticeable than the absolute rate. Finally, on lots of hardware, you can't actually display at 59Hz, say. You'll either be at 60 or 30, and will oscillate between the two in a most annoying way.


Floats are actually much faster than integers.


That is my point. You are sacrificing the accuracy of a double for the speed of a float.

You are already storing all these values in floats which is inherently inaccurate. Also if the dt becomes very large you have bigger problems than gravity anyway.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: