Status: done (2026-11-13)
Priority: 3
Size: M
Arch: animals
Phase: implement
Design ref: Land and ecology (Forest spread: Decided; Grazing: Decided; Grazing at low cost: pressure feeds forest spread, Agreed); Making a hay meadow (a meadow left unmown and ungrazed falls under the forest-spread rule); Inheritance and expansion, Empty farms (meadow goes on to scrub and young forest).
Goal: Forest turns nearby meadow, and fields by way of meadow, into scrub and then woodland, unless grazing or farming keeps the land open (Decided). Today trees only grow back on tiles that still have some (growTrees, src/sim/forest.js); open land never closes, so the commons stay open for ever and grazing has nothing to hold back. Depends on the grazing-pressure task that VB-047 writes (“herding and grazing pressure”); until that exists, mark this blocked.
Acceptance criteria:
treesMax is drawn as for generated forest.treeStage), and its trees can be felled for firewood like a forest tile’s.clear job (VB-010); at half cover or more the tile is felled (10 h) and grubbed (6 h) as forest (VB-031).st.regrow (@state documented), and only that set is visited each day; the PR reports the set’s size and the daily cost on populous medium at seed 7.docs/testing.md stands.)
Notes / questions:QUESTION_ARCHIVE.md).w.graze, halving each year, with the “keeps open” and “thins” thresholds); this task waits for it.Implementation (13 Nov 2026):
sim/spread (material layer, loaded after sim/grazing, which it reads, and before the fields, meadows, plots and
kinds that call it). It owns st.front (a Set of tiles, @state in the module) and w.tended (Int32Array, the day of the last work
on a tile plus 1; in the save’s WORLD list). initFront makes the front once at seed (one pass over the tiles) and at the load of an
older save; spreadForest visits only the front, once a game day (sim/clock, after growTrees).w.dev < 2) beside forest or thick scrub (half cover
or more), and every tile with scrub. A tile that no longer qualifies is dropped when visited (lazily; a felled neighbour needs no
scan). It is joined by a forest tile cut bare (sim/forest emits cutBare; the kernel module does not call up a layer) and by the open
neighbours of a tile that becomes thick scrub or forest (added after the pass, visited from the next day).SPREAD.years (30) game years, linearly, so a quarter (scrub) in 7.5. treesMax is drawn by
gen/cover fullTrees for the forest it will become (pine where most forest neighbours are pine), at its first growth; at full
cover the biome is set and treesMax redrawn if the kind changed. Walking costs are told (costChanged); the page is told
(treeDirty, biomeDirty). Stones are untouched.GRAZE.keepsOpen; at or above GRAZE.thins the trees go at SPREAD.thin (a fifth) of the rate;
work within SPREAD.tendedDays (a year: a plot’s steps, a field’s clearing and breaking, a meadow made, a field reclaimed); a
household’s field (in use, or to be reclaimed); its meadow mown within the last game year (YEAR_DAYS, rolling rather than the
calendar year: a meadow mown last summer stays open through spring, before its next mowing); other land it uses; an empty farm’s fields and meadows while a
claimant restores it (Projects.forEach, made once a pass on first need). A house and a green leave the front.gen.js decorateChunk treats it as
broadleaf for the drawing; one line, gen.js is at its lint baseline). Thick scrub (half cover or more) is in a village’s wood
(sim/territory reckonWood, woodland) and cut for firewood as forest is; fellTree puts a scrub tile in the front, not in
st.regrow. The invariant on a village’s wood accepts it.scrubHours adds SPREAD.scrubHours (10) below half cover and FELL_HOURS + GRUB_HOURS (16, now exported by
sim/forest, which owns felling) at half or more, to a field’s clearing (clearHours) and a meadow’s; a plot fells and grubs thick
scrub as steps of its own (stepsFor). clearScrub takes the trees off when the clearing is done.RECLAIM hours (a field gone to forest is meadow again once reclaimed). Reason: the clearing
rule above, applied to the other clearing job, so that a farm empty 30 years is not cleared as cheaply as one empty 8.nearForest) is gone: an empty farm’s field is ‘scrub’ when the trees on its tile reach a quarter of full
cover (SPREAD.scrub), ‘fallow’ when they are cleared or thinned off; a scenario’s ruin laid out in scrub gets a quarter’s trees.frontTile (VB.COUNTERS; its key added by hand to tests/counters.json at 0, the
probe has no forest). The grazing scale is taken once a pass (yearScale), not per tile.Validation (13 Nov 2026; a shared machine at a load near 25, so the times are high):
tests/forest-spread.js (fast tier, 0.2 s), on a tiny village under a broadleaf and pine forest: the front; a day’s growth and the
drawn treesMax; a quarter in 7.5 years, thick scrub opening the front, forest (pine beside pine) at 30; grazing at keepsOpen and at
thins; work within a year; a field in use, an empty farm’s field, a restoration; a house leaving the front; the clearing hours and
clearScrub; a thick-scrub field’s reclaim; a forest tile cut bare joining the front; thick scrub in a village’s wood, young scrub
not; the invariants; a save keeping the front and w.tended. tests/crops.js: the empty field’s stage now follows its trees.kinds.js thresh’s done, through Stores.thresh), a
failure of the base, not of this task (this task’s run went through 50 years).frontTile equals the front’s size). spreadForest alone at populous medium, seed 7, year 0 (2,493 tiles after 200 days):
0.28 ms a game day (0.50 ms before the grazing scale was taken once a pass), against the 200 ms budget; in the 50-year run on the
loaded machine 0.5 to 1.1 ms of 600 to 1,270 ms a day.scaling.frontTile is out (exponent 1.22 against 1.15): the scaling probe repeats a strip with a forest at its left
edge, so 2 villages have 3 forest edges and 4 have 7; the front follows forest edge, not people. Reported, not changed. Otherwise
verify’s targets out are those of the base (13 there, 14 here with this one).npm test 51/51, npm run verify 99/99. node tests/smoke.js fails on “Walk here’s tool did not queue the walk” both here and
on the base tree (not this task’s). Screenshot: docs/img/vb091-forest-spread-founders-7-s-y12.jpg (founders, small, seed 7, year
12: young wood on the meadows round Asklunda and Vallen where nothing grazes them).