htmlgodot

How can I run a Godot program on a website?


I want to make a program in Godot and then write a website in HTML, so that this Godot app would run on it. I want it to run like some of the web games. You click on a link and can play the Godot-based game in any web browser.

What are the first steps I should consider when building something like this?


Solution

  • First you need to make sure you have the export templates for your version of Godot installed. You can do that by going to Editor -> Manage Export Templates which will allow you to download, install and remove the export templates.

    With the export templates installed go to Project -> Export… Then you need an HTML5 export preset which you add by clicking on Add… And selecting HTML5. The same dialog will allow you to configure the preset and to export your project for the web. Be aware that the exported project needs to run on a web server.

    You can read more about exporting Godot projects for the Web on the Godot official documentation: Exporting for the Web. Read Exporting first.

    It is also possible to customize the web page on which the Godot project will run. Please refer to Custom HTML page for Web export for that.