289 lines
13 KiB
Markdown
289 lines
13 KiB
Markdown
# Session Summary
|
|
|
|
## Current State
|
|
|
|
The repository is now split into two apps that live side-by-side:
|
|
|
|
- [apps/backend](/home/jbourdon/repos/space-game/apps/backend)
|
|
- authoritative ASP.NET Core simulation
|
|
- [apps/viewer](/home/jbourdon/repos/space-game/apps/viewer)
|
|
- Three.js/Vite observer client
|
|
- [shared/data](/home/jbourdon/repos/space-game/shared/data)
|
|
- shared scenario data
|
|
|
|
The complete simulation runs in the backend. The viewer fetches one world snapshot, then subscribes to an SSE delta stream and renders the world as an observer.
|
|
|
|
The world model is now hierarchical:
|
|
|
|
- systems live in galaxy space
|
|
- ships, stations, and resource nodes live in system-local space
|
|
- the viewer applies a local presentation layer for the active system
|
|
|
|
## Runtime / Networking
|
|
|
|
The backend currently provides:
|
|
|
|
- `GET /api/world`
|
|
- initial authoritative snapshot
|
|
- `GET /api/world/stream`
|
|
- incremental SSE deltas after a sequence number
|
|
|
|
The viewer currently does:
|
|
|
|
1. fetch the world once
|
|
2. connect to the stream
|
|
3. apply deltas into a local render model
|
|
4. interpolate and briefly extrapolate moving ships for presentation
|
|
5. compose galaxy-space systems with system-local entities for rendering
|
|
|
|
This supports multiple simultaneous observers on the same world. Interest management is not implemented yet, so every observer still receives full-world deltas.
|
|
|
|
## Viewer Status
|
|
|
|
The viewer currently supports:
|
|
|
|
- single-click selection for ships, stations, nodes, planets, and stars
|
|
- rectangular marquee selection
|
|
- constrained to one group at a time:
|
|
- ships
|
|
- structures
|
|
- celestials
|
|
- `WASD` panning on the `XZ` plane
|
|
- middle-mouse tactical orbit camera
|
|
- smooth wheel zoom across local, system, and universe scales
|
|
- layered system presentation
|
|
- one active local system with detailed content
|
|
- non-local systems projected as distant shell markers
|
|
- procedurally animated planets and moons from orbital metadata
|
|
- ringed planets, binary star presentation, and richer resource visuals
|
|
- explicit camera modes
|
|
- tactical free-move / orbit camera
|
|
- `camera-follow` third-person trailing camera for ships
|
|
- dedicated `System` and `Focus` panels on the right HUD
|
|
- hover labels for projected system markers
|
|
- a bottom ship list with horizontally scrolling ship cards
|
|
- card click selects the ship
|
|
- card double-click selects, focuses, and enables `camera-follow`
|
|
- cards now span the full screen width as a compact bottom rail
|
|
- cards show ship name, class, fuel, energy, state, and order
|
|
- cards include a compact history icon button under the ship-class tag
|
|
- multiple floating history windows for debugging
|
|
- openable from ship cards
|
|
- independently movable and resizable
|
|
- copy-to-clipboard support with a DOM fallback path
|
|
|
|
Local presentation is now intentionally isolated:
|
|
|
|
- only the active system renders local detail
|
|
- ships
|
|
- stations
|
|
- resource nodes
|
|
- planets
|
|
- moons
|
|
- other systems render as distant stars plus compact summary presentation
|
|
- projected systems can show shell reticles and hover labels
|
|
- distant galaxy motion now has only minimal parallax while moving inside a system
|
|
|
|
The viewer also includes plain-text HUD readouts for:
|
|
|
|
- game state
|
|
- network statistics
|
|
- ship debugging history in separate floating windows
|
|
|
|
The viewer now consumes richer celestial metadata from the backend:
|
|
|
|
- star kind and star count
|
|
- planet type, shape, moon count, and orbital elements
|
|
- resource node source kind such as `asteroid-belt` and `gas-cloud`
|
|
- galaxy-space system positions
|
|
- system-local entity positions and velocities
|
|
|
|
Planets and moons are not simulated as networked entities. Their positions are reconstructed client-side from snapshot time plus orbital configuration.
|
|
|
|
Viewer-side orbital presentation now also applies to:
|
|
|
|
- resource nodes
|
|
- stations
|
|
|
|
These orbitals prefer nearby planets or moons as anchors, with fallback to the system star.
|
|
|
|
## Simulation Status
|
|
|
|
The backend simulation already includes:
|
|
|
|
- autonomous ships
|
|
- orbital travel
|
|
- pad-based docking and undocking
|
|
- stations expose docking capacity through installed dock-bay modules
|
|
- ships reserve an empty pad before docking
|
|
- ships wait in a holding pattern when no pad is available
|
|
- mining and refinery delivery
|
|
- module-gated ship and station capabilities
|
|
- ships require fitted modules such as reactor, capacitor, mining turret, gas extractor, or gun turrets
|
|
- stations require installed modules such as power, docking, refinery, fuel processing, and storage modules
|
|
- fuel-to-energy power simulation
|
|
- gas clouds provide raw `gas`
|
|
- station fuel processors convert `gas` into `fuel`
|
|
- ship reactors consume `fuel` to charge capacitors
|
|
- station power cores consume `fuel` to charge station energy buffers
|
|
- powered actions stop when fuel and energy are depleted
|
|
- constructor-led station module construction
|
|
- stations now track installed modules per instance instead of relying only on static constructible definitions
|
|
- module construction uses station inventory plus timed build progress
|
|
- explicit action timing in the control loop
|
|
- mining now runs on a fixed cycle
|
|
- warp and FTL travel require spool time
|
|
- docking and undocking have explicit durations
|
|
- refining / fabrication
|
|
- faction growth through ship and outpost production
|
|
- pirate pressure and combat
|
|
- procedural galaxy generation with deterministic expansion beyond the authored scenario
|
|
- handcrafted `Sol` system easter egg with Saturn and rings
|
|
- resource geography beyond simple ore nodes
|
|
- asteroid belts for ore
|
|
- gas clouds for gas
|
|
- hierarchical coordinates for replication
|
|
- systems in galaxy space
|
|
- in-system entities in local space
|
|
- item-based inventories for ships and stations
|
|
- ore, refined metals, raw gas, fuel, and cargo now flow through per-item inventories instead of ad hoc stock fields
|
|
|
|
The runtime model still follows the intended layered control architecture:
|
|
|
|
1. `order`
|
|
2. `defaultBehavior`
|
|
3. `assignment`
|
|
4. `controllerTask`
|
|
5. `state`
|
|
|
|
## Important Recent Changes
|
|
|
|
- split the old monolith into `apps/backend` and `apps/viewer`
|
|
- moved simulation authority fully into .NET
|
|
- replaced frontend polling with snapshot-plus-delta SSE replication
|
|
- added viewer-side interpolation / short extrapolation for movement
|
|
- added a plain-text network statistics readout
|
|
- reworked the camera with smoother zoom, orbit, panning, and marquee selection
|
|
- split viewer camera behavior into tactical and `camera-follow` modes
|
|
- added ship-card double-click to focus and enter follow mode
|
|
- cleaned up several viewer HUD elements and removed redundant panel content
|
|
- expanded the backend world into a large procedural galaxy with elevated vertical variance
|
|
- added deterministic orbital metadata for planets and client-side orbital animation in the viewer
|
|
- added moon rendering in the viewer
|
|
- added backend-generated asteroid belts and gas clouds as resource sources
|
|
- injected the `Sol` system into the generated galaxy
|
|
- refactored contracts from flat world coordinates to galaxy-space systems plus system-local entities
|
|
- normalized authored scenario placements and patrol routes into system-local coordinates during load
|
|
- added viewer-side local-focus / floating-origin style presentation for the active system
|
|
- reworked local-vs-remote rendering so only one system shows detail at a time
|
|
- added projected shell markers and hover labels for distant systems while inside a local system
|
|
- added viewer-side orbital motion for stations and resource nodes
|
|
- tuned local movement so the rest of the galaxy remains mostly fixed during in-system travel
|
|
- reduced the starting faction to a minimal bootstrap
|
|
- one modular station
|
|
- one constructor ship
|
|
- one mining ship
|
|
- added a gas mining ship for bootstrap fuel logistics
|
|
- moved the starting ships close to the `helios` star and next to each other
|
|
- added modular ship and station data
|
|
- new station power and storage modules
|
|
- new fuel processing and docking bay modules
|
|
- new ship reactor, capacitor, mining turret, gas extractor, and gun turret modules
|
|
- refactored simulation inventories to per-item storage
|
|
- stations and ships now replicate inventories instead of specialized ore/refined/cargo counters
|
|
- split raw `gas` from burnable `fuel` in the simulation loop
|
|
- added module recipe data and per-station installed-module runtime state
|
|
- added constructor-led station module construction for the bootstrap station
|
|
- added gas harvesting, gas-to-fuel processing, and explicit ship refueling behavior
|
|
- reworked docking into pad reservation with visible stand-off positions instead of snapping ships into station centers
|
|
- added action timing for mining cycles, warp / FTL spool-up, and undocking
|
|
- replaced the viewer bottom faction strip with a horizontal ship-card debugging rail
|
|
- added movable, resizable, multi-window history panels in the viewer
|
|
- fixed the auto-miner undock controller transition
|
|
- ships now keep their docked station link until the undock move actually completes
|
|
- this prevents auto-miners from falling into `idle` immediately after unloading
|
|
|
|
## Current Known Limitations
|
|
|
|
- replication is still world-wide
|
|
- no observer-scoped interest management yet
|
|
- the viewer is still observer-focused
|
|
- no command submission UI yet
|
|
- local / projected / galaxy presentation is now workable but still needs tuning
|
|
- shell marker art direction and scaling still need polish
|
|
- tactical/follow camera tuning still needs iteration
|
|
- projected-system composition is still a viewer illusion, not a full multi-layer renderer
|
|
- the galaxy is much larger now, so viewer performance and visual density need active tuning
|
|
- moon rendering is procedural from counts, not authored moon-by-moon data
|
|
- resource extraction behavior still treats all resource nodes generically
|
|
- item inventories exist, but storage/module restrictions are still partial
|
|
- station storage capacity is now enforced by storage class and installed module
|
|
- ship cargo compatibility is still mostly data-convention driven
|
|
- hull-specific module restrictions are not enforced yet
|
|
- constructor logic only builds from station-local inventory
|
|
- it does not yet fetch module materials from other stations or ships
|
|
- station installed modules and active construction are not yet exposed in the viewer contract
|
|
- piracy and faction growth are still functional rather than strategically deep
|
|
- no persistence for saves, seeds, or reconnect state
|
|
|
|
## Important Files
|
|
|
|
- [apps/backend/Program.cs](/home/jbourdon/repos/space-game/apps/backend/Program.cs)
|
|
- backend API endpoints
|
|
- [apps/backend/Simulation/WorldService.cs](/home/jbourdon/repos/space-game/apps/backend/Simulation/WorldService.cs)
|
|
- authoritative world state and stream coordination
|
|
- [apps/backend/Simulation/SimulationEngine.cs](/home/jbourdon/repos/space-game/apps/backend/Simulation/SimulationEngine.cs)
|
|
- simulation advancement
|
|
- snapshot / delta composition for galaxy-space systems and local-space entities
|
|
- inventory, gas/fuel, and energy processing
|
|
- station module construction
|
|
- gas harvesting, refueling, and pad-based docking
|
|
- action timing for mining, spool-up, docking, and undocking
|
|
- [apps/backend/Simulation/ScenarioLoader.cs](/home/jbourdon/repos/space-game/apps/backend/Simulation/ScenarioLoader.cs)
|
|
- faction bootstrap
|
|
- galaxy generation
|
|
- special systems
|
|
- procedural celestial/resource content
|
|
- normalization of authored placements into system-local space
|
|
- minimal startup seeding for ships, station, fuel, and module materials
|
|
- [apps/backend/Contracts/WorldContracts.cs](/home/jbourdon/repos/space-game/apps/backend/Contracts/WorldContracts.cs)
|
|
- snapshot and delta contract shape
|
|
- station dock-pad count
|
|
- [apps/backend/Simulation/RuntimeModels.cs](/home/jbourdon/repos/space-game/apps/backend/Simulation/RuntimeModels.cs)
|
|
- runtime vector math and world model
|
|
- per-item inventories on ships and stations
|
|
- per-station installed modules and docking pad assignments
|
|
- [apps/viewer/src/GameViewer.ts](/home/jbourdon/repos/space-game/apps/viewer/src/GameViewer.ts)
|
|
- camera, selection, streaming integration, and presentation
|
|
- layered local/remote system presentation
|
|
- orbital reconstruction and moon rendering
|
|
- projected shell markers and hover labels
|
|
- ship card list and multi-window history debugging UI
|
|
- station HUD docked/pad count readout
|
|
- [apps/viewer/src/style.css](/home/jbourdon/repos/space-game/apps/viewer/src/style.css)
|
|
- HUD layout
|
|
- ship-card rail
|
|
- floating history window styling
|
|
- [apps/viewer/src/api.ts](/home/jbourdon/repos/space-game/apps/viewer/src/api.ts)
|
|
- snapshot fetch and SSE stream integration
|
|
- [apps/viewer/src/contracts.ts](/home/jbourdon/repos/space-game/apps/viewer/src/contracts.ts)
|
|
- viewer-side snapshot contract for galaxy-space systems and local-space entities
|
|
- [shared/data](/home/jbourdon/repos/space-game/shared/data)
|
|
- scenario and world data definitions
|
|
- `module-recipes.json` now defines timed module construction costs
|
|
|
|
## Validation
|
|
|
|
Validation passing at the end of this session:
|
|
|
|
- `dotnet build apps/backend/SpaceGame.Simulation.Api.csproj`
|
|
|
|
Validation currently failing / blocked:
|
|
|
|
- `cd apps/viewer && npm run build`
|
|
- fails because `apps/viewer/src/GameViewer.ts` references a missing `followedShipId` property
|
|
|
|
## Last Commit
|
|
|
|
- `ef62577`
|