How to Run and Play a Godot WebGL Build Locally (Simple)
Max O'Didily
How to Run and Play a Godot WebGL Build Locally (Simple)
Greetings, today I am here with a quick and simple Godot tutorial. We are going to look at how to Run and Play a Godot WebGL build locally.
This will work if you developed your Godot project is currently using version 4.3 or above or a version of Godot that supports Web exporting prior to version 4.
So, you have built your Godot game. It is a WebGL one, but you want to test it for platform specific bugs and see how it runs in a web browser. You can hit play and run, but that would mean you would have to build the game each time you want to playtest.
You double click your index html file, the game doesn't load. You could upoload your Godot WebGL build to itchio or Github. That takes time.
This solution is super simple! it takes less than a minute and I use this at my day job for when I need to quickly test something during its early stages.
Make sure you have Python installed: https://www.python.org/downloads/windows/
Open a powershell terminal where your index.html file is. You need to shift and right click to see Powershell appear as an option. The do the following command:
py -m http.server
This will host a Python server on your machine. This server will run your game when someone joins it. You can then try out your game by opening a web browser and typing "localhost:8000/".
Now you can play your webgl game. Please note this is a locally hosted server so others can't connect to it. If you want your friends to try your game, you could send them the webgl build and this tutorial or you could host the game on a website like Github or itchio.
If py -m http.server doesn't work, try python -m http.server. Older versions of Python do -python instead of -py.
Thanks for watching this quick tutorial on how to Run and Play a Godot WebGL Build locally.
Be sure to subscribe for more Godot tutorials!
How to Run and Play a Godot WebGL Build Locally (Simple) ... https://www.youtube.com/watch?v=0cmnq9GQTaY
4888797 Bytes