Gumawa ng browser game para sa 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.
Gamit ang iyong 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.
Ang ZIP
- Sinisimulan ng index.html ang laro. Ilagay ito sa itaas ng ZIP, o sa loob ng nag-iisang folder ng ZIP.
- Nasa ZIP ang lahat ng nilo-load ng laro, naka-link sa relative path: Build/game.wasm, hindi kailanman /Build/game.wasm o buong address ng sarili mong site.
- Hanggang 1 GB kapag naka-zip, 10 000 file at 2 GB kapag naka-unzip.
Mga engine at uri ng file
- Gumagana ang anumang larong tumatakbo sa browser: HTML5 canvas, WebGL at WebGPU (three.js, Babylon.js, PixiJS, Phaser, PlayCanvas), WebAssembly (Emscripten, Rust, Bevy, Go), Godot 3 at 4, GameMaker, Construct, Defold, PICO-8, RPG Maker at LÖVE sa pamamagitan ng love.js.
- Unity WebGL: gumagana ang anumang compression. Ipinapadala ang mga Brotli at gzip file nang may tamang header, kaya hindi mo kailangan ang decompression fallback.
- Ipinapadala nang may tamang uri ang mga JavaScript module, import map, .mjs file, glTF at GLB na modelo, KTX2 texture at WAV, OGG, Opus at MP3 na tunog.
Mga multithreaded na laro
- Ang mga build na gumagamit ng thread (SharedArrayBuffer), gaya ng Godot 4 na naka-on ang thread, Emscripten na may -pthread at mga threaded na build ng Unity o love.js, ay nangangailangan ng pahinang cross-origin isolated. Natutukoy ito ng Sofala kapag in-upload mo ang ZIP at ganoon ito pinapatakbo. Para sa Unity build na Brotli lang ang compression, lagyan ng tsek ang “Kailangan ng SharedArrayBuffer” sa listing.
- Hindi makakapag-load ang naka-isolate na laro ng mga script, larawan o tunog mula sa ibang site maliban kung nagpapadala ang mga iyon ng CORS o Cross-Origin-Resource-Policy header, kaya ilagay ang lahat sa ZIP. Puwedeng mag-load mula sa ibang site ang mga larong walang thread.
Sa loob ng laro
- Nananatili sa browser ng manlalaro ang mga save sa localStorage o IndexedDB, hiwalay para sa bawat laro.
- Puwedeng gumamit ang laro ng fullscreen, mouse pointer, gamepad, tunog at WebXR. May fullscreen button din ang pahina ng Sofala.
- Tumatakbo ito sa isang naka-sandbox na frame sa sarili nitong address: hindi ito makakapagbukas ng pop-up, makakaalis sa pahina o makakakita ng Sofala account ng manlalaro. Huwag hilingin sa mga manlalaro na mag-sign in o magbayad sa loob ng laro; ang Sofala ang nagbebenta nito.
- Hindi kailangan ng sariling server para sa multiplayer: ang Sofala ang nagpapatakbo ng mga room (sa ibaba). Puwede ring kumausap ang laro ng sarili mong server.
Mga phone at tablet
- Pakinggan ang mga touch sa isang element ng laro mo, gaya ng canvas nito, hindi sa window o document: sa loob ng frame, hindi laging ipinapasa ng iPhone ang mga touch sa window.
- Bigyan ang element na iyon ng CSS na touch-action: none, at tawagin ang preventDefault() sa mga touchstart at touchmove listener nito, na idinagdag gamit ang { passive: false }. Kung hindi, aakalain ng phone na pag-scroll ng page ang swipe at hihinto itong magsabi sa laro mo pagkalipas ng ilang pixel.
- Dumarating din sa mga phone ang mga pointer event (pointerdown, pointermove). Puwedeng pakinggan ng laro ang dalawa, basta isang beses lang bibilangin ang isang daliri.
- Ginagawa ito lahat ng Snake Party, at gumagana ang mga swipe nito sa iPhone; ang source code nito ang nagpapakita kung paano.
- Kung engine ang gumawa ng laro mo, ang engine ang bahala sa touch input. Anuman ang ginamit, subukan ang laro sa phone bago mo ito i-publish.
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
- Ang Sofala ang nagpapatakbo ng mga room, kaya hindi kailangan ng server ng laro mo. Ilagay ang sofala-game-1.1.js sa ZIP mo katabi ng index.html, i-load ito bago ang sarili mong script, at isang linya lang ay nasa room na ang player kasama ang iba.
- Ang ipinapadala ng isang player ay umaabot sa iba sa room, ayon sa pagkakasunod ng pagpapadala. Hanggang 32 player ang kasya sa isang room, at bawat isa ay puwedeng magpadala ng 60 message kada segundo na hanggang 16 KB: tama para sa turn-based, party at relax na real-time na laro. Kailangan pa rin ng sariling server ang mabilis na shooter.
- Walang code mo na pinapatakbo ang Sofala. Ang player na pinakamatagal na sa room ang host: hayaan siyang magpatakbo ng laro at sabihin sa iba kung ano ang nagbago. Kapag umalis ang host, ang susunod na player ang magiging host.
- Pinupuno ng quick play ang mga public room. May code ang private room para makasali ang mga kaibigan.
- Kilala ng laro ang bawat player sa isang id na hindi nagbabago sa laro mo at sa pangalan niya bilang player, hindi kailanman sa email address o account. Ang pangalan ng player ay ang pangalan niya sa Sofala, maliban kung pumili siya ng iba sa account page niya; puwede ring hayaan ng laro mo na mag-type siya ng pangalan pagsali. Ang mga naglalaro ng libreng laro nang hindi nagsa-sign in ay mga guest.
- Sa sarili mong computer, ganoon din ito gumagana: buksan ang laro mula sa localhost at sarili mong test space ang mga room.
- Kung may server ka pa rin, binibigyan ito ng Sofala.token() ng signed token na nagsasabi kung sino ang player. Suriin ito gamit ang mga public key sa
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>Nakalista sa itaas ng sofala-game-1.1.js ang lahat ng kayang gawin ng mga room. Isang buong laro na puwedeng gayahin, sa iisang file: Snake Party (ang source code nito).
Pagbebenta
- Gawin itong libre, o lagyan ng presyong kasama ang VAT na hindi bababa sa €0.50. Matatanggap mo ang presyo nang walang VAT, bawas ang 5% na bayad ng Sofala at ang bayad ng Stripe, sa pamamagitan ng Stripe: i-set up muna ang payout sa iyong Sales page.
- Ang unang cover photo ng listing ang tile ng laro sa play.sofala.market; pinakamaganda ang malapad na 16:9 na screenshot. Magdagdag pa ng mga screenshot at preview video sa edit page ng listing.
- Nilalaro ng isang tao sa Sofala ang bawat bagong laro bago ito ilabas; makakatanggap ka ng email kapag live na ito.
- Para i-update ang larong live na, i-upload ang bagong ZIP (ang agent mo: upload_files na may replace). Papalitan nito ang luma sa loob ng mga isang minuto, nang walang bagong pagsusuri at sa parehong address, kaya hindi mawawala ang mga save ng mga player.