# How to vibe-code a multiplayer game you can actually ship

> Start from a finished multiplayer template instead of a blank page, let your agent change only the declarative game file, and gate every change on a headless bot playtest. The netcode, rendering and server authority are already done, so prompts change the game, not the plumbing.

Net Forge, the open-source multiplayer browser game engine built for AI coding agents, is published on npm under `@netforge` with source at https://github.com/netnetdev/net-forge.

Source: https://forge.netnet.capital/docs/guides/vibe-code-multiplayer-game  
Last updated: 2026-10-23. Checked against @netforge/engine 0.2.0.

Start from a finished multiplayer game instead of a blank page, let your agent change only the rules file, and gate every change on a bot playtest. With Net Forge that is three commands, and the parts that usually sink a prompted multiplayer game (netcode, server authority, rendering, bots) are already done before your first prompt.

```sh
npm create netforge@latest my-game -- --template party --yes
cd my-game
npm run play -- --players 2
```

## Where prompted multiplayer games usually break

| Problem | What Net Forge does instead |
|---|---|
| The agent writes networking from scratch and it desyncs. | The template's netcode runs the same simulation on the server and the client. The agent never writes it. |
| Clients decide outcomes, so anyone can cheat. | The server decides every hit, kill and pickup. Game code is declarations the server runs. |
| Each prompt touches many files and something unrelated breaks. | The game is one file, `src/game.ts`, and it may import only `@netforge/engine`. |
| Nobody can tell if a change made the game worse. | `npm run check` plays the game with bots and reports kills, progress, softlocks and design metrics as JSON. |
| It works on one machine and nowhere else. | The same game folder plays locally with `npm run play` and can be published through the hosted studio. |

## 1. Pick the closest template

Choose the template nearest to the game you imagine and change it, rather than describing a new game from nothing. `npm create netforge@latest -- --list` prints all ten. See [Templates](https://forge.netnet.capital/docs/templates.md).

## 2. Give the agent one rule

Put this in your first prompt, or rely on `AGENTS.md`, which already says it: "Only edit src/game.ts. After every change, run npm run check and fix what it reports before you stop."

## 3. Prompt in small, playable steps

One idea per prompt keeps each change testable: a new enemy, then a boss, then a store item. Play between prompts with `npm run play`.

## 4. Ship it

When it plays well locally, publish it through the hosted Net Forge studio, or keep it as an open-source project that anyone can run with `npm run play`. See [Deploy and host your game](https://forge.netnet.capital/docs/guides/deploy-and-host.md).

## Alternatives

- **[Rosebud](https://rosebud.ai/)** is a hosted, browser-based builder for prompting games into existence, a good fit when you want everything in one web app.
- **[Phaser](https://phaser.io/)** with its official agent tooling is a strong choice for 2D games where you want full control of the code.
- **Your own engine** gives you every choice and every bug. Net Forge suits you when you want the multiplayer foundation finished and owned by you under MIT.

## FAQ

### Can you vibe-code a multiplayer game?

Yes, if the multiplayer foundation exists before the first prompt. Starting from a Net Forge template, the agent changes the game rules in one file while the template supplies the server authority, netcode and rendering.

### Which template is best for a first vibe-coded game?

The survivor-like (`survivor`) and the party game (`party`) respond most visibly to small prompts: enemies, weapons, rounds and pacing are all one-line declarations.

### How do I stop the agent from breaking things?

Keep it in `src/game.ts` and make `npm run check` part of every change. The play build already rejects imports other than `@netforge/engine`.

### Does vibe-coding with Net Forge cost money?

The engine, templates and tools are free and MIT licensed. Your coding agent's own pricing is separate.
