Skip to content

Fulgora: one 12-way tile argmax, ocean included; terrain matches the game on every pixel - #537

Merged
wormeyman merged 1 commit into
mainfrom
fulgora-joint-tile-argmax
Nov 25, 2026
Merged

wormeyman merged 1 commit into
mainfrom
fulgora-joint-tile-argmax

Conversation

@wormeyman

Copy link
Copy Markdown
Collaborator

Part of #535. Every planet's terrain render now matches the game's preview on every pixel. Fulgora goes from 20 differing pixels to 0, joining Nauvis, Vulcanus and Aquilo.

The finding

  • The game picks each tile with one strict f32 argmax over all 12 Fulgora candidates, the four oil-ocean tiles included:
    • BasicTilesMapGenerationTask::generateBasicTiles, at 0x1ca6ef0;
    • the candidate list is built in compile with no water filter;
    • the map preview uses the same function.
  • The port decided ocean first. If ocean_tile gave a positive score, ocean won before any land tile was scored.
  • All 20 pixels were that case: the port drew shallow oil ocean where the game draws rock, and rock had beaten the ocean score by 0.14 to 3.45.
  • An Opus reviewer re-read the disassembly and reproduced 20 → 0 from source before this was built.

Changes

  • tiles/fulgora_ocean.rs: a new ocean_probabilities returns the four ocean scores, and the formulas now live only there. ocean_tile stays as the ocean-only test, because the get_tile fixture uses it.
  • tiles/fulgora_catalog.rs:
    • resolve_tile is one strict > f32 argmax from -inf, over the four ocean tiles and then LAND_ORDER. The winner goes through poison::index_result(i, 12), so the poison gate still turns puts_every_fulgora_tile_where_the_game_puts_it red.
    • The candidate order only breaks exact ties and isn't settled. It's kept as it was, and a comment says so.
    • land_probabilities now rounds every step to f32, constants included.
  • The land mask and the island finder (render.rs landmask arm, lib.rs field 41) use the same winner, so island outlines agree with the terrain.
    • The old comment estimated this at 14-16% slower. Measured: 12 windows, median of 15, before and after the change in one process, two runs. The landmask view came out 0.998-1.039x at 8 tiles per pixel and 1.005-1.017x at 2, which is within run-to-run noise.
  • Tests:
    • ocean_short_circuits_the_land_argmax passed under both rules, so it checked nothing. It's replaced by two tests: a positive ocean score that loses to rock, which is the case the old rule gets wrong, and an ocean score that wins.
    • wasmFulgoraRenderParity.spec.ts goes from toBe(20) to toBe(0), with a history line.

What moved

measure before after
Fulgora terrain against the game PNG 20 px 0 px
fulgoran_dust_probability exact f32 46 / 101 75 / 101
fulgoran_rock_probability exact f32 78 / 101 100 / 101
  • Tier 2 re-recorded the landDust, landRock, landDunes and landSand folds in both slider cases.
  • Unchanged:
    • the get_tile fixture (4915 / 7 / 11);
    • every tier-3 row;
    • the island freezes;
    • the scrap footprint (it never reads the tile).

Nothing got worse.

Checks

  • pnpm vp test: 131 files, 1,357 tests passed.
  • scripts/verify-rust.sh: passed, including the poison gate and the wasm byte match. cargo-deny isn't installed locally.
  • vp check, check:vue and clippy -D warnings are clean.
  • Re-run for review: engine.wasm rebuilt to the same bytes; the Fulgora render, Fulgora parity and island specs pass, 43 of 43.

This PR and the overlay PR coming next both touch engine.wasm, so whichever merges second gets rebased and rebuilt.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Kd6o1cBoAGaJ1FoYPm6arC

@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You'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 7 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3a1e88d3-b714-4f01-a2b5-996c413b0ee6
Commits

Reviewing files that changed from the base of the PR and between 1eca92d and 113bb38.

Files ignored due to path filters: 1

  • src/noise/wasm/engine.wasm is excluded by !**/*.wasm
Files selected for processing: 10

  • crates/fmw-noise/src/fixtures.rs
  • crates/fmw-noise/src/poison.rs
  • crates/fmw-noise/src/tiles/fulgora_catalog.rs
  • crates/fmw-noise/src/tiles/fulgora_ocean.rs
  • crates/fmw-wasm/src/lib.rs
  • crates/fmw-wasm/src/render.rs
  • docs/noise/tile-correction-NOTES.md
  • src/noise/preview/elevationRenderRequest.ts
  • test/fixtures/tier2-checksums.json
  • test/wasmFulgoraRenderParity.spec.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

…0 -> 0 px

The game's generateBasicTiles runs a single argmax over all twelve candidate
tiles (four oil-ocean, eight land). The port tested the ocean first and let a
positive ocean score win outright, which painted shallow ocean over the 20
pixels where rock scores higher at seed 123456.

- fulgora_ocean: add ocean_probabilities (the four formulas, written once);
  ocean_tile calls it.
- fulgora_catalog: resolve_tile is one strict-> f32 argmax from -inf over
  [shallow, shallow-2, deep, deep-2, LAND_ORDER..], fallback LAND_ORDER[0],
  winner through poison::index_result(i, 12). Candidate order only decides
  exact ties and is not settled (commented). land_probabilities rounds every
  step to f32, constants included.
- The Fulgora land mask (render.rs) and checksum field 41 (lib.rs) follow the
  same joint winner, so the island finder and the terrain view agree.
- Tests: ocean_short_circuits_the_land_argmax checked nothing under the new
  rule; replaced by a_positive_ocean_score_loses_to_a_larger_land_score and
  an_ocean_score_that_beats_every_land_score_wins.
- docs/noise/tile-correction-NOTES.md: Nauvis and Vulcanus are 0 px now.

Moved counts, old -> new:
- wasmFulgoraRenderParity terrain vs game PNG: 20 -> 0 differing pixels
- fulgoran_dust_probability exact f32 matches: 46 -> 75 of 101
- fulgoran_rock_probability exact f32 matches: 78 -> 100 of 101
- tier-2 folds landDust, landRock, landDunes, landSand (both cases) re-recorded
- unchanged: get_tile fixture 4915/7/11, tier-3 and islands freezes
Landmask view speed (12 island windows, median of 15, interleaved): 0.998x to
1.039x at 8 tiles/px, 1.005x to 1.017x at 2 tiles/px.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kd6o1cBoAGaJ1FoYPm6arC
@wormeyman
wormeyman force-pushed the fulgora-joint-tile-argmax branch from 703cbe7 to 113bb38 Compare November 25, 2026 20:48
@claude

claude Bot commented Nov 25, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant