# Session Summary ## Project State This repository now contains a playable Three.js/Vite prototype for a space RTS / economy sim testbed inspired by EVE Online and X4. The codebase has been refactored away from a single monolithic `GameApp.ts` toward a more maintainable, data-driven structure. Authored game content now lives in JSON catalogs, while runtime code is split into domain types, world-building helpers, UI presenters, and rendering helpers. The current prototype includes: - Two solar systems: `Helios Reach` and `Perseus Gate` - A large space environment with stars, planets, orbit lines, nebulae, asteroid/resource fields, and starfield - RTS-style ship selection, command issuance, camera movement, zoom levels, and follow-camera support - Three view levels based on zoom: `local`, `solar`, and `universe` - A bottom command bar with selection info, order buttons, and a minimap - A strategic HUD overlay that switches to NATO / military-style symbols at higher zoom levels - A generic window layer, with an initial fleet command window for managing multi-wing groups - App windows can now be dragged by their headers and resized from a corner grip - `stargate` now exists as a constructible category in the same authored pipeline as other stations ## Major Gameplay Systems Added ### World / Navigation - Ships can travel between the two systems using staged FTL travel - Travel flow includes: - leaving gravity well - FTL spool - warp - arrival - FTL speed was increased and a basic warp streak / tunnel effect was added - Local ship movement is no longer purely straight-line: - ships bias toward curved orbital-style transfers around the system center - idle ships hold a passive orbit instead of freezing in place ### Orbital Model - Stations are no longer static arbitrary points - Stations in `Helios` are placed on Lagrange-style offsets relative to planets - Stations update position over time with the planetary orbital motion - Ships and stations are beginning to behave like orbitals rather than free-floating markers ### Units / AI / Orders - Ship roles currently in the prototype: - military - transport - mining - Ship classes now distinguish: - frigate - destroyer - cruiser - industrial - capital - Unit state machine now includes states for: - idle / moving - FTL travel - mining and delivery - docking approach / docking / docked / undocking - patrol / escort - Fleets are now a first-class gameplay concept: - fleets have a commander, stance, high-level fleet order, and explicit wings - wings can be nested via parent/child relationships to represent sub-wings - ships now carry behavior metadata such as command, mining, escort, screen, or logistics - fleet orders fan out into ship-level execution orders, keeping "order" separate from "behavior" - Fleet tree selection is now manager-backed: - fleets, wings, sub-wings, and ships can be selected directly from the fleet window - selection is now handled through a dedicated selection manager rather than scattered UI state mutations - Orders currently supported: - move - transfer - mine - patrol - escort ### Docking / Logistics - Docking was added as a required step for transfer to stations - Stations have limited docking capacity and explicit docking ports - Carriers now act as mobile docking hosts for smaller combatants - Carrier recovery was corrected so docking ships reserve a pad early and approach the moving pad directly instead of stalling behind the hull - Mining ships now: - mine ore in `Perseus` - return to `Helios` - dock at a refinery - transfer ore - undock and repeat - Mining ships now correctly leave for the refinery once full even when the delivery leg is inter-system ### Economy / Inventory Foundations - Added item storage classes: - `bulk-solid` - `bulk-liquid` - `bulk-gas` - `container` - `manufactured` - Added itemized manufactured goods for industrial progression: - `hull-sections` - `ammo-crates` - `naval-guns` - `ship-equipment` - `ship-parts` - Added deployable constructible kit items so buildables are also producible: - `trade-hub-kit` - `refinery-kit` - `farm-ring-kit` - `manufactory-kit` - `shipyard-kit` - `defense-grid-kit` - `stargate-kit` - Added module categories and starter module definitions for ships/stations - Added explicit recipe data for refinery and fabrication processing - Ships and stations now expose compatible cargo/storage/module metadata - Refineries track: - ore stored - active refining batch - refining timer - refined output stock - Stations now also maintain per-item stock internally - Fabricator-array stations can now build ship parts, ammo, guns, and equipment from recipe data - Fabricator-array stations can now also assemble deployable kits for constructibles, including stargates - Refinery/manufactory processing now consumes itemized inputs and produces itemized outputs through a shared recipe-driven flow ### Energy / Fuel - Ships now track: - fuel - energy - Stations now track: - fuel - energy - Ships consume energy/fuel depending on activity - Docked ships recharge energy - Stations recharge energy passively ## Testbed Layout - `Helios Reach` is now the industrial / infrastructure system - stations are concentrated there - refinery loop terminates there - `Perseus Gate` is now the extraction / resource system - resource asteroid nodes are concentrated there - miners operate there before hauling back ## UI / UX State - Ship and station selection is supported - Ship multi-selection is supported via click modifiers and marquee drag selection - Selected ships can now be ordered to dock with the nearest friendly carrier - Active fleets can be selected and focused through the fleet command window - The fleet window now renders fleets as a real tree rather than a flat list - Fleet tree nodes show order, behavior, and state on ship-level entries - `Solar` and `universe` views now overlay high-level tactical symbology instead of relying only on 3D meshes - `Solar` view now shows fleet hierarchy links between commanders and wing leaders - Ships use role-specific long-range symbols: - military: hostile/combat-style diamond iconography - transport: boxed logistics symbol - mining: angular resource / industrial symbol - Stations and constructibles use square strategic markers with category-specific internal glyphs - `Universe` view groups ships into fleet counts per system and role for cleaner strategic readability - Focusing works for: - single ships: follow camera - stations: focus camera on the station - Selection panels show: - ship state, order, cargo, hold type, fuel, energy, modules - station role, docking occupancy, stored resources, refinery timing, fuel, energy, modules ## Controls - `Left Click`: select ships or stations - `Shift + Left Click`: add ships to ship selection - `Ctrl/Cmd + Left Click`: toggle ships in selection - `Left Drag`: marquee-select multiple ships - `Right Click`: issue move/transfer orders - `Right Click` with no ship selection and an active fleet: issue a fleet move order - `Mouse Wheel` or `-` / `=`: zoom - `W A S D`: pan camera - `Q / E`: rotate camera - `F`: focus selection, and follow a single selected ship - `G`: toggle the fleet command window - `R`: assign selected compatible ships to dock with the nearest friendly carrier - `Tab`: jump camera between systems - `B`: toggle build mode - `1-7`: choose constructible - `M`: assign mining - `P`: assign patrol - `E`: assign escort ## Technical Notes - The prototype is built with: - Vite - TypeScript - Three.js - Authored data now lives in JSON files under `src/game/data/`, including: - `items.json` - `recipes.json` - `systems.json` - `modules.json` - `ships.json` - `constructibles.json` - `scenario.json` - `balance.json` - Shared domain and runtime types now live in `src/game/types.ts` - Stations now carry both coarse storage totals and itemized stock for recipes - The recipe graph now covers every current constructible and every current catalog item ID - World construction is extracted into `src/game/world/worldFactory.ts` - HUD creation and presentation logic are extracted into: - `src/game/ui/hud.ts` - `src/game/ui/presenters.ts` - `src/game/ui/strategicRenderer.ts` - Fleet composition helpers now live in: - `src/game/fleet/runtime.ts` - Inventory helpers now live in `src/game/state/inventory.ts` - Selection logic is now centralized in: - `src/game/state/selectionManager.ts` - Ship-to-ship docking now reuses the same generalized docking path as station docking inside `src/game/GameApp.ts` - High-level symbology is rendered through a dedicated 2D HUD overlay canvas layered above the 3D scene - Production build is currently passing with `npm run build` ## Known Limitations / Caveats - Orbital behavior is still an approximation for gameplay, not a full orbital mechanics simulation - Stations are on Lagrange-style offsets, but not using a physically rigorous orbital solver - Ship transfer paths are curved and orbit-biased, but still use authored steering rather than patched conics or n-body integration - Fuel / energy exist but station refueling, resupply, and depletion failure states are still minimal - Module definitions exist, and a generic window framework now exists, but there is still no actual ship/station designer yet - Production is still automated by recipe priority; there is not yet a player-facing queue UI for choosing or reordering station recipes - Constructible recipes currently output kit items, but build mode still spawns structures directly rather than consuming those kits - Docking works for logistics, but there is not yet a richer docking queue / reservation UI - NATO-style symbology is gameplay-oriented inspiration, not a strict APP-6 / MIL-STD implementation - Fleet orders currently cover patrol, move, hold, and mining, but wing-specific doctrine editing is still minimal - Carrier recovery exists, but launch/redeploy flows and richer carrier doctrine are still minimal - Window positions and sizes are not yet persisted across reloads ## Suggested Next Steps - Continue shrinking `GameApp.ts` by extracting simulation/order logic into dedicated gameplay systems once the current rules stabilize - Add JSON schema validation or runtime validation for the authored data catalogs to catch content errors earlier - Move constructible placement and future unit spawning onto a shared scenario/entity factory pipeline - Introduce explicit orbital anchors for: - stars - planets - stations - asteroid belts / resource fields - Replace the current movement approximation with a more formal orbital transfer model - Add refueling and power management gameplay - Add ship/station fitting data structures that can later drive a designer UI - Expand the economy beyond ore/refining into manufactured goods and trade lanes - Improve FTL visuals with a fullscreen post-process distortion or tunnel effect - Expand the strategic overlay with threat rings, route arrows, and fleet stance/status markers - Extract fleet command propagation and ship AI execution out of `GameApp.ts` into dedicated simulation systems now that the fleet model has stabilized enough to justify it