LOCAL SYSTEM tab: planet list + exploration to find things #6

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

Goal

Make the LOCAL SYSTEM tab functional: real planet list for the current system, and exploring planets finds things (resources/parts/crew).

Scope

  • DB: planets table (id, system_id, parent_id for moons, name, type, hazard flag, explored status) — generated when a system is generated; moons nested under their parent planet.
  • Exploration: POST /api/explore {planetId} → outcome from seeded RNG: find resources/parts/crew/nothing; marks the planet explored/scanned; costs a turn; writes event. Findings land in the save's inventory (resources) and/or crew roster (see CREW issue).
  • API: GET /api/system (current system's planets incl. moons), POST /api/explore. Update OpenAPI spec.
  • Frontend: list rendered from API, keeping the staggered moon layout; explore button per row; badges reflect real state (UNEXPLORED/SCANNED/HAZARD). No placeholder data for this tab.

Acceptance criteria

  • Unit tests: generation shape (planets + nested moons), exploration outcomes deterministic under seed, turn cost, planet status transitions.
  • e2e: explore a planet → row status changes and something is found; state survives container restart.
  • Local verify green: tsc / vitest / playwright --list (+ build DOM check).

Dependencies

After WORLD MAP issue (needs systems + save + turns).

## Goal Make the LOCAL SYSTEM tab functional: real planet list for the current system, and exploring planets finds things (resources/parts/crew). ## Scope - **DB:** `planets` table (id, system_id, parent_id for moons, name, type, hazard flag, explored status) — generated when a system is generated; moons nested under their parent planet. - **Exploration:** `POST /api/explore {planetId}` → outcome from seeded RNG: find resources/parts/crew/nothing; marks the planet explored/scanned; costs a turn; writes event. Findings land in the save's inventory (resources) and/or crew roster (see CREW issue). - **API:** `GET /api/system` (current system's planets incl. moons), `POST /api/explore`. Update OpenAPI spec. - **Frontend:** list rendered from API, keeping the staggered moon layout; explore button per row; badges reflect real state (UNEXPLORED/SCANNED/HAZARD). No placeholder data for this tab. ## Acceptance criteria - Unit tests: generation shape (planets + nested moons), exploration outcomes deterministic under seed, turn cost, planet status transitions. - e2e: explore a planet → row status changes and something is found; state survives container restart. - Local verify green: tsc / vitest / playwright --list (+ build DOM check). ## Dependencies After WORLD MAP issue (needs systems + save + turns).
Author
Owner

Done in v0.4.0 (PR #13, merge commit a6a5e82).

  • DB: planets (system_id, parent_id for nested moons, name/type/hazard/explored), inventory_items (resource|part, accumulates)
  • Gen: 2–5 planets per system, 60% with 1–3 moons; pure + seeded per system in lib/game/world.ts
  • Exploration: POST /api/explore — deterministic roll per save+planet (70% resource qty 1–4, 30% part, ~21% nothing), one scan per body, turn cost, event write
  • API: GET /api/system + POST /api/explore; OpenAPI updated in code
  • UI: LOCAL SYSTEM tab on live data — staggered moons kept, real badges, EXPLORE per row, SCAN RESULT strip + CARGO HOLD panel
  • Tests: unit 20→29, e2e 7→10 incl. explored-state persistence across the mid-run container restart

Deployed to https://space-wanderer.dev.kkhost.pl — verified /api/version → 0.4.0 and live system state (Hollow Bend with planets + nested moons). Note: the prod DB was wiped once after deploy because the pre-existing v0.3.0 save predates planet generation; fresh saves carry full bodies.

Done in v0.4.0 (PR #13, merge commit a6a5e82). - DB: `planets` (system_id, parent_id for nested moons, name/type/hazard/explored), `inventory_items` (resource|part, accumulates) - Gen: 2–5 planets per system, 60% with 1–3 moons; pure + seeded per system in lib/game/world.ts - Exploration: POST /api/explore — deterministic roll per save+planet (70% resource qty 1–4, 30% part, ~21% nothing), one scan per body, turn cost, event write - API: GET /api/system + POST /api/explore; OpenAPI updated in code - UI: LOCAL SYSTEM tab on live data — staggered moons kept, real badges, EXPLORE per row, SCAN RESULT strip + CARGO HOLD panel - Tests: unit 20→29, e2e 7→10 incl. explored-state persistence across the mid-run container restart Deployed to https://space-wanderer.dev.kkhost.pl — verified /api/version → 0.4.0 and live system state (Hollow Bend with planets + nested moons). Note: the prod DB was wiped once after deploy because the pre-existing v0.3.0 save predates planet generation; fresh saves carry full bodies.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: OpenCode/SpaceWanderer#6