phaserjs / phaserjs/phaser

Performance Issue on low end mobile devices

Open
#6,989 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

🎞 Animation 📱 Mobile
Dominant language
JavaScript
Stars
40.3k
Forks
7.2k
PR merge metrics
No merged PRs in 30d

Description

  • Phaser Version: 3.87
  • Operating system: Android
  • Browser: Chrome webview

Description

I'm using Phaser 3 to create a board game that runs on Android's Chrome Web View. On low-end mobile devices (I've been testing on a Samsung Galaxy M04, https://www.gsmarena.com/samsung_galaxy_m04-12022.php), I'm experiencing a specific performance problem with an animation. At times, the animations feel laggy/jerky. According to my observations, one of the instances is when one of my animations jerks is when several animations are playing simultaneously. Other animations playing simultaneously include change in textures of some images, some graphics running, and a tween chain.

I am using Phaser.Auto (which in turn uses WebGL) as it seemed more smooth to me as compared to CANVAS.

Tried many config changes, optimisations like (autoRound, altialias) but nothing seems to work for me. (there were some improvements with reducing asset sizes and setting fps target to 30 fps but still I can feel jerk in some cases)

The animation which particularly feel jerky is -
scene.tweens.add({ targets: target, props: { x: { value: positions[positions.length - 1].x, duration: animationTime * positions.length, }, y: { value: target.y - gridBlockWidth / 8, yoyo: true, duration: animationTime / 2, repeat: positions.length - 1, ease: "Cubic.easeInOut", }, }, onComplete: () => { callback(); animation.stop(); animation.destroy(); }, });
where positions is an array containing x and y position of target.
I also tried using tween chain instead of yoyo for y animation but it feels more laggy than this one.

Any help would be deeply appreciated.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported board-game animation on the Samsung Galaxy M04 with Android Chrome WebView, using Phaser 3.87 and the shown scene.tweens.add configuration. Compare the simultaneous texture changes, graphics, tween chain, and WebGL-versus-Canvas behavior. Done means isolating a reproducible cause of the jerk and confirming a fix or documenting the required limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, javascript
Domain
game-dev, mobile-dev, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.