hump.timer is imprecise, so beware

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
dusoft
Party member
Posts: 634
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

hump.timer is imprecise, so beware

Post 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.
pericles
Prole
Posts: 12
Joined: Tue Dec 25, 2018 6:31 pm

Re: hump.timer is imprecise, so beware

Post 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. :)
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 5 guests