WORLD MAP tab: world generation + jump between solar systems #5

Closed
opened 2026-09-28 23:12:47 +02:00 by kamilkrzywda · 1 comment
Owner

Goal

Make the WORLD MAP tab functional: a real, persistent world map for the current save and jumping between solar systems. This is the foundation issue — it introduces the game save, DB schema, turn counter, and event writing that all other tabs build on.

Scope

  • DB (Drizzle/sql.js): single active game/save (single-player, no auth); solar_systems table (id, name, x/y position for the node graph, discovered flag, is_current). Seeded RNG per save so generation is deterministic and unit-testable.
  • World generation: on new game (auto-init on first load of an empty DB) generate a starting system + a ring of neighbours with jump routes (edges). Jumping to an adjacent undiscovered system generates it (+ its neighbours) for the current save — you can always get back.
  • API: GET /api/world (systems + edges + current), POST /api/jump {systemId} → validate adjacency, set current, increment turn counter, write event row. Update OpenAPI spec in code (lib/openapi.ts).
  • Frontend: WORLD MAP tab renders real data into the NodeGraph; highlight current system; jump affordance per connected system (button list is fine if the widget's nodes aren't clickable — keep it simple). No placeholder constants for this tab anymore.

Acceptance criteria

  • Unit tests: generation shape (starting system + neighbours, edges), jump validation (adjacent only, sets current, increments turn), persistence across DB reopen.
  • e2e: fresh CI stack → map shows starting system + neighbours; a jump works and survives the mid-run container restart in state.spec.ts.
  • Local verify green: tsc / vitest / playwright --list (+ build DOM check).

Notes

  • Single-player = one server-side save, no accounts ever.
  • Turn counter introduced here (jump = 1 turn); encounter/turn effects come later.
  • Events table + writes start here so the EVENT LOG tab is a thin read+render at the end.
## Goal Make the WORLD MAP tab functional: a real, persistent world map for the current save and jumping between solar systems. This is the foundation issue — it introduces the game save, DB schema, turn counter, and event writing that all other tabs build on. ## Scope - **DB (Drizzle/sql.js):** single active game/save (single-player, no auth); `solar_systems` table (id, name, x/y position for the node graph, discovered flag, is_current). Seeded RNG per save so generation is deterministic and unit-testable. - **World generation:** on new game (auto-init on first load of an empty DB) generate a starting system + a ring of neighbours with jump routes (edges). Jumping to an adjacent undiscovered system generates it (+ its neighbours) for the current save — you can always get back. - **API:** `GET /api/world` (systems + edges + current), `POST /api/jump {systemId}` → validate adjacency, set current, increment turn counter, write event row. Update OpenAPI spec in code (`lib/openapi.ts`). - **Frontend:** WORLD MAP tab renders real data into the NodeGraph; highlight current system; jump affordance per connected system (button list is fine if the widget's nodes aren't clickable — keep it simple). No placeholder constants for this tab anymore. ## Acceptance criteria - Unit tests: generation shape (starting system + neighbours, edges), jump validation (adjacent only, sets current, increments turn), persistence across DB reopen. - e2e: fresh CI stack → map shows starting system + neighbours; a jump works and **survives the mid-run container restart** in state.spec.ts. - Local verify green: tsc / vitest / playwright --list (+ build DOM check). ## Notes - Single-player = one server-side save, no accounts ever. - Turn counter introduced here (jump = 1 turn); encounter/turn effects come later. - Events table + writes start here so the EVENT LOG tab is a thin read+render at the end.
Author
Owner

Done in v0.3.0 (PR #12, merge commit b79b771).

  • DB: saves (single-player save), solar_systems, jump_routes, events — Drizzle/sql.js
  • Seeded deterministic world gen (lib/game/world.ts): starting system + ring of 6 neighbours; jumping into unknown space grows the chart with a route back
  • API: GET /api/world (auto-inits on empty DB), POST /api/jump with adjacency validation, turn counter, event writes; OpenAPI updated in code
  • UI: WORLD MAP tab renders live state into NodeGraph + JUMP ROUTES button panel
  • Tests: unit 7→20, e2e 5→7 incl. jump persistence across the mid-run container restart

Deployed to https://space-wanderer.dev.kkhost.pl — verified /api/version → 0.3.0 and live world state (Iron Gate + neighbours).

Done in v0.3.0 (PR #12, merge commit b79b771). - DB: `saves` (single-player save), `solar_systems`, `jump_routes`, `events` — Drizzle/sql.js - Seeded deterministic world gen (lib/game/world.ts): starting system + ring of 6 neighbours; jumping into unknown space grows the chart with a route back - API: GET /api/world (auto-inits on empty DB), POST /api/jump with adjacency validation, turn counter, event writes; OpenAPI updated in code - UI: WORLD MAP tab renders live state into NodeGraph + JUMP ROUTES button panel - Tests: unit 7→20, e2e 5→7 incl. jump persistence across the mid-run container restart Deployed to https://space-wanderer.dev.kkhost.pl — verified /api/version → 0.3.0 and live world state (Iron Gate + neighbours).
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: OpenCode/SpaceWanderer#5