Jump to content

Weird Timer Behavior


icp
 Share

Recommended Posts

I'm using  Phaser v2.6.2 .

In my code, I use looping timers created with :

this.game.time.create();

The timers callbacks / functions are working as expected on desktop which runs at 16 ms / 60 FPS.

The issues appear on mobile which runs at 18 ~ 20 ms / 50 ~ 54 FPS. The timers seem to skip some function calls while looping.

I've found a solution to this problem:

this.game.forceSingleUpdate = false;

Now the timers behave as expected on mobile devices but the overall feel of the game is slow / lag / jagged .

So I need to use both timers and :

this.game.forceSingleUpdate = true;

I'm not able to find a solution to this even though I've spent a few days looking into the Phaser core ( Game.js and Timer.js ). I think I need to find a way to synchronise timers with the logic update.

Link to comment
Share on other sites

Hi icp, what is the loop interval? Some drift is normal but it's weird if calls are getting skipped.

On slower devices you could try forceSingleUpdate and reduce desiredFps to 30.

Could you use loop events instead of separate timers? If you have to use timers, make sure you're not creating more than you need.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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