How to make a multiplayer game with AI
173 of the 404 games we list (43%) have online multiplayer. Getting two browser windows to talk is easy for an agent. Keeping ten players smooth and fair is harder, because an open prompt gets the simplest netcode that works on localhost.
Below are the four terms to put in that first prompt and a stack table with current prices.
What breaks in AI-written netcode
In the two build logs below, bandwidth gave out first, then connection handling. Endel Dreyer, who created the Colyseus game server, had Claude Opus 4.5 write a 2D multiplayer shooter from one prompt. It ran, and once deployed it became unplayable above 10 clients. Sending each bullet once, as a start position and angle, and sending each player only what was near them got it to 100 connections (Dreyer).
Tejas Kulkarni built a 1v1 browser shooter with Grok 3 and Cursor, and called multiplayer playtesting and feeding problems back to the model “the most time consuming part of the process”. Stale browser windows kept reconnecting to running games until the prompt added an “Enter Game World” button, and one bug showed a player a duplicate copy of themselves (Kulkarni).
The netcode architecture to ask for
Ask for an authoritative server with client-side prediction, reconciliation and interpolation. Gabriel Gambetta’s three-part series explains all four, and the terms below come from it (architecture, prediction, interpolation).
1. Authoritative server. The server runs the game and owns the state. Clients send inputs such as “left pressed”, never positions, because a client that reports its own position can report any position.
2. Client-side prediction. Waiting for the server makes your own moves feel laggy, so the client applies its inputs at once and numbers each one. Ask for the movement code in one shared module that client and server both run, or the prediction drifts.
3. Reconciliation. The server replies with the last input number it processed. The client drops acknowledged inputs and replays the rest on top of the server’s state; skip this step and you get rubber-banding.
4. Interpolation. Other players are drawn slightly in the past, 100 milliseconds in Gambetta’s example of a server that updates 10 times a second, and move smoothly between two updates instead of jumping on every packet.
Put all four in the first prompt, with a tick rate. Colyseus’s fixed-tickrate tutorial simulates at 60 ticks per second and processes the queued inputs on each tick (Colyseus).
Build online multiplayer with an authoritative server. Clients send numbered inputs only. The server runs the simulation at a fixed 60 ticks per second and sends state patches 20 times per second. Movement code lives in one module shared by client and server. The client predicts its own player and reconciles with the server’s last processed input. Other players are interpolated 100 ms in the past.
Which multiplayer stack to pick
Colyseus suits most real-time games, and Playroom Kit suits a game that should have no server of yours at all. Prices below are from each vendor’s page as of September 2026.
| Stack | What it is | Cost | Good for |
|---|---|---|---|
| Colyseus | Open-source Node.js server for authoritative game rooms, with state sync | Free to self-host; cloud from $15 a month | Most real-time games |
| PartyServer on Durable Objects | Rooms on Cloudflare’s edge, one object per room | Free plan: 100,000 requests a day, SQLite-backed objects | Small rooms, global players |
| Socket.IO | Messaging with reconnects, rooms and fallbacks; you write the game logic | Free, self-host | Turn-based and casual games |
| Playroom Kit | Hosted multiplayer, no backend of yours | Free for 10 users a day; $10 a month for 10,000 monthly users | Party games and prototypes |
| PeerJS | Peer-to-peer WebRTC | Free signaling server | Two friends, no server |
Sources: Colyseus, Colyseus pricing, PartyServer, Durable Objects pricing, Socket.IO, Playroom, PeerJS FAQ.
Colyseus keeps the state on the server, and @colyseus/schema sends clients only the properties that changed (state sync). Its team counted 48 of the 945 Vibe Jam 2026 entries built on it (Colyseus blog). Start with npm create colyseus-app@latest ./my-server (docs).
PartyServer is Cloudflare’s library for real-time rooms on Durable Objects, from its PartyKit repo (repo). Deploy it with Wrangler directly. An issue open since June 2026 reports that new deploys to hosted PartyKit fail with a domain-limit error (issue #985).
On Durable Objects, watch hibernation. Hibernating WebSockets stop duration charges, but a setInterval game loop keeps the object awake, so on the free plan run the loop only while players are connected (WebSockets guide).
PeerJS is tempting because there’s no server. Its free cloud server only handles signaling, and two players behind symmetric NATs can’t connect at all unless you configure a TURN relay (PeerJS FAQ). With no server, one player’s browser is the authority, so cheating and a host who closes the tab are your problem.
In Godot, web exports have no low-level networking (web export docs), but the WebRTC classes, WebRTCMultiplayerPeer included, are built into HTML5 builds, so the high-level multiplayer API still works (WebRTC docs). The four terms above apply unchanged.
Send less data, less often
Both fixes that took Dreyer’s shooter from 10 clients to 100 cut the data it sent. Ask the agent for these four:
- Events instead of frames. “Fired at angle 42” is one message; a bullet’s position every tick is sixty a second.
- Deltas only. Colyseus sends only changed properties by default; with Socket.IO you write that yourself.
- Interest management. Each player gets only what’s near them. Dreyer’s shooter needed a spatial index for this before it scaled.
- Twenty patches a second. Colyseus’s default patch rate is every 50 milliseconds (rooms), and interpolation hides the gaps.
Test with two players on day one
Open the game in a normal window and a private one, or in two browser profiles, so each player has its own storage. Two tabs of one window share localStorage, so a game that keeps its player ID there sees one player twice. In an automated test, two Playwright browser contexts do the same job (browser contexts); playtesting games with AI shows the setup.
Then have the agent add a switchable 100-millisecond delay to the server’s outgoing messages, and play again. A game that feels fine on localhost can fall apart at that latency.
Close a window mid-round too, and decide what a dropped player gets back. Colyseus’s allowReconnection() lets a dropped client return to its room within a time window (rooms); Kulkarni’s “Enter Game World” button stops forgotten windows from rejoining on their own.
Portal rules for multiplayer chat
CrazyGames and Poki both restrict chat. CrazyGames wants your chat to turn off when the player’s settings say so, and requires moderation, with a profanity filter as the minimum. It also places the first player of a party straight into a new private room (CrazyGames). Poki doesn’t allow chat at all, because it exposes younger players to real risks, and suggests an emoji system instead (Poki).
Emotes or preset messages from the start mean one build fits both portals.
Next: test it, then ship it
- Playtesting games with AI: automated tests with two players.
- Where to publish a browser game: portals and their multiplayer rules.
- Play the online multiplayer games in the catalog, ranked by player ratings.
Games to look at
Kurve Royale
Fly a trail-leaving craft and outlast rival pilots inside a shrinking dome.
Starpit.io
Grow from a brown dwarf into a black hole by devouring rival bodies online.
SumoBall.io
Bump rival sumo balls off the arena to be the last one standing.
Land Capture
Fight alongside your team to claim more of a shared island than four rival teams.
Questions
Can AI make a multiplayer game?
Yes. 173 of the 404 games we list have online multiplayer. The hard part is netcode that stays smooth and fair with many players, which goes better when the first prompt names the architecture.
What is the easiest way to add multiplayer to a browser game?
A hosted service such as Playroom Kit needs no server of your own. For more control, Colyseus is an open-source Node.js game server, and PartyServer runs rooms on Cloudflare Durable Objects. Peer-to-peer with PeerJS works for two friends, but one player's browser runs the game.
Why do AI-written multiplayer games lag or break?
A first version tends to send too much state, too often, and to trust what each client reports. The fixes are the classic ones: a server that owns the game, inputs instead of positions from clients, prediction for your own moves, interpolation for everyone else's, and only the data that changed.
How do I test a multiplayer game alone?
Open a normal and a private browser window, or two browser contexts in one Playwright test, and join the same room. Then add about 100 milliseconds of delay to the server's messages, because a game that works on localhost can fall apart once packets take that long.