# 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 - direct per-ship faction control - 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 - 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 and issues direct orders to ships. - Empire AI chooses high-level goals such as: - secure home and mining space - contest central systems - send miners to resource systems - send military ships to rally and patrol targets - Pirate AI chooses raid targets and moves military ships into hostile space. - The fleet / wing layer has been removed from both simulation and UI. ### 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: - 1 miner - 1 manufactory - 1 refinery - Each pirate faction currently starts with: - 1 frigate - 1 trade hub - This is a bootstrap-oriented setup: factions mine first, then try to grow from minimal infrastructure. ## 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 - 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. ### Windows - Generic draggable / resizable app windows still exist. - Main windows currently in use: - `Ships` - `Debug` - The `Ships` window: - lists ships grouped by faction - selects a ship on click - focuses a ship on double click - focuses a faction home system when clicking that faction header ### 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. - Fleet link overlays and fleet counters were removed along with the fleet system. ## 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 using the same motion as `Shift + Middle Drag` - `Q / E`: rotate camera - `F`: focus current selection - `G`: toggle ships 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` - 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. - Bootstrap progression is still constrained by the current station recipe / stock model. - The ships window is useful for inspection, but the overall UI is still 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 - 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 - Rework bootstrap progression so factions can genuinely grow from near-zero infrastructure - Add system-level threat, ownership, and economy views for game-master inspection - Add save/load support for generated universes and long-running simulations