Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

How do I port an Electron project to NW.JS (GDevelop)

A topic by CyberRobotnix created Nov 17, 2021 Views: 780 Replies: 6
Viewing posts 1 to 3
(1 edit)

When I export a GDevelop game, it always turns into an uncompilled Electron project with which I'm expected to compile via Electron and Node.js, but I found it to be an almost impossible task (I explain a bit more about it below), so my solution was to use NW.JS, but NW.JS doesn't seem to be compatible.

So, my question is simple, how do I port an Electron project over to NW.JS?


I'm not familiar with Electron and Node.js, not only that, but I still haven't figured out how to install them on my Windows 10 computer, I have a Linux dual-boot, that's mainly for testing purposes since I don't usually code and/or execute scripts there, so I would have to reinstall everything I need there with the possibility that it might end up not working, thus wasting my time.

On the other hand, I have NW.JS ready to be used with libnode (Libre variant of Node.js I guess) preinstalled, the problem is that it just doesn't want to work with a HTML5 game made with GDevelop. 

I know GDevelop has an online compiller, but I really don't want to create an account just to use it, so that's not happening either.

Moderator moved this topic to General Development

I've never had any luck with Node.js on Windows either. I'm not familiar with GDevelop, but if it supports building for Electron then that implies that it allows building for the web as well; Maybe you could do that instead for the time being?

That's already done actually, but I would like my game to be playable directly on computers w/o the need for a web browser.

(1 edit)

Well it isn't really without the need for a web browser; Since Electron is at the core just a Chromium browser that always loads the same web page. Personally I'm against this idea since if the program already runs in a browser it simply adds extra steps for people who want to play it and it means the user doesn't get to choose what browser they use.

Have you considered making it a progressive web application (PWA)?

I've found that to be pretty straight forward (I don't know anything about GDevelop though).

It allows a game to run in the browser OR be installed (on both desktop and mobile) so that it runs in its own window, feels like a native application, and functions offline. You can also publish them on the Google Play store, and in fact a lot of well known apps are actually PWAs - Tinder, Instagram, Spotify, Uber...

Welp, if you're giving me this solution, then I'd assume you know it's possible and you know how to do it. So, how do I port my Electron project over to PWA?

You said you've exported a web version, so yes, it most likely should be possible, though it might take a while. You should just need to add a script and some meta tags to the HTML, and add a few other small files (a manifest, a service worker and some icons), and then you must host the file on a secure website (ie. https, not just http - getting that set up is actually the hardest part).

When I was doing it (not starting with a GDevelop app), the most helpful tutorials I found were these:

https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Installable_PW...

https://medium.com/james-johnson/a-simple-progressive-web-app-tutorial-f9708e5f2...

https://web.dev/offline-cookbook/

Anyway, I'm not saying it's definitely the way to go, but it might be worth looking into.