# Net Forge and three.js: what Net Forge adds on top

> three.js is a general-purpose JavaScript 3D library, and Net Forge is built on it. Net Forge adds a simulation shared by client and server, netcode, physics, a typed game API and ten finished multiplayer games.

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/compare/threejs  
Last updated: 2026-10-24. Checked against @netforge/engine 0.2.0.

Net Forge is three.js plus the game engine, physics, entity system and authoritative multiplayer you would otherwise build yourself: `@netforge/engine-sim` (a bitECS entity system with Rapier physics at a fixed tick), `@netforge/engine/net` (input commands, delta snapshots, prediction and reconciliation), and the room host in `@netforge/kit-play`, all under a three.js renderer (`three` 0.186.1, with `WebGPURenderer` and a WebGL2 fallback). Use three.js on its own when you want full control of a 3D scene; use Net Forge when you want a multiplayer game on three.js where the simulation, netcode, physics and a finished game are already done.

```sh
npm create netforge@latest my-game -- --template survivor --yes
```

## At a glance

| | three.js | Net Forge |
|---|---|---|
| What it is | "An easy-to-use, lightweight, cross-browser, general-purpose 3D library" ([README](https://github.com/mrdoob/three.js)) | A game engine and ten multiplayer templates that render with three.js |
| Language | JavaScript, with TypeScript types | TypeScript |
| Rendering | WebGL and WebGPU renderers, with SVG and CSS3D as addons | three.js `WebGPURenderer`, falling back to WebGL2 |
| Game loop, physics, netcode | Not included; bring your own | Included: fixed tick (30 or 60 Hz), Rapier physics, authoritative rooms, prediction |
| License | MIT ([npm](https://www.npmjs.com/package/three)) | MIT |
| Latest version (checked 2026-10-23) | 0.186.1, released 2026-09-24 | `@netforge/engine` 0.2.0, on `three` 0.186.1 |
| Best for | Any 3D on the web: scenes, visualizations, games, tools | Online games in ten genres |

## What Net Forge adds to three.js

| Layer | Package | What it does |
|---|---|---|
| Simulation | `@netforge/engine-sim` | A bitECS world with Rapier physics at a fixed tick, no DOM and no clock, so the same code runs in Node and the browser |
| Netcode | `@netforge/engine/net` | Sequence-numbered inputs, quantized delta snapshots, prediction, reconciliation and interpolation |
| Rendering stack | `@netforge/engine/runtime` | `createRenderStack` (lighting rig, bloom, colour grade, fog, quality tiers, GPU particles), instanced and vertex-animated crowds for thousands of enemies |
| Game feel | `@netforge/engine/runtime` | `FeelKit`: hit-stop, screen shake, hit flash, damage numbers, procedural audio cues, rumble |
| Game API | `@netforge/engine` | `game`, `prefab`, `weapon`, `system`, `earn`, `store`: declarative and validated |
| Games | `@netforge/template-*` | Ten finished multiplayer games |

## When to use three.js on its own

- **Your project is not a game, or not this kind of game.** three.js is general purpose: product viewers, data visualization, art and any scene graph you can imagine.
- **You want to choose every layer yourself**, including physics, networking and the game loop.
- **You want the largest pool of examples.** The [three.js examples](https://threejs.org/examples/) cover most rendering techniques.

## When to use Net Forge

- **You want one simulation on both sides.** The room host and the browser step the same `@netforge/engine-sim` world, so there is no second copy of the rules to keep in sync. See [Simulation and ECS](https://forge.netnet.capital/docs/concepts/simulation-ecs.md).
- **You want to start from a finished game.** See [Templates](https://forge.netnet.capital/docs/templates.md).
- **Your coding agent writes the game.** See [The typed game API](https://forge.netnet.capital/docs/concepts/game-api.md).

## Honest limits of Net Forge

Net Forge is young (0.2.0) and covers ten genres. Game code in `src/game.ts` may import only `@netforge/engine` and never touches three.js directly; scene code lives in the template's `client/` folder. The public repository's room host is for play on your own computer and network; the production room server is the hosted Net Forge service.

## Using the simulation under your own three.js scene

`@netforge/engine-sim` has no rendering dependency, so you can step it under a scene you wrote yourself and draw its entities however you like. This runs one tick in Node or the browser:

```ts title=sim.ts
import { initSim, createWorld, addPlayer, step, Button } from "@netforge/engine-sim";

await initSim(); // once per process (loads Rapier's WebAssembly)
const world = createWorld({ tickRate: 30, seed: 7 });
addPlayer(world, 1);

// One fixed tick with every player's input for that tick.
const { tick, events } = step(world, new Map([[1, { seq: 1, tick: 0, moveX: 0, moveZ: 1, yaw: 0, buttons: Button.Fire }]]));
console.log(tick, events.length);
```

For moving an existing scene over step by step, see [Migrating a three.js scene to Net Forge](https://forge.netnet.capital/docs/migrate/from-threejs-scene.md). For a plain three.js scene with Net Forge's netcode under it, see the runnable example in [How to add authoritative multiplayer to a three.js game](https://forge.netnet.capital/docs/guides/threejs-authoritative-multiplayer.md). For three.js next to Babylon.js, PlayCanvas, Godot and Unity, see [3D multiplayer browser game engines compared](https://forge.netnet.capital/docs/compare/3d-multiplayer-engines.md).

## FAQ

### Is Net Forge built on three.js?

Yes. `@netforge/engine` depends on `three` 0.186.1 and renders with `WebGPURenderer`, which falls back to WebGL2.

### Is three.js a game engine?

three.js describes itself as a general-purpose 3D library ([README](https://github.com/mrdoob/three.js)). It draws scenes; game loops, physics and networking come from other libraries. Net Forge is one way to add those.

### Can I write three.js code inside a Net Forge game?

Not in `src/game.ts`, which may import only `@netforge/engine`. Scene code lives in the template's browser client, which you can read and fork.

### How does Net Forge draw thousands of enemies with three.js?

With instanced meshes and vertex-animation crowds (`InstancedCrowd`, `AnimatedCrowd`, `VatCrowd`), so a whole crowd is one draw. The survivor-like template holds 2,000 enemies; see [Templates](https://forge.netnet.capital/docs/templates.md).
