NHacker Next
login
▲Upload a Godot HTML5 Game to Itch.io with GitHub Actionssimondalvai.com
118 points by dulvui 782 days ago | 33 comments
Loading comments...
seba_dos1 782 days ago [-]
It's pretty much just two commands:

   godot --export-release HTML5 web/index.html
   butler push web <itch_account>/<project_name>:<channel>
Used those with GitLab CI for ages:)
dulvui 780 days ago [-]
Yes you are right, its that simple. I just made a Github Action wrapper around this 2 commands, that download and then caches the godot/butler files, so the next tun gets the files from the cache.
gradiustheguide 771 days ago [-]
After a week of faffing I managed to fork the three repos Simon made and upgrade them from 3.x to 4.x . Very untested and maybe there's stuff there you don't need. But by gum it works! I'll slim it down in the future, and remove echo messages. Big thanks Simon for your work!

Parent action: https://github.com/North-Street-Games/nutshells/blob/main/.g... (attach this as a main.yml file in your GitHub actions workflow folder, and change the in-file variables and your secret itch.io butler key as needed!)

Child Godot export action: (for ref) https://github.com/Kwpa/godot-html-export/tree/main

Child itch upload action: (for ref - no different to original) https://github.com/Kwpa/itchio-butler-upload

Note that 4.x Web builds currently do not run well on MacOS browser apps :/ See this: https://github.com/godotengine/godot/issues/70691

dulvui 769 days ago [-]
Cool to see that my work was useful for you! Yeah, I have to update the default version to 4.x now, but you could have use the `godot-version` parameter to set it to 4.x like this

  - name: Godot HTML5 export
    uses: dulvui/godot-html-export@v0.0.2
    with:
      godot-version: 4.1
Probably I also need to improve the documentation.
gradiustheguide 766 days ago [-]
Did you test that with 4.x? Because when I did I got toooooonnnnnessss of errors. Godot changed path names on a lot of things - and there's no headless download binary, you have to use headless as a command option in the bash file settings.
dulvui 765 days ago [-]
Oh thanks good to know, I saw that the headless build was gone but didn't try it yet. This weekend I'll take a closer look to it and see what changed.
gradiustheguide 764 days ago [-]
Please take a look at my copy of your Godot export repo, if it helps :) took me a week to figure out the intricacies... a lot of path names changed, headless changed, the export command changed...

But then again it was my first ever GitHub action :D

I'd be interested to know what works for you, especially making sure the caching works optionally as that is out of my perview

dulvui 764 days ago [-]
Great thank you so much! I already saw your fork and might simply merge it or see what I can integrate.
sovietmudkipz 782 days ago [-]
Hey not bad. 3 years ago now (ugghh wow) I chose what engine to go all in on as a hobbyist. At the time only Unity supported producing web based games and I wanted to make games for the web so I went all in on Unity.

Unity is great. Unity is also horrible, especially on devx. It takes anywhere from 10-30 seconds to recompile code or changes on each save. Making a unity html game takes 5-30 minutes. There are things that can be done to reduce these times but requires knowing a bunch of info (usage of asset database, dividing code into assemblies, etc). Writing a container image to run Unity CLI commands requires you deal with license. Ugghh I wish Unity was just better to use.

I may scope out godot again. I’m working on a multiplayer game and it’d be interesting to evaluate how I’d plug a godot game into AWS gamelift.

fulafel 782 days ago [-]
There's also PlayCanvas and Three.js which have been around for a long time.
nonethewiser 782 days ago [-]
You described how Unity fares with web games. How does Godot compare?
nightowl_games 782 days ago [-]
We made this in Godot, and it deploys to k8s on digital ocean via GitHub actions;

https://rocketbotroyale.winterpixel.io/

a1o 782 days ago [-]
Hey that looks very good. Do you mind walking through a bit on how the graphics work? Are they vector or raster? Or are they 3D?

In what format the artist sends the assets that get into the game?

Is there any trick you had to do to make the graphics look this sharp? Does adapting to different viewport size required a lot of work?

nightowl_games 782 days ago [-]
Raster, all the assets are hi rez pngs. We play around with mipmaps and filtering algorithms to make the assets scale down nicely. Mostly just using large .pngs will get you all the way.
a1o 782 days ago [-]
Pretty cool. I am on iPhone 14 and it plays really fluid in it, which surprised me. There is a small weird loading thing in the border right interacting with the ground, when scrolling either left or right.

I am impressed on how sharp the PNG looks though! I thought filtering in WebGL was like nearest neighbor and bilinear and that's it, perhaps there is additional things that can be accomplished with shaders that you are using.

rcme 782 days ago [-]
The frame rate on an iPhone 13 Pro is pretty bad. Seems to average around 20 FPS. Granted, Safari sucks, but it’s not exactly a ringing endorsement of Godot given that your game appears to be 2D?
nightowl_games 782 days ago [-]
It's not optimized to run on mobile iPhone. Apple deliberately doesn't support open gl on the web. We previously disabled mobile iPhone from playing the game, and redirecting to the store.

I wouldn't lay this issue at Godots feet.

The difference between 2D and 3D in terms of performance demand is not significant.

We are running some serious shaders to render the terrain. They are pure SDFs that are absolutely massive mathematical functions that run on both the cpu and GPU. These shaders run better on android phones than on iOS phones, largely because apple does not iterate on webgl, because it undermines their app store to do so.

The menu is poorly optimized in terms of draw calls. The poor performance is largely our fault and apples fault. Godot could offer some tooling to make optimizing draw calls easier, but the way we built the menu is just not optimal for the GPU.

The biggest endorsement of Godot is the smallness of the download for our game. ~20mb iirc. It's not the smallest download in the world, but it's way smaller than a unity web game.

fulafel 781 days ago [-]
Mobile Safari was advertised to have gotten a WebGL upgrade (w 2.0 support) about 1.5 years[1] ago but has since been plagued by reports of performance problems. It seems to take a long time to mature there. Chrome shipped WebGL 2 in 2017, hopefully WebGPU case won't take 6+ years for Safari to catch up.

[1] https://news.ycombinator.com/item?id=30370852

sovietmudkipz 781 days ago [-]
Can you elaborate on your system architecture for your game? It’s interesting that you’re deploying on k8s and implies a more complex app than a simple game client.
nightowl_games 780 days ago [-]
This is a multiplayer game with dedicated game servers, a matchmaker, agones to orchestrate those game servers, a client that runs on the web, a second client that runs on the web but doesnt use threads, an account system/api server, a database, a couple reverse proxies and some generic tooling like grafana and pyroscope.

Heres a blog post about it from a while back: https://blog.winterpixel.com/the-tech-stack-behind-a-wasm-an...

We also deploy the client to steam for windows, mac and linux, the mac app store, google play, the ios app store, and we have custom web clients for some international portals.

It's definetly a lot.

z3t4 781 days ago [-]
It's very fun. Remins me about worms armageddon - but this is more fun. What are you using for the backend ?

The hardest part in the beginning is to not get dropped in the water :P

tester457 782 days ago [-]
Do you have a blog where you talk about the deploy?
DoItToMe81 781 days ago [-]
I wish Godot allowed for smaller file sizes. The very lowest I've seen someone get a project down to is 10 MB. It's a little disappointing when your files work out to barely a few megabytes.
dulvui 780 days ago [-]
You can disable dome features of Godot by using a custom build of the engine. I did that for my F-Droid builds, since a F-Droid build recipe builds all dependencies from source. But I don't know how many MB I saved.
jokoon 782 days ago [-]
A godot dev said html5 games are difficult to do because of multithreading.
nightowl_games 782 days ago [-]
That's specific to the refactoring of godots internals in 4.0. specifically the performance will suffer in single threaded systems.

Note that we are running a multithreaded Godot 3 game on the web. It only uses threads when sharedarraybuffer is available, otherwise uses single threaded mode. Mostly just affects the latency of audio.

hu3 782 days ago [-]
source? I'd like to learn more about the intrinsics of web games.
Kiro 782 days ago [-]
There are a lot of restrictions when using multiple threads in the browser. You need to spawn workers and they can only share certain things in memory between the threads (transferable objects and SharedArrayBuffer for generic data). For everything else you need to pass messages back and forth between the workers.

Another problem is that SharedArrayBuffer was disabled by default after Spectre and in order to enable it you need to send certain headers from the server (Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy). I don't know if itch.io has support for that, but maybe.

I haven't used Godot but I'm thinking that the multithreaded models game engines are using don't convert very well to SharedArrayBuffers. It's a very crippled form if you're used to say C#.

aezart 782 days ago [-]
Itch does support the headers for SharedArrayBuffer, but it causes problems if you want to have both a web player and a downloadable version of the game. It was recently fixed for Chrome, but in Firefox trying to download a game from a page with SharedArrayBuffer results in the browser blocking the download from the CDN.
omoikane 782 days ago [-]
SharedArrayBuffer can be enabled on itch.io with one checkbox.

https://itch.io/t/2025776/experimental-sharedarraybuffer-sup...

a1o 782 days ago [-]
Can you do that and still ping a server outside of itch.io? Say for analytics or for online gaming.
omoikane 782 days ago [-]
I haven't tried accessing any external network resources, but the article above suggest it wouldn't work:

   If your game accesses resources on other domains then those requests will fail by default.
a1o 782 days ago [-]
I think this is also not available in either iPhone or iPad Safari.