Start here

Architecture

How a game, its plugins, and the engine with its addons fit together on the server and in the browser.

Your game

A game is many entity types: the player, every kind of enemy, projectiles, pickups, doors. Each type's gameplay is a .sim.ts file run on the server, and its look a .client.ts file run in the browser. Systems only your game needs are its own plugins and addons, built the same way as the engine's. The examples in the diagram come from Patchwork's example games: turn-based battles with their own battle screen, an auction house, daily weather, mission objectives, RTS unit orders, a HUD, and an addon that runs a racing lobby and its match.

Plugins

Engine features such as rendering, physics, animation and movement, each with a server half, a browser half, or both. A mod lets one plugin use another: here walker takes the ground height from terrain3d, switched on in the scene.

Engine and addons

The core steps every entity at a fixed rate and sends each player the entities they can see. Addons extend the engine itself: scenes, player slots, saves, lag compensation, interest management, client-side prediction and the network. A plugin that needs one, such as scenemanager or persist, talks to its addon.