At some point, you will want to distribute your game to allow other people to play it. This tutorial will explain how to export a Godot project to PC and web platforms.
Before you can export a project, Godot needs export templates installed. They can be installed using the Manage Export Templates menu:
Click on the Download button to download the templates for the current version of Godot:
Then, select which mirror to download the template from. Once the download is complete, you can proceed to configure the export settings.
First, we will see how to configure the export for PC (i.e. to Windows, Linux and Mac OSX platforms).
Open the Export window by clicking the Project -> Export menu. The window will be empty because we have not yet added an export preset.
To create an export preset, click the Add… button at the top of the window. This will open a drop-down list of platforms to choose from:
I want to create an executable for Windows, so I choose Windows Desktop. The settings for Mac OSX and Linux are quite similar, so you shouldn’t have any particular problems if you want to export for one of these two platforms.
Once the preset is added, all the options for the platform you have chosen will appear. The default options are often enough to export, so tweaking them is usually not necessary.
The only thing I recommend you to do is filling in the information in the Application section of the Options tab:
Note: the fields to be filled in may vary depending on the chosen export platform.
Changing icons of the Windows executable
By default, the icon of the Windows exported project will be the Godot icon. But surely you will want to change it with a custom one for your game!
There are two types of icons that can be changed for the Windows Desktop executable:
- the taskbar icon: it’s the icon that shows up on the taskbar when your project is running. This is also the icon that gets displayed in the Godot project list.
- the file icon: it’s the icon of the executable file that you click to start the project.
First, download the icons by clicking on the button below:
The file contains two images, one in PNG format and one in ICO format, which is the default format for Windows icons. Since ICO files cannot be imported into a project using Godot editor, copy these two files to the project folder using Windows File Explorer or the equivalent of your operating system. The ICO file will not be shown in the editor’s FileSystem panel, while the PNG file will be automatically imported.
To change the taskbar icon, go to Project → Project Settings → Application → Config → Icon. Click on the folder icon and select the simplerpg_icon.png file.
To change file icon, you will need to install an extra tool called rcedit (you can download it here). Then, you must set in Godot the path to the rcedit executable. Go to Editor → Editor Settings → Export → Windows:
Click on the folder icon for the rcedit entry, navigate to the rcedit executable and select it.
To use rcedit, Linux and macOS users will also need to install WINE.
Now, you must set the file icon to use when exporting for Windows. Go to Project → Export and select the Windows Desktop preset. Click on the folder icon next to the Application → Icon field and choose the simplerpg_icon.ico file.
Exporting the game for PC
When exporting for PC, the exporter takes all the project assets and compresses them into a resource pack file. This .pck file is bundled with a specially optimized Godot binary that loads it at runtime.
To export the project, click on the Export Project button at the bottom of the Export window. Then choose the folder where you want to export the project and the name of the executable.
If you are exporting the release version that you want to distribute publicly, disable the Export With Debug option that you find at the bottom left of the window.
Click Save to export the game. In the folder you have selected you’ll find the game executable and the resource file.
Exporting for the Web
Exporting a project for the web is not much different from what we have seen previously, just add an HTML5 preset and click the Export Project button. The export will generate a series of files:
- an HTML page
- a binary WebAssembly module implementing the Godot engine
- the .pck file containing your game
- a .png file that contains the boot splash image, used only in custom HTML pages (see below)
If you want to customize the generated HTML page, in the export options you’ll find two new export options to do it:
- Custom HTML shell: here you can set a custom HTML page to use as a template for exporting. You can learn how to create a template here.
HTML5 exports require browser support for WebAssembly and WebGL. Some browsers, like Firefox and Chromium-based browsers, will not load exported projects when opened locally. To get around this, you must upload the exported project to a server o use a local server.
Note also that for security and privacy reasons, many features available on native platforms are limited or missing on the web platform (more info here).
An awesome place where you can host your Godot games for free is gotm.io. With gotm.io, you don’t have to set up a server to host your web exported project. You simply upload the .pck file generated by the HTML5 exporter and you can instantly play your game on both mobile and desktop.
Additionally, they are planning to add ways to make you earn money with your game, so keep an eye on this site!
Exporting for mobile
In this tutorial we learned the basics of exporting a project and the particularities of each export platform. In the next one we’ll go back to game development, adding a house where the player can go to rest.