Sign in to follow this  
icp

Weird Timer Behavior

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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

I have two timers. One runs at 1000 ms and another at 2200 ms. I'm arleady using loop events. I would not like to limit the performance at 30 FPS since besides this minor issue everything runs smooth.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.