Enhance school creation and map management features by updating the API to support mod packs and map layouts. Introduce a new map snapshot protocol for efficient data handling during school sessions. Revise documentation to reflect these changes, including updates to the protocol and architecture documents. Improve UI components for mod selection and map editing, ensuring a better user experience. Update tests to validate new functionalities and ensure robustness.
ci / server (push) Failing after 3m31s
ci / client (push) Successful in 14s

This commit is contained in:
Leonid Pershin
2026-08-18 15:15:49 +03:00
parent 1bc75244e8
commit 30cc937069
36 changed files with 1876 additions and 171 deletions
+9 -9
View File
@@ -87,8 +87,8 @@ produces the same date.
**Every school runs on its own.** A new school starts living immediately and keeps going whether
or not anybody is looking at it; only the player's pause button stops one, and that pause sticks
until they press play again. Opening a school subscribes the connection to its clock frames and
nothing more. One school's pause cannot stall another's calendar, because they do not share a
thread.
sends one map snapshot labelled in the Hello locale. One school's pause cannot stall another's
calendar, because they do not share a thread.
The main menu therefore re-reads `GET /api/schools` once a second while it is on screen — that is
how the cards tick. It patches the cards it already has instead of rebuilding them, so a refresh
@@ -105,14 +105,15 @@ mod folder or a map that no longer validates leaves the file in place and that s
## Connection lifetime
1. The browser opens `/ws/game`; `ClientRegistry` assigns a client id.
2. The client sends `Hello`; a version mismatch closes the socket.
2. The client sends `Hello` (version + UI locale); a version mismatch closes the socket.
3. `Welcome` goes out with the tick rate and the school limit, and the client is marked ready.
4. Opening a school enqueues `OpenSchool`; the worker starts pushing clock frames.
4. Opening a school enqueues `OpenSchool`; the worker sends a map snapshot then clock frames.
5. `SetRunning` and `SetSpeed` go to that school's mailbox; `CloseSchool` goes back to the menu.
6. On disconnect the client is removed; the school it was watching keeps running.
Outbound frames go through a bounded channel per connection (32 frames, drop-oldest). A client
that cannot keep up loses intermediate clock frames instead of stalling a worker.
Clock frames go through a bounded channel per connection (32 frames, drop-oldest). A client
that cannot keep up loses intermediate clock frames instead of stalling a worker. The map
snapshot uses a separate reliable queue so it cannot be dropped for a newer tick.
## Where to add things next
@@ -120,6 +121,5 @@ that cannot keep up loses intermediate clock frames instead of stalling a worker
`School.Tick`, and unit-test them against `School` directly — no server needed.
- **More state on the cards**: extend `SchoolState` and the JSON response; the menu reloads from
the server after every change, so nothing else has to know.
- **Create editor and the map snapshot**: the catalog and vanilla map exist; the player still
cannot pick mods or see the tree from the server. That work lives in
[`phases/04-create-editor.md`](phases/04-create-editor.md).
- **Create editor and the map snapshot**: done in this slice. Next game verbs (Sit) and the
event log are out of scope here.