Include NW.js to export games to Windows, Linux and Mac

I decided to pay a bit more attention to HTML5 platform and use (learn) Javascript mainly to develop Android games using HTML5, but I also thought about the possibility what if I’m going to use Javascript and Javascript libs in my game and later I want to release my game also on desktop as well. Since Javascript events and libs would not work on Native platform I was look in to Node-Webkit (NW.js):
github.com/nwjs/nw.js/

The reason I think it would be a useful thing to include with GDevelop is because at the moment we can export native games only to 64bit Ubuntu and Windows and only Linux to Linux and Windows to Windows, and this could be a kind of deal breaker for some people who would like to have 32bit Linux support or they would like to run their games on other distros as well not only on Ubuntu. GDevelop also just become available for Mac but only HTML5 platform so it would be also useful for Mac users while the native platform is under development but maybe even after. As today only the HTML5 platform available on the Mac, later the Mac users may find themselves in the same situation with Javascript event. The export their games to native platform would require to replace Javascript event and libs with C++ or find an other way around using GD events or use NW.js

The advantages of NW.js would be:
-games can be exported to Windows, Mac and any Linux distribution
-games can be exported from any platform to any platform so we could export from Mac to Windows and Linux, and also from Windows to Mac and Linux and from Linux to Windows and Mac.

I have just tried it and I was able to make a standalone nw package on 64bit Windows to run on 32bit Linux and it was seriously surprise me how easy it is so I guess it could be done on any platform.

I think the only disadvantage would be the size increase of GDevelop as to do such thing would require to include NW.js for each platform which would be around 300+ Mb I guess, so it would be a huge increase in size. I know you care about the download size, so how about that if somebody wan’t to export to Windows, Linux and Mac using the HTML5 platform then GDevelop would download the correct NW.js version automatically and just prompt a message to the user about it is downloading if not already downloaded?

Maybe it is sounds useless as NW.js is there, it free it easy to use if somebody is interested but what I have in mind really is that, an option in GDevelop to export to Windows, Linux(32bit/64bit) and Mac would be more attractive than just provide a link to NW.js on the wiki on the forum and that’s it. But the main thing is, it is not only about an option to export HTML5 to the desktop but it would also have advantages over the native export such as:

  • cross platform export to the desktop
    -32bit Linux support
    -better Linux and Mac support of games made in GDevelop as of now native games are supporting mainly Ubuntu other non ubuntu or debian based distros may having trouble running games out of the box made in GDevelop and Mac games when native export is become available probably going to have trouble with running on different versions of Mac OS.

NW.js could provide a bit more flexibility and better support on Linux and Mac.

Wow, nice ! :smiley:
and it’s really easy to package the game. :wink: Just done it with the Platformer template of GDevelop.

It’s definitely something to consider and that could be integrated in the future. :slight_smile:

I tried it so I searched the forum and found this topic. :smiley:

Maybe you don’t need to include nw in GD. You only need to generate a package.json when exporting as a web game. The user can then decide to make their own package (basically a renamed zip file) or just copy the contents to their nw executable folder (or vice versa).

Edit*

By the way, if I change a game’s setting from html to native or from native to html, the game usually doesn’t work.
I mean, gd doesn’t warn you or gives error messages, but the game just acts differently.

So this is the easiest solution currently if the game developer wants to make a game for both platforms.

There’s definitely a problem with your game if it doesn’t work when you switch platform. The only possible causes are that you use a condition/action/expression that is not available on both platforms.

Since 4ian is working on the new HTML5 based IDE and my understanding is that it is going to include only the HTML5 compiler at first, I though it would be the best time to bump this topic up again. If GD becoming an HTML5 focused engine from version 5, I believe it would be extremely useful.

Desktop export as a stand-alone application (with optional installer) is something that would be really great, using either nw.js or Electron.
By the way, with a bit of documentation reading and time, you should be able to make by yourself a Electron powered application, using just the default export to web from GDevelop. :slight_smile:

If that’s the case, please do not hesitate to contribute to the wiki to explain how to do so. If I add this Window/Linux/Mac export to GDevelop later, it will be only an automatic way to do this. :slight_smile:
(See Electron website here: electron.atom.io/)

Yes and it is pretty simple with both NW.js and Electron but it would be just nice if it could be done with a click of a button from GD.

Unfortunately I’m not very good in explaining things, I always get people confused when I try explain something so even though I would love to, I’m no longer attempt to explain anything to anyone :imp:

Besides, I could not explain it any better and more simple way than the documentation of NW.js and Electron, there are even third party packaging tools that automate the whole process so yeah, it is not that complicated but it would be just nice…