Launch game on Github Pages

It's time to launch your awesome game. How do you do it?

The easiest way would be to use https://itch.io platform, but it has a couple problems. For one, people coming to your game have to come to itch, so it doesn't look as legit. Also, the web3 features may now work, we know that itch doesn't work with Phantom wallet for some reason.

One of the best ways, which is also free, is through Github Pages. It may require some more work, but trust us, it's going to be worth it!

Step 1: Build your Web Game

First, go to Project -> Export. Here, you will have to do a very important thing, which will be explained later. In the Head Include section of the export settings, write in:

<script src="enable-threads.js"></script>

Finally, press Export Project. Make sure that the name you are saving your game as is index.html. Also check off "Export with Debug" option for a smaller build size.

Step 2: Build your Web Game

Create a Github Repository for your game. You can do it very easily by downloading Github Desktop and watching some tutorial if you're new to it. Once you have the repository created, drag all the files from the build folder created in step 1 into that repository.

Step 3: Add a Fix File

Building for github pages using a Godot 4 is quite experimental, and there are some errors popping up when trying to play it. Luckily, it can be fixed by adding the following file inside the root of your game's repository. Here it is:

That's why you needed to write in that heading line in the step 1 - it makes the game use the script when initialized through github pages. With this file in place, you are ready to push the repository!

Step 3: Launch the Github Pages

When you have your repository pushed, you are finally ready to launch its page. Make sure the repository is open for everyone. If it's private, you will need a paid version of github to launch it.

In github, find your repository, and then go to Settings -> Pages and choose the page to be created from the origin branch. Wait a couple of minutes and your game will be live to play for everyone!

If you want, with some extra work you are able to add your own custom domain, but that you can figure out for yourself!

Last updated