Skip to content

[TECH-DEBT] GameEngine.tsx is too large (~1900+ lines) #2

@matthewod11-stack

Description

@matthewod11-stack

Description

GameEngine.tsx is approximately 1900+ lines and handles too many concerns in a single file.

Current State

Boss logic has been extracted to systems/bossSystem.ts, but background SVG rendering, spawn logic, and collision handling are still concentrated in the engine component.

Suggested Fix

  • Extract background/SVG rendering to a dedicated module (e.g., systems/renderSystem.ts)
  • Move spawn logic to systems/spawnSystem.ts
  • Consider splitting collision dispatch to systems/collisionSystem.ts
  • Each extraction should be a separate commit within the same PR
  • After each extraction, verify that GameEngine imports and calls the extracted module correctly
  • Run the game locally if possible to verify no behavioral changes

Verification

  • npm run build passes
  • npx tsc --noEmit clean
  • wc -l src/components/GameEngine.tsx is significantly reduced
  • No new circular imports (grep -r "from.*GameEngine" src/systems/)

Automation Hints

scope: src/components/GameEngine.tsx, src/systems/
do-not-touch: src/scenes/, src/levels/, src/services/, src/server/
approach: extract-modules
risk: high
max-files-changed: 15
blocked-by: none
bail-if: more than 5 circular import errors after extraction, or any runtime error in build

Priority

Medium — doesn't block current work but will slow future level development


Migrated from KNOWN_ISSUES.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    tech-debtTechnical debt to address in future sprints

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions