Make a browser game for Sofala
Players start your game right on play.sofala.market, with nothing to install: free games at once, paid ones after one payment. The easy way is to let an AI agent build and upload it; doing it by hand comes after.
With your AI agent
You do not need to know how to program. A coding agent writes the game with you, uploads it to Sofala, writes the listing and publishes it when you say it’s done. Any agent that works with MCP servers can do this; these steps use Claude Code on Windows, and we recommend it with the model Opus 5.5 or newer.
- Get a Claude accountGo to claude.ai, create an account and choose a paid plan (Pro or higher). Claude Code is not part of the free plan.
- Open PowerShellPowerShell is a window where you type commands. Press the Windows key, type
powershelland press Enter. A window opens with a line that starts withPS C:\Users\and your name. That is where the next lines go. - Install Claude CodeCopy this line, paste it into PowerShell (right-click pastes) and press Enter. Nothing seems to happen while it downloads; wait until it says it is done.
irm https://claude.ai/install.ps1 | iex
Now close PowerShell and open it again. This matters: the window you installed from does not know the new program yet. - Check that it worksIn the new PowerShell window, this prints a version number:
claude --version
Does it say thatclaudeis not recognized? Then Windows has not been told where Claude Code is. Paste these two lines, one after the other, close PowerShell, open it again and try once more:$currentPath = [Environment]::GetEnvironmentVariable('PATH', 'User') [Environment]::SetEnvironmentVariable('PATH', "$currentPath;$env:USERPROFILE\.local\bin", 'User')Still stuck? Claude Code’s page for installation problems lists the other causes. - Add Sofala, before you start Claude CodeThis tells Claude Code where Sofala is, so it can upload and publish for you. Paste it and press Enter:
claude mcp add --transport http Sofala https://sofala.market/mcp
- Start Claude CodeType this and press Enter:
claude
The first time, your browser opens and asks you to sign in with your Claude account. Do that and come back to the PowerShell window.
Does it stop to ask permission too often? Start it with this line instead, with no checks at all. It then does everything without asking, also when it gets something wrong, so use it only if you accept that; Anthropic advises it only on a computer with nothing on it that you would miss.claude --dangerously-skip-permissions
- Connect it to your Sofala accountInside Claude Code, type the line below and press Enter, pick Sofala and choose to sign in. Your browser opens sofala.market: type your email address, then the code Sofala emails you. That also makes your Sofala account if you have none; it is free and has no password. Then press Allow. Back in Claude Code, Sofala now shows as connected.
/mcp
- Pick the modelType the line below, press Enter and choose Opus 5.5 or newer. A game is a lot of code, and smaller models make more mistakes.
/model
- Ask for your gameNow say what you want, in your own words and in any language. For example:
Make a simple online multiplayer snake game that runs in the browser, for Sofala. Use Sofala’s multiplayer rooms so friends can join. Let me test it, and when I say it’s done, put it on Sofala as a free game.
- When the game is ready to try, your agent gives you a link to play it on Sofala before anyone else can see it. Say what to change, as often as you like: “make the snakes faster”, “add a score board”.
- Happy with it? Say “publish it”. A person at Sofala plays each new game before it goes up; you get an email when it is live.
- To change a live game later, open PowerShell, start Claude Code again and ask. The new build replaces the old one at the same address.
- On a Mac or on Linux, open Terminal instead of PowerShell and install with the line on Claude Code’s setup page; the other steps are the same. Using another agent? Add a remote MCP server with the address
https://sofala.market/mcp.
For manual game devs
Building or packaging the game yourself? This is what Sofala expects. An AI agent follows the same rules; it reads them from Sofala.
The ZIP
- index.html starts the game. Put it at the top of the ZIP, or inside the ZIP’s one folder.
- Everything the game loads is in the ZIP, linked by relative paths: Build/game.wasm, never /Build/game.wasm or a full address of your own site.
- Up to 1 GB zipped, 10 000 files and 2 GB unpacked.
Engines and file types
- Any game that runs in a browser works: HTML5 canvas, WebGL and WebGPU (three.js, Babylon.js, PixiJS, Phaser, PlayCanvas), WebAssembly (Emscripten, Rust, Bevy, Go), Godot 3 and 4, GameMaker, Construct, Defold, PICO-8, RPG Maker and LÖVE through love.js.
- Unity WebGL: any compression works. Brotli and gzip files are sent with the right headers, so you do not need the decompression fallback.
- JavaScript modules, import maps, .mjs files, glTF and GLB models, KTX2 textures and WAV, OGG, Opus and MP3 sound are all sent with their proper types.
Multithreaded games
- Builds that use threads (SharedArrayBuffer), such as Godot 4 with threads on, Emscripten with -pthread and threaded Unity or love.js builds, need a cross-origin isolated page. Sofala detects them when you upload the ZIP and runs them that way. For a Unity build compressed only with Brotli, tick “Needs SharedArrayBuffer” on the listing.
- An isolated game cannot load scripts, images or sounds from other sites unless those send CORS or Cross-Origin-Resource-Policy headers, so put everything in the ZIP. Games without threads may load from other sites.
Inside the game
- Saves in localStorage or IndexedDB stay in the player’s browser, separate for each game.
- The game may use fullscreen, the mouse pointer, gamepads, sound and WebXR. Sofala’s page has a full-screen button too.
- It runs in a sandboxed frame on its own address: it cannot open pop-ups, leave the page or see the player’s Sofala account. Do not ask players to sign in or pay inside the game; Sofala sells it.
- Multiplayer needs no server of your own: Sofala runs the rooms (below). A game may also talk to a server of yours.
Phones and tablets
- Listen for touches on an element of your game, such as its canvas, not on window or document: inside the frame, an iPhone does not always pass touches on to window.
- Give that element the CSS touch-action: none, and call preventDefault() in its touchstart and touchmove listeners, added with { passive: false }. Otherwise the phone takes a swipe for scrolling the page and stops telling your game about it after a few pixels.
- Pointer events (pointerdown, pointermove) arrive on phones too. A game may listen for both kinds, as long as one finger counts once.
- Snake Party does all of this, and its swipes work on an iPhone; its source shows how.
- If an engine made your game, its touch input is the engine’s. Whatever made it, try the game on a phone before you publish it.
const area = document.querySelector('canvas'); // an element of the game, not window
area.style.touchAction = 'none';
let from = null;
area.addEventListener('touchstart', e => {
e.preventDefault();
from = [e.touches[0].clientX, e.touches[0].clientY];
}, { passive: false });
area.addEventListener('touchmove', e => {
e.preventDefault();
if (!from) return;
const x = e.touches[0].clientX, y = e.touches[0].clientY, dx = x - from[0], dy = y - from[1];
if (Math.abs(dx) < 20 && Math.abs(dy) < 20) return;
from = [x, y];
swipe(Math.abs(dx) > Math.abs(dy) ? (dx > 0 ? 'right' : 'left') : (dy > 0 ? 'down' : 'up'));
}, { passive: false });Multiplayer
- Sofala runs the rooms, so your game needs no server. Put sofala-game-1.1.js in your ZIP next to index.html, load it before your own script, and one line puts the player in a room with others.
- Whatever one player sends reaches the others in the room, in the order it was sent. A room holds up to 32 players, and each can send 60 messages a second of up to 16 KB: right for turn-based, party and casual real-time games. A fast shooter still wants a server of its own.
- Sofala runs none of your code. The player who has been in the room longest is the host: let that one run the game and tell the others what changed. When the host leaves, the next player becomes host.
- Quick play fills public rooms. A private room has a code for friends to join with.
- The game knows each player by an id that stays the same in your game and by their player name, never by an email address or an account. The player name is their Sofala name unless they chose another on their account page; your game can also let them type one when they join. People who play a free game without signing in are guests.
- On your own computer it works the same: open the game from localhost and the rooms are a test space of your own.
- If you do run a server, Sofala.token() gives it a signed token that says who the player is. Check it with the public keys at
https://sofala.market/game-api/keys.
<script src="sofala-game-1.1.js"></script>
<script type="module">
const room = await Sofala.rooms.quick({ max: 4 }); // a room with other players, or a new one
room.on('message', (data, from) => { /* from.name did something */ });
room.on('enter', peer => { });
room.on('exit', peer => { });
room.send({ move: 'e2e4' }); // to everyone else in the room
</script>Everything the rooms can do is listed at the top of sofala-game-1.1.js. A whole game to copy from, in one file: Snake Party (its source).
Selling it
- Make it free, or set a price with VAT included, at least €0.50. You get the price without VAT, minus Sofala’s 5% fee and Stripe’s fee, through Stripe: set up payouts on your Sales page first.
- The listing’s first cover photo is the game’s tile on play.sofala.market; a wide 16:9 screenshot works best. Add more screenshots and a preview video on the listing’s edit page.
- A person at Sofala plays each new game before it goes up; you get an email when it is live.
- To update a live game, upload the new ZIP (your agent: upload_files with replace). It takes the old one’s place in about a minute, with no new check and at the same address, so players keep their saves.