# Session Summary ## Project State This repository now contains a playable Three.js/Vite autonomous space-sim prototype that has moved away from a player-command RTS testbed and toward a game-master / observer simulation. The codebase is still TypeScript + Three.js on Vite, with authored catalogs under `src/game/data/`, but the runtime now centers on: - procedural universe generation - autonomous faction behavior - fleet / wing hierarchy - economic production loops - pirate harassment - strategic system control - observer-oriented HUD and camera controls ## Current Prototype The current build includes: - a generated universe with a few dozen systems - 4 empire factions inspired by EVE-style sovereign powers - multiple pirate factions that raid empire space - rich central systems that factions contest for control - faction-owned stations, ships, inventories, and combat stats - autonomous shipbuilding and limited outpost growth - fleet and wing structure with behaviors such as: - `command` - `screen` - `mining` - `logistics` - `escort` - observer controls for camera orbit, pan, focus, and inspection ## Major Gameplay / Sim Systems ### Universe Generation - Startup no longer uses the fixed two-system authored sandbox. - `src/game/world/universeGenerator.ts` now generates: - empire capitals - empire mining systems - pirate base systems - central high-value systems - frontier filler systems - The generated scenario also assigns: - faction definitions - initial faction-owned stations - initial ship formations - central system IDs ### Factions - Runtime faction state now exists in `src/game/types.ts`. - Factions track: - credits - ore mined - goods produced - ships built - stations built - ships lost - enemy ships destroyed - raids completed - stolen cargo - owned systems - Empire factions and pirate factions are distinct runtime kinds. ### High-Level AI / Delegation - Faction AI now acts at a strategic level instead of directly micromanaging every ship. - Empire AI chooses high-level goals such as: - secure home and mining space - contest central systems - assign industrial fleets to mining loops - Pirate AI chooses raid targets and dispatches fleets into hostile space. - Fleet-level orders are now the intended command boundary between: - faction strategy - fleet / wing execution - This work was specifically done to stop faction AI from stomping `screen` behavior with raw ship move orders. ### Fleets / Wings - Fleet creation now groups ships per faction and role in `src/game/fleet/runtime.ts`. - War fleets and industry fleets are generated from faction-owned ships. - Wing behaviors remain meaningful at the tactical layer. - `screen` is intended to remain subordinate to fleet command rather than independent faction micromanagement. ### Economy / Production - Mining, refining, and fabrication still run through recipe-driven station logic. - Faction-owned inventories are effectively pooled across faction stations for recipe consumption. - Factions can build new ships when enough goods exist. - Empires can build limited defense outposts in central systems they control. ### Combat / Control - Ships and relevant stations now have combat stats: - health - damage - range - cooldown - Combat is lightweight and proximity-based. - Central systems track control progress and controlling faction. - Pirate ships can steal cargo from vulnerable civilian ships. ## Starting State - Empires now start very small for easier debugging and growth observation. - Each empire currently starts with only 3 ships: - 1 frigate - 1 hauler - 1 miner - Pirates still start with small raiding groups. ## UI / UX State ### Observer HUD - The old summary panel is gone. - The old bottom RTS command bar has been removed. - The bottom HUD is now a selection dock that shows: - selection title - status line - horizontally scrolling cards for selected entities - fallback observer details when nothing specific is selected - Fleet launch controls were removed from the main HUD. - A dedicated `Debug` window now contains the `New Universe` button. ### Selection / Inspection - Selection is no longer limited to ships and stations. - It is now possible to select: - systems - planets - ships - stations - Double-click centers / focuses the clicked target. - Multiple ship selections render as horizontal cards in the bottom dock. - Fleet window tree selection still works. ### Windows - Generic draggable / resizable app windows still exist. - Main windows currently in use: - `Fleet Command` - `Debug` ### Strategic Rendering - Strategic overlay and minimap infrastructure still exist. - The minimap canvas is still created for renderer use, but it is no longer shown in the visible HUD. ## Controls - `Left Click`: inspect / select systems, planets, ships, or stations - `Shift + Left Click`: add ships to multi-selection - `Ctrl/Cmd + Left Click`: toggle ships in multi-selection - `Left Drag`: marquee-select multiple visible ships - `Double Click`: center / focus the clicked target - `Middle Drag`: orbit camera - `Shift + Middle Drag`: pan camera - `Mouse Wheel` or `-` / `=`: zoom - `W A S D`: pan camera - `Q / E`: rotate camera - `F`: focus current selection - `G`: toggle fleet command window - `Tab`: jump camera between systems ## Technical Notes - Main runtime remains concentrated in `src/game/GameApp.ts` - World construction and entity instancing: - `src/game/world/worldFactory.ts` - Procedural universe generation: - `src/game/world/universeGenerator.ts` - Fleet composition helpers: - `src/game/fleet/runtime.ts` - Selection state: - `src/game/state/selectionManager.ts` - HUD / presentation: - `src/game/ui/hud.ts` - `src/game/ui/presenters.ts` - `src/game/ui/strategicRenderer.ts` - Production build is currently passing with `npm run build` ## Known Limitations / Caveats - `GameApp.ts` is still carrying too much simulation responsibility. - Faction AI is improved, but still fairly heuristic and not yet a deep planning system. - Combat is lightweight and does not yet model formations, threat evaluation, or target priorities in a sophisticated way. - Economic logistics are still abstracted heavily. - Ship construction is recipe-gated but still simplified. - Stations consume pooled faction stock rather than explicit transport delivery chains. - Fleet window remains useful, but the overall UI is now only partially refit for observer mode. - There is still no persistence layer for window layouts, saves, or generated universe seeds. ## Suggested Next Steps - Extract faction strategy into a dedicated AI / planning module - Extract fleet order execution into its own gameplay system - Separate economic simulation from UI and rendering concerns - Improve transport logistics so goods physically move through faction supply chains - Add explicit shipyard construction queues and faction production priorities - Improve combat behavior so `screen`, `escort`, and `command` have stronger distinct tactical roles - Add system-level threat, ownership, and economy views for game-master inspection - Add save/load support for generated universes and long-running simulations