Repository navigation
Vulcanus: round every layer to f32; the terrain render matches the game (#521) - #529
Merged
Merged
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 23 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
wormeyman
force-pushed
the
f32-521-fulgora
branch
from
November 25, 2026 15:23
76e01e1 to
c53d81c
Compare
vulcanus_plasma's abs(A - B) is now one f32 subtraction of its two basis_noise values. vulcanus_threshold and vulcanus_contrast round each step in the Lua's order (1 - threshold, the subtraction, 1 / threshold, the product; the f32 knee and the f32 subtraction), with their arguments narrowed first. The unit tests that bounded these by 1e-12 use 1e-6, since the functions are f32 now. Tier 1 (counts only; the fixtures.rs comments are updated in the last commit of the series): floodCracksA 55 -> 56, floodCracksB 51 -> 52, floodPaths 34 -> 41, floodBasaltsFunc 37 -> 39, climate aux 51 -> 52 and moisture 35 -> 36, elev and elevation 171 -> 180, temperature 252 -> 251, rock_huge 178 -> 180, rock_big 205 -> 203, tile-channel elevation 786 -> 813. The helper fixture (38 of 38 on all three) does not move. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kd6o1cBoAGaJ1FoYPm6arC
The lerps are lerp_f32, 0.2, 0.4, 0.125, 0.3 are narrowed before use, and each subtraction, sum and product is rounded in the Lua's order (flood_cracks_b's min - 0.5, flood_paths' 0.4 - plasma before the detail term, flood_basalts_func's final sum). Tier 1 (cumulative with the helpers commit; fixtures.rs comments are updated in the last commit of the series): all five crack fields reach 61 of 61 (was 61, 55, 51, 34, 37). The fields that read them move too: elev and elevation 171 -> 213, temperature 252 -> 253, tile-channel elevation 786 -> 996, climate moisture 35 -> 37 (aux stays 51, it was 52 after the helpers commit), rock_huge 178 -> 179, rock_big 205 -> 199, rock density 412 -> 411. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kd6o1cBoAGaJ1FoYPm6arC
mountain_elevation (lerp_f32, 0.7 and the flattening factor), volcano_inverted_peak, vulcanus_mountains_func (700 and 200 products, (aux - 0.5) and (spots + 0.5) before they meet), vulcanus_ashlands_func (the 1 / 50 / 3 input scale as two f32 divisions, 0.001 narrowed), vulcanus_basalt_lakes, the two outer lerps, 120 *, 20 + * 1.5, and vulcanus_temperature all go through f32r one step at a time in the Lua's order. volcano_spots, aux and the biome weights are narrowed on entry: they are f32 fields in the game. Tier 1: elev and elevation 213 -> 327 of 434 (171 at the start of the series; unsnapped 169 -> 321), temperature 253 -> 355 of 434 (252 at the start; unsnapped 244 -> 346), tile-channel elevation 996 -> 1,392 of 12,675, corners where the two grids differ 2,346 -> 2,649. The 107 positions still short all read a fractional biome or volcano-spot input, which the spawn and biome layers own. The last-pixel diagnostics move (19,197 -> 19,200 ULPs; -60,441/784 -> -60,544/884). fixtures.rs comments now carry the whole series' before -> after. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kd6o1cBoAGaJ1FoYPm6arC
aux and moisture now round each subtraction and product, and the literals 0.3, 0.6 and 0.2, to f32 in the Lua's order. Tier 1: aux 51 -> 56 of 61, moisture 35 -> 60 of 61. Downstream counts moved because their own glue is still f64: elev and elevation 171 -> 169, temperature 252 -> 250, tile-channel elevation 786 -> 784, rock_big 205 -> 214, rock_huge 178 -> 174, density 412 -> 411. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kd6o1cBoAGaJ1FoYPm6arC
Spawn: the starting-area radius is folded then rounded to f32 before any product reads it, the wobble sums and distortion products and starting_circle round per step. Biomes: volcanism, the starting weights, every lerp and *_full subtraction, the volcano query position (walked one add at a time) and distortion round per step, and the volcano cone uses the game's own arithmetic (f32 distance, the double 3.1416, peak in f64). Tier 1 (spawn, of 410): startingArea 371 -> 392, startingCircle 247 -> 410, ashlandsStart 61 -> 410. Tier 1 (biomes, of 434): mountain_volcano_spots 359 -> 434, mountains_raw 174 -> 343, mountains_full 135 -> 354, ashlands_full 114 -> 365, basalts_full 134 -> 343, mountains_biome 404 -> 428, ashlands_biome 404 -> 429, basalts_biome 408 -> 426. Downstream: elev 169 -> 203, temperature 250 -> 278, tile-channel elevation 784 -> 5311 of 12675, resource favorabilities and regions up 9 to 54 each, rock_huge 174 -> 175, rock_big 214 -> 218, density 411 -> 415. The last Vulcanus pixel now picks the game's tile. One test is left red on purpose: the_shared_spot_query_is_the_vulcanus_ one_bit_for_bit in vulcanus_resources.rs, whose frozen fold depends on this layer. New value 0x37cd_8605_5f45_a0ef; that file is another worker's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kd6o1cBoAGaJ1FoYPm6arC
vulcanus_rock_huge and vulcanus_rock_big now evaluate one f32 operation per step. The game reads `-1.2 + 1.2 * min(..) + rock_noise + 0.5 * knockout` left to right, so each rock adds its own offset before the noise terms; the port had summed the three shared terms first and added the offset last. The caps `0.2 * (1 - k * ashlands)` and every literal are narrowed too. Tier 1 (434 positions): rock_huge 178 -> 287, rock_big 205 -> 284, density 412 -> 417. The knockout stays 434. The remainder is upstream (climate, biomes, rock_noise). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kd6o1cBoAGaJ1FoYPm6arC
`0.025 * ((patchy > 0) + 2 * patchy)` now narrows 0.025, the product and the sum as the game does. Ungraded: no tier-1 count moves (the geyser peak at the measured argmax shifts by 2.7e-9, a half f32 step, and its unit test is updated to match). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kd6o1cBoAGaJ1FoYPm6arC
`clamp(0.5 * log2(r) + noise, 0, 1) + 0.5` now rounds each step as the game does. Ungraded: cliffiness was already 12,675 of 12,675 exact and stays there, and the cliff placement counts do not move. Kept because it matches the Lua. cliff_elevation is the planet elevation, which another worker owns. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kd6o1cBoAGaJ1FoYPm6arC
Every arithmetic step of the resource layer is one f32 operation in the Lua's order: the resource wobble, the four favorabilities (0.01, 0.78, the buffers and the contrast narrowed, and the upstream biome_full rounded on the way in), ore_dist, the size expression, spot density, quantity and the `> 0.9` favorability, the cone distortion weights, the two spot-placer caps, `1 - starting_circle`, the sulfur patches and the patchy region. metal_tile now uses the same f32 `ore_probability` chain as the overlay (rp still approximated as 1). Tier 1 (1,085 positions), before -> after: basalts favorability 994 -> 1029, mountains 1004 -> 1016, mountains sulfur 989 -> 1007, ashlands 997 -> 1036, starting tungsten 1082 -> 1085, starting sulfur 1049 -> 1050, tungsten region 1033 -> 1036, coal 1026 -> 1030, calcite 999 -> 1000, sulfuric acid region 1020 -> 1022, patches 867 -> 1085, patchy 1020 -> 1025. Starting coal, starting calcite and metalTile do not move. The spot-query fold in the unit tests is re-frozen on purpose. No tile, cliff or rock count moves from this module. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kd6o1cBoAGaJ1FoYPm6arC
All 19 tile ranges from tiles-vulcanus.lua, plus mountain_lava_spots, now evaluate one f32 operation at a time in the Lua's order, with each non-exact literal (0.05, 0.3, 0.15, 0.85, 0.35, 0.2, 0.8, 0.25, 0.6, 0.66, 0.01, 0.1, 1.95, 0.95, 0.4, 1.8) narrowed first. Each range's final sum is rounded too. A private range_select_base_f32 holds the f32 form of clamp(min(input - from, to - input) / slope, lo, hi); the shared f64 helper is left alone. Vulcanus tile ranges use no expression_in_range builtin, so the center/half-width form (#523) does not apply. Tier 1: tile argmax 374/381, saves-surface-seed 368/381 and lava classification 49/49 with 0 mismatches do not move. The last-pixel argmax gap moves 19,301 -> 19,300 ULPs. On the point kernel warm stays exact to the game and cracks moves -60,387 -> -60,388 ULPs (grid shift 627 -> 628). The 60k cracks gap is not step rounding. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kd6o1cBoAGaJ1FoYPm6arC
Each Vulcanus worker measured its own layer against unrounded neighbours. Combined, the layers lift each other well past any single branch's numbers. Before #521 -> now: - climate: aux 51 -> 61 of 61, moisture 35 -> 61 of 61 - elevation surface: elev and elevation 171 -> 423 of 434 (unsnapped 169 -> 405); temperature 252 -> 429 (unsnapped 244 -> 411) - cliff tile-channel elevation: 786 -> 12,675 of 12,675 - resources (of 1,085): the four favorabilities and sulfuric acid patches all reach 1,085; tungsten region 1033 -> 1059, coal 1026 -> 1043, calcite 999 -> 1028, sulfuric acid region 1020 -> 1039, patchy 1020 -> 1040 - rocks: huge 178 -> 303, big 205 -> 297, density 412 -> 421 of 434 - the last Vulcanus pixel: the game's tile (volcanic-cracks) now wins, and its point-kernel score equals the game's to the ULP (was 60,387 low) No Vulcanus count is below its value on main. The shared spot query's frozen fold is re-frozen to the combined value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kd6o1cBoAGaJ1FoYPm6arC
…me (#521) The Vulcanus terrain render now matches the game's own terrain-only preview on every pixel: 0 differ, down from 1. The last pixel was a volcanic-cracks against volcanic-cracks-warm swap, and the combined rounding put the game's tile first. - tier 2: 310 Vulcanus rows moved, all in the layers this branch rounds (climate, cracks, spawn, biomes, elevation, temperature, resources, rocks, cliffs and every tile score). No other planet moved, and no key was added or removed. - tier 3: four Vulcanus render rows moved (terrain, cliffs, rocks and resources). - The control that leaves the ore levers at their defaults moved 10,605 -> 10,636; it only has to stay far from the real count. The full vitest suite passes after the re-record. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kd6o1cBoAGaJ1FoYPm6arC
wormeyman
force-pushed
the
f32-521-vulcanus
branch
from
November 25, 2026 15:37
8aaa851 to
4d3996a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack 4 of 5 for #521. Base #528. Merge that first; this then retargets to
main.The Vulcanus terrain render now matches the game's own preview on every pixel: 0 of 1,048,576 differ, down from 1.
This rounds every Vulcanus expression layer to f32 one step at a time: the helpers, cracks, elevation, climate, spawn, biomes, resources, rocks, cliff fields and every tile score. Four agents each did a share. Each measured its share against unrounded neighbours. Combined, the layers lift each other well past any one share's numbers.
Results (tier 1, exact f32 matches)
aux/moisture(of 61)elevandelevation(of 434)temperature(of 434)startingCircle/ashlandsStart(of 410)mountain_volcano_spots(of 434)No Vulcanus count is below its value on
main. In the last-pixel tests, volcanic-cracks now wins as it does in the game, and its point-kernel score equals the game's to the ULP (it was 60,387 low).How it came together
-1.2or-1.0first, then the noise terms. The port summed the noise terms first.mountain_volcano_spotsfrom 380 to 434.range_select_base, a Lua function, not theexpression_in_rangebuiltin. So Nauvis terrain matches the game on every pixel: expression_in_range's real form (#521) #523's center form does not apply to Vulcanus tiles.fixtures.rs. Those were measured again on the combined tree in one pass, and one commit re-freezes them with the combined numbers.What is still short
startingAreato 410 of 410 and all eight biome fields to 434. It is not committed. Trig crosses into the engine as values computed in V8 (The un-narrowed slider_rescale diverges between the wasm libm and V8 at 1 of 600 positions #270), so the fix belongs inAngleTrig::from_degreesandtrigOfinsrc/noise/wasm/request.ts. It needs its own issue.Checks
cargo test -p fmw-noise --lib: 538 passed.scripts/verify-rust.sh: passed.engine.wasmrebuilt. Tier 2: 310 Vulcanus rows re-recorded. Tier 3: four Vulcanus render rows. No other planet moved.test/wasmVulcanusRenderParity.spec.ts:DIFFERING_PX1 -> 0. The control with the ore levers at their defaults moved 10,605 -> 10,636; it only has to stay far from the real count.pnpm vp test: green.pnpm vp check: clean.🤖 Generated with Claude Code
https://claude.ai/code/session_01Kd6o1cBoAGaJ1FoYPm6arC