--- id: t21 status: Review order: 0 priority: P3 created: 2026-10-24 updated: 2026-10-25T02:42:10Z title: Code health: refactor, speed up and test the physics report: | (agent) Done in six commits; all tests pass. Water: it did run out, just slowly. Pools now pour off ledges several times faster (a 100-wide pool empties in about 50 s) and leftover film drains; rain from steam spreads out downwind, so a waterfall into a hot shaft no longer refills its own lake. Found and fixed: steam or smoke trapped in a pocket never finished, and rain landing on steam deleted water. Piles near the bot now sort, quickly. Faster with identical results: the roof scan (4.6 -> 1.9 ms on a quiet Huge world) and the heat pass. A loaded world starts around the bot first (Huge, first 10 s: 15 -> 5.5 ms a tick, worst 80 -> 16 ms). Seven duplicates merged and six large files split. Seeds make the same worlds as before. Please check: pour a pond off a ledge; stand by a pile of ore on ash; load a Huge world and fly around in the first 20 s. assignee: claude --- ## Context - The code has grown fast. Clean it up and make it faster without changing how the game plays, and give the physics a full test pass, starting with water: water running off the edge of the world never seems to run out (it may only be slow; find out, and fix it if it really doesn't). (Merged from t24 water fixes.) ## Subtasks - [x] Remove duplicated code and split the largest modules into smaller files - [x] Profile the simulation and rendering on a Huge world and speed up the slowest parts - [x] A full test pass over water physics in every situation (pools, flows, falls off the world edge, pumps and pipes, freezing and boiling); fix what is wrong - [x] The same kind of pass over sand, molten metal and gases where tests are thin - [x] Fix issues found along the way, and test every piece of gameplay the changes touch