NW.js Refusing to Close / Game Failing to Start

0 favourites
From the Asset Store
20 high quality click sounds, ready to improve your game's UI instantly
  • I'd try to report this as a bug of some sort, but I can't replicate it and therefore the report would just get closed. I've made a game using Construct 3, Version R210. It is on Steam.

    The game is exported using NW.js, version 0.47.0, Chromium 84.

    It has the greenworks plugin running, version 0.47.0.

    I've been downloading the matching node files needed at the link below and replacing them. Currently I'm getting the v84 node files for NW.js.

    greenworks-prebuilds.armaldio.xyz

    All this said, I still have people who are playing the game who say that the game will either fail to launch. Or it will launch and sit on a black screen forever and never actually load the game. Alongside this there are reports of NW.js leaving processes behind after the game is closed.

    The general assumption I've made is that if you force close these tasks it will allow you to start the game, which seems to work in most cases. However I've also had two people report that it doesn't fix the problem.

    My question, after all this, is does anyone know anything about this? All I could find was a thread from 5 years ago talking about the issue happening in C2. Despite like 8 pages of thread there was seemingly no fix. Based on how the thread went it looked like the Construct devs just chose to forget it was a problem, but perhaps I missed something. Anyone else having this issue or know what to do about it? From what I can tell this has nothing to do with the project itself, it seems like an NW.js thing. Any answer is appreciated, thanks.

  • I vaguely remember this happening when trying something out with nw.js exports. As you said, it leaves processes running in the background that then prevent the game launching. So in theory, it should always work the first time after restarting the pc. Since I never used the greenworks plugin I doubt that it causes the issue.

    I found this 3 year old (and fixed) issue, it seems that may have creeped back in github.com/nwjs/nw.js/issues/6059

    And a newer one (I think there are actually several)

    github.com/nwjs/nw.js/issues/7122

    You could try the solutions from there.

  • Would you mind uploading your "package.json" file? I can be found inside the exported folder if uncompressed or compressed inside the "package.nw" file (rename to ".zip" and unzip).

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It's posted below. I just copy pasted it from the document. If you actually want the file I can upload that, I just figured it would be easier this way. The only change from the default file that I'm aware of is the addition of "--in-process-GPU" to my knowledge you have to have that included or the Steam Overlay doesn't work properly.

    {

    "main": "index.html",

    "name": "Verdant_Village",

    "description": "",

    "version": "1.0.0.0",

    "window": {

    "icon": "icons/icon-256.png",

    "title": "Verdant_Village",

    "width": 512,

    "height": 288,

    "position": "center",

    "resizable": true,

    "frame": true,

    "kiosk": false,

    "show": true

    },

    "user-agent": "Mozilla/5.0 (%osinfo) AppleWebKit/%webkit_ver (KHTML, like Gecko, Chrome, Safari) NWjs/%nwver",

    "chromium-args": "--enable-node-worker --disable-plugins --disable-internal-flash --disable-popup-blocking --allow-file-access-from-files --ignore-gpu-blacklist --in-process-GPU"

    }

  • "user-agent": "Mozilla/5.0 (%osinfo) AppleWebKit/%webkit_ver (KHTML, like Gecko, Chrome, Safari) NWjs/%nwver",

    "chromium-args": "--enable-node-worker --disable-plugins --disable-internal-flash --disable-popup-blocking --allow-file-access-from-files --ignore-gpu-blacklist --in-process-GPU"

    }

    Looks alright to me. The "--enable-node-worker" arg is exclusive to C3 and needed if you run your game in worker mode. NWjs worker mode did make problems in the past, it could be in conflict with "--in-process-gpu" but it's difficult to tell. If you don't use worker mode, I'd recommend removing "--enable-node-worker" and try to reproduce again. At least this way we could try to isolate the underlying cause.

    When you say you get reports of it not launching or running the in the background. Do you mean on Windows or other operating systems?

  • Thanks for the info I'll try disabling node workers in the next build. I usually patch on Fridays so it will be a few days.

    As far as reports go, all the occasions I've heard of it popping up the user was on Windows 10. They didn't specify what version of the OS, but this has happened on and off in rare occasions for several months now, probably as far back as April. Whatever the issue is it seems to be pretty rare, like I said I've only seen it a few times and others very rarely report it.

  • Thanks for the info I'll try disabling node workers in the next build. I usually patch on Fridays so it will be a few days.

    Only do this if your game doesn't run in worker mode.

    It would still be better to find a clear way to reproduce instead.

  • Only do this if your game doesn't run in worker mode. It would still be better to find a clear way to reproduce instead.

    Yeah, I did for curiosities sake try it while worker mode was enabled, game just crashes on launch, no surprise there. The couple of times that I took it off worker mode and deleted the argument it ran fine, but that probably doesn't mean too much since it runs fine 95% of the time.

  • I'd try to report this as a bug of some sort, but I can't replicate it and therefore the report would just get closed. I've made a game using Construct 3, Version R210. It is on Steam.

    The game is exported using NW.js, version 0.47.0, Chromium 84.

    It has the greenworks plugin running, version 0.47.0.

    I've been downloading the matching node files needed at the link below and replacing them. Currently I'm getting the v84 node files for NW.js.

    https://greenworks-prebuilds.armaldio.xyz/

    All this said, I still have people who are playing the game who say that the game will either fail to launch. Or it will launch and sit on a black screen forever and never actually load the game. Alongside this there are reports of NW.js leaving processes behind after the game is closed.

    The general assumption I've made is that if you force close these tasks it will allow you to start the game, which seems to work in most cases. However I've also had two people report that it doesn't fix the problem.

    My question, after all this, is does anyone know anything about this? All I could find was a thread from 5 years ago talking about the issue happening in C2. Despite like 8 pages of thread there was seemingly no fix. Based on how the thread went it looked like the Construct devs just chose to forget it was a problem, but perhaps I missed something. Anyone else having this issue or know what to do about it? From what I can tell this has nothing to do with the project itself, it seems like an NW.js thing. Any answer is appreciated, thanks.

    Hi Assailant107

    I know this post is very old. Just wanted to know if you ever figured out a fix for this? I have exactly the same issue as you. Also using NW.js, version 0.47.0, Chromium 84 with Greenworks plugin.

    My Steam game runs fine, but if you open it again afterwards just a black screen. Then I have to kill nwjs processes in task manager to get it go again. :( Not good for a published game. I'm trying to fix it.

    If you could share any advice I would appreciate it.

    Thank you.

  • Hey dcadjust. So as far as I know it is fixed. Here's the steps I take to export every time. I don't honestly know if it does anything or if they fixed the issue. I guess if you are still experiencing it then its still happening though.

    So. As far as I know this happens due to the greenworks plugin not playing nice with NWjs. At least that's what I remember being the issue.

    First you go here. construct.net/en/make-games/addons/84/greenworks. Download the most recent greenworks plugin if you don't already have it. Make sure the version of greenworks matches your export version of NWjs and Steamworks. (This seems to rarely change so you probably won't have to do it often.) Install this plugin, restart construct to make sure it takes.

    Next, go here. greenworks-prebuilds.armaldio.xyz

    From that site you can use the section on the left (click the three bars) to select various versions of the greenworks.node file. You want to find the ones you need and download them. You will probably always want the most recent version (89 at time of writing). When you export as NW.js on the last step where you pick which version of NW.js to use the same area will say "Chromium 'number'", replacing 'number' with the chromium version. On that above website you want to match versions with that number.

    Your runtime will be nw.js. And last your architecture, depending on what versions you are exporting, Win64, Win32, Mac, or Linux you will need to download all the different versions, or just the ones you need. Also of course match to the steamworks release you are using.

    Okay so now that you have all your files there is one thing you have to do before you actually click export in construct. In the command line options box type "--in-process-GPU" without the quotes. I don't think this is related to the issue, but its in my notes so I'm adding it just in case. From what I remember, this command makes using shift tab in your game function properly.

    Anyway, after all of that, you should have your exports and all the node files. So here comes the tedious bit (as if this wasn't already stupidly tedious). Before I continue I should mention that if you don't have it you'll probably want to get winRAR or an equivalent. (https://www.win-rar.com/start.html?&L=0) the free version works fine. Its just a zipping program like 7zip, it will basically help with looking through zipped folders.

    First unzip your node files that you downloaded. Do NOT unzip your game. Next you'll go to your exported game (the zipped version) and double click it, which if you have winRAR should open it up so you can see inside. I'll use a Windows 64 version for this example, but I'll list stuff for the other exports below (most are the same anyway). So you will see all your files within the zip folder. First, locate the "package.nw" file and double click to go into it.

    Within the package.nw file there will be a ton of stuff. You are first looking for a file called "package.json". Double click to open it in notepad. You'll find some gibberish, near the bottom should be a bit of text that says "--enable-node-worker" without the quotes. Delete that text and save the file. Don't touch anything else, you'll probably make something explode.

    Okay so back in package.nw you will see several files called "greenworks-"insert OS architecture here".node. Remember those node files from before? You are going to first delete the relevant file from package.nw. So in the case of Windows 64 delete the one that says "win64" at the end. Then you are going to take your shiny new node file and drag and drop it in. If winRAR ever bothers you with questions along the lines of "are you sure" just say yes. General rule of thumb for this, always tell winRAR yes, unless it asks you to buy it cause nobody has time for that.

    I'm going to go out on a limb and assume you already know all the other tidbits about adding your steam appID and the proper dlls and all that. So you're done. Close the winRAR windows, say yes to anything winRAR asks and then upload as usual.

    If you need to export for Mac look below. Windows 32 bit is the same just replace 64 with 32. Linux is also laid out the same as the windows ones in terms of finding package.nw.

    Path to "package.nw" in Mac

    Open normal zip > mac64 > gameName.app > Contents > Resources > app.nw (at the bottom)

    Where you are at now is the equivalent of package.nw, just named different, follow the steps above.

    I recommend testing all this stuff before you just put it on Steam because I'm pretty sure if you screw it up, especially the node files part, the game just black screens on launch every time. Anyway, hopefully that helps. I don't know if I've ever gotten confirmation that it 100% works, but no one has mentioned a black screen issue to me since I started doing this so I'm assuming it is fine. Good luck bud, hope your game does well.

  • Wow! Thank you very much for the detailed advice and explanation. (You also made me laugh out loud. Loved the humor)

    I'm going to try all this and test it thoroughly. I'll give you feedback in a day or so to let you know how it went and if the problem was resolved. (Won't upload to Steam until I'm 100% sure I got it right.)

    Even if it does not fix it thank you for taking the time to try and hep me. Much appreciated.

    After 2 and half years of hard work a guy doesn't want a problem like this when your game has just been released.(Sigh)

    The joys of indie game dev ;D

  • I still think removing "--enable-node-worker" shouldn't make a difference, if you don't use C3 worker mode to begin with. There is probably a different underlying cause for NWjs to not close properly. I'd recommend checking out the browser console after long gameplay sessions, maybe there is a script error or similar that's preventing NWjs from closing.

    As a side note. I'd recommend doing OS specific steps on the OS itself (even if it's done in a VM). Unzipping MacOSX game files on Windows could mess up OS specific permissions, causing issues later. At least that's what people exporting games for those platforms told me.

    NWjs can be a pain sometimes but it's alright if you just write down and do things step by step.

  • I don't honestly know about the node worker bit. Like I said I just found a setup that seemed to work. But I agree if you uncheck "use node worker" it probably doesn't make a difference.

    As for the Mac bit because I wanted to address it. Yes, if you unzip the Mac export on Windows it will break it. But as I found out, if you just open it in winRAR and edit the files it works fine. I assume the file permissions get busted during the unzipping process but just viewing them doesn't tamper with it I guess.

  • As for the Mac bit because I wanted to address it. Yes, if you unzip the Mac export on Windows it will break it. But as I found out, if you just open it in winRAR and edit the files it works fine. I assume the file permissions get busted during the unzipping process but just viewing them doesn't tamper with it I guess.

    I never tested this so it's good to know. Usually viewing and editing still requires the archive to be re-compressed. Surprised it works.

  • Hi RealDannyyy

    I'll take note of that. Thx.

    At this point it will all be done on Windows 10. I exported as 32 bit for the sake of windows compatibility. I'm sure probably 99% of windows pcs these days are 64bit these days , so probably unnecessary.

    I do have the C3 worker mode enabled in my project so I'll follow assailant107's steps exactly as is for now and keep my fingers crossed. Let see how it goes.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)