Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Electron 2.0.6 causes flickering on Native export (#566) #572

Closed
Wend1go opened this issue Aug 4, 2018 · 14 comments
Closed

Electron 2.0.6 causes flickering on Native export (#566) #572

Wend1go opened this issue Aug 4, 2018 · 14 comments

Comments

@Wend1go
Copy link
Contributor

Wend1go commented Aug 4, 2018

Describe the bug

The recently submitted patch for solving the flickering on Android and Ubuntu Touch causes flickering in the Electron export (tested on Windows and Linux). #566

To Reproduce

  1. Export a game for native platform
  2. Run the game
  3. The background colour flickers through the game occasionally (although not in fullscreen mode)

Other details

I think I need to set the new "transparent=true" parameter to only apply to mobile exports and keep the "transparency=false" for the Electron export.

@4ian is it ok If add a condition like this to runtimegame-pixi-renderer.js?

 * Create a standard canvas inside canvasArea.
 *
 */
gdjs.RuntimeGamePixiRenderer.prototype.createStandardCanvas = function(canvasArea) {
    this._canvasArea = canvasArea;

    //Create the renderer and setup the rendering area
    if (navigator.isCocoonJS){
        //This prevents flickering on some mobile devices
        PIXI.glCore.VertexArrayObject.FORCE_NATIVE = true;
        //"transparent: true" is needed to avoid flickering issues on some mobile phones (see #566)
        this._pixiRenderer = PIXI.autoDetectRenderer(this._game.getDefaultWidth(), this._game.getDefaultHeight(), {transparent: true} );
    } else{
        this._pixiRenderer = PIXI.autoDetectRenderer(this._game.getDefaultWidth(), this._game.getDefaultHeight());
    }
@4ian
Copy link
Owner

4ian commented Aug 5, 2018

The hard thing is to come up with a solution that allow to properly check if we're on mobile or not. There is gdjs.evtTools.systemInfo.isMobile(in systeminfotools.js). In this case, the body of the function should be refactored directly into gdjs.

The thing is that these checks are notoriously hard to maintain in the long term and not always very reliable.
Do we know why the flickering is happening? Can we do something else to prevent it?

@Wend1go
Copy link
Contributor Author

Wend1go commented Aug 5, 2018

I don't know either. The issue I linked in the last PR just gave a solution that worked for others but no explanation.
Since this issues are very device specific, maybe we could add the option as an action in a sub menu of the display category and leave it to the game developers to set or not set the transparency. So game devs could add a settings menu to their games and let the player decide to enable it or not depending on if the game runs smoothly on their device.

@Wend1go
Copy link
Contributor Author

Wend1go commented Aug 7, 2018

Yesterday I managed to build an Electron App locally on my system but eventhough I removed the changes made in runtimegame-pixi-renderer.js the screen was still flickering on my Linux machine.
Can someone confirm that the flickering in the Native export also occures on their systems?

@Wend1go
Copy link
Contributor Author

Wend1go commented Aug 7, 2018

I did a little more research and it seems that Electron itself is the culprit.
Electron 2.0.6 which gets chosen by electron-builder by default creates the flickering.
I tried using Electron 2.0.2 as a test and the flickering went away.

@4ian :
Could it be that you also recently updated the Electron version in the build service?

@4ian
Copy link
Owner

4ian commented Aug 7, 2018

I did a little more research and it seems that Electron itself is the culprit.
Electron 2.0.6 which gets chosen by electron-builder by default creates the flickering.
I tried using Electron 2.0.2 as a test and the flickering went away.

Good catch!

Could it be that you also recently updated the Electron version in the build service?

No but the latest version being used and Electron 2.0.6 being released a few days ago, the build service is now using it.
Let me check if I can pin it to a specific version - will help for future similar issues.

Also I want at some point to update Electron that is used for the IDE (https://trello.com/c/fIyghcLM/87-update-electron-to-latest-version), let's try to find something that has not this issue.
Can you find any online issue/report about this problem btw?

@4ian
Copy link
Owner

4ian commented Aug 7, 2018

Should be fixed by 9a55167
Note that this was entirely fixed by updating the files that are generated by GDJS when exporting the game :) (good example that the build service is useful, but you still have full control on your game)

@ghost
Copy link

ghost commented Aug 8, 2018

It also flickers on desktop, using the latest electron version 2.0.6.

@4ian
Copy link
Owner

4ian commented Aug 8, 2018

@rikazukun Yes, see the previous messages ;)

@Wend1go
Copy link
Contributor Author

Wend1go commented Aug 8, 2018

I don't think we need to go back that far, 2.0.5 was working without issues. (I just tested it again)

I couldn't find a bug report about the flickering over at electron but the changelog for 2.0.6 states this:

Fix flicker on Macs when the GPU is under heavy load. #13896

I don't really understand what they did in that PR, but they changed something OpenGL related.

@Wend1go Wend1go changed the title Anti-flicker patch for Andorid causes flickering on Native export (#566) Electron 2.0.6 causes flickering on Native export (#566) Aug 8, 2018
@Wend1go
Copy link
Contributor Author

Wend1go commented Aug 8, 2018

Reported bug on Electron Repo:

[Bug][2.0.6] Flickering with PixiJS #13983

@Wend1go
Copy link
Contributor Author

Wend1go commented Aug 9, 2018

Electron 2.0.7 seems to have fixed it.

@4ian
Copy link
Owner

4ian commented Aug 9, 2018

Awesome. Thanks for reporting the issue on electron and glad that they already had the fix :)
I'll update to use version 2.0.7 for exported games in the next version of GDevelop. At least having a pinned version will avoid such problems later.
For the current version, I guess the workers will pick 2.0.7 once it's officially released.

@Wend1go
Copy link
Contributor Author

Wend1go commented Aug 9, 2018

Sounds good, closing this now.

@Wend1go Wend1go closed this as completed Aug 9, 2018
@4ian
Copy link
Owner

4ian commented Aug 9, 2018

Might be a good idea to bump GD to use Electron 2.0.7 too btw.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants