Internals

This section explains how Gamehoster runs, worked through as one model. It starts on your machine with the local tool, moves to the server box, the infrastructure that serves the play and the protocol it speaks, covers the two management APIs the local tool speaks, sync and tools, and ends deep in the model: the instance and the front end. None of it is needed to ship a game; it is here so the whole picture, and the design, has one place to live.

How it runs: generated ahead of time

A game's definition (JSON schemas and raw JS bodies) is generated into plain static code when you sync it, not interpreted on the server. The build emits two files per game and the sync pushes them; the server loads them directly, so no new Function ever runs at request time:

The runtime that runs every game is shared: the same code loads each generated module and runs the tick, rather than compiling raw bodies. How the box serves it is the Infrastructure page, the binary it speaks is the Protocol page, and how the runtime works is the Instance page; the generation step itself is the Sync page.

From definition to live play A game's definition is generated to static code at sync time; the server requires it and runs live instances; the browser sends commands up and receives state deltas down. definition JSON + raw JS generate generated module + front-end library sync World live instances (tick loop) browser state deltas commands
The definition is generated to static code at sync; the server runs the tick loop, and the browser trades commands for state.

Each tick runs the tick function, the three-step cycle from the tick: handle the commands, update every actor, run the instance body.

The pages

The parts shared by every hoster, the local tool, the server, sync and the tools, live in Hoster. What is unique to gamehoster is here.

Model and code

These pages describe the model as the code runs it: authoritative server, the tick function, the per-viewer delta each player receives, the view, and the client that interpolates it and predicts your own actions. The prediction add-ons are still being refined; where a detail is still open, the page says so.