Net Forge concepts
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.
Read these when you want to know why the engine is shaped the way it is.
- Simulation and ECS: Net Forge runs one simulation module, @netforge/engine-sim, on the server for authority and in the browser for prediction. It is a bitECS world with deterministic Rapier physics, stepped at a fixed tick, with integer state and bit-exact snapshots.
- Netcode and prediction: The server runs the simulation and decides what happened. Each browser predicts its own player with the same simulation, reconciles when the server's snapshot arrives, and interpolates everyone else. Inputs are sequence-numbered and sent with redundancy; snapshots are bit-packed deltas.
- The typed game API: A Net Forge game is one TypeScript file, src/game.ts, that declares what exists and the rules with game(), prefab(), weapon(), director(), system(), earn and store from @netforge/engine. Declarations are Zod-validated, and a mistake fails with one line that says what to fix.
- Assets and art styles: Net Forge games reference models and sounds from a CC0 asset library by id, such as style.lowpoly.ghost, never by URL. Every template draws in six art styles (lowpoly, toon, ps1, pixel, voxel, handdrawn), and an id resolves to that style's own model when the style has one.
- Testing with playtest bots: engine.test.run plays a declared Net Forge game headless with bots and reports kills, waves, levels, earn rules fired, softlocks, the server cost per tick and design metrics such as time to first threat. npm test runs it on your game folder; npm run check prints it as JSON for coding agents.