A few questions about runtime and project distribution

Greetings! I just recently discovered this beautiful engine while looking for a good library to create HTML5 / JavaScript based platformers or RPG’s. I’m positively shocked by what I’m seeing, this engine is a big case of something so good it’s hard to believe it’s true in the world of open-source. The professionalism and attention to detail I’m seeing is remarkable, thank you developers!

I wanted to start with some simple questions on a few technicalities I was interested in, hoping it gives me a better understanding of when and how I can use the engine. I noticed the engine is written in C++ which initially confused me for something I hoped was 100% JavaScript, however this might help with some features I’ve been desiring in such an engine.

  1. One thing I’ve always wanted with HTML5 games and other projects was the ability to distribute them both as a website and a standalone version: If people want to play the game in a browser they just open the link, whereas if they wish to download and run it from a standalone package they can do that as well. Does GDevelop allow both options, exporting projects as a website but also a binary you can download and run without needing a web browser?
  2. A huge grievance I had with using JS engines in the past is they’d want you to create a local web server to be able to test your game. This is typically due to the insanely strict CORS settings in almost every web browser today, the cross origin policy is a nightmare for any developer: I always want the ability to open index.html from a local directory and actively design my engines with this ability guaranteed. Figured I’d ask just so this concern is out of the way, although GDevelop seems to have its own interface to test from which I take it doesn’t have such limitations.
  3. Speaking of web and format: Are GDevelop projects formatted in such a way as to make their Github repository compatible with Github pages and similar systems, so the latest commit can also be played directly on GH? That’s what I currently do with the little engines I write from scratch and it’s an option I enjoy having. As long as it automatically runs as a website and index.html is stored in the root directory I take it this should be the case.
  4. I know some JS engines were set up to load their libraries via network, which while useful in making a game smaller means you rely on the official website and an internet connection at runtime. Are projects fully self contained without requiring anything from any remote server in order to run them?
  5. Last thing I’d like to ask is if game developers should expect the code generated by the editor to be stored in readable format which can be edited independently in need. Obviously I’m going to use the interface if I have this option over coding stuff manually but was still curious; If I ever want to edit a piece of core logic in a text editor, can I do so without having to open GDevelop at the time, then when I do it automatically works with my changes without anything breaking?

Hello!

I’ve tried to answer what I could below.

  • For #1: Yes. The engine can export for Web (HTML5) AND for executables (which uses Electron to wrap your game).
  • For #2: Yes…but also no. CORS is not bypassable in general with anything using chromium or another browser tech. However, GDevelop does it’s own internal previews and if you want to test on mobile devices without building the game, you can click one button to have it do a “Network preview” where it hosts an local server and gives you the IP address. If you connect with the mobile device you’ll be able to test on that.
  • For #3: Can’t answer this one definitively, having never messed with github pages. There is no github integration (nor git integration) in the engine, so it’d be up to your own setup on uploading the files and overriding them on github.
  • For #4: The game will use whatever you give it, so if you’re pulling any web resources (via events using web calls for APIs or pulling web-based resources such as internet hosted images/etc), then it’ll need a network connection since those events will make those calls at runtime. If you’re using local resources for everything, there will not be a need for a network connection, barring you’re not trying to set up multiplayer or anything.

Edit: For #5: Also yes/no. Keep in mind that while the exported code is Javascript, and JS is available as a secondary option for the engine, the engine’s only first class language is the event system.

Javascript can be added in your game (here’s how Javascript events work), and you can review and edit the exported javascript code (although it is minified). But projects themselves are not stored as JS code (outside of any JS events you have added).

1 Like

Thank you for the answers! I cloned and exported the default platformer out of curiosity and it seems to be pretty much what I had hoped for: The web version is indeed exported as standalone and fully HTML / JavaScript based. Though like you said the scripts seem to be crushed which to be fair I wouldn’t mind the ability of disabling just in case.

This means that at least technically speaking, Github Pages should also work. But only if I put the exported web version on Git not the project itself: The project seems to be stored as a json file which is actually very good and simplistic but won’t work obviously. What I may want is to export the web version to the same directory before every commit, but that would be a messy layout and even duplicate the assets! So I might need two repositories or branches, one for the source and one for Github pages… that’s twice the work and also duplicating everything however. Wonder if anyone else does this and can offer suggestions here.

For desktop it’s not exactly what I expected but I can see what it’s doing: The export tab builds successfully but there’s no binary for Linux (my OS) nor an exe file for Windows. It’s an Electron project of course, Electron is what I was previously looking at for this sort of thing: I presume I must manually bundle my project with its executables? Is there an explanation on how to do this the right way?

For this you have two options:

  • Option 1: Use the external online build service (not part of the engine, but linked within the engine.): Publish your game to Windows, macOS and Linux [GDevelop wiki] Because this is running on AWS and there are both bandwidth and server costs, this is rate limited (Max project size ~100-200mb, only 1-2 builds per 24 hour period, etc), but otherwise will basically build your executables with 1 click. If this meets your needs and you want to compile to executable more often, there is some subscriptions you can sign up for that increase the builds-per-day. The filesize limit is a hard limit, though.
  • Option 2: Build manually on your workstation. This uses electron builder and is relatively simple after you get it set up: Publish your game to Windows, macOS and Linux manually using Electron and Electron Builder [GDevelop wiki] These instructions are using Yarn, which has builds for most linux distros, but installing electron-builder should be feasible via any linux package manager (Although I’ve only tested with Mint and Kubuntu using yarn years ago). While I am predominantly a Windows user, this is the method I use for 99% of any exe build I’m making.
1 Like

Thanks again, that should be it! I may use the external build service then, shouldn’t need to reach those limits. Just in case though I’ll want to set up local building too so I’ll also go with the second option.