Page 1 of 1

hump.timer is imprecise, so beware

Posted: Tue Apr 16, 2024 8:14 pm
by dusoft
I have been using hump libraries including gamestate and timer and they worked quite well.

However once I needed precise timing, hump.timer failed most of the time. Sometimes the tweening transitions were not finished, other times they went further than requested.

Supposedly by the docs for Timer.after function:
There is no guarantee that the delay will not be exceeded, it is only guaranteed that the function will not be executed before the delay has passed.
But also tweening didn't work right.

And that's why I had to switch to Knife instead:
https://github.com/airstruck/knife

Since it has similar function signature, it was easy to convert tweening parts into Knife. Fortunately, timings work well and I have encountered no imprecision.

I am still keeping hump's gamestate around as I am pretty content with that.

I searched for hump's timer having these bugs, but it's not been mentioned, so there is this. Maybe someone else will find this and not pull their hair on why some exact timings don't work for their animations.

Re: hump.timer is imprecise, so beware

Posted: Wed Apr 17, 2024 3:52 pm
by pericles
That's interesting!
I tend to use Hump libraries, but I never noticed the timer thing since I didn't actually need it to be that precise.
Thanks for the warning and Knife recommendation, much appreciated. :)