This document consolidates known problems from source comments, README notes, and observed architecture risks.
- Monolithic frontend orchestrator
src/js/UI/Renderer.tsis a very large mixed-responsibility class (state, rendering, input, transport, window logic).- Increases regression risk and makes isolated feature rewrites difficult.
- Late-game performance bottlenecks
- README notes slowdown when rebuilding transferred data.
Rendererhas TODOs calling out expensive reconstitution and orphan cleanup concerns.DataQueueincludes TODO to chunk data transfer but currently sends full queue each flush.
- Protocol drift risk in transport channels
quitandrestartare now declared inTransportDataMap, but neither channel has a receiver on the opposite side (restartfrom backend → no frontend handler;quitfrom frontend → no backend handler).- Suggests protocol contract is typed but only partially wired end to end.
- Hardcoded UI behavior and theme parameters
- Map scale/tile size hardcoded in
Renderer. - Some options are local in-memory defaults only (
GameOptionsRegistry) and not persisted.
- Map scale/tile size hardcoded in
- Plugin/translation generation portability
- Generated import files use absolute filesystem paths, potentially brittle across environments.
- Asset readiness is strict and static
- Required asset list is a large hardcoded path list in
AssetStore. - Any naming/version mismatch blocks gameplay entry.
- Required asset list is a large hardcoded path list in
From README.md known issues/TODO:
- Some civilization colors are poor.
- Map portal recentring can fail in some situations.
- Trade-rate slider behavior can be inconsistent.
- Minimap highlight render position/wrapping needs work.
src/js/UI/Renderer.ts- Explicit note to break down and potentially use framework approach.
- Performance TODOs around reconstitution and background processing.
src/js/Engine/DataTransferClient.ts- Multiple TODOs around action handling structure, hidden actions, negotiation reuse, and cleanup behavior.
src/js/Engine/DataQueue.ts- TODO for chunking patch transfer.
src/js/UI/components/Minimap.ts- TODO around rectangle rendering near map edges.
Suggested targets for a full rewrite to de-risk migration:
- Establish a versioned worker protocol and runtime validation.
- Replace global mutable object map with reactive normalized store + selectors.
- Split frontend into bounded modules (map rendering, HUD panels, modal windows, input controller).
- Keep asset import feature parity early to avoid blocking user testing.
- Add instrumentation around patch size, reconstitution time, and render frame cost.
- Transport protocol audit (typed channels vs actual runtime usage).
- Patch/reconstitution performance profiling under late-game saves.
- Input handling redesign (hotkeys, modal routing, action dispatch).
- Asset manifest and extraction format versioning plan.