src/game/game.ts is 1,742 lines against a stated target of ~300. It is down
from 3,244 and is now the last named size debt in tools/sizes.mjs alongside
npc.ts.
It is no longer the urgent problem it was — the browser shell came out
(engine/shell.ts), so the file is portable and testable, and
test/game.test.ts flies it. This is decomposition for readability now, not to
unblock anything.
Measured by section:
| section |
lines |
| header + fields + constructor |
690 |
| input |
259 |
| mode transitions |
161 |
| per-frame |
155 |
| combat |
115 |
| contracts |
104 |
| autopilots |
87 |
| HUD |
84 |
| world lifecycle |
81 |
Two cuts look real:
- the input section (259) — key handling and the command dispatch table.
controls.ts already owns the bindings; this owns execution.
- the HUD driver (84) —
renderHud, updateSight, aimBeams. Pure
presentation, and hud-binding.ts already owns the frame it paints.
That lands it near 1,300. Getting to ~300 would mean moving the five host
tables and the mode transitions too, and it is worth checking at that point
whether the target is still the right one — the apply* methods ARE the
orchestrator's job, and moving them would scatter the step order.
Caution: the file is 34% prose. The comments carry the step order and the
reasons for it; they should move with the code they explain, not be dropped.
src/game/game.tsis 1,742 lines against a stated target of ~300. It is downfrom 3,244 and is now the last named size debt in
tools/sizes.mjsalongsidenpc.ts.It is no longer the urgent problem it was — the browser shell came out
(
engine/shell.ts), so the file is portable and testable, andtest/game.test.tsflies it. This is decomposition for readability now, not tounblock anything.
Measured by section:
Two cuts look real:
controls.tsalready owns the bindings; this owns execution.renderHud,updateSight,aimBeams. Purepresentation, and
hud-binding.tsalready owns the frame it paints.That lands it near 1,300. Getting to ~300 would mean moving the five host
tables and the mode transitions too, and it is worth checking at that point
whether the target is still the right one — the
apply*methods ARE theorchestrator's job, and moving them would scatter the step order.
Caution: the file is 34% prose. The comments carry the step order and the
reasons for it; they should move with the code they explain, not be dropped.