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.

Export templates

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.

Export Configuration

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:

Download “SimpleRPG Icons”

simplerpg_icon.zip – Downloaded 15533 times – 12.66 KB

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.

You can create an ICO file with a graphic program of your choice (e.g. Gimp). For the icon of this project, I used win10iconTools to convert a series of PNGs at various resolution into the 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
  • a JavaScript file containing start-up code, used by the .html file to access the 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.
  • Head Include: this option is used to append code in the element of the generated HTML page. This allows to, for example, load webfonts, CSS or run JavaScript code.

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).

gotm.io

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

To export for mobile platforms, in addition to what we have seen so far, additional tools (SDKs) and steps are required. For more information, see the Godot documentation for iOS and Android.

Conclusions

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.

Did you enjoy this article? Then consider buying me a coffee! Your support will help me cover site expenses and pay writers to create new blog content.


6 Comments

James · February 25, 2020 at 12:51 pm

Hey Davide!
These tutorials have been so helpful. I actually updated my Godot and it worked!
Then I followed your tutorials up to here. Love the progress you’ve been making it has helped me alot.

The funny thing that I figured out when I was playing the game was that the player can pick up the necklace even before he is given the mission. Is there any way we can fix this, because it just seems off to me.
I’ll be glad to hear from you as soon as possible.
Thanks. 🙂

    Davide Pesce · February 25, 2020 at 6:39 pm

    You can usually pick up an item at any time (and find out later that it’s part of a quest), but if you prefer to change this behavior, you can change the _on_Necklace_body_entered function like this:

    func _on_Necklace_body_entered(body):
    	if body.name == "Player" and fiona.quest_status > 0:
    		$SoundObject.play()
    		hide()
    		fiona.necklace_found = true
    

    As you can see I added the condition fiona.quest_status > 0 which checks if the quest has already started.

James · February 27, 2020 at 11:22 am

Thanks I now notice that.
The function also works without any problems. Why didn’t we have the pop-up menu thing at the beginning of the game, so buttons such as “Play” or “Start game could’ve been added.

Thank you Davide for the help!

    Davide Pesce · February 27, 2020 at 12:37 pm

    I am planning to write a tutorial on how to save and load a game, we’ll add the home screen in that tutorial.

      James · February 27, 2020 at 12:53 pm

      Wow! That sounds great.
      Will be waiting on that tutorial.

      Thank you for putting that into thoughts.

Daniel · December 25, 2021 at 8:44 am

Hi Davide ,I love your tuts so simple and easy to understand
I’m currently working on a fighting game and I need an explanation or a tutorial concerning coin system to unlock players

Comments are closed.

By continuing to browse this Website, you consent to the use of cookies. More information

This Website uses:

By continuing to browse this Website without changing the cookies settings of your browser or by clicking "Accept" below, you consent to the use of cookies.

Close