249 lines
11 KiB
Markdown
249 lines
11 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 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
|
|
- follow-camera behavior for selected 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 and follows the ship
|
|
- cards show ship name, class, fuel, energy, state, and order
|
|
- 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
|
|
- docking and undocking
|
|
- mining and refinery delivery
|
|
- module-gated ship and station capabilities
|
|
- ships require fitted modules such as reactor, capacitor, and mining or gun turrets
|
|
- stations require fitted modules such as power, refinery, and storage modules
|
|
- fuel-to-energy power simulation
|
|
- ship reactors consume `gas` fuel to charge capacitors
|
|
- station power cores consume `gas` fuel to charge station energy buffers
|
|
- powered actions stop when fuel and energy are depleted
|
|
- 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, 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
|
|
- 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
|
|
- 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 ship reactor, capacitor, mining turret, and gun turret modules
|
|
- refactored simulation inventories to per-item storage
|
|
- stations and ships now replicate inventories instead of specialized ore/refined/cargo counters
|
|
- added fuel-driven power generation and energy consumption in the simulation loop
|
|
- 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
|
|
- local camera feel 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 enforcement and module-slot restrictions are still lightweight
|
|
- cargo/storage compatibility is mostly data-convention driven
|
|
- hull-specific module restrictions are not enforced yet
|
|
- 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, fuel, and energy processing
|
|
- auto-miner undock state transition fix
|
|
- [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, and fuel
|
|
- [apps/backend/Contracts/WorldContracts.cs](/home/jbourdon/repos/space-game/apps/backend/Contracts/WorldContracts.cs)
|
|
- snapshot and delta contract shape
|
|
- [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
|
|
- [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
|
|
- [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
|
|
|
|
## Validation
|
|
|
|
Validation passing at the end of this session:
|
|
|
|
- `dotnet build apps/backend/SpaceGame.Simulation.Api.csproj`
|
|
- `cd apps/viewer && npm run build`
|
|
|
|
## Last Commit
|
|
|
|
- `1747d84`
|