Skip to content

Exporting builds from Godot

I didn’t look into this too much, but what I did want is a way to determine if I was using a debug build, and that’s easy (reference): OS.has_feature("debug"). When exporting, just make sure not to export a debug build, that way you can hide all of your “cheats” from the player.

This needs to be done before any kind of export:

  • Make sure you’ve downloaded Godot export templates from EditorManage Export Templates…: 500
  • Make sure to install export templates (reference)
  • All you need to do is:
    • Set the export path (e.g. ./output.app)
    • Fill out the bundle identifier (e.g. com.example.game)
    • If you’re not going to sign/notarize the app, then you should also enable CodesignEntitlementsDisable Library Validation (it says to enable that option if you’re using ad-hoc signing, which should be the case, and you can verify that by reading the yellow warning text at the bottom of the export window).
    • Click “Export All…”
  • To run it, just do open ./output.app on the command line

Exporting Windows builds using a Mac

Section titled Exporting Windows builds using a Mac

Pasted image 20240516101219.png

If you get that warning about needing rcedit, you can just uncheck ApplicationModify Resources, which means you won’t have a custom icon on Windows. If you do want a custom icon, then install rcedit (and apparently WINE) following these instructions.

Note that as of 02/14/2024, you cannot do a web export from the .NET version of Godot, so make sure you open the non-Mono version; it says so right in the export dialog: 500

  • Make sure to install export templates (reference)
  • Set the export path (e.g. ./out/index.html)
    • Note: the out folder needs to exist for this to work
    • It’s a good idea to make an intermediate folder like html or out since you’ll get more files than just the HTML file.
  • Click “Export Project…” or do it through the command line

With any means of hosting on the web, you may eventually see an error like this:

Error
The following features required to run Godot projects on the Web are missing:
Cross Origin Isolation - Check web server configuration (send correct headers)
SharedArrayBuffer - Check web server configuration (send correct headers)

This means that the headers haven’t been set correctly by the web server. Sub-sections below talk about how to fix this.

  • Note: regardless of how you do this, you’ll need to do a new web export every time you want to update the game for people playing it. Also, you probably need to restart the server unless you only made client-side changes.
  • The easiest way to do this is to use the Python script that they link from this page (here’s a direct link to the Python script, but maybe this’ll change eventually).
    • The concrete steps are very simple:
      • Download that page as host.py
      • Run python3 host.py -r path_to_the_folder_containing_your_html_file
    • If you don’t do this and instead try to host with something like http-server ., you’ll get an error like this:
  • If you want to easily share this with people without having to upload this anywhere, just use Cloudflare Tunnels.
    • When setting up the tunnel, you can choose “HTTP” and Cloudflare will automatically set up a certificate for you so that it works over HTTPS, which is apparently required by Godot for the secure-context stuff.

If the host is based on Apache (e.g. it can be LiteSpeed Web Server), then it supports .htaccess files, which means you can upload an .htaccess file alongside your .html file that looks like this:

<IfModule mod_headers.c>
Header add Cross-Origin-Opener-Policy "same-origin"
Header add Cross-Origin-Embedder-Policy "require-corp"
</IfModule>

This should be straightforward. There’s some additional context around the header stuff here. I hosted a game on Itch a while ago, so I didn’t think there was much to write notes about this time around.

Instead of doing open YourGame.app, do cd YourGame.app/Contents/MacOS./YourGame. That should show errors that won’t show when you use open.

In my specific case, I saw ERROR: Can't load dependency: res://Src/SceneScripts/Main.cs., which seemed could have been a Godot issue but turned out to be my issue 🤦‍♂️.