Guide

How to make a web game multiplayer

Updated 2026-11-08

Short answer: you need three things: a way for players to find each other (invite links or matchmaking), a server that relays messages between them, and netcode that keeps their games in step. You can build all three yourself, use a framework for the server, or use a hosted SDK that does all three. With Joinable, the hosted route is one script tag and one call, and your game's code stays almost as it is.

<script async src="https://relay.getjoinable.com/sdk.js" data-connect="invite"></script>

No key while you build. On localhost Joinable works without one, free, in rooms of up to 4 players. Before the game goes live on a real site, get a key free at getjoinable.com/app and add data-key="pk_…" to the tag. Set theme to your game's own colours and font too: Joinable's waiting room, countdown and results then look like part of your game (the kit's "Match the game's look").

(window.JoinableQ = window.JoinableQ || []).push((Joinable) => {
  Joinable.game({
    profile: 'score',
    start({ seed }) { newRound(seed); },     // every player gets the same seed
    go() { running = true; },
    local() { return { score }; },
    stop() { showMenu(); },
  });
});
// when the round ends:
window.Joinable?.finish({ score });

That gives players a play-online button, invite links, quick match with strangers, a waiting room, a synced 3-2-1, live scores, one results screen and rematch.

The four ways, compared

You writeYou runGood for
WebSockets yourself (Node + ws or Socket.IO)Server, rooms, lobby, reconnects, netcode, UIA server, foreverLearning; unusual games
A server framework (Colyseus, Nakama)Server room code and client codeTheir server, or their cloudGames that need a trusted server: anti-cheat, hidden information, persistent worlds
A hosted state API (PlayroomKit, Photon Realtime)Client code that reads and writes shared state or eventsNothingNew games designed around the API
A hosted session SDK (Joinable)A few hooks: start from a seed, report your player, draw the othersNothingExisting games; solo developers; games built with coding agents

Peer-to-peer WebRTC on its own isn't a fifth option: you still need a server for signalling and a TURN relay for the players whose networks block direct connections.

Which kind of multiplayer does your game need?

The genre decides the netcode. Pick by what your game is, not by what's easiest to code.

Your gameWhat worksWith Joinable
Racer, time trial, runnerEach player owns their car; others are predicted between updatesFull rounds, race profile
Anything with a score or a timeEveryone plays the same seeded round; scores are compared liveFull rounds, score profile
Board, card, puzzle, clicker, builder, drawingOne shared world; one player's device runs itPattern A: often data-sync="game" on the script tag
Platformer, top-down, party gameEach player has an avatar in one worldPattern B
Turn-basedShared world, plus whose turn it isPattern A with a turn check
RTS with many unitsDeterministic lockstep: send inputs onlylockstep profile (Tiny Front)
Fighting gameRollback netcodeNot yet
Competitive shooterA trusted server with lag compensationNot yet

Doing it with Joinable, step by step

  1. No key to start. On localhost and other local sites Joinable works with no key, free and never counted. Before going live, get a key free at getjoinable.com/app and add your site's address to it.
  2. Add the script tag above, async, so the game starts at once even if Joinable can't load.
  3. Wire the hooks for your game's pattern. The agent kit has each one with code. Or give your coding agent this prompt from your game's folder: ``text Make this web game multiplayer using the Joinable SDK (project key pk_…). Read https://getjoinable.com/AGENTS.md first and follow it exactly. ``
  4. Seed your randomness. Anything random that changes the level, the course or the spawns must come from the round's seed, so every player gets the same game.
  5. Test it: npx getjoinable test http://localhost:5173/ opens two headless players and checks the whole round: same seed, players see each other, one result, rematch.
  6. Try one real round on two devices, a phone and a laptop, on different networks.

Where this stops working

FAQ

Do I need a server? No. Joinable's relay runs the rooms, matchmaking and messages.

Does it work with my engine? Anything that runs in a browser page: Phaser, three.js, PlayCanvas, Babylon.js, PixiJS, plain canvas, and engines that export to the web, like Godot, through a small JavaScript bridge. Guides: Phaser, three.js, PixiJS, PlayCanvas, Babylon.js, plain canvas.

Will my game still work offline? Yes, if you load the script async and guard calls with window.Joinable?.. The kit's tests check that a never-loading Joinable leaves the game playable.

Can my coding agent set it up? Yes. That's what the agent kit and the MCP server are for.

Copy the prompt for your coding agent or sign up free