I made a small score-attack shooter in Godot 4 to show off online features in a web export: sign-in with a gamertag, a daily and all-time leaderboard, and a cloud save.
Play it in the browser: <itch.io link>
A few things that might be useful if you’re doing the same:
It’s a single-threaded web export (thread support off), so it runs on itch.io and other hosts without the SharedArrayBuffer headers.
Every online call is an `await` that returns `{ok, error, …}`, so a refused name (“That name is not allowed.”) or a lost connection shows as a message instead of hanging the game.
The server validates scores (allowed range, rate limit) and filters names. The client doesn’t decide anything.
var r = await Backend.sign_in(gamertag)
if not r.ok:
show_error(r.error)
return
await Backend.submit_score(“highscore”, score)
var today = await Backend.leaderboard(“highscore”, “daily”, 10)
Full disclosure: the backend comes from a generator I make (BackendGen.dev). It’s a self-hosted Node.js server with the source code included. Happy to answer questions about the Godot side or the web export either way.