Status: done (2026-11-11) Priority: 2 Size: M Design ref: design.md, Weather, seasons and daylight, Wind and rain Goal: Give the generator a weather model that places biomes: the first batch of weather (Kim, 11 Nov). Acceptance criteria:
w.wind (a unit vector, the way the air moves).w.rain, 0 to 1.tests/climate.js (npm test): rain on the windward side of a ridge, erosion keeps the coast, moisture by wetness, the same seed the same climate. Invariants for w.rain and w.wind.tests/golden.json re-recorded, every entry (every island changed); the tests that leaned on one seed’s scene are listed below.
Notes:design.md, Wind and rain (Proposed) says the wind is “mostly from the south-west and west” and changes slowly.
Kim’s decision here is one fixed direction per seed, any direction. The design row is not edited by this task.design.md, Climate (Proposed, slice 10) sets climate by latitude. This task adds no temperature; rain is the only climate so far.
Implementation:src/gen/climate.js (new, kernel layer, before gen.js): CLIMATE (its numbers), wind, drainage and catchment on the coarse grid
(a priority flood with gen/rivers’ heap, now exported), erode, rainfall, climate, moisture, and tiles, which gen.js calls.src/gen.js: one call to erode after the elevation is made, one to tiles before the biome rule; w.wind, w.rain. Its line count is
unchanged (547, the lint baseline).main at 8f3fabd):npm test 90 s before, 123 s after.tools/sim.js), at year 10, before and after: seed 7, 399 and 400 living, mean grain 428 and 392, no hungry
days in either; seed 3, 421 and 393 living, mean grain 382 and 372, hungry days 1 and 0. The islands differ as two seeds differ, so
these say that play goes on as it did, not that households are better or worse off.main too
(seeds 1, 4, 28); tests/meadows.js and tests/hay.js assert none at one seed, which was seed 7’s luck. Worth a task of its own.
Rivers by basin (second change of the task, src/gen/rivers.js, trace):RIVERS.longEnough and RIVERS.noise are gone.main). The numbers under Validation above were taken before this change; the two lines below are after it.src/gen/climate.js, pond, called with erode through shape):main; 13.3 lakes of 441 tiles now; land 20,114 tiles to 19,991.DEMO.seeds is 18, 23, 29, 32, 33, 44, 74, 93, 98, 101 (seeds
where heirs also fits at every map size; heirs finds no room on tiny at seeds 3 and 102 on main as well, and now at 15).tests/goods.js, tests/fresh.js at seed 3, tests/offers.js at 51, tests/record.js at 57 events.tests/smoke.js (verify) failed once on the build before the lakes (“a holder’s history lacks its birth or its farm”) and passes on this
one: the check depends on which holder the scene picks. Not looked into further.
A fault found on the way (src/sim/herds.js, giveAnimal): an animal marked for slaughter could be given to a new household (its start, a
share paid in animals) while its entry stayed on the old herd’s cull list. tests/invariants.js met it at heirs seed 42, day 751, on the
new island; it is on main too, unmet at the seeds tested. The cull list is now pruned when an animal is given; tests/herds.js has the case.
tests/golden.json did not move with the fix.
tests/browser.js: the marriage-offer scene now looks for a people seed and a marriage of the round whose man, when played, is asked,
in place of taking the first marriage at seed 7.
Saves: format 4 (src/sim/saves.js). A save holds its seed and the state, not the island’s heights, rivers or moisture, so a save of an
earlier build would load onto another island. Older saves are refused, as a save of another build is on the page.
Tests moved or re-recorded (every island changed):tests/meadows.js, tests/hay.js (populous: every farm with animals has a meadow), tests/ale.js
and tests/labour.js to seed 3; tests/causes.js (populous fits 60 by 40) to seed 11; tests/goods.js (the founders’ household) and
tests/settle.js (founders: a lone farm within reach) stay at seed 7 after the rivers changed; tests/offers.js to seed 45 (the round’s
first marriage is a son of the house and a woman who speaks for herself: a rare scene, 1 seed in about 40).tests/record.js: the heirs lives at 2.5 years, 77 events to 69, hash re-recorded.tests/commands.js: two live runs shared one world, so one run read the other’s fish stocks from a later day (a negative catch). Each now
has a world of its own. This is a fault of the test, shown by a pawn that now fishes there.src/page/loader.js, DEMO.seeds: chosen again as ten seeds where all three scenarios fit the showcase island (see Lakes, above, for the final list). The old list was also chosen for looks, which nobody has judged for the new one.
START_PEOPLE (populous) re-measured at those seeds.
Checks at the end (890a1a6 and this commit): npm test 103 scripts pass; npm run verify 121 scripts pass; tests/golden.json matches.
Targets (the change adds no work in play; the history targets are ratios of one 40-year run on small seed 7, now another island):scaling.*: 3 out before and after, the same three with the same values (routeRefresh +0.3, roundPairs +0.85, takeInWeighed).history.*: 8 out on main, 6 out now. Worse: routeExpand 1.52 to 2.58 (target 1.25), routeRefresh 1.63 to 1.83, walkTies in to 1.67,
labourWeighed (none at year 5, some at year 40). Better: roundPairs 3.99 to 2.17, occasionAsked 5.57 to 1.61; heirRank, recordFold,
planReview and roundRank are in. Cause: the island and so the run, not the cost of any system; routeExpand is the one to watch.