Status: done (2026-11-23)
Priority: 2
Size: M
Design ref: docs/architecture/target-v2.md 3.1 (the layers; Player and presentation); docs/architecture/modules.md
Goal: Third step of the terrain split: everything that draws the map leaves gen/ at once (gen.js imports gen/bake, whose decorateChunk calls gen/paths and gen/rivers, so none can move alone) and loads after sim.js, where tests/dependencies.js refuses any reference to it from the generator or the simulation.
Acceptance criteria:
draw/bake (LV, TEX, bakeWater, bakeChunk, decorateChunk), draw/marks, draw/paths and draw/rivers, under src/draw/, listed in src/manifest.json after sim.js, in a sixth layer presentation of src/layers.json. Each move is verbatim; each rename of a module key a commit of its own, with every use changed (src/, tests/, tools/, AGENTS.md, docs/architecture/, the open task files).ArchGen (VB['gen']) exports generate and what of the generator its readers need, and no drawing: the page reads VB['draw/bake'] and the others by key, and mulberry32 from gen/noise. tests/lib/dompage.js, which wraps ArchGen.bakeChunk, wraps the draw module’s; the page calls it by property so the wrap holds.draw/* module fails tests/dependencies.js (a case in that test, as its other cases).setBiome still writes the colour, until VB-1504; say in the notes what draw/* still reads of gen/* because of it.node tools/same.js --base REF prints same; the pixel check of VB-1500 prints same, and finds the functions at both commits; npm run verify, node tests/smoke.js and the browser tests of the map pass.docs/architecture/modules.md (the module list and Layers), docs/architecture/target-v2.md 3.1 only where it lists modules, tools/writes.js, and AGENTS.md follow.
Notes:gen.js imports gen/bake at load and bake.js:320 calls gen/paths and gen/rivers. The w.trees ? ... : n guards of decorateChunk are dead (every world has trees): leave them in the move, a finding for VB-663.generate, BIOMES, COVER, setBiome (readers: sim/forest, sim/spread, sim/saves, page editor, tools/cover); mulberry32 left it too, its readers (page, tests/rng, populous, lib/tiny) read gen/noise.draw/* still reads of gen/*: draw/bake reads BIOMES of gen/biomes (the pigments, .c, until VB-1504) and mulberry32 of gen/noise (seeded scatter; noise is no drawing, stays).sim/layout only names draw/paths in a comment. tools/stocks.js skips draw/* as it skipped gen/*; tools/writes.js GEN keeps the same members.tests/browser.js timed out once (work bar, 60 s) on the shared machine and passed on rerun.