Rebuild lake generation: bowls in valleys filled to their spill level (t96)

Lakes no longer pour water to a guessed lip and repair it afterwards. Each lake lowers the land
in the nearest valley with a smoothstep bowl, and water fills it to its spill level (the lower of
the highest ground on each side, Priority-Flood in one dimension), so it is flat and contained by
construction. Clay beds, no caves or loose pockets close under lakes, trees kept off the shore.
Removes the levelling pass, the lower-rim lip and the bank-slope cap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Cj2RPXdPykKMEz5BXXczsj
This commit is contained in:
2026-10-29 20:55:52 -04:00
co-authored by Claude Opus 5.5
parent e3e01a84b1
commit daeb3b2238
9 changed files with 165 additions and 206 deletions
+3 -2
View File
@@ -185,8 +185,9 @@ oreNames.forEach((name, j) => {
});
const totalOre = oreBalance.counts.reduce((a, b) => a + b, 0);
check('total ore is about 4 to 4.5 times the original', totalOre >= 162519 * 4 && totalOre <= 162519 * 4.5, totalOre);
// t96: lake basins moved and their high banks now slope, so ore there changed (only at the two lakes).
check('shallow ore matches the original generator', oreBalance.shallowHash === 1640715415, oreBalance.shallowHash);
// t96: lakes are bowls in the nearest valley with no caves or loose pockets close under them, so ore
// changed there (724 cells, all within the old and new lake spans).
check('shallow ore matches the original generator', oreBalance.shallowHash === 3875519651, oreBalance.shallowHash);
run('generateWorld(99, 4096, 1536, null)');
const marks = run('(()=>{let lakes=0,peaks=0,inLake=false;for(let x=1;x<W-1;x++){const l=mat[(surfY[x]-1)*W+x]===WATER;if(l&&!inLake)lakes++;inLake=l;if(surfY[x]<surfBase-100&&surfY[x]<=surfY[x-1]&&surfY[x]<surfY[x+1])peaks++;}return [lakes,peaks]})()');
check('a large world has several lakes and mountains across it', marks[0] >= 2 && marks[1] >= 2, marks);