How to deploy and host your browser game
Net Forge, the open-source multiplayer browser game engine built for AI coding agents, is published on npm under @netforge with source at github.com/netnetdev/net-forge.
A Net Forge game runs in two places: on your own computer and network through the local room host in @netforge/kit-play, and in production on the hosted Net Forge service at forge.netnet.capital, which runs the room servers for published games. The public repository does not include a production room server, so for a game anyone on the internet can join, publish it through the hosted studio.
npm run play -- --host 0.0.0.0 --no-openThat line serves your game to every device on your local network from your computer, which is the right setup for playtests in one place.
The options
| Option | Who can play | What runs it | Good for |
|---|---|---|---|
npm run play | You, in as many tabs as you like | @netforge/kit-play on 127.0.0.1:4663 | Building and testing |
npm run play -- --host 0.0.0.0 | Anyone on your network (phones, laptops) | The same local host, listening on every interface | Playtests in a room, a classroom or an office |
| Hosted Net Forge studio | Anyone with the link | Net Forge's room servers | Publishing a game for the public |
1. Host a playtest on your network
npm run play -- --host 0.0.0.0 --port 4663 --no-openkit-play prints a link such as http://localhost:4663/?server=http%3A%2F%2Flocalhost%3A4663. On the other devices, open it with localhost replaced by your computer's address on the network, in both places (the page and the server parameter). Every device joins the same room until it is full, then a new room opens. Stop it with Ctrl+C.
What the local host is, exactly:
- One Node process serves the built page, the asset library and the room (WebSockets through a Colyseus room) on one port.
- It runs the same simulation as the hosted server at the game's fixed tick and sends each player delta snapshots at 20 Hz.
- It holds at most 8 rooms. Progress (achievements, looks bought with play money) lives in memory and is gone when it stops.
- It has no lag compensation history (hitscans resolve against current hitboxes, which is exact at local latency), no run log, no replay and no sign-in. Every money route answers 403. Coins are play money.
- It is not a sandbox: it runs the game's code with your permissions, so host only games whose code you trust.
2. Publish through the hosted studio
The hosted studio at forge.netnet.capital builds, plays and publishes games on Net Forge's servers. A studio draft is the same kind of game folder: src/game.ts and src/names.json on one of the ten templates.
To bring rules you wrote locally into a studio draft on the same template:
- In the studio, type
/agent. You get a one-time key and the draft's git address. - Clone the draft with the key as the password, copy in your
src/game.ts(andsrc/names.jsonif you changed labels), and push to theagentbranch.
git push origin HEAD:agentOnly src/game.ts and src/names.json are taken. Playtest bots play every change before it becomes a new version, so a change that softlocks or breaks a rule is refused with the reason. Or connect Claude Code with the line the studio shows, and let it push for you.
What the hosted service adds over the local host: rooms for the public, lag compensation for hitscan weapons (rewound to what the shooter saw, capped at 200 ms), a run log and replay for every run, saved progress per player, and the optional on-chain economy (a game token and rewards), which runs only there and is decided by its server.
3. Keep the local copy in sync
A studio draft can be downloaded as source at any version: src/game.ts, src/names.json, netnet.json and an llms.txt for agents. Inside that folder, npx @netforge/kit-play plays it locally with play money, the same way as a game made with npm create netforge.
How it works
A game module (src/game.ts) may import only @netforge/engine, and the template supplies everything else. That is what lets the same file run under kit-play on your laptop and on the hosted room servers without changes: both load the template's game module, step the same @netforge/engine-sim world, and use the same client build. See Simulation and ECS.
Alternatives
If you want to run and scale your own game servers instead, these are the established choices, each with its own server model:
- Colyseus documents self-hosting with PM2, Nginx, Apache and Docker, and offers a managed option in Colyseus Cloud.
- Nakama is an open-source game backend you can run yourself, with authoritative multiplayer, accounts and storage.
- PartyKit runs real-time rooms on a hosted platform that handles the infrastructure and scaling.
Pick the hosted Net Forge studio when your game is built on a Net Forge template and you want it published without operating servers.
FAQ
Can I deploy a Net Forge game to Vercel, Netlify or GitHub Pages?
Not as a complete multiplayer game. Those hosts serve static files, and a Net Forge game also needs its room server running the simulation. The client is static, but it needs a room to join.
Can I run kit-play on a public server?
It is built and supported for your own computer and network. It has no persistence, a cap of 8 rooms, no lag compensation history and no sandbox for the game's code. For a public game, publish through the hosted studio.
Does publishing cost money or require a token?
A token is not required. The on-chain economy is an optional upgrade on the hosted service. Check the studio for its current terms.
Will my game play the same locally and in production?
Yes for the rules: both run the same game module and the same simulation. Hitscan feel can differ slightly over the internet, because production adds lag compensation that local play does not need.
How do friends on my Wi-Fi join?
Run npm run play -- --host 0.0.0.0, then open the printed link on their devices with 127.0.0.1 replaced by your computer's address on the network.
Where do I see the room server's code?
The local host's authoritative loop is in packages/kit-play/src/host in the public repository. The hosted room server is not open source.