summaryrefslogtreecommitdiff
path: root/PLAN.md
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2026-11-12 00:28:50 +0100
committerJoel Klinghed <the_jk@spawned.biz>2026-11-12 00:28:50 +0100
commit808294adad3f378ad8d66b698acf8df7f49c2302 (patch)
treecfd11a1395a8ad482311969f86abbbad97e7e0b4 /PLAN.md
parentf6955e34489c79f6d5b764cb6a39b1387366b433 (diff)
Phase 1: headless game engine on the server (M1)
Complete mechanical port of the reference app's game engine to server/lib/core/ so later phases are UI-only: - models/ (7), state/ (GameState + 18 part files), methods/ (7), game_methods, 79 command files, enums, card_stack, stat_calculator, action_handler (index, 250-deep history, save-per-action, undo/redo), disk-based game_data, l10n, translation_service, service_locator - ValueNotifier/ChangeNotifier removed in favor of plain fields with a minimal GameState listener hook for the Phase 2 broadcast layer; shared_preferences replaced by the SaveStore abstraction (InMemory for tests, File-backed for bin/main.dart) - command registry: 82 entries mapping wire names to constructors with arg validation; live-object args (loot/ability cards, figure lists) travel as id/name/nr and resolve against live state, enums by name, injected singletons never serialize - line_builder ported to Phase 1 scope: stat_applier + minimal LineBuilder (isElement, tokens); widget rendering deferred to Phase 4 - ported test suite: 81 test files, 562 tests green (command tests 1:1 with the reference, resource tests, registry smoke tests) - new headless integration test drives a full round: scenario setup, characters + standee, secret-initiative gate, draw, every figure's turn (incl. undo/redo), next round, round 2, round 3 - PORTING.md: the conventions contract used for the port - bin/main.dart boots the engine (file save store, assets/data) before serving; pubspec gains built_collection, collection, get_it, intl - dart format drift on pre-existing net/test files from the current formatter (whitespace only) dart analyze warning-free; dart test 562/562.
Diffstat (limited to 'PLAN.md')
-rw-r--r--PLAN.md25
1 files changed, 14 insertions, 11 deletions
diff --git a/PLAN.md b/PLAN.md
index cec7ea5..6ff7294 100644
--- a/PLAN.md
+++ b/PLAN.md
@@ -192,18 +192,18 @@ Tooling notes (fixed during implementation):
Port of the complete engine — all of it, so later phases are UI-only:
-- [ ] `lib/Model/` → `server/lib/core/models/`
-- [ ] `Resource/line_builder/` (ability-line parser)
-- [ ] `Resource/game_data.dart` (disk-based loading) + test data loader
-- [ ] `Resource/state/` → GameState and all part files (plain fields + toJson/fromJson,
+- [x] `lib/Model/` → `server/lib/core/models/`
+- [x] `Resource/line_builder/` (ability-line parser)
+- [x] `Resource/game_data.dart` (disk-based loading) + test data loader
+- [x] `Resource/state/` → GameState and all part files (plain fields + toJson/fromJson,
keep the `GameSaveState` snapshot structure)
-- [ ] All 84 command files → `core/commands/` + **command registry** (wire name + args ↔
+- [x] All 84 command files → `core/commands/` + **command registry** (wire name + args ↔
constructor, incl. args validation)
-- [ ] All `*Methods` classes, `game_event.dart`, `stat_calculator.dart`, `card_stack.dart`,
+- [x] All `*Methods` classes, `game_event.dart`, `stat_calculator.dart`, `card_stack.dart`,
`enums.dart`
-- [ ] `action_handler.dart`: index, 250-deep history, save after every action, undo/redo
-- [ ] Port unit tests (`test/command/*`, `test/resource/*`, model tests) to the new core
-- [ ] Headless integration test: full round driven by command invocations — scenario setup →
+- [x] `action_handler.dart`: index, 250-deep history, save after every action, undo/redo
+- [x] Port unit tests (`test/command/*`, `test/resource/*`, model tests) to the new core
+- [x] Headless integration test: full round driven by command invocations — scenario setup →
characters → initiative → draw → turns → next round → round 2
**Milestone M1** — engine runs headless; ported test suite green.
@@ -320,6 +320,7 @@ changes, room sections, spectator view. *First end-to-end moment.*
| 2026-11-08 | Plan drafted. Decisions fixed: Dart server, TS+Svelte client, full parity, faithful UI. |
| 2026-11-08 | Plan approved. |
| 2026-11-08 | **Phase 0 complete** — server package (shelf + WS, hello/welcome handshake, smoke tests 5/5), web app (Svelte 5 + TS, protocol client, svelte-check clean, build OK), assets copied (73 MB), AGPL license, README, .gitignore, CI script passing end-to-end. |
+| 2026-11-12 | **Phase 1 complete / M1 reached** — full engine ported to `server/lib/core/` (models, state + 18 part files, 7 methods classes, game_methods, 79 command files, enums, card_stack, stat_calculator, action_handler, disk-based game_data, l10n, minimal line_builder per conventions §8b). Command registry: 82 entries (wire name ↔ constructor + arg validation; enum/object args resolved against live state). Ported test suite: 81 test files, **562 tests green** (command tests 1:1 with the reference; resource/action-handler/stat-calculator/modifier-deck tests; registry smoke tests). New headless integration test drives a full round (setup → characters + standee → initiative gate → draw → every figure's turn incl. undo/redo → next round → round 2 → round 3). `dart analyze` warning-free. Porting conventions in `server/PORTING.md`. Notable porting fix found by tests: removable-card physical sync had to stay gated to the ten initial counters (reference listener semantics). |
## 7. Risks and open items
@@ -327,8 +328,10 @@ changes, room sections, spectator view. *First end-to-end moment.*
Svelte. Mitigation: faithful *flows and layout*, not pixel-perfect; menus are built once
as a reusable dialog primitive.
- **Command args coverage.** Every command's constructor args must be fully serializable
- (e.g. `AddMonsterCommand` with standee selection). Discovered during Phase 1; the registry
- is the enforcement point.
+ (e.g. `AddMonsterCommand` with standee selection). Resolved in Phase 1 by the registry:
+ live-object args (loot card, ability card, character/monster lists) travel as
+ id/name/nr and are resolved against live state; enums by name; injected singletons
+ never serialize. The registry remains the enforcement point in Phase 2.
- **66 MB of images** — served statically with caching; no processing. Watch initial paint.
- **Concurrent players.** Sequential server-side execution resolves races deterministically;
the losing side gets a clear `error` (e.g. "round already drawn").