Weird lags

This is strange to me, because a lot more elaborate games, among others from Ketchap, work better than this jumping square on my phone

Strange. So I guess, can’t help you solve it :confused:

I’m just curious if this example works on your device. Could you please test if for me?

It works, not even bad. I just wonder why when I was using Phaser 2 everything was fine :frowning:

Does it work better when simplifying the config like this:

game = new Phaser.Game({
  type: Phaser.AUTO,
  physics: {
    default: 'arcade'
  },
  scene: [preloader, loader, menu]
})

// remove all of this:
// game.renderer.config.clearBeforeRender = false
// game.renderer.config.antialias = false
// game.config.clearBeforeRender = false
// game.config.antialias = false

How does the game work I posted earlier? (In my first post in this thread)

When starting your game, I have a long lag at the beginning, and then it works at about 35-40 fps
With your confing it is about 5-10fps worse.If I add a html bar, there is already a chapel

I don’t agree with webgl is faster than canvas…
but I think iPhone and in safari or chrome has good performance is OK…
Because webgl need more cpu resource to calculation, but in android, usually has lower cpu rate for JS thread, otherwise, some freak browser maybe cause this problem

Hi @ptaku19,
In my huawai y635 (screen 480x854), in portrait mode I get 60fps and in landscape mode (game size about 1440x854) about 30fps.
The size of the game in the config has a great impact on performance. Therefore, I would first try to optimize that way.
Regards.

As a curiosity in this Phaser benchmark on my computer:
CANVAS:
15700 objects —> 20fps
WEBGL:
15700 to 90000 objects —> 60fps
+90000 objects —> 30fps

On a windows atom tablet, the results indicate that with few sprites, canvas performs better, but as that number grows, webgl far exceeds it.

Do you have a constant 60fps even with faster clicking on the screen several times?

Maybe android studio webview is not the best choice. What do you guys think?

No. When I click many times faster, fps falls down, and if I wait some seconds I got again 60fps. In this case, the problem is the fact of create and destroy and object many times, and the use of a text object.
From the docs:

A note on performance: Every time the contents of a Text object changes, i.e. changing the text being displayed, or the style of the text, it needs to remake the Text canvas, and if on WebGL, re-upload the new texture to the GPU. This can be an expensive operation if used often, or with large quantities of Text objects in your game. If you run into performance issues you would be better off using Bitmap Text instead, as it benefits from batching and avoids expensive Canvas API calls.

Regards.

1 Like