v0.7.0 — SKILL TREE: technology research unlocks (#9) #16

Merged
kamilkrzywda merged 7 commits from skill-tree into master 2026-09-29 02:59:32 +02:00
Owner

Closes #9. Real tech tree that gates and extends ship actions, with researched state seeded on new games AND backfilled (v5) for existing saves.

Tech list (6 techs, two short chains)

  • WEAPONS SYSTEMS (2 parts) — gates BUILD NEW on WEAPONS (409 until researched)
  • REACTOR OVERCLOCK (3 res) — REACTOR max level +2 · FUSION CORE (4 res, prereq: RO) — REACTOR max capacity +3
  • HULL PLATING (3 res) — HULL max capacity +3 · NAVIGATION AI (2 res) — NAV COMPUTER max level +2 · PLASMA CANNON (3 parts, prereq: WS) — WEAPONS max level +2

Schema: tech table (slug/name/cost_kind/cost_qty/prerequisites/effect/researched; UNIQUE per save+slug); definitions seeded from a pure module on new game and as backfill step v5 (SCHEMA_VERSION 4→5) — old saves get the tree on first read, no DB wipe.

API: GET /api/tech (state RESEARCHED/AVAILABLE/LOCKED + missingPrereqs) · POST /api/research {techId} → fresh tree; 400 malformed · 404 unknown · 409 already researched/prereq missing (names it) · 422 insufficient hold. OpenAPI now documents 12 paths.

Gating: pure helpers in lib/game/tech.ts (effectiveLevelCap/effectiveCapacityCap/buildGate) shared by API and UI — ship endpoints reject gated actions with a clear "requires " error; SHIP SYSTEMS cards show disabled buttons + red REQUIRES line, flipping live when research lands (MissionControl owns both states).

Tests: unit 50→59 (prereq chains, cost validation w/ no mutation, oldest-first spend + turn + event + persistence, WEAPONS gate 409→success, cap raises), e2e 12→13 (scan until 5 parts → BUILD NEW disabled+gated → research via UI → card flips RESEARCHED → build enabled and builds; restart deep-equal now includes /api/tech).

Local verification: tsc ✓, vitest 59/59 ✓, playwright --list ✓, next build clean (7 tab triggers present).

Closes #9. Real tech tree that gates and extends ship actions, with researched state seeded on new games AND backfilled (v5) for existing saves. **Tech list (6 techs, two short chains)** - WEAPONS SYSTEMS (2 parts) — **gates BUILD NEW on WEAPONS** (409 until researched) - REACTOR OVERCLOCK (3 res) — REACTOR max level +2 · FUSION CORE (4 res, prereq: RO) — REACTOR max capacity +3 - HULL PLATING (3 res) — HULL max capacity +3 · NAVIGATION AI (2 res) — NAV COMPUTER max level +2 · PLASMA CANNON (3 parts, prereq: WS) — WEAPONS max level +2 **Schema:** `tech` table (slug/name/cost_kind/cost_qty/prerequisites/effect/researched; UNIQUE per save+slug); definitions seeded from a pure module on new game and as backfill step v5 (`SCHEMA_VERSION` 4→5) — old saves get the tree on first read, no DB wipe. **API:** GET /api/tech (state RESEARCHED/AVAILABLE/LOCKED + missingPrereqs) · POST /api/research {techId} → fresh tree; 400 malformed · 404 unknown · 409 already researched/prereq missing (names it) · 422 insufficient hold. OpenAPI now documents 12 paths. **Gating:** pure helpers in lib/game/tech.ts (`effectiveLevelCap`/`effectiveCapacityCap`/`buildGate`) shared by API and UI — ship endpoints reject gated actions with a clear "requires <TECH>" error; SHIP SYSTEMS cards show disabled buttons + red REQUIRES line, flipping live when research lands (MissionControl owns both states). **Tests:** unit 50→59 (prereq chains, cost validation w/ no mutation, oldest-first spend + turn + event + persistence, WEAPONS gate 409→success, cap raises), e2e 12→13 (scan until 5 parts → BUILD NEW disabled+gated → research via UI → card flips RESEARCHED → build enabled and builds; restart deep-equal now includes /api/tech). Local verification: tsc ✓, vitest 59/59 ✓, playwright --list ✓, next build clean (7 tab triggers present).
kamilkrzywda added 6 commits 2026-09-29 02:41:56 +02:00
kamilkrzywda added 1 commit 2026-09-29 02:56:30 +02:00
kamilkrzywda scheduled this pull request to auto merge when all checks succeed 2026-09-29 02:59:30 +02:00
kamilkrzywda merged commit 5657e8938a into master 2026-09-29 02:59:32 +02:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: OpenCode/SpaceWanderer#16