ChatGPT: Take the game ChatGPT built online, with one dedicated server per match and Matchmaking

ChatGPT can write a whole browser game from one prompt, as an HTML file you play in a preview next to the chat. It's a single-player game: you against bots, no server. This guide takes that game online. Edgegap runs a dedicated server for each match, close to its players, and stops it when the match ends. Edgegap Matchmaker is optional: it groups players who don't know each other and starts their server.
The file keeps working. Solo play stays the same, and the online version runs the exact same rules on the server, copied out of ChatGPT's file by a script.
This guide covers:
Asking ChatGPT for a game that can go online, and the two fixes it needed
Splitting the rules out of the file
Adding online play with a coding agent and the Edgegap MCP
Building the server and creating the app version
Playing online without a matchmaker
Adding Edgegap Matchmaker (optional)
Proving it end to end, then cleaning up
We ran this path end to end on November 20, 2026, with a game ChatGPT wrote on the Free plan. The code is public: Turf Painters, a ChatGPT game on Edgegap, with every prompt in its PROMPTS.md.

How the pieces fit together:
chatgpt.com --writes--> artifact/turf-painters.html (solo game, rules between two marker lines)
split script --copies the rules--> client/rules.js --runs on--> one Node.js server per match
Browser page --Find match--> Edgegap Matchmaker --starts--> dedicated server near the players
Browser page <== wss:// (TLS Upgrade) ==> dedicated server
What ChatGPT does | What your coding agent does | What you do |
Writes the game as one HTML file, with every rule in one block. | Adds the server, the Find match button, the Dockerfile and the tests, and can deploy test servers through the Edgegap MCP when you say so. | Check the bots move, get the file out, add the GitHub secrets, create the app version and the matchmaker in the dashboard, and playtest. |
What ChatGPT gives you
Ask ChatGPT for a browser game and it builds an HTML file in its workspace and shows it in a preview you can play. Ask for changes and it rewrites the file. Anyone you send the file to plays their own copy: there's no server, so there's no match to join.
What our prompts got us
We used a new chat on chatgpt.com, on the Free plan with the default model, and asked for Turf Painters: four painters in an arena, drift movement, every tile you roll over takes your color, and bumping a rival splashes paint around it. We asked for Canvas, but on that plan ChatGPT said it couldn't launch a playable Canvas preview in the chat. It answered with an HTML file in a preview pane instead, with a download button.
The first file played, but the bots never moved. Its
setInputignored bot players, while the page fed the bots throughsetInput.Its world wasn't server-ready.
createWorld()added the four painters itself, andaddPlayerput every new painter in the middle. A server that seats its own players can't use that.One follow-up fixed both, and the fixed file kept everything else and the marker lines.
Getting the file out took one more try
The download button worked for the first file. For the fixed one it did nothing, and ChatGPT no longer had the file when asked to paste it. Uploading the first file back with "apply the two fixes and paste the complete updated HTML file in one code block" worked: Copy code on that block gave the exact file. Ask for the code block from the start and you skip this.
The trick: keep every rule in one block
A server can't run a page, and the game has to stay one file to keep playing in ChatGPT's preview. So the prompt asks ChatGPT to put every game rule between two exact marker lines, with nothing from the browser inside. The file still plays in the preview, and a script copies the block out for the server. Solo and online play the same rules, with no port and no drift between them.
One server per match
Edgegap runs the server as a container and starts a fresh copy for each match, at the best available location for its players. The server stops itself when the round ends. In our test, a 60-second round cost one 0.25 vCPU server for about 90 seconds.
Browser games need secure WebSockets
ChatGPT's game runs in the browser, and browsers can't open raw UDP connections. They talk to game servers over WebSockets, and a page served over https:// may only use secure WebSockets (wss://). Edgegap's TLS Upgrade gives each server a secure endpoint without you buying or renewing certificates, so the server itself stays plain ws.
Matchmaking for strangers
The Edgegap Matchmaker groups players by rules you choose and starts their server close to them. In this sample it matches 2 to 4 players. After 20 seconds in the queue, a lone player gets a match with bots in the empty seats, so nobody waits forever. You can test it for free.
Step-by-Step Guide
Detailed Integration Steps
1. Ask ChatGPT for a game that can go online
Start a new chat on chatgpt.com and send this prompt. It's the one used for Turf Painters, word for word:
Use canvas. Build a small browser game as a single HTML file called "Turf Painters" (plain Canvas 2D, no frameworks, no external libraries) and show it in canvas so I can play it in the preview. Gameplay: 4 round painters in a square arena (800x800 units, a 20x20 grid of floor tiles) move with WASD/arrow keys with drift (velocity + friction). Every tile a painter rolls over turns its color. Bumping another painter at speed splashes paint: the 3x3 tiles around the bumped painter turn to the bumper's color. A round lasts 60 seconds; the painter with the most tiles wins, then a results screen and restart. The human plays against 3 simple bots. VERY IMPORTANT architecture: put ALL game rules in one block between the exact lines /* RULES:BEGIN */ and /* RULES:END */, with NO window, document, canvas, audio, requestAnimationFrame or timers inside, and no export keyword. The world is plain data (objects, arrays, numbers, strings; no classes or Maps). The block defines createWorld(), addPlayer(world, id, name, isBot), removePlayer(world, id), setInput(world, id, {up,down,left,right}), step(world, dt) returning an array of events ({type:'bump', a, b} and {type:'win', winner}), and botInput(world, id) using only positions and tiles. Everything else (rendering, keyboard input, calling step() at 60 Hz) stays outside the block.
For your own game, change the gameplay sentences and keep the architecture part as it is. Here's why it's shaped this way:
| Prompt detail | Why it matters online |
Rules between /* RULES:BEGIN */ and /* RULES:END */, with no browser code inside | The file still plays in ChatGPT's preview, and the block runs unchanged in Node.js on the server. |
| The world is plain data | The server sends it to players as JSON (the 400 tiles as owner ids), and the page draws it with ChatGPT's own draw(). |
setInput(world, id, {up,down,left,right}) | That object is exactly what the browser sends: four booleans. |
botInput(world, id) reads only positions and tiles | The server fills empty seats with the same bots, and the tests use it to drive headless players. |
| Drift, bumping, painting | The game still feels right with 50 to 100 ms of network delay. Avoid precise platforming, rhythm or instant-hit aiming. |
Play it before you save it. In our run the bots never moved, and the world wasn't ready for a server. This follow-up fixed both:
Two fixes, keep everything else and the RULES markers the same. 1) The bots never move: setInput ignores bot players, but the game loop feeds bots through setInput. Let setInput work for every player. 2) createWorld() should return a world with no players; the page then adds the 4 painters with addPlayer, and addPlayer places each new painter at its own free start spot (one per corner area), so any code can add up to 4 players with any ids. Give me the full updated HTML file.
Check the same things in your game: the bots move in the preview, createWorld() returns no players, and addPlayer() gives each new player its own start spot.
Get the file out. Ask ChatGPT to paste the complete HTML file in one code block, use Copy code, and save it unchanged as artifact/turf-painters.html in your repo.
Done when: the file plays solo with moving bots, and it contains both marker lines.
2. Split the rules out of the file
Copy the sample's tools/split-artifact.mjs into your repo and run it once:
node tools/split-artifact.mjs artifact/turf-painters.html --page
- It copies the block into
client/rules.jsand adds anexportfor every function the server needs. - It refuses a block that uses
window,document, canvas, timers or module code, and names the line, so you can ask ChatGPT to move it. --page(first time only) writesclient/index.html: ChatGPT's page without the block, importing the rules instead.
When you change the game later in ChatGPT, save the new file over the old one and run npm run split. CI runs npm run check:rules, which fails when the server's rules no longer match the file, so the server never runs old rules.
Done when: npm run check:rules reports that client/rules.js matches the file.
3. Add online play with your coding agent
Give a coding agent with the Edgegap MCP server connected this prompt. Its edgegap-chat-canvas skill holds the split script, the server templates, the matchmaker configuration and the tests used here:
Make this ChatGPT game online multiplayer on Edgegap. Use the Edgegap MCP and its edgegap-chat-canvas skill. Keep the solo mode, add a Find match button, 2 to 4 players per match, bots fill empty seats. Ask me before you create anything in my Edgegap account.
What gets added (all of it is in the sample, ready to copy):
| File | What it does |
server/game.js | About 80 lines that wrap the rules: take the four buttons from players, feed the bots botInput() (ChatGPT's step() doesn't), run step(), count tiles as scores, send the world 20 times a second. The only server file you adapt to your game. |
server/main.js, room.js, edgegap.js | Connections, match phases, bots in empty seats, and the self-stop when the round ends. |
client/online.js, client/net.js | Find match through the Edgegap JS SDK, then the WebSocket to the match server, with retries while it boots. |
client/index.html | ChatGPT's page plus about 60 lines: Find match, Local server and Cancel buttons, the server's world drawn with ChatGPT's draw(), waiting and results text in the side panel. Start and Restart still play solo. |
server/Dockerfile | A Node 22 image with the server and the rules. |
tests/local-match.mjs | Two headless players play a full round against a local server, on every build. |
The server never trusts the browser: it accepts four booleans and decides movement, bumps and painting itself. Two changes to ChatGPT's page were needed. Its scoreboard wrote player names straight into the page, so online the page escapes them first. And the human's id was a constant ("player"), so every non-bot said YOU. Online, the id comes from the server, and only your own painter says YOU.
Done when: npm install && npm run test:local prints PASS, and two tabs on the local page see the same round.
4. Build the server and create the app version
The sample's GitHub Actions workflow builds the server on every push, checks the rules still match ChatGPT's file, runs the local match test, and pushes the image to the Edgegap Container Registry. You don't need Docker on your computer.
One-time setup in GitHub (Settings > Secrets and variables > Actions): a variable EDGEGAP_REGISTRY_PROJECT and two secrets, EDGEGAP_REGISTRY_USERNAME and EDGEGAP_REGISTRY_TOKEN, from the Credentials box of your Edgegap Container Registry.
Keep provenance off. By default, docker/build-push-action wraps the image in a multi-manifest index, and Edgegap then fails with "Unable to pull image from registry". Keep provenance: false and sbom: false, as the sample does.
Then create the application and its version in the Edgegap dashboard:
| Setting | Value | Why |
| vCPU | 0.25 (512 MB) | Plenty for a 4-player Node.js match. |
| Port | 7777, protocol WS, name gameport, TLS Upgrade on | Pages on https can only open wss://. |
| Restart policy | Never | A crashed match should end, not restart half-played. |
| Max duration | 30 minutes | A backstop: the server normally stops itself much earlier. |
EMPTY_TIMEOUT_S, FIRST_JOIN_TIMEOUT_S, RESULTS_SECONDS | 15, 60, 8 | Stop 15 s after the last player leaves, or if nobody joins within 60 s. Show results for 8 s before stopping. |
To ship a new server build later, change the image tag on the version. Running matches aren't affected.
5. Play online without a matchmaker
The quickest way online, and enough for playing with friends: start one server and share its address.
- In Deployments, create a deployment of your version near the players, or let your coding agent deploy it through the Edgegap MCP.
- When it's Ready, copy the
gameportaddress:wss://<host>:<external port>. - Everyone opens your page with
?server=<that address>. Bots fill the empty seats, and the round starts 15 seconds after the first player joins.
Done when: two windows on that URL play the same 60-second round, and the deployment disappears by itself once the round is over and everyone has left.
Sharing an address works when you know who you're playing with. To put strangers in matches automatically, add a matchmaker.
6. Add Edgegap Matchmaker (optional)
This step is optional. Without a matchmaker, the game works with a shared server address, and solo play always works.
- In the sample's
matchmaker/turf-painters.json, set the version to your image tag and add your page's address toallowed_cors_origins. - Open Matchmaker, select Create Matchmaker, upload the file, and select Create and Start. If the dashboard warns that the image "is not cached" or "not valid", continue: it can't check a private registry, and the end-to-end test in step 7 proves it works.
- When it's ONLINE, copy the API URL and the Auth Token into
client/config.js.
The matchmaker's Auth Token is made to ship in game pages: it can only ask for matches. Never put your Edgegap API token in the page, the repo or the image.
Done when: the matchmaker shows ONLINE, and Find match on the page starts searching for players.
7. Prove it end to end, then clean up
These checks prove the whole loop works, from Find match to the server stopping itself:
Serve the page with
npm run client(http://localhost:8080), or publish it with the sample's GitHub Pages workflow and add that address to the CORS list.In GitHub Actions, run the Matchmaker e2e workflow. Two headless players queue, land on the same server and play a round, and the test checks that the server stopped itself.
Open the page in two windows and select Find match in both within 20 seconds. Both land in the same round, with two bots, on a server near you.
In the dashboard's Deployments list, check that nothing stays running after the round.
In our run, the players were matched after 13 seconds and had their server after 15, and the server stopped itself 11 seconds after the round:
e2e-1: MATCH_FOUND after 13s
e2e-1: HOST_ASSIGNED after 15s
deployment stopped itself 11s after the match
PASS
Clean up. Each match server stops itself. Stop or delete the matchmaker when you're done testing: on the free tier it stops by itself about 3 hours after each start, and Start brings it back. While it's off, Find match fails but solo play keeps working. The app version, registry images and GitHub secrets cost nothing while idle.
Built a game with ChatGPT you want to take online? Show us on the Edgegap Discord or contact us.
Frequently Asked Questions
Common questions about taking a game ChatGPT built online with Edgegap’s dedicated servers and matchmaking.
Is there a working example?
Yes: Turf Painters (netcode-sample-chatgpt-turf-painters on GitHub), a 4-painter territory game ChatGPT wrote on the Free plan. The commit before the tag before is ChatGPT's first file, before is that file with the two fixes, and every change after it, including the optional Find match, is in the history.
Does ChatGPT need Canvas for this?
No. We asked for Canvas, but on the Free plan ChatGPT answered with an HTML file in a preview pane instead. Any way of getting one HTML file works, as long as every game rule sits between the two marker lines.
Why didn't the bots move in ChatGPT's first version?
Its setInput ignored bot players, while the page fed the bots through setInput. One follow-up prompt fixed it, and made createWorld() return a world with no players so the server can seat its own. Check both in the preview before you save the file.
Do I need a matchmaker?
No. Without one, start a server and share its address: everyone who opens the page with ?server= joins that round. Add the Edgegap Matchmaker when players who don't know each other should press Find match and be placed on a server near them.
What does a match cost?
In our test, a 60-second round cost one 0.25 vCPU server for about 90 seconds. Each server stops itself when its round ends, so nothing runs while nobody plays. The free tier is enough to test: one matchmaker and one server at a time.
Which games work well online?
Games that still feel right with 50 to 100 ms of network delay: slippery movement, pushing and bumping, slow shots or turn-based play. Avoid precise platforming, rhythm games and instant-hit aiming.

Clients
Learn more from clients who integrated Edgegap
31 case studies are available from studios that moved to Edgegap from another platform.

A Flawless Global Launch for Rivals of Aether 2
Aether Studios
Learn how Aether Studios quickly added Edgegap and delivered flawless launch & post-launch to their community.
Case Study

Overcome Latency Introduced by VR’s use of WiFi in Competitive Multiplayer
Halfbrick Studios
Discover how Halfbrick successfully launched & maintains a multiplayer-focused Early Access on META Quest's VR platform.
Case Study

MENA’s Social App Adds Online Games
WOLF
Learn how the highly popular MENA-region social app added matchmaking & multiplayer games orchestration easily to WOLF Qanawat.
Case Study

Hybrid Orchestration Keeps Kickoff Tactics Ready for Any Traffic
Birch Games
How hybrid orchestration helped Birch Games handle traffic, pairing egress-free Fleets with the regionless cloud.
Case Study

Authentic Online Warfare Requires the Ultimate Orchestration
Highwire Games
Learn how Highwire's need for performance required orchestration only Edgegap can deliver.
Case Study

22,000 Reviews, 4.8 Stars, and Infrastructure That Scaled Automatically
Sinn Studios
How a simple, Slack-supported integration got Sinn Studio's hit VR title online fast and keeps it there.
Case Study

Dynamic Server Orchestration
Under NDA - AAA Studio
Discover how one the world's biggest AAA studio improved its peer-to-peer multiplayer experience through edge computing.
Case Study

Near Zero Latency for AAA Fighting Game
AAA Studio - Under NDA
How an unannounced project delivered the lowest lag possible and improved fairness in its 1v1 game.
Case Study

Play Gods with Multiplayer Physics
Squido Studio
Learn how Squido uses Edgegap's highligh optimized game servers to deliver mind-bending & chaotic VR gameplay.
Case Study

A Fully Managed Solutions that Saves Time for Indies Multiplayer VR Horror
Dirty Pearl Studios
Discover how Dirty Pearl Studios saved development time thanks to Edgegap’s easy integration and automated orchestration alongside its Nakama integration.
Case Study

7 Days Blood Moons
The Fun Pimps & iLLOGIKA
Learn how Illogika dramatically reduced server costs & ensured the online experience the 7 Days to Die franchise expects.
Case Study

Instant Global Server Deployment for Collaborative XR Medical Education
AlensiaXR
How AlensiaXR uses Edgegap to deliver low-latency, always-available shared anatomy sessions to medical students worldwide.
Case Study

FunPlus
FunPlus
Case Study

The Lightkeepers: A VR Social Co-op Game with Dedicated Servers
Spectral Games
How Spectral Games used Edgegap Matchmaking and Server Browser to launch dedicated servers for its VR social lobby, with no prior server experience.
Case Study

Fast & reliable deployments worldwide for PvPvE challenger Gravebound
Crater Studios
How Edgegap’s orchestration and matchmaking helped Crater Studios dramatically helped a small them focus on gameplay instead of infrastructure.
Case Study

Rapid Scaling of Web Metaverse
Hiber
Learn how Hiber eliminated the guesswork out of its server capacity planning with Edgegap.
Case Study

High Hardware Requirements & Custom Game Server Pools
Alderon Games
Learn how Alderon Games instantly leverages a custom pool of game servers across multiple providers worldwide for its popular MMO.
Case Study

Easy Integration for Indie Devs
WhaleFood Games
Read how WhaleFood Games "kicked out" its netcode issues with Edgegap.
Case Study

Cutting-edge tech that powers South-East Asia’s first-ever eSports title.
Anantarupa Studios
Learn how Edgegap transformed South-East Asia’s gaming landscape streamlining complex infrastructure and cutting-edge tech with one seamless solution.
Case Study

One Strike. Global Reach.
Triple Hill Interactive
How Triple Hill Interactive leverages Edgegap's orchestration to deliver low latency and improve fairness in a genre where every millisecond counts.
Case Study

Fast-paced Team Battle Royale... with Gun-totting Animal Plushes!
SANDYFLOOR
Discover how a Korea-based Indie Studio launched it multiplayer worldwide.
Case Study

Mobile Horse Racing Goes Global with Instant, Cost-Efficient Servers
Mirai Labs
How Mirai Labs powers Pegaxy Blaze's worldwide multiplayer races with just-in-time server deployment and fractional vCPU to keep cost per player low.
Case Study

Server Management & Distribution
Matrioshka Games
Read how Matrioshka Games were able to ship a Battle Royale in early access with limited ressources.
Case Study

At my Signal, Unleash Hell!
TyGames
Discover how Indie studio TyGames immerses players in third-person gladiatorial combat multiplayer.
Case Study

Instant Worldwide Orchestration
Soliton Interactive
Discover how Soliton Interactive did the impossible… Ship it's first playable as multiplayer!
Case Study

Competitive play with server-side physics ensures ideal sub-50 ms latency
NS7
Discover why solely Edgegap could enable an indie studio to deliver on its vision for a AAA-quality F2P sports gameplay through server-side physics and authority.
Case Study

Regional Deployments for iGaming
X1 Contra 1
X1 Contra 1 delivers real-time PvP casual games to its Brazilian player base through cost-effective hosting & regional deployments, ensuring data and legal compliance.
Case Study

Pay Only When Players Play: Affordable Multiplayer Infrastructure
Meltdown Interactive
How Edgegap helped indie developer Meltdown Interactive Media solve cost-effective scaling and matchmaking without the complexity, so they could focus on building the game.
Case Study

One Edgegap platform, three very different networking profiles
Warped Games
How Warped Games runs a social hub, real-time co-op, and turn-based co-op, all on the same Edgegap deployment API and the same container pipeline.
Case Study

Pool Live Tour Max
RETA Games
Case Study

Korea’s Web3 POP Extraction Shooter Goes Global, Instantly
NDUS Entertainment
How XOCIETY easily added Edgegap orchestration & integrated custom matchmaking working alongside Edgegap Ping Beacons to optimize latency.
Case Study

Multiplayer in Every Dimension
Arcadia.tv
Discover how Arcadia.tv uses Edgegap's edge network to deliver an innovative, team and location-based athletic VR sport.
Case Study

F2P Mobile Fighter Cuts Infrastructure Costs With Just-in-Time Servers
Game Changers Worldwide
How Game Changer Worldwide hosted Rumble Rush's real-time 3v3 PvP globally on mobile.
Case Study
Key reasons why they chose Edgegap
Discover the impact of Edgegap's automated game server orchestration for a flawless multiplayer experience.









