phaserjs / phaser

Phaser is a fun, free and fast 2D game framework for making HTML5 games for desktop and mobile web browsers, supporting Canvas and WebGL rendering.
https://phaser.io
MIT License
37.22k stars 7.1k forks source link

Phaser3 crashes on Android (Google Chrome) when using createLayer (Tilemap) #6705

Closed luckyr13 closed 9 months ago

luckyr13 commented 11 months ago

Version

Description

Hi, I really love using Phaser. I want to report that I'm having a very strange issue. I made a game using Phaser3 and it seems to work fine in my laptop (Chrome, and Firefox) but when I try to run the game on my Android device, the game starts loading fine but suddenly the browser returns the error: Something went wrong while displaying this webpage.

errorPhaser

I'm using Google Chrome on my Android device. I noticed that this error happens in any Android mobile with Google Chrome.

The bug seems to happen when using createLayer function. Phaser3 docs says: Prior to v3.50.0 this method was called createDynamicLayer.

I tried with a downgrade and my same code works using Phaser 3.24.1 and using createDynamicLayer.

Example Test Code

Here's my full source code: https://github.com/luckyr13/labyrinth-game/

And these are the lines that I think are causing the bug: https://github.com/luckyr13/labyrinth-game/blob/main/src/labyrinth/scenes/levels/level.ts#L711

Additional Information

You can try the game here: https://labyrinth-bgd.pages.dev/

The game should work fine in a laptop or desktop but stops working when running on Android + Google Chrome

This is the error I'm getting: errorPhaser

I think that probably something changed between 3.24.1 and 3.50.0, so my guess is that the bug was introduced somewhere on that point.

Thanks in advance!

photonstorm commented 9 months ago

I tried your game URL on a Samsung S23 and S21 and it ran fine on both of them (the screen was very small, but the game worked!)

image

I tried it on a Google Pixel 6 and it errored on load because it couldn't decode the audio files (you can see all of those errors in dev tools). If I left it long enough, it then went onto the 'oh snap' screen, but it didn't get past the audio errors to even start to build the map from what I can see in dev tools.

I'd suggest doing a build with no audio at all, and then testing it on device with dev tools active to see what happens. 'oh snap' can be anything - from out of memory, to getting stuck in an eternal loop. Best if this is followed-up on the Phaser Discord or Forum, unless you can pin it down to a specific bit of code that makes certain Android devices crash.

luckyr13 commented 8 months ago

oh my gosh! thank you my friend, it is working now. I removed all the background music. Thanks, I love Phaser, looking forward to keep building with Phaser. Thanks again Superman!