[How to] Node Webkit for Linux and Mac (2015)

0 favourites
From the Asset Store
Node Downloader is a plugin for download file for Construct 3 and construct 2 game engine
  • Hi everyone.

    I spent many hours to get Penelope working on Linux, and it also fixed a problem a few users had on the Mac version as well.

    So, maybe this could be useful to share how I made it. I'm not a linux expert, others may add some more points, but it works.

    Let's talk quickly about NW.js 12:

    ★ - Exported games work out of the box if your game is very light on Mac and Linux. Are you making a flappy bird clone? Congrats, you don't need to read this!

    - if your game is a bit heavy, you'll get the red loading bar of death. And there is nothing you can do, we'll come back to this later.

    Please note this is very inconsistent, there is no precise limit about the number of files involved. From my experience, around 400 files and it crashes.

    -----------------------------------------------------------------------------------------------

    - HOW TO / LINUX -

    So, back to our old pal, Node Webkit 10.5. (don't know how to revert? the link below explains it)

    1 - Export your game the classic way.

    2 - Use the well known libudev.so.0 to libudev.so.1 trick so it can run on the last Ubuntu distribs.

    ( More on this: )

    Note: if your game is light enough, just use NW.js 12, it now supports both libudev libs.

    3 - THEN, and this is new stuff to me, you have to edit your package.json and add the " --file-descriptor-limit<10000> " argument.

    This only works on Node Webkit 10.5, it has no effect on newer versions.

    This tag will allow to load a game correctly. Again, doesn't work on NW.js 12.

    You can also add the good old "--ignore-gpu-blacklist", it will increase your game compatibility, but it will mean some users with low hardware will play your game, even if their machine is not powerful enough.

    4 - and as always, once on a Linux system, right click on the app, and allow it to be launched as an executable.

    That's it! Now you can share your game on Linux.

    - HOW TO / MAC -

    Same as linux, but forget about the libudev.so.0 to libudev.so.1 trick. Instead, be sure none of your PNG is fully transparent, as it would turn the loading bar to red on Mac using the NW export.

    -----------------------------------------------------------------------------------------------

    A note about this "too many cooks/files" problem:

    You'll read it's fixed for a long time on the NW forums. It's absolutely not, on Node Webkit 10.5 AND on NW.js 12

    You'll also read "maybe if your game has more than 1024 files..". No, even with around 400 some of your users will get this error depending of their hardware.

    The fun part being it happens randomly, and how the loading bar turns red at different % from one launch to another.

    Sometimes you'll think you're making progress finding the cause, you're not.

    Also, for Mac export, some of your users can AND have the game working at first launch, then being stuck with the red loading bar the next day.

    I guess it explains why it's difficult for them to provide a fix.

    A note about Dropbox and Mac builds

    Exported Mac builds works alright until you use Dropbox or this kind or services. The file properties can vanish (very often).

    Compress your game in an archive before transfer (if possible, not only as a ZIP, as Dropbox handles it as a regular folder now. Changing the extension like a fancy .ZOP will assure Dropbox don't mess with your game)

  • Thanx for the info! Very useful.

  • Yeah, your game is definitely in the "will turn red, sad smiley" category!

  • Thanks for the info!

    By the way, anyone having luck with windowed/fullscreen mode on OSX and Linux? I'm using the browser plugin to get it working in Windows, but on OSX the game has black bars around it and on Linux nothing happens...

  • On mac, I've definitely had the same issue that you mentioned. I had no idea what it was, interesting. Guess I'll have to revert to 10.5 and suffer crappier performance ._.

    hmm. Have you talked with the NW people about getting it fixed? it's a pretty huge issue. Let me know if I can help you out in that regard by bugging them.

    What's up with 'hmm, maybe it'll break if you had more than 1024 files'? That's a horrible limitation to put on anything! If the nw people are saying that that's pretty disappointing.

  • No, I've read a lot of posts about this on the NW website, and most of the time this kind of posts are ignored.

    It's supposed to be fixed, and if you say it isn't, it goes "alright, send your sources" > "no I can't, my big project is a mess and I spent years on it I don't want to release the sources" > "alright then".

    I understand they need sources (even if filling a project with 2000 files should be enough to find out), and I understand people don't want to send it. I gave the Penelope sources to Ashley cause I trust him, but I don't know anyone enough at NW to do this.

    Also, I don't think it's a big issue for NW. This only occurs for people using NW for large games on Linux and Mac, which should be... 10, 15 guys in the world?

    (@Nesteris NW for Windows has no problem with large number of files)

  • Added this point to the tutorial:

    You can also add the good old "--ignore-gpu-blacklist", it will increase your game compatibility, but it will mean some users with low hardware will play your game, even if their machine is not powerful enough.

    sqiddster did you try to add it to your game already? Did it change something regarding the perfs for some of your users with both graphic card and chipsets?

  • How do you know the limitation is specifically 'large number of files'? If that's really the limitation, we could probably come up with a pretty simple way to fill a blank C2 project with 2000 files, and post it as a bug report.

  • Yes, on Mac the problem is very random, but on Linux/Ubuntu it's pretty clear: a C2 games with 2000 objects won't be able to load/run without the argument trick.

  • What do you mean by 'the argument trick'?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • When you have to edit your package.json and add the " --file-descriptor-limit<10000> " argument to allow the game to run on Linux.

  • OK so I've put together a build that's basically just Airscape's objects without any events, layouts, families, etc. tried it on a mac and it red-bars literally every time. So at least we have a repro.

    Reckon you could point me towards a good place to put that so the NW people can get on it? Are they OK with getting C2 projects?

  • Issues are reported here: https://github.com/nwjs/nw.js/issues

    I'd send a html5 export as well, not only a capx

    Also, make sure to add the -- ignore gpu blacklist tag and see if it works. If the red loading bar is still here, you'll be sure it's only related to the number of files.

    And maybe send a working capx + a working project with very few objects so they know it's really related to this issue?

    Thanks for being brave enough to report this issue, if this works, I think some devs here will be very thankful to you : )

  • OK so I've put together a build that's basically just Airscape's objects without any events, layouts, families, etc. tried it on a mac and it red-bars literally every time. So at least we have a repro.

    Reckon you could point me towards a good place to put that so the NW people can get on it? Are they OK with getting C2 projects?

    You can actually find out what's going on if you add

    "toolbar": true[/code:368yldo1]
    To your package.json. Then start your game, click what looks like a "settings" icon and go to the "console" tab. The error will be listed there.
    
    The first time it happened to me I learnt that my game was trying to load the wrong settings file, so I fixed it and it worked. But the second time it happened to me I had some crazy issues - I contacted Ashley and he suggested I could try a clean reinstall of both C2 and Node-Webkit, so I deleted everything, installed the latest C2 (r200), Node-Webkit 10.5 on the right folder (the folder name changed after r198 or something I think) and it worked!
  • OK so I've put together a build that's basically just Airscape's objects without any events, layouts, families, etc. tried it on a mac and it red-bars literally every time. So at least we have a repro.

    Reckon you could point me towards a good place to put that so the NW people can get on it? Are they OK with getting C2 projects?

    sorry if this was asked, but are you using the 'High Quality' graphics setting in the project settings? Does it work if you switch it to Medium?

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