Skip to content

Developer ​

Building on Washiki Washoi. Architecture overview + how-tos for the common extension points.

Architecture at a Glance ​

Three things to understand before extending:

  1. The server is authoritative. All gameplay state lives on the server. The client predicts locally for responsiveness, but the server's tick is the source of truth.
  2. The simulation is shared. simulation/FPSSimulation.ts runs on client (predicted) and server (authoritative). Identical code, identical config. Drift between them is a bug.
  3. The engine seam. The submodule talks to the engine through documented extension points: NetworkConnector, GameplayMapLauncher, Pickup (subclass), CommandRegistry, IGameHost. See getting-started/project-structure.md for the full mapping.

How-Tos ​

PageCovers
Adding a WeaponDefining a new WeaponDef, projectile, HUD slot
Adding a GametypeSubclassing BaseGametype, score/time rules, registration
Server CommandsOp commands for dedicated server admins

Code Conventions ​

  • Singleton pattern throughout. XYZ.getInstance(). Reset hygiene matters — use resetInstance() in tests.
  • EventBus for decoupled events. Always store unsubscribe handles.
  • One host path. Everything goes through NetworkGameHost. Playing alone still runs a real dedicated server, started by the lobby's dev-spawn; see the engine's Map Launching Guide.
  • Submodule edits commit to this repo first, then the outer engine repo bumps the submodule pin. AGENTS.md in the engine repo documents the flow.

Tests ​

Washoi owns .github/workflows/ci.yml. It checks out SHAG, places this repository at src/games/fps, installs dependencies at the assembled root, and runs the game/server checks, Node/Bun parity and benchmark recipe tests. SHAG's own workflow checks out and validates only the engine.

The assembled workflow selects SHAG's matching branch (the pull request's head branch, or the pushed branch/tag). Set the repository variable SHAG_REF to a compatible engine branch, tag or commit when those names differ. If SHAG is private, provide SHAG_CHECKOUT_TOKEN with read access to it; the default game repository token only grants access to this repository.

Browser and desktop builds use SHAG_APP=src/games/fps. browser.json owns the extra Babylon modules the game needs prebundled; the engine contributes its own list. Regenerate both lists with the game selected:

powershell
npm --prefix src/games/fps run deps:babylon

Tests live in __tests__/ directories next to the code they cover. Run from the outer engine repo:

bash
npm --prefix src/games/fps run test:run
npm --prefix src/games/fps run test:run -- FPSPickup

The outer vitest config picks up src/games/fps/**/*.test.ts automatically.

See Also ​

Built on the SHAG Engine.