Games (Steam & Discord)
Build a game in the browser and ship the same files everywhere: on the web at your app's URL, on Steam as a desktop game (including Steam Deck), and inside Discord as an Activity. Cloudrizz runs the online parts: player accounts, leaderboards, saves and real-time multiplayer.
Start from the game template
Ask your assistant for a game, or have it create the app with create_app and type: "game". You get a small, complete arcade game to reshape into yours:
| File | What it does |
|---|---|
game.js | The game: steady-speed loop, keyboard, gamepad and touch input, menu, pause and game over |
platform.js | One API for web, Steam and Discord: sign-in, achievements, saves and calls to your API |
api/scores.js | Leaderboard: top 10, saves runs, rejects impossible scores |
api/me.js | The signed-in player |
api/_README_GAMES.md | The guide your assistant follows while building the game |
The template draws with plain canvas and has no outside downloads, so the Steam version works offline from day one.
2D or 3D: pick an engine
- 2D: Phaser (a full 2D engine with physics, tilemaps and audio) or PixiJS (very fast 2D drawing).
- 3D: Three.js (the most used 3D library) or Babylon.js (a complete 3D engine with physics and audio). Phaser is 2D only.
Keep a copy of the engine inside the app (for example vendor/three.module.min.js) instead of loading it from a CDN, so the Steam build runs offline and Discord's proxy doesn't block it. For ES-module engines, an import map points at your copy:
<script type="importmap">
{ "imports": { "three": "./vendor/three.module.min.js" } }
</script>
<script type="module" src="./game.js"></script>./game.js, not /game.js) everywhere. The Steam build serves the game from its own folder and Discord runs it under a path, so root-relative links break there.Ship to Steam
- Deploy the game to production.
- Open the app in the dashboard and click Download Steam kit. The zip holds the live version of your game plus a ready desktop project with the Steam overlay, achievements, Steam Cloud saves and Steam Deck settings.
- Follow the README inside: run it locally, build for Windows, macOS and Linux, and upload each build to Steam.
- To give Steam players accounts, set the app env vars
CR_AUTH_STEAM_APP_IDandCR_AUTH_STEAM_WEB_API_KEY(a Steamworks publisher key, stored as a secret). Only setCR_AUTH_STEAM_IDENTITYif you change the identity in the kit (both default tocloudrizz). - If you limited which sites may call your app (CORS, in the dashboard), add
app://game: that is where the desktop game calls from.
In the Steam build, platform.unlock("first_orb") unlocks a real Steam achievement (create it with the same id in Steamworks) and platform.save() uses Steam Cloud. On the web the same calls use the browser's storage. Publishing on Steam has a one-time fee per game, paid to Valve.
Ship as a Discord Activity
- Create an application in the Discord Developer Portal and enable Activities.
- Under URL Mappings, map
/to your app's address (for exampleyour-game.cloudrizz.app). - Under OAuth2, add a redirect URI (Discord's Activity guide uses the placeholder
https://127.0.0.1). Then copy the client id and secret into the app env varsCR_AUTH_DISCORD_CLIENT_IDandCR_AUTH_DISCORD_CLIENT_SECRET. - Add Discord's Embedded App SDK to the app and call
platform.signInWithDiscord(discordSdk, clientId). Your assistant knows the steps from the template's README.
Accounts, leaderboards and saves
Steam and Discord players get a normal app account the moment they start the game, named after their Steam or Discord name. Your server code reads them like any other user with env.AUTH.getUser(request). See Players on Steam and Discord for the details.
Leaderboards and anything else you store live in your app's database. Anything a player's device sends can be faked, so check scores on the server (the template rejects impossible ones) and run competitive rules in a multiplayer room.
Multiplayer
Real-time multiplayer uses env.ROOM: players join a named room over WebSockets, and an api/room.js file runs the game rules on the server so nobody can cheat. The same room works for web, Steam and Discord players at once. env.ROOM is a paid-plan feature.
Other places to publish
- itch.io: upload the
game/folder from the Steam kit as a zip and choose "played in the browser", or link to your app's URL. - Web game portals such as CrazyGames and Poki: they require their own SDK and small download sizes; add their script as their docs describe.
- App Store and Google Play: the mobile kit packs the same game as iPhone and Android apps.