Jump to content

Tween and Animation Issues on slow machines


Recommended Posts

Hi all and thanks for reading.

Me and my team are working with Phaser ,creating Games 9 months now.

Recently we have encountered a problem when running our games on slower machines.

It seems like that when we are trying for example to run a tween(moving an object from a spot to another) , the slow PC is unable to demostrate the actual tween and the object just jumps to the final position.

From what we understand when we say to the tween to complete in 600ms, the slow machine in not reacting accordincly. Maybe it takes like 600ms for the slow PC to proccess the script and thus the actual script when it starts, 600 ms have allready passed , moves to the final position.

Is there any way to deal with this with the timers?

Any help whould be great.


Sorry for my bad english and thanks in advance!



Link to comment
Share on other sites

What phaser version are you using? The current 2.2.0 release canidate contains some awesome changes for tweening. Especially on slower machines.

Hi and thanks for responding.

Today we will upgrade Phaser version and research further for a solution.

If anything comes up i will update the post.

Link to comment
Share on other sites

After many tests it seem 2.2 is really nice and helped a lot with the fps drops overall.

Me and my team ralized that using a background image on canvas was causing huge fps drop.

It seems like phaser renders the image over and over again while the game plays for some reason.

So instead we will be using bg as dom object and later on we will try to implement double canvas teqnuiqe.

Again thanks for reading and any more tips whould be usefull.

Link to comment
Share on other sites

Check out the desiredFps variable (renamed recently?) and the fpsProblemNotifier.  These are designed specifically for your use-case where a system can't maintain a steady 60 fps.  The problem notifier is a callback that happens if the game is frequently dropping frames to the point where it will start to look bad... a very simple way to use it would be:

game.fpsProblemNotifier.add(handleFpsProblem, this);function handleFpsProblem() {// modify the game desired fps to match the current suggested fpsgame.time.desiredFps = game.time.suggestedFps;}

This will drop the fps down to whatever the system has been managing to maintain over the last second or so.

A couple of caveats:

- don't set this until the game is actually running, you probably don't want the game fps to drop just because the titles are running slowly (alternatively, reset the desiredFps when the game starts so this can drop it again if the game is running slowly as well)

- this implementation only notifies when the actual fps is lower than desired, so it won't ever shift upwards.  Again you could reset it manually, or try a slow increment to try to find the ideal balance point for your game on the current system.


An alternative implementation might be to detect the callback and just drop the desired fps to 30.

Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...