Make a multiplayer game with Claude Code
Updated 2026-11-23
Short answer: start Claude Code in your web game's folder and paste Joinable's prompt. Claude reads getjoinable.com/AGENTS.md, picks the pattern for your genre, adds an async script tag and a few hooks, and runs npx getjoinable test to play a round in two real browsers. No server code, no account and no key while the game runs on localhost. For more, add Joinable's MCP server with claude mcp add joinable -- npx -y getjoinable mcp.
1. Paste the prompt
Open a terminal in the game's folder, run claude, and paste:
Make this web game multiplayer using Joinable. Read
https://getjoinable.com/AGENTS.md first and follow it exactly: it says how
to pick the right pattern for this game's genre, what to change, and how to test
with two browser tabs. Start with the smallest change that works (usually one
script tag), test it with two tabs, and only go further if the doc's checks fail
for this game. Don't write any server code: Joinable's hosted relay does all of
that. No key is needed on localhost. If the doc's self-test applies (full rounds),
run it with `npx getjoinable test <the game's local URL>` until it passes. When
you're done, tell me which pattern you used, what you changed, and anything that
doesn't sync.
Claude will ask before it fetches the kit, edits files and runs commands, depending on your permission settings. The self-test needs the game served locally, so let it start your dev server (npm run dev, npx serve, or whatever the project uses) if it isn't running already.
2. Optional: add the MCP server
The prompt is enough. The MCP server gives Claude Joinable's tools directly: the kit (joinable_kit), a pattern picker (joinable_choose_pattern), the exact snippet for that pattern (joinable_snippet), the steps to go live (joinable_get_started), desync reports for lockstep games (joinable_desyncs) and the self-test (joinable_selftest).
Local, with the self-test:
claude mcp add joinable -- npx -y getjoinable mcp
Remote, nothing to install, everything but the self-test (it has to open your game on your machine):
claude mcp add --transport http joinable https://getjoinable.com/mcp
Check it with claude mcp list, or /mcp inside Claude Code. The package is getjoinable, one word: never npx joinable, which is someone else's package.
3. What Claude changes in your game
It depends on the pattern, and Claude should tell you which one it chose.
- Racers and score games (full rounds): an
asyncscript tag, oneJoinable.game({...})call queued onwindow.JoinableQ, and awindow.Joinable?.finish({ time })orfinish({ score })where the player finishes. The hooks:startbegins a round from a shared seed,goreleases the player,localreports your player 20 times a second (race) or twice a second (score),remotedraws the others (race only), andstopgoes back to the menu. Random level or course generation must come from the round'sseed, so Claude will swapMath.random()there for a seeded generator. - Board, puzzle, clicker, builder games (Pattern A): often one script tag with
data-sync="game", or oneJoinable.sync(state)call. Claude may addids to entities in arrays so they sync by id. - Platformers and party games (Pattern B): the single
playerbecomes a map of players, and only the host simulates; everyone sends inputs. - Strategy and RTS: the
lockstepprofile, if the simulation can be made deterministic.
In every case, solo play keeps working: the tag is async, calls are guarded, and the Online button only appears once Joinable has loaded. Review the diff like any other: it should be small, with no new server, no WebSocket code and no lobby screen.
4. Test it
For full rounds, Claude runs:
npx getjoinable test http://localhost:5173/
It plays a round with two headless players and checks the seed, local, remote, one result and the rematch, with a fix for each failure. Useful options: --players 4 (up to 8 on localhost), --round 90 for long rounds, and --channel chrome for heavy 3D games that crawl in software WebGL. If Playwright's Chromium is missing: npx playwright-core install chromium.
Then play it yourself: two browser windows side by side (not two tabs: background tabs are throttled), Play online, invite, open the link in the other window, Ready in both. Once that works, a phone and a laptop on different networks.
For shared worlds, there's no automated test: check that both windows show the same world, that actions in each show up in the other, and that closing the host window leaves the other playing.
5. Go live
- Sign up free at getjoinable.com/app and add your game.
- Add the address players will use (
https://yourgame.com) to the game's sites. - Ask Claude to put the key in the script tag:
data-key="pk_…". It isn't a secret; the site list protects it.
The free Sandbox plan gives a live site 100 player-hours a month in rooms of 4. Starter is $9.99 a month for 3,000 player-hours and rooms of 8. Pricing.
Troubleshooting
- The dock says "Offline: key not allowed here": the page's address isn't on the game's sites. Add it in the dashboard. On localhost, leave
data-keyout. - "Offline: unknown key": a typo in
data-key, or a key from another account. - Claude wrote a Node server or Socket.IO code: it skipped the kit. Ask it to remove that and read https://getjoinable.com/AGENTS.md again.
- The self-test says a player never received the other's state:
local()must return an object while the round is on. On heavy 3D games, try--channel chrome. - The game shows a black screen when Joinable is blocked: the script tag lost its
async.
Where it stops working
Joinable is for games that run in a web browser. Native desktop, console and mobile builds aren't supported. Fighting games need rollback and competitive shooters need a trusted server, and Joinable has neither yet; the kit tells Claude to stop and say so. Scores are reported by players, so leaderboards are for friends and casual play, not prizes. More in the general guide.
FAQ
Can Claude Code make my game multiplayer?
Yes, for web games. Paste Joinable's prompt in the game's folder: Claude reads the kit, picks the pattern for your genre, wires the script tag and hooks, and runs a two-browser self-test. You don't need to write or host a server.
Do I need the MCP server?
No. The prompt alone works, because Claude Code can read the kit from the web and run the self-test in a terminal. The MCP server adds Joinable's tools, such as the pattern picker and snippet, for agents that prefer tools.
What's the Claude Code command to add Joinable's MCP server?
Run claude mcp add joinable -- npx -y getjoinable mcp for the local server with the self-test, or claude mcp add --transport http joinable https://getjoinable.com/mcp for the remote one.
Does it cost anything to try?
No. On localhost there's no account and no key, and rooms hold up to 8 players. You need a free key only when the game goes on a real site.