# Development Log

## 2026-06-26

- Wrote `PLAN.md` before any code, per protocol.
- Copied shared harness config files into the project root.
- Chose React for the app shell to match repository guidance, but kept game entities rendered exclusively on Canvas and kept simulation modules DOM-free for hidden tests and performance.
- Updated Vite/Vitest to current patched major versions after `npm audit` showed vulnerabilities in the older conservative versions. Node 22 is available in the environment, so this does not create a local compatibility issue.
- Kept `src/lib/engine-core.ts` independent from the game layer. It uses simple component maps for correctness and typed arrays inside A\* for predictable pathfinding allocations.
- Implemented tower placement by validating a cloned blocked grid with A\* before committing the tower. This prevents player builds from sealing the spawn-goal route while still allowing reroutes.
- Used pooled component objects for enemies, projectiles, and particles. Entity ids are still managed by `World`, but hot component bags are recycled on death, projectile impact, particle expiry, and reset.
- Added `seedStress()` and `runWorkload()` so the browser hook can create a 200+ entity scene and step 300 fixed ticks deterministically.
- Split the initial `GameSim` implementation into `sim.ts`, `simLifecycle.ts`, and `simSystems.ts` after checking line counts. This keeps each game-systems file under the rubric's 400-line god-file threshold while preserving a compact public `GameSim` API.
- Verified after the split: `npm run lint`, `npm test`, `npm run build`, and `npx prettier --check .` all pass. The production JS bundle reports about 53.8 kB gzip.
