Crea un gioco per browser per 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.
Con il tuo agente IA
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.
Lo ZIP
- L’index.html avvia il gioco. Mettilo in cima allo ZIP, o nella sua unica cartella.
- Tutto ciò che il gioco carica è nello ZIP, collegato con percorsi relativi: Build/game.wasm, mai /Build/game.wasm né un indirizzo completo del tuo sito.
- Fino a 1 GB compresso, 10 000 file e 2 GB decompresso.
Motori e tipi di file
- Funziona qualsiasi gioco che giri in un browser: HTML5 canvas, WebGL e WebGPU (three.js, Babylon.js, PixiJS, Phaser, PlayCanvas), WebAssembly (Emscripten, Rust, Bevy, Go), Godot 3 e 4, GameMaker, Construct, Defold, PICO-8, RPG Maker e LÖVE tramite love.js.
- Unity WebGL: qualsiasi compressione funziona. I file Brotli e gzip vengono inviati con le intestazioni giuste, quindi non ti serve il decompression fallback.
- Moduli JavaScript, import map, file .mjs, modelli glTF e GLB, texture KTX2 e audio WAV, OGG, Opus e MP3 vengono tutti inviati con il tipo giusto.
Giochi con più thread
- Le build che usano i thread (SharedArrayBuffer), come Godot 4 con i thread attivi, Emscripten con -pthread e le build Unity o love.js con i thread, hanno bisogno di una pagina con isolamento tra origini. Sofala le riconosce quando carichi lo ZIP e le avvia così. Per una build Unity compressa solo con Brotli, spunta “Richiede SharedArrayBuffer” nell’annuncio.
- Un gioco isolato non può caricare script, immagini o suoni da altri siti, a meno che questi non inviino intestazioni CORS o Cross-Origin-Resource-Policy, quindi metti tutto nello ZIP. I giochi senza thread possono caricare da altri siti.
Dentro il gioco
- I salvataggi in localStorage o IndexedDB restano nel browser del giocatore, separati per ogni gioco.
- Il gioco può usare lo schermo intero, il puntatore del mouse, i gamepad, l’audio e WebXR. Anche la pagina di Sofala ha un pulsante per lo schermo intero.
- Gira in un riquadro isolato, al suo indirizzo: non può aprire pop-up, lasciare la pagina né vedere l’account Sofala del giocatore. Non chiedere ai giocatori di accedere o pagare dentro il gioco; lo vende Sofala.
- Il multigiocatore non richiede un server tuo: Sofala gestisce le stanze (sotto). Un gioco può anche parlare con un tuo server.
Telefoni e tablet
- Ascolta i tocchi su un elemento del tuo gioco, come il suo canvas, non su window o document: dentro il frame, un iPhone non sempre passa i tocchi a window.
- Dai a quell’elemento il CSS touch-action: none e chiama preventDefault() nei suoi listener touchstart e touchmove, aggiunti con { passive: false }. Altrimenti il telefono scambia uno swipe per lo scorrimento della pagina e smette di avvisare il tuo gioco dopo pochi pixel.
- Gli eventi pointer (pointerdown, pointermove) arrivano anche sui telefoni. Un gioco può ascoltare entrambi i tipi, purché un dito conti una volta sola.
- Snake Party fa tutto questo, e i suoi swipe funzionano su iPhone; il suo codice sorgente mostra come.
- Se il tuo gioco l’ha fatto un motore, l’input touch è affare del motore. Comunque sia fatto, prova il gioco su un telefono prima di pubblicarlo.
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 });Multigiocatore
- Sofala gestisce le stanze, quindi il tuo gioco non ha bisogno di un server. Metti sofala-game-1.1.js nel tuo ZIP accanto a index.html, caricalo prima del tuo script, e una riga mette il giocatore in una stanza con altri.
- Quello che un giocatore invia arriva agli altri nella stanza, nell’ordine di invio. Una stanza contiene fino a 32 giocatori, e ognuno può inviare 60 messaggi al secondo fino a 16 KB: giusto per giochi a turni, party game e tempo reale tranquillo. Uno sparatutto veloce ha comunque bisogno di un server suo.
- Sofala non esegue nessun tuo codice. Il giocatore che è nella stanza da più tempo è l’host: lascia che gestisca la partita e dica agli altri cosa è cambiato. Quando l’host esce, il giocatore successivo diventa host.
- La partita rapida riempie le stanze pubbliche. Una stanza privata ha un codice con cui entrano gli amici.
- Il gioco conosce ogni giocatore per un id che resta uguale nel tuo gioco e per il suo nome giocatore, mai per un indirizzo e-mail o un account. Il nome giocatore è il suo nome Sofala, a meno che non ne abbia scelto un altro nella pagina del suo account; il tuo gioco può anche farglielo scrivere all’ingresso. Chi gioca a un gioco gratis senza accedere è ospite.
- Sul tuo computer funziona allo stesso modo: apri il gioco da localhost e le stanze sono uno spazio di prova tutto tuo.
- Se invece usi un server, Sofala.token() gli dà un token firmato che dice chi è il giocatore. Verificalo con le chiavi pubbliche su
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>Tutto quello che le stanze sanno fare è elencato in cima a sofala-game-1.1.js. Un gioco intero da cui copiare, in un solo file: Snake Party (il suo codice sorgente).
Venderlo
- Puoi renderlo gratuito o dargli un prezzo IVA inclusa di almeno 0,50 €. Ricevi il prezzo senza IVA, meno la commissione del 5% di Sofala e quella di Stripe, tramite Stripe: imposta prima i pagamenti nella tua pagina Vendite.
- La prima foto di copertina dell’annuncio è la miniatura del gioco su play.sofala.market; rende meglio uno screenshot largo in 16:9. Aggiungi altri screenshot e un video di anteprima nella pagina di modifica dell’annuncio.
- Una persona di Sofala gioca ogni nuovo gioco prima che vada online; ricevi un’e-mail quando è online.
- Per aggiornare un gioco online, carica il nuovo ZIP (il tuo agente: upload_files con replace). Prende il posto del vecchio in circa un minuto, senza nuova verifica e allo stesso indirizzo, così i giocatori conservano i salvataggi.