If you’re thinking of making a 3D or 2D web-gamified experience or even games that run on various platforms, Godot is the way to go! It’s a free, open-source game engine, and chances are it’s got all the features you need, a great community, and it’s straightforward to use — not to mention it’s growing more and more each day.

Why Godot

Godot’s combination of nodes and scripts makes it easy for beginners to create complex canvas-based applications such as drag-and-drop blocks-based flow designers, for example, educational-purpose 2D and 3D games, games in general, or even gamified static pages like cool game portfolios. While you can quickly implement simple dynamic UIs, you can also create XR experiences.

All that with the great benefit of coding once and exporting to Web, Android, iOS, Windows, MacOS, Linux, or even consoles. Additionally, the client’s features like the scene tree editor, built-in script editor, scripting debugger, and more, make it even greater!

Getting started

To get started, download the client from their website, open the executable, and Create a new project in Compatibility renderer mode (so you can export it to the web). You can also always look for what you need on its great documentation.

Godot “Create Project” screen

Its workflow consists of using the integrated IDE to create Scenes that contain specialized Nodes to do the things you need in the hierarchy. You’ll find many useful existing types of nodes, but you can even create your own. You can also attach GD Scripts (syntax based on Python) to the instantiated nodes to modify or add to their behavior (you can also use C#; just make sure you download the right client).

You are then presented with an empty Scene. Let’s create our first 3D Node, which will be the root of our main Scene.

Godot Client running an empty scene

Adding things to our Scene

Under this same Scene tab, you’ll find the Add (“+”) button showing a vast list of types of Nodes can select to instantiate. Use it to add a Camera3D node to our Scene, and then add a WorldEnvironment node as a child of our Scene so we can make sure our Camera works.

With our WorldEnvironment selected, you’ll find its properties under the Inspector tab to your right. Use it to add a New Environment to the “Environment” property.

Properties of a selected Node (WorldEnvironment)

Then, under the “Background” section, set the “Mode” property to Sky, and under the “Sky” section, create a New Sky. Our “Sky Material” will be a New ProceduralSkyMaterial.

After that, we can run a debug version of our Scene by clicking the “Play” button at the top right corner of the screen.

Note that this will bring up a pop-up to select our project’s main scene. We can use that to save our current scene and select it as the main one.

WorldEnvironment properties are set to run the scene.

And this is the result! That is what our Camera sees:

Running debug scene showing the Camera view

Exporting for Web

The next step is to export the Web executable. To do this, go to Project -> Export… and click on the Add Preset button. Select the Web preset. For more information, refer to the Exporting for Web part of the documentation.

Export the Web executable

You will get a “No export template found at expected path” warning, which is easily fixed by clicking on Manage Export Templates and then on the Download and Install button on the pop-up.

Manage Export Templates pop-up allow

After that, you can close the pop-up, go to the Export path again, and click on the Export Project… button. This pop-up will appear:

Exporting HTML debug executable

You can then Save it and serve the files on any server. For testing, you can run a simple server using Godot’s Python serve script (as per Exporting for the Web docs). Save the serve.py script file and run it like this inside the exported files directory:

# You may need to replace `python` with `python3` on some platforms.

python serve.py — root .

This will serve all the exported files, you can then select the index.html file to view it.

9 - view

You can download this final example here, including the exported files.

Conclusion

This brief article shows you a little about the capacity of Godot and how it’s able to create simple 2D and 3D applications or even complex ones (with XR and all) that can be exported to multiple platforms at once. Its great community and documentation will help you move forward and allow you to be creative with your canvas-based app for the Web or any other native solutions you’re looking for.

This article is meant to give you a simple template to check how web export works on Godot, but if you want to go further, like for example, adding Input support or adding objects to your scene, here are some recommendations for a follow-up reading you can refer to:

Godot Docs, including:

Other references:

Written by: Jonathan Ferreira / Developer and Godot Fan

Let's team up!

Tarmac partners with Databricks to redefine data engineering and AI workflows.
Find out more Close Button