Guide

How to make an .io or arena game multiplayer

Updated 2026-11-23

Short answer: an .io or arena game gives every player an avatar in one shared world. The common browser approach is host-authoritative input: each player sends their inputs, one simulation moves every avatar, and the world is synced to everyone. Joinable does this without a server of your own (Pattern B in its kit), and it suits casual arenas, top-down and party games for up to 16 players a room. It is not the right tool for a 100-player .io arena or a competitive shooter, and this page says why.

Two kinds of ".io game"

People mean two different things:

  1. The classic .io: one big public arena, dozens or hundreds of strangers, drop in any time, play for minutes. Agar.io and its descendants.
  2. The small arena: 2 to 8 friends or strangers in one room, avatars in a shared world: top-down brawlers, co-op dungeon runs, party games, platformers.

The second is what Joinable is built for. The first needs a different architecture: a server running the world at a fixed tick, interest management (each player only gets what's near them), and rooms far bigger than Joinable's. If that's your game, a server framework like Colyseus is a better fit, and you'll run it yourself.

How avatars work with Joinable

Pattern B in the kit:

The room keeps a copy of the world, so late joiners arrive in the current game.

The code

Joinable.sync(game, { local: ['keys'] });

const inputs = {}; // host only: latest input per player id
let lastSent = '';
function sendInput() {
  const me = Joinable.me;
  if (!me) return;
  const mine = { left: keys.left, right: keys.right, jump: keys.jump };
  if (Joinable.isHost) inputs[me.id] = mine;
  else if (JSON.stringify(mine) !== lastSent) {
    lastSent = JSON.stringify(mine);
    Joinable.send({ input: mine }, Joinable.hostId);
  }
}
Joinable.on('message', (data, from) => { if (data?.input) inputs[from] = data.input; });

// host only: an avatar for every player, and none for players who left
Joinable.on('players', (players) => {
  if (!Joinable.isHost) return;
  for (const p of players) game.players[p.id] ??= { id: p.id, x: 100, y: 100, color: p.color, name: p.name };
  for (const id of Object.keys(game.players)) if (!players.some((p) => p.id === id)) delete game.players[id];
});

function update(dt) {
  sendInput();
  if (Joinable.me && !Joinable.isHost) return; // guests: the host's world arrives by itself
  for (const [id, p] of Object.entries(game.players)) movePlayer(p, inputs[id] ?? {}, dt);
  // …the rest of your update: enemies, spawns, scoring
}

Draw every avatar in its color, so players can tell each other apart. Before connecting, Joinable.me is null and the game plays solo as before. Star Catcher is a complete example; its changes are marked MP:.

Load the script with <script src="https://relay.getjoinable.com/sdk.js">. No key is needed on localhost; before going live, get one free at getjoinable.com/app.

Where this stops working

We'd rather you know before you start:

Make it feel good anyway

Arena games with rounds

If your arena game is really a score attack (everyone in their own copy of the same seeded level, racing for points), the score profile is simpler and gives you the waiting room, 3-2-1, live scores and one leaderboard for free. See score games. If it's a race, see racing games.

Test it

Open the game on localhost in two windows side by side (not background tabs: browsers throttle them, and the host role moves). Check that both show the same world, that each player's input moves their own avatar on both screens, and that closing the host's window leaves the other playing. A third window opened late should get the current world. Or give the prompt to your coding agent.

FAQ

Can I make an agar.io-style game with Joinable?

Not one with dozens or hundreds of players in one arena. Joinable's rooms hold up to 16 players on Studio, and the world is synced from one player's device. Small arenas of 2 to 16 work; massive public arenas need a server you run.

Is there input lag for other players?

The host's own avatar moves at once. Every other player feels about one round trip of delay between their key press and their avatar moving. That suits casual and party games; it doesn't suit a competitive shooter.

Do I need a server for a multiplayer arena game?

No. Joinable's hosted relay runs the rooms, invites, host changes and late joiners. One player's device runs the world; you write no server code.

What happens when the host leaves?

The next player becomes host and the world carries on from the synced state. Write the host code so any player can take over at any frame, which mostly means keeping everything the simulation needs in the synced state.

Copy the prompt for your coding agent or sign up free