Skip to content

Fulgora: terrain matches a real surface through tile correction (#454) - #564

Merged
wormeyman merged 1 commit into
mainfrom
fulgora/real-surface-tiles
Nov 27, 2026
Merged

wormeyman merged 1 commit into
mainfrom
fulgora/real-surface-tiles

Conversation

@wormeyman

Copy link
Copy Markdown
Collaborator

Fulgora's terrain now matches a real Fulgora surface at every tile of the 256 x 256 window around spawn, where before it matched only the game's map preview. Tile correction does it, once the -2 ocean twins are modelled as tiles of their own.

Against a real surface

by tile name by map colour
raw argmax (what the preview draws) 1,703 1,003
with tile correction 0 0

The target is oracle-fulgora-real-surface-radius10.seed123456.json (2.1.23, seed 123456, a radius-10 spawn request, terrain-only mod). Two more captures sit beside it, all with PROVENANCE entries: radius 6 (the probe's default) and a rows-order capture.

  • The -2 ocean tiles. oil-ocean-shallow-2 and oil-ocean-deep-2 share a map colour with their base tiles but not a layer (147 vs 148, 67 vs 66), so correction sees a boundary between twins. FulgoraTile gains Shallow2 and Deep2. A new folded() keeps the land mask, the tier-2 checksum and the old get_tile grade where they were.
  • No allowed_neighbors on any Fulgora tile, so Fulgora passes None to correct_window.
  • No ties: none at the maximum in the area the render reads, or on a 16,384-point sweep.

The game's chunk order, decoded

Correction writes into neighbouring chunks, so the order chunks are corrected in changes the map. Against the radius-6 capture, columns order leaves 5 tiles in one cluster near the request edge; against the rows capture, 10. MapGenerationManager::request (from the 2.1.23 decompile) asks for each chunk's 3x3 neighbours one stage lower before it queues the chunk itself. That walk is ported as requested_correction_order and reproduces the radius-6, radius-10 and rows captures at every tile. It also reproduces Gleba's rows capture, the 16 tiles the earlier note left undecoded.

The renderer keeps columns order. Inside a generated area the two orders give the same tiles. The walk depends on a request edge no preview can know, and it would make tiled renders differ from whole ones. The walk is used only in tests. correct_chunks_in_order composes with Nauvis's neighbour rule, which a test checks.

Planted breaks

  • The shallow twins' layers swapped: 0 -> 679 tiles.
  • -shallow-2 folded back into -shallow: 0 -> 18,564.
  • No correction margin: 0 -> 61.
  • Columns order against the radius-6 and rows captures: 5 and 10, where the walk gives 0.
  • Poison: both new grades fail, and they are in POISONED_TESTS.

What moved

  • Preview PNG (now a reference): 0 -> 22,288 over the 1024. In the 256 window the count is 1,003, exactly where the real surface differs from it.
  • Tier 3: 11 rows were re-recorded, every one a 1-tile-per-pixel window. Every moved pixel is terrain, and no scrap pixel moved. The origin window went from 189 pixels off the real surface to 0.
  • Tier 2: no fold moved.

Cost and what users see

The app renders Fulgora at 1 tile per pixel, so every user gets the corrected terrain.

app default (1024 all, 64 tiles of 128, Node, serial, median of 7) time
raw argmax 4.95 s
eager correction 13.76 s
this PR (correct_window, lazy) 9.11 s (1.84x)

Not covered yet: scrap placement still tests the raw tile for oil ocean.

Gate

pnpm run verify:lint, the full pnpm vp test (1,368 passed) and scripts/verify-rust.sh pass locally. cargo deny is not installed on hammond; CI runs it. Rebased onto #563 with no content change.

Refs #454.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Kd6o1dTdCEZ5JSjytamwMZ

At one tile per pixel the Fulgora render runs tile correction after the raw
argmax through correct_window (lazy raw reads, no-op walks skipped), in
columns order over the window's chunks plus one, as Gleba and Aquilo do.
Against get_tile on a real Fulgora surface (map seed 123456, -128..127,
radius-10 spawn request) it differs at 0 of 65,536 tiles, from 1,703 by name
(1,003 by map colour) for the raw argmax.

- FulgoraTile gains Shallow2 and Deep2. The -2 oil-ocean tiles share a map
  colour with their base tile but not a layer (147/148, 67/66), so correction
  sees a boundary between them. folded() keeps the land mask, the tier-2
  checksum and the old get_tile grade unchanged.
- The twelve scores are visited in tile-name order (Gleba's rule). No exact
  tie at the maximum exists in the window or a 16,384-point sweep.
- correction.rs, in a separate block after correct_window:
  correct_chunks_in_order (lazy reads, any order, and Nauvis's optional
  Neighbours rule; Fulgora passes None) and
  requested_correction_order, the order MapGenerationManager::request queues
  correction tasks. Inside a generated area it gives the same tiles as
  columns order; near the requested area's edge it does not. With lazy reads
  it reproduces the radius-6, radius-10 and rows-order Fulgora captures at
  every tile, and Gleba's rows capture. Test model only.
- Probe: FMW_PLANET=fulgora and FMW_MARGIN_CHUNKS; three fixtures with
  provenance.
- Tier 3: 11 rows at 1 tile/px re-recorded (every moved pixel is terrain).
  The preview PNG is a reference: 1,003 in the window, exactly where the real
  surface differs, 22,288 of the full 1024.
- Cost (Node, median of 7 interleaved): app default 4.95 s raw, 9.29 s
  corrected (1.9x; eager correction was 13.76 s, 2.8x). 256 px terrain
  170 / 301 ms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 27, 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 26 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: a3d0fea9-2a63-4b27-a824-33cadb64e049
Commits

Reviewing files that changed from the base of the PR and between 55146ed and 4ad5348.

Files ignored due to path filters: 1

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

  • crates/fmw-noise/src/expressions/fulgora_stack.rs
  • crates/fmw-noise/src/fixtures.rs
  • crates/fmw-noise/src/fixtures/fulgora_real_surface.rs
  • crates/fmw-noise/src/resources/fulgora_catalog.rs
  • crates/fmw-noise/src/tiles/correction.rs
  • crates/fmw-noise/src/tiles/fulgora_catalog.rs
  • crates/fmw-wasm/src/lib.rs
  • crates/fmw-wasm/src/render.rs
  • docs/noise/tile-correction-NOTES.md
  • docs/rust-wasm-port.md
  • scripts/probes/gleba-real-surface/README.md
  • scripts/probes/gleba-real-surface/capture.ts
  • scripts/verify-rust.sh
  • test/fixtures/PROVENANCE.json
  • test/fixtures/oracle-fulgora-real-surface-radius10.seed123456.json
  • test/fixtures/oracle-fulgora-real-surface-rows.seed123456.json
  • test/fixtures/oracle-fulgora-real-surface.seed123456.json
  • test/fixtures/tier3-render-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

@wormeyman
wormeyman merged commit 809b190 into main Nov 27, 2026
16 checks passed
@wormeyman
wormeyman deleted the fulgora/real-surface-tiles branch November 27, 2026 03:02
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