4ian / GDevelop

🎮 Open-source, cross-platform 2D/3D/multiplayer game engine designed for everyone.
https://gdevelop.io
Other
7.99k stars 764 forks source link

New Layer Effects and freeze on Android webview #1228

Closed KinkGD closed 4 months ago

KinkGD commented 4 years ago

Describe the bug

The new Layer effects aren't working on android : I used at start a layer a effect (blur) and modified the blur parameter in a scene : the effect works perfectly smooth on desktop version of the game, but not android : it just makes the game freeze.

So i can report the bug occures in two scenarios on android : 1) Layer effect "blur) + effect modifiation through events : the scene freeze 2) Just the "blur" effect, without event modification of the the effect parameters Both scenario => freeze. It seems the webGL effect just cannot be rendered on android (webview/canva).

To Reproduce

Here a source file of the platformer example with scenario 1 events : LayerEffectTrouble.zip

Solutions ?

Disable everything related to these effects on Android ? At least the possibility of disabling the effects on Mobile through event would be great for people like me who develop a single project for both desktop and mobile (right now, i have to remove the effect totally because of this android issue).

Other details

GD5b80 - tested on android 6/7/8

4ian commented 4 years ago

If the game freeze, might be either because of a crash related to the Pixi Filter - but I assumed that Pixi was just ignoring the filter when it's in canvas mode - or in the GD game engine because we assume a filter exists while it's not the case or something like this.

In any case, it should not freeze/crash the game. Would be great to see if you can have the webview console logs - it would show immediately the problem. Not sure exactly how to do it though, especially if the webview is not based on Chrome and is old.

Another option for debugging can be to force canvas rendering on desktop and see if it crash.

Bouh commented 4 years ago

What I noticed is that the problem is only in the webview. By testing with the wifi preview, we have the effect, but it's ultra slow. The device seems to be poorly optimized for shaders.

4ian commented 4 years ago

There might be a difference according to the browser. Android 4.x devices webviews are based on the slow and non webgl capable old internal browser, even if they have Chrome. If you're running a wifi preview with Chrome, it might be slow because the device won't have a GPU fast enough for rendering the shader, but at least Chrome will render with WebGL and not canvas.

KinkGD commented 4 years ago

Apk tested on android 9 : same issue

4ian commented 4 years ago

What if you replace blur by another effect? I tried sepia and it worked on a Android 6 (both preview on wifi in a browser and in an apk)

PascalLadalle commented 4 years ago

Bumping this as I used the blur effect in my game, and that part of the game is unplayable on mobile, the game renders at 3 FPS on Firefox (blurs works). The game is smooth on Chrome, but the blurred layer is just a big greenish rectangle. On computer, it's smooth. The pixelate effect works perfectly in the same project. Even changing the value every frame doesn't make it lag. I'm on Oreo.

Workaround: use the kawase blur, it works fine. I suggest we rename Kawase blur to Blur and remove the original Blur. 😁

4ian commented 4 years ago

Not all effects are equally performant indeed. We should surely flag the Blur or hide it, or at least show a warning.

PascalLadalle commented 4 years ago

Bump: https://forum.gdevelop-app.com/t/issue-in-blurring-the-layer/26301/2

Bouh commented 4 months ago

Problem doesn't occur since PixiJS updates, and a hightlight on a cheaper blur in the effects list.