From f6955e34489c79f6d5b764cb6a39b1387366b433 Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Sun, 8 Nov 2026 21:56:29 +0100 Subject: Phase 0: project scaffolding - server/: Dart game-server package (shelf + WebSocket) with the hello/welcome handshake, ping/pong, error responses, healthz, static SPA serving with SPA fallback, and smoke tests (5/5) - web/: Svelte 5 + TypeScript SPA with the protocol client, connection-status page, vitest and svelte-check; Vite dev server proxies /ws to the Dart server - game data assets copied from the read-only reference app into server/assets/ (data, images, i18n, fonts, testData) - PLAN.md implementation plan and progress tracker; README rewritten for the web app; AGPLv3 LICENSE inherited from the reference app; .gitignore; scripts/ci.sh (full pipeline) - CLAUDE.md project guidance Verified: scripts/ci.sh passes end-to-end; live smoke confirms the server serves the built SPA at / and answers a WebSocket hello with a welcome message. --- README.md | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 85 insertions(+), 19 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 75c60fc..e767a12 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,85 @@ -There is a companion/assistant app for playing gloomhaven (and related games -such as frosthaven) called X-haven assistant. - -The code for X-haven assistant is checked out in directory FrosthavenAssistant, -DO NOT DO ANY MODIFICATIONS to this repo. - -The app is somewhat hard to use tho, especially the network code, it disconnects -and looses sync quite often. Instead of having an app on each device -that connects to a server I wonder if we could make the whole app run -as a webapp. So every player could just connect to a webserver running the -app. Keeping all the data on the webserver, removing the need for keeping -data in sync. It is still important that any changes done on the clients -are sent to the server but only as input. For example the priority input -should only be visible on each clients browser until all players have entered -their priority and draw action is tapped. - -The server will run the app and keep state. Each player will have the webpage -open in a browser tab. But there will also be other clients that have -the webpage open just to show the current state. \ No newline at end of file +# X-Haven (web) + +There is a companion/assistant app for playing Gloomhaven (and related games +such as Frosthaven) called X-haven assistant. The original code is checked out +in `FrosthavenAssistant/` — **DO NOT DO ANY MODIFICATIONS** to that repo. + +The original app is hard to use, especially the network code: it disconnects +and loses sync quite often. Instead of having an app on each device that +connects to a server, this repository re-architects the whole app as a +**server-driven web app**: every player connects to a web server running the +app, keeping all the data on the web server, removing the need for keeping data +in sync. It is still important that any changes done on the clients are sent to +the server — but only as input. For example, the priority (initiative) input +should only be visible on each client's browser until all players have entered +their priority and the draw action is tapped. + +The server runs the app and keeps the state. Each player has the web page open +in a browser tab. There will also be other clients with the page open just to +watch the current state (spectators). + +The design intent and the full implementation plan (with progress tracking) +live in [`PLAN.md`](PLAN.md). + +## Repository layout + +- `server/` — the Dart game server. Owns all game state, serves the built web + app, and hosts the game WebSocket at `/ws`. Game data is copied from the + reference app into `server/assets/` (`data/`, `images/`, `i18n/`, `fonts/`, + `testData/`). +- `web/` — the Svelte + TypeScript single-page app. Carries no game state; it + renders the server's state and submits player input. +- `scripts/ci.sh` — analyze, test, and build both halves. +- `FrosthavenAssistant/` — read-only reference implementation (gitignored). + +## Requirements + +- Dart SDK ≥ 3.11 +- Node.js ≥ 20 (tested with Node 26) + +## Development + +Terminal 1 — the Dart server (WebSocket + static serving, default port 4567): + +```bash +cd server +dart pub get +dart run bin/main.dart # from server/; serves ../web/dist when built +``` + +Terminal 2 — the web dev server (Vite, port 5173, proxies `/ws` to the server): + +```bash +cd web +npm install +npm run dev +``` + +Open — you should see the connection status and, once +the handshake completes, your session/role/state index. + +## Production run + +```bash +cd web && npm run build # outputs web/dist +cd server && dart run bin/main.dart # serves web/dist + /ws on :4567 +``` + +Open . The port and static dir can be overridden: +`dart run bin/main.dart --port 8080 --static-dir ../web/dist` (the `PORT` +environment variable is also honored). + +## Testing + +```bash +scripts/ci.sh +``` + +runs `dart analyze` + `dart test` for the server and `svelte-check` + +`vitest` + `vite build` for the web app. + +## License + +This project ports code from and ships the game data and art assets of +FrosthavenAssistant, which is licensed under the GNU AGPL v3. This project +therefore inherits that license — see `LICENSE`. -- cgit v1.3.1