chore: refactor GameApp.ts into parts

This commit is contained in:
2026-03-11 18:21:51 -04:00
parent caa9d40cba
commit 5727cb0e88
19 changed files with 2322 additions and 1762 deletions

View File

@@ -4,6 +4,8 @@
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`
@@ -74,12 +76,14 @@ The current prototype includes:
- `container`
- `manufactured`
- Added module categories and starter module definitions for ships/stations
- Added explicit recipe data for refinery processing
- Ships and stations now expose compatible cargo/storage/module metadata
- Refineries track:
- ore stored
- active refining batch
- refining timer
- refined output stock
- Refinery processing now consumes ore inventory and produces manufactured output through a recipe-driven flow
### Energy / Fuel
@@ -144,6 +148,22 @@ The current prototype includes:
- 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`
- 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`
- Inventory helpers now live in `src/game/state/inventory.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`
@@ -160,6 +180,9 @@ The current prototype includes:
## 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