1 Challenges 260202
justinaquino edited this page 2026-02-03 02:03:01 +08:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Challenges (260202)

Document Date: 2026-02-02 (YYMMDD: 260202) Previous Version: Challenges-260115 Related: Mneme-Logic-Specification-260202, Architecture


Project Vision & Outcomes

The Big Picture

This project is not just about generating worlds in a CSV file. The outcome is a complete toolkit for hard sci-fi TTRPG gameplay:

  1. Build star systems procedurally (stars, planets, moons, satellites—children and grandchildren of INRAS)
  2. Export/Import systems as shareable files (CSV, JSON)
  3. Visualize systems at multiple levels of abstraction
  4. Explore systems with physics-accurate navigation tools
  5. Travel between planets with realistic trajectory calculations

What "Done" Looks Like

A gamer can build a ton of star systems for their game in a spreadsheet. The culture generator provides keywords for AI to generate details, plus prompts for internal consistency. Then they have tools to travel between planets. Running on anyone's phone, players can load the star file from their Game Master and make their own navigation calculations.


Visualization Roadmap

vis01: Abstract Row View

The Simplest Visualization

A horizontal row showing the system in order:

[★ Star] ─── [Planet 1] ─────── [Planet 2] ── [Planet 3] ─────────── [Planet 4]
              0.7 AU             1.0 AU        1.5 AU                  5.2 AU
Feature Description
Star on left Anchor point, shows class/grade
Planets in order Left to right by distance
Distance indicators AU spacing shown proportionally or labeled
Planet size/type Visual indicator (color, icon)

Use Case: Quick overview, CSV validation, print-friendly.


vis02: Interactive System Map (Top View)

Scalable, Scrollable, Zoomable Web Map

A 2D top-down view of the system with planets positioned around the star.

Feature Description
Vertex-based rendering SVG or Canvas for smooth scaling
Random angular positioning Planets placed at random angles (initial state)
Zoom controls Pinch/scroll to zoom in/out
Pan controls Drag to scroll around the system
Orbital rings Optional display of orbit paths

vis02.01: Orbital Animation

Bring the System to Life

Feature Description
Orbital speed formula v = √(G × M_star / a) → period T = 2π × √(a³ / (G × M_star))
Animated planets Planets move along orbits in real-time or accelerated
Speed controls 1×, 10×, 100×, 1000× time acceleration

vis02.02: Time Dial

Navigate Through Time

Feature Description
Reference point Start position = "Epoch" (e.g., campaign start date)
Time input Positive or negative value in Earth days/years
Position calculation All planets repositioned based on their orbital periods
Use case "Where will Mars be in 47 days?"

vis02.03: Delta-V Cost Display

Per-Planet Transfer Costs

Feature Description
Delta-V from current position Cost to reach each planet from selected origin
Hohmann transfer baseline Minimum energy transfer Δv
Visual indicators Color-coded by cost (green = cheap, red = expensive)

vis03: Brachistochrone Trajectory Calculator

Hard Sci-Fi Navigation Tool

vis03.01: Realistic Brachistochrone (Burn-Coast-Burn)

Not Constant Acceleration

True hard sci-fi doesn't assume infinite fuel. The realistic profile:

    Acceleration ──────┐
                       │
    Coast (Ballistic)  │────────────────────────────│
                                                    │
                                    Deceleration ───┘

    [Origin] ═══════▶ [Midpoint] ═══════▶ [Destination]
              Burn      Coast       Coast      Burn
Input Description
Ship thrust (m/s²) Available acceleration
Ship Δv budget (km/s) Total fuel available
Origin planet Starting position
Destination planet Target position
Departure time When to leave (affects positions)
Output Description
Total Δv required Fuel cost for the trip
Burn duration How long engines fire
Coast duration Ballistic flight time
Total trip time End-to-end journey
Arrival positions Where planets will be on arrival

vis03.02: Route Planner

Planet-to-Planet Navigation

Input Description
From planet Origin selection
To planet Destination selection
Start epoch System time reference
Ship parameters Thrust, Δv budget
Output Description
Δv budget required Total fuel needed
Trip duration Days/months/years
Launch window Optimal departure time
Trajectory preview Visual path on vis02 map

Visualization Implementation Phases

Phase Component Dependencies
V1 vis01 (Row View) Spreadsheet export working
V2 vis02 (Static Map) vis01 complete
V3 vis02.01 (Animation) vis02 complete
V4 vis02.02 (Time Dial) vis02.01 complete
V5 vis02.03 (Δv Display) vis02.02 complete
V6 vis03.01 (B-Traj Calc) vis02.03 complete
V7 vis03.02 (Route Planner) vis03.01 complete

End-User Experience

For Game Masters

  1. Generate hundreds of star systems with one click
  2. Export to spreadsheet for campaign management
  3. Use culture generator keywords as AI prompts for world-building
  4. Share system files with players

For Players

  1. Load GM's star system file on their phone
  2. View system map (vis02)
  3. Plan their own navigation (vis03)
  4. Calculate travel times and fuel costs
  5. Make informed decisions without GM doing all the math

Action Plan Overview

This update establishes two parallel development streams that can proceed simultaneously, followed by incremental updates to the master logic.

┌─────────────────────────────────────────────────────────────────────────────┐
│                         PARALLEL DEVELOPMENT STREAMS                        │
├─────────────────────────────────┬───────────────────────────────────────────┤
│      STREAM A: UI UPDATE        │       STREAM B: PLACEMENT TESTING         │
│   (Window/Tile Migration)       │      (Validation & Spreadsheet Gen)       │
├─────────────────────────────────┼───────────────────────────────────────────┤
│ • Component tiling design       │ • Planet generation script                │
│ • Responsive reorientation      │ • Mass calculation per system             │
│ • Device adaptation             │ • Hundreds of systems → spreadsheet       │
│ • Information hierarchy         │ • Pattern validation                      │
└─────────────────────────────────┴───────────────────────────────────────────┘
                                    │
                                    ▼
┌─────────────────────────────────────────────────────────────────────────────┐
│                    INCREMENTAL MASTER LOGIC UPDATES                         │
├─────────────────────────────────────────────────────────────────────────────┤
│  Phase 1: Star & Barycenter                                                 │
│      ↓                                                                      │
│  Phase 2: Companion Star & Positioning                                      │
│      ↓                                                                      │
│  Phase 3: Main World & Waterfall Creation                                   │
│      ↓                                                                      │
│  Phase 4: Other Planets                                                     │
└─────────────────────────────────────────────────────────────────────────────┘

Stream A: UI Update (Window/Tile Migration)

Objective

Migrate from the current linear page flow to a Window/Tile-based system that adapts to different devices and screen sizes.

Why This Can Run in Parallel

  • UI work is largely independent of core generation logic
  • Can use mock/dummy data while placement logic is being validated
  • Design decisions don't block algorithmic development

Tasks

A1. Component Audit & Tiling Design

Task Description Status
Inventory all components List every component in src/components/ and its data dependencies Pending
Define information tiles Group related information into logical tiles Pending
Create tile hierarchy Primary tiles vs. secondary/detail tiles Pending
Design tile relationships Which tiles update when others change Pending

A2. Responsive Reorientation Strategy

Device Layout Strategy
Desktop (>1200px) Multi-column tile grid, all information visible
Tablet (768-1200px) 2-column layout, collapsible secondary tiles
Phone (<768px) Single column, stacked tiles with expand/collapse

A3. Implementation Phases

  1. Design Phase: Wireframes for each device size
  2. Component Refactor: Extract tile-able units from existing pages
  3. Layout System: Implement responsive grid/flexbox container
  4. State Management: Ensure tiles can update independently
  5. Testing: Cross-device validation

Key Challenges

  • Maintaining context when tiles reorient
  • Ensuring touch-friendly interactions on mobile
  • Performance with multiple reactive tiles

Stream B: Placement Testing (Validation Script)

Objective

Create a standalone script that generates planetary systems and outputs them to a spreadsheet for pattern validation.

Why This Is Critical

The Script Requirements

Input Parameters

Parameter Description Default
Star Class O, B, A, F, G, K, M Random (weighted)
Star Grade 0-9 Random
Number of Systems How many to generate 100

Generation Logic

For each system:
  1. Generate Star (class, grade) → derive Luminosity, Mass
  2. Calculate zones (Snow Line, Habitable Zone)
  3. Roll for planet counts (Gas, Ice, Terrestrial, Dwarf, Disk)
  4. Generate masses for each planet
  5. Apply Waterfall Placement (heaviest first)
  6. Apply Hill Radius checks and "Shove" logic
  7. Record final positions and masses

Output: Spreadsheet Format

Each row = one system. Columns organized in clusters:

Cluster Columns
Star Class, Grade, Mass (M☉), Luminosity (L☉)
Zones HZ_inner (AU), HZ_outer (AU), Snow_Line (AU)
Planet 1 Type, Mass (M⊕), Distance (AU), Hill_K
Planet 2 Type, Mass (M⊕), Distance (AU), Hill_K
Planet 3 Type, Mass (M⊕), Distance (AU), Hill_K
... (up to max planets)
Stats Total_Planets, Ejected_Count, Shove_Count

Validation Criteria

Check Expected Pattern
Gas Giants near Snow Line Most should cluster at 1.3× - 3× D_snow
Terrestrials in Inner System Should populate HZ and Inner Zone
Hill K values All should be ≥ 5 (Mneme standard)
Hot Jupiters ~1% of Gas Giants at <0.1 AU
System stability No overlapping forbidden zones

Implementation Plan

B1. Core Script (lib/generators/systemValidator.ts)

Task Description Status
Create generator function generateSystem(starClass?, starGrade?) Pending
Implement zone calculations Use existing zoneCalculations.ts Pending
Implement Waterfall Placement New function based on spec Pending
Add Hill Radius checks calculateMutualHillRadius() Pending
Add Shove logic applyShove() with ripple effect Pending

B2. Batch Generation (lib/generators/batchGenerator.ts)

Task Description Status
Loop N times Generate N systems Pending
Collect results Array of system objects Pending
Export to CSV/JSON Spreadsheet-compatible output Pending

B3. Analysis & Iteration

Task Description Status
Run 100 systems Initial validation Pending
Review patterns Do results look believable? Pending
Identify edge cases Systems that "break" Pending
Tune parameters Adjust K values, roll tables Pending
Run 500+ systems Statistical confidence Pending

Incremental Master Logic Updates

After Stream B validates placement, we update the master logic incrementally:

Phase 1: Star & Barycenter

Task Description Dependencies
Refactor primaryStarGenerator.ts Align with spec v2.1 None
Add Barycenter support For multi-star systems Star generation
Update stellar data tables Match spec constants None

Phase 2: Companion Star & Positioning

Task Description Dependencies
Implement Multiplier Cap Companion ≤ Primary guaranteed Phase 1
Add 3D6 Orbit Table Distance determination Phase 1
Implement Rule of Five Forbidden zone calculation Phase 1
Add hierarchy logic D6 roll for multi-star orbits Multiplier Cap

Phase 3: Main World & Waterfall Creation

Task Description Dependencies
Implement World Type roll Habitat/Dwarf/Terrestrial Phase 2
Build Waterfall Algorithm 6-step habitability cascade World Type
Add Inhabitants logic HDI, Gini, Elite Ratio Waterfall
Add Starport calculation PVS formula Inhabitants

Phase 4: Other Planets

Task Description Dependencies
Integrate validated placement From Stream B Stream B complete
Add moon generation Sub-system level Placement
Add ring detection Roche limit checks Moon generation
Full system export Complete data structure All above

Timeline Overview

┌─────────────────────────────────────────────────────────────────────────────┐
│                           FOUNDATION (Weeks 1-4)                            │
├─────────────────────────────────────────────────────────────────────────────┤
│ Week 1-2:  ┌─ Stream A: UI Design & Wireframes                              │
│            └─ Stream B: Core placement script                               │
│                                                                             │
│ Week 3-4:  ┌─ Stream A: Component refactoring                               │
│            └─ Stream B: Batch generation & validation                       │
│            └─ vis01: Abstract Row View (simple, data-driven)                │
├─────────────────────────────────────────────────────────────────────────────┤
│                         CORE LOGIC (Weeks 5-12)                             │
├─────────────────────────────────────────────────────────────────────────────┤
│ Week 5-6:  ┌─ Stream A: Responsive implementation                           │
│            └─ Phase 1: Star & Barycenter updates                            │
│            └─ vis02: Static System Map (zoom/pan)                           │
│                                                                             │
│ Week 7-8:  ┌─ Stream A: Testing & polish                                    │
│            └─ Phase 2: Companion Star logic                                 │
│            └─ vis02.01: Orbital Animation                                   │
│                                                                             │
│ Week 9-10: ─── Phase 3: Main World & Waterfall                              │
│            └─ vis02.02: Time Dial                                           │
│                                                                             │
│ Week 11-12: ── Phase 4: Other Planets & Integration                         │
│             └─ vis02.03: Delta-V Display                                    │
├─────────────────────────────────────────────────────────────────────────────┤
│                       NAVIGATION TOOLS (Weeks 13-16)                        │
├─────────────────────────────────────────────────────────────────────────────┤
│ Week 13-14: ── vis03.01: Brachistochrone Calculator (Burn-Coast-Burn)       │
│                                                                             │
│ Week 15-16: ── vis03.02: Route Planner (Planet-to-Planet)                   │
│             └─ Full integration & polish                                    │
└─────────────────────────────────────────────────────────────────────────────┘

Success Metrics

Stream A (UI)

  • All pages work on phone, tablet, desktop
  • Tile transitions feel natural
  • No information loss on smaller screens

Stream B (Placement)

  • 500+ systems generated without crashes
  • Hill K values all ≥ 5
  • Gas Giant distribution matches expectation (Snow Line clustering)
  • Believable variety in system architectures

Master Logic

  • All phases pass unit tests
  • Full system generation matches spec v2.1
  • Export produces complete, valid data

Visualization (vis01-vis03)

  • vis01: Row view renders any generated system
  • vis02: Map is smooth at 60fps on mobile
  • vis02.01: Orbital animation matches Kepler's laws
  • vis02.02: Time dial accurately repositions all planets
  • vis02.03: Δv costs match physics calculations
  • vis03.01: B-traj calculator handles edge cases (same planet, no fuel, etc.)
  • vis03.02: Route planner provides accurate trip times

End-to-End (The "Done" Checklist)

  • GM can generate 100+ systems and export to CSV
  • Culture keywords can be fed to AI for world-building
  • Player can load system file on phone
  • Player can calculate their own navigation
  • Travel times match hard sci-fi expectations

Open Questions

  1. UI: Should tiles be draggable/rearrangeable by user?
  2. Placement: What's the max number of planets before we cap?
  3. Validation: Do we need visual plots in addition to spreadsheet?
  4. Integration: When do we merge Stream B results into main app?
  5. vis02: Canvas vs SVG for rendering? (Performance vs. accessibility)
  6. vis02.02: What's a reasonable time range for the dial? (±100 years?)
  7. vis03: Should we support multiple ship profiles (cargo, fast courier, warship)?
  8. vis03.01: How do we handle relativistic speeds? (Probably ignore for now)
  9. Export: What file format for sharing systems? (JSON preferred, CSV for spreadsheets)
  10. Moons: Do moons get their own vis03 sub-calculations?