Framerate, FPS stabilization for tween times

Recommended Posts

Hey hello together :]

I'm currently working on a online presentation using a lot of dynamically driven graphics, filters et cetera.

Now i recognized that tween time (by ms) is not stable between different devices.

So on a very slow device with ~13 fps, 10 (60 fps) seconds will only be like 3 seconds or so. So the 10min presentation is over in 3 (lower fps = faster animation)

Its no problem to drop support for such devices, but still I need a way to stabilize the time of tweens for 30 - 60 fps devices.

I wanted to ask you guys what methods are u using to get a better time () behavior?

Should I better use time by frames?, but then it would just change to the approx switched scenario (low fps = slower animation) if i got it right .

Katy

Share on other sites

I'm sorry but I fail to understand why would a tween that is set to last 10 seconds will only last 3 when viewed on a good (60fps) device, and I don't think that is the case. What I would expect to happen (on a slow low fps device) is for the animation to skip frames and go from point A to point Z by skipping some in-between points but still end up on Z in 10 seconds.

Unless I fail to understand your statement.

Share on other sites

I'm sorry but I fail to understand why would a tween that is set to last 10 seconds will only last 3 when viewed on a good (60fps) device...

Yeah you understood me wrong :]

On a normal device with 60fps the tween takes the expected time of 10 seconds to complete. But on bad devices with slower fps the time for X to Y is a lot shorter.

Expected behavior is that the time for the tween keeps the same, no matter what the fps of the device is... But that doesn't work.

Maybe its a bug :/

Of course I know how to change to frameBased, that wasnt the question...

Question is if there are other better solutions for the problems .

However I will try changing it to frame based at the evening .

Share on other sites

A tween programmed to execute for 10 seconds should run for 10 seconds, regardless of the device / performances. If not, then it's a bug IMHO.

Share on other sites

That's what Phaser.Tween#frameBased is for, so we don't have to argue.

Can't we all just get along??!!?

Share on other sites

@drhayes
I dont know if anyone has said anything bad or "unethically", or flamed you but if it is so, i am sorry!

But its should not be a problem to ask questions without getting re-asked "to get along", but if you really want this emotional discussion, this forum is not the right place for it.

For everyone else thanks a lot for your help!

I will try out the frameBased option as already mentioned *___* and give feedback later this evening.

Edit:

I tried it out but only with the 10 FPS device. Wondering how it will be on the 60 FPS device (Update comes later)

However:

The text at http://phaser.io/docs/2.4.3/Phaser.TweenManager.html states:

"If the Tween uses a time based update (which is the default) then the duration is given in milliseconds. In this situation a 2000ms tween will last exactly 2  seconds, regardless of the device and how many visual updates the tween has actually been through. For very short tweens you may wish to experiment with a frame based update instead."

So the time difference betwenn lo and high fps devices (with time based update) really looks like a bug, and I will probably add a github issue in a week or so, if no one knows what it is

Share on other sites

Sorry, I was kidding. I should've added the   after what I wrote.

Share on other sites

Sorry, I was kidding. I should've added the after what I wrote.

Saying it with the words of teal'c:

"Indeed"

Share on other sites

• 6 months later...

Hello There, I am having the same problem with my game.

I have a tween that has a duration of 800 milliseconds doing a change on the "y" property of a sprite. On desktop takes exactly 800 milliseconds  to finish at 60 fps, but on mobile devices, also at 60fps the tween runs slower, it takes like 1200 milliseconds to make the distance. The time.elapsed variable has the same value on both desktop and mobile, that is 16 or 17.

I solved the problem using game.forceSingleUpdate = true, but the tileSprite background started to autoScroll at very different speeds across devices.

Is there a clean way to make tweens behave properly across devices without using game.forceSingleUpdate = true?