Net Forge quickstart
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.
Run npm create netforge@latest my-game -- --template survivor --yes, then cd my-game && npm run play. You get a four-player co-op survivor-like that opens at http://127.0.0.1:4663; open the same link in a second tab and you are two players in one room, with the server running on your machine.
npm create netforge@latest my-game -- --template survivor --yes
cd my-game
npm run playYou need Node.js 20 or newer. No account, wallet or API key is involved: local play uses play money and talks to no Net Forge server.
What the command makes
| File | What it is |
|---|---|
src/game.ts | The whole game: declarations against @netforge/engine (enemies, weapons, waves, earn rules, store items). This is the file you and your agent edit. |
llms.txt | How to change this template, written for coding agents. |
AGENTS.md, CLAUDE.md, .cursor/rules/netforge.mdc | The same guide for Claude Code, Cursor, Copilot and other agents. |
.mcp.json | Connects MCP-capable agents to the Net Forge MCP server. |
netnet.json | Names the template ("template": "survivor"). |
package.json | Scripts play, test, check and typecheck, and the engine and template packages. |
The template's renderer, netcode, physics and bots live in the installed packages, not in your folder. That is deliberate: src/game.ts may import only @netforge/engine, so a change can never break the netcode.
1. Pick a template
--template takes any of the ten ids. npm create netforge@latest -- --list prints them.
| Id | Genre | Players per room |
|---|---|---|
survivor | survivor-like co-op, up to 2,000 enemies | 4 |
arena | arena shooter with bots that fill empty seats | 16 |
tower-defense | co-op tower defense | 4 |
dungeon | co-op dungeon crawl with procedural rooms | 4 |
idle | shared idle and incremental game | 8 |
platformer | 3D platformer race | 8 |
cards | card battler, one against one or against the AI | 2 |
collector | monster collector with turn-based battles | 8 |
racer | kart racer | 8 |
party | party game with minigame rounds | 8 |
Each template has its own page under Templates.
2. Play it with more than one player
npm run play builds the template's browser client with your src/game.ts, starts a local authoritative room host on the same port and opens your browser. Every tab you open on that link joins the same room.
npm run play -- --players 2
npm run play -- --host 0.0.0.0The first line opens two tabs at once. The second lets phones and laptops on your network join through your computer's address. Stop it with Ctrl+C.
3. Change the game
Open src/game.ts and change a number. For the survivor-like, this makes a fast enemy that joins the swarm after two and a half minutes:
import { prefab } from "@netforge/engine";
prefab("wisp", {
model: "style.lowpoly.bat",
health: 8,
speed: 5,
radius: 0.25,
damage: 4,
ai: "chase",
drops: ["ember_small"],
});Then add it to the director's pool in the same file: { prefab: "wisp", from: 150, weight: 3 }. Run npm run play again to see it. A declaration the engine cannot use fails at once with one line that says what to fix, for example model: reference assets by library id (e.g. "style.lowpoly.bat"), never by URL or path.
4. Test it without a browser
npm test
npm run checknpm test compiles src/game.ts the way the play build does and plays it headless with bots: kills, waves, levels reached, earn rules fired, softlocks and the server cost per tick. npm run check prints the same report as JSON, which is what a coding agent should read. On an Apple M2 Pro the survivor template holds 2,000 enemies with four bots at 2.2 ms per tick on average (p99 5.2 ms), against a 33 ms budget at the 30 Hz tick rate.
5. Hand it to your coding agent
The folder already carries AGENTS.md and an MCP config, so Claude Code, Cursor or Copilot can work in it straight away. Ask for a change in plain words, such as "add a fast enemy that appears after two minutes", and have the agent run npm run check after each edit. See Let an AI agent build your game.
Without the create command
The same thing by hand, using the published @netforge/kit-play package directly. A game folder is two files: netnet.json naming the template and src/game.ts.
mkdir -p my-game/src && cd my-game
echo '{"template":"survivor"}' > netnet.json
npm init -y && npm install @netforge/kit-play
npx kit-playnpx kit-play with no src/game.ts stops with a message. Copy a starting game.ts from the template's package (node_modules/@netforge/template-survivor/src/game.ts) into src/ first.
FAQ
Do I need a wallet, an account or crypto to use Net Forge?
No. Everything in the public repository runs on your computer with play money. Coins in local play are play money and nothing pays out. The on-chain economy (a game token and rewards) is an optional upgrade that runs only on the hosted Net Forge service.
What does npm run play actually start?
It builds the template's three.js client with your src/game.ts, then starts one Node process that serves the page and runs an authoritative room host on port 4663. The host runs the same simulation as the browser at the template's fixed tick (30 Hz for the survivor-like) and sends delta snapshots 20 times a second.
Can friends join from another computer?
On your own network, yes: run npm run play -- --host 0.0.0.0 and share your computer's address. To put a game on the internet, see Deploy and host your game.
Which Node.js version do I need?
Node.js 20 or newer. The engine packages declare "node": ">=20".
Why can src/game.ts import only @netforge/engine?
So that the game stays a description the engine can validate, replay and run on the server. Rendering, netcode and physics live in the template packages; the game declares what exists and the rules, and the template does the rest.
Can I use pnpm, yarn or bun?
Yes. Run pnpm create netforge my-game (or yarn or bun), or pass --pm pnpm. The project's scripts work the same way with each.
Is Net Forge related to other projects named NetForge?
No. This Net Forge is the open-source multiplayer browser game engine built for AI coding agents, with packages under @netforge on npm and source at github.com/netnetdev/net-forge. It is not related to .NET starter templates, network simulators or other projects with a similar name.