1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
# 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 <http://localhost:5173> — 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 <http://localhost:4567>. 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`.
|