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

Discussion and feedback on Construct 2

Post » Sat Mar 21, 2015 4:54 pm

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: viewtopic.php?f=146&t=121514&p=870727&hilit=linux#p870727 )
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)
Last edited by Aurel on Sun Jun 14, 2015 8:37 am, edited 10 times in total.
Image | @AurelRegard on twitter
B
19
S
6
G
1
Posts: 307
Reputation: 2,495

Post » Sat Mar 21, 2015 5:02 pm

Thanx for the info! Very useful. :)
B
67
S
19
G
12
Posts: 314
Reputation: 11,786

Post » Sat Mar 21, 2015 5:05 pm

Yeah, your game is definitely in the "will turn red, sad smiley" category!
Image | @AurelRegard on twitter
B
19
S
6
G
1
Posts: 307
Reputation: 2,495

Post » Sat Mar 21, 2015 5:50 pm

Definitely useful information, thanks Aurel!

No problems like this so far on Windows?
The moderators are corrupt and ban for no reason, especially that condescending neckbeard asshole Kyatric. The forums are filled with fanboys.
Banned User
B
22
S
7
G
1
Posts: 558
Reputation: 2,925

Post » Sat Mar 21, 2015 6:07 pm

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...
B
119
S
41
G
40
Posts: 836
Reputation: 27,792

Post » Sat Mar 21, 2015 8:33 pm

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.
B
92
S
30
G
24
Posts: 3,191
Reputation: 32,584

Post » Sun Mar 22, 2015 4:33 pm

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)
Image | @AurelRegard on twitter
B
19
S
6
G
1
Posts: 307
Reputation: 2,495

Post » Sun Mar 22, 2015 6:28 pm

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?
Image | @AurelRegard on twitter
B
19
S
6
G
1
Posts: 307
Reputation: 2,495

Post » Sun Mar 22, 2015 9:21 pm

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.
B
92
S
30
G
24
Posts: 3,191
Reputation: 32,584

Post » Sun Mar 22, 2015 9:33 pm

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.
Last edited by Aurel on Mon Mar 23, 2015 12:21 am, edited 1 time in total.
Image | @AurelRegard on twitter
B
19
S
6
G
1
Posts: 307
Reputation: 2,495

Next

Return to Construct 2 General

Who is online

Users browsing this forum: Baidu [Spider], Kermad and 8 guests