Add HSchool.Content project for JSONC definitions, catalog, and map validation. Update solution structure to include new content and tests projects. Enhance school management to support mod packs and map instances, ensuring proper loading and validation. Revise documentation to reflect these changes and update tests for new functionality.
This commit is contained in:
+14
-9
@@ -14,8 +14,11 @@ there is no UI on the server.
|
||||
│ │ ├── SchoolWorker ×N │ └──────────────────┘ │
|
||||
│ │ │ └── School │ │
|
||||
│ │ │ ├─ Clock│ │
|
||||
│ │ │ ├─ Catalog (frozen Content) │
|
||||
│ │ │ ├─ Map │
|
||||
│ │ │ └─ World│ (Arch ECS, empty for now) │
|
||||
│ │ ├── SchoolStore │ saves/{id}.json │
|
||||
│ │ ├── ModContent │ mods/<id>/ │
|
||||
│ │ └── ClientRegistry │ │
|
||||
│ └────────────────────────┘ │
|
||||
│ │ OTLP logs / traces / metrics │
|
||||
@@ -29,14 +32,15 @@ there is no UI on the server.
|
||||
| Project | Role |
|
||||
| --- | --- |
|
||||
| `src/HSchool.Protocol` | Binary wire format. No dependencies, referenced by everything that talks to the socket. |
|
||||
| `src/HSchool.Simulation` | Schools, the game clock, the Arch ECS world. No ASP.NET, no sockets — this is what unit tests exercise. |
|
||||
| `src/HSchool.Server` | ASP.NET Core host: the menu API, the WebSocket endpoint, per-school workers, disk saves. |
|
||||
| `src/HSchool.Content` | JSONC defs, inheritance, patches, locales, map instance and connectivity. No Arch, no ASP.NET. |
|
||||
| `src/HSchool.Simulation` | Schools, the game clock, the Arch ECS world. Holds a frozen catalog and map; no HTTP. |
|
||||
| `src/HSchool.Server` | ASP.NET Core host: the menu API, the WebSocket endpoint, per-school workers, `mods/` and `saves/`. |
|
||||
| `src/HSchool.ServiceDefaults` | Shared Aspire wiring: OpenTelemetry, health checks, service discovery, resilience. |
|
||||
| `src/HSchool.AppHost` | Aspire orchestration: which resources run and how they find each other. |
|
||||
| `src/HSchool.Client` | Vite + TypeScript UI: main menu, creation form, the school screen. |
|
||||
|
||||
Dependency direction is one-way: `Protocol ← Server → Simulation`. Nothing in `Simulation` knows
|
||||
about HTTP, and nothing in `Protocol` knows about schools.
|
||||
Dependency direction is one-way: `Protocol ← Server → Simulation → Content`. Nothing in
|
||||
`Simulation` or `Content` knows about HTTP, and nothing in `Protocol` knows about schools.
|
||||
|
||||
## Two channels, on purpose
|
||||
|
||||
@@ -94,8 +98,9 @@ cannot land between a mouse-down and a click.
|
||||
|
||||
Each school is a JSON file under `Simulation:SavesDirectory` (`saves/{id}.json` plus `index.json`
|
||||
for the next id). The worker writes on create, pause, speed change, shutdown, and on a rare clock
|
||||
snapshot (`SaveIntervalSeconds`, 30 by default) — never on every tick. The supervisor reloads the
|
||||
directory at process start. A file that cannot be read is left in place and logged.
|
||||
snapshot (`SaveIntervalSeconds`, 30 by default) — never on every tick. The file also stores the
|
||||
mod pack ids and the map layout; the catalog is loaded again from `mods/` on start. A missing
|
||||
mod folder or a map that no longer validates leaves the file in place and that school unstarted.
|
||||
|
||||
## Connection lifetime
|
||||
|
||||
@@ -115,6 +120,6 @@ 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.
|
||||
- **Defs, map, mods**: the save record is intentionally small so later slices can add layout and
|
||||
pack ids without a second persistence mechanism. That work lives in
|
||||
[`phases/03-defs-map.md`](phases/03-defs-map.md).
|
||||
- **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).
|
||||
|
||||
Reference in New Issue
Block a user