AI models are good at single-player games and bad at netcode. GameRelay moves the netcode into the SDK, so a model only declares what exists and who owns it. Give your assistant the guide, a public key and the right starter, and it usually builds a working multiplayer game on the first try.
Why multiplayer trips AI up
Ask a model for "a multiplayer game" and it will usually write its own WebSocket server, send positions on every frame, and skip smoothing, reconnects and players who leave. That works on localhost and falls apart on a real network. With GameRelay there's no server to write: the model declares entities (things that move, each with one owner), events (moments) and state (facts like the score), and the SDK sends, smooths and cleans up.
We measure this. In our eval, models add multiplayer to single-player games using only the guide, then bots play the results in real Chrome on a bad network. The latest run scored 85 out of 100. The SDK's console warnings are written for the model that reads them, so a mistake usually comes with its own fix.
1. Get a public key
Sign in at gamerelay.io/app and create an instance for your game. Copy its public key (gr_pub_…). It's meant to be in the page, so it's fine to paste it into a chat. Never paste a secret key (gr_sk_…).
2. The prompt
Any assistant that can read a URL can do this. Start with something like:
Make a 2–4 player browser game in one HTML file: [describe your game].
Use GameRelay for multiplayer. Read https://gamerelay.io/llms.txt first and follow it:
pick the shape that fits ("players own avatars", "host simulates" or "mixed")
and start from that starter. My public key is gr_pub_…llms.txt is the whole SDK guide in one plain-text file, written for models: three starters, the API, and the rules that keep games working. If your assistant can't open links, paste the file in.
Better: connect the MCP server
With the MCP server connected, the assistant reads the guide and gets a working starter game itself (get_starter_game). The account server goes further: it can create the instance, set it up, and later read your rooms, logs and leaderboards, all as you.
Claude Code
claude mcp add --transport http gamerelay https://gamerelay.io/mcp
claude mcp add --transport http gamerelay-account https://gamerelay.io/mcp/adminChatGPT
Add a connector with the URL https://gamerelay.io/mcp (docs only, no account) or https://gamerelay.io/mcp/admin (your account; the first call opens a sign-in page to approve it).
Cursor, Windsurf, Claude Desktop and others
{
"mcpServers": {
"gamerelay": { "type": "http", "url": "https://gamerelay.io/mcp" },
"gamerelay-account": { "type": "http", "url": "https://gamerelay.io/mcp/admin" }
}
}3. Test it in two tabs
Save the file and open it in two browser tabs. Each tab is a separate player, so you can test alone. Previews inside chat apps and online editors often block outside connections, so if it won't connect there, open the saved file from a local server or your host instead.
If something's off, open the browser console and paste any GameRelay warnings back to the assistant. Each one says what to change and which section of the guide covers it. For a closer look, ask it to add debug: true to connect(), which shows ping, smoothing and traffic on screen.
4. Put it online
The game is one static file, so any static host works: GitHub Pages, Netlify, Cloudflare Pages, itch.io (see the itch.io guide) or your own site. Then lock the key to your site and give the game short links that preview nicely when shared. With the account MCP connected, just ask:
Set my game's allowed origins to https://mygame.example,
give it the slug "space-tag", the play URL https://mygame.example/
and the cover image https://mygame.example/cover.png.
Then make the "points" leaderboard reject scores above 10000.Tips for better results
- Name the shape. "Each player moves their own ship" (players own avatars) or "the host runs the ball" (host simulates) steers the model to the right starter.
- Ask for one file. Single-file games are easier for models to keep consistent and easier to host.
- Keep the key in. Some models replace the public key with a placeholder. Without it,
connect()fails withunauthorized. - Ask for invite links. "Put the room in the URL so I can send it to a friend" gives you
joinInvite()andshareInvite().
Try it
GameRelay has a free plan, no card needed. Get a public key, then follow the quickstart, or point your AI coding agent at llms.txt.