Skip to content

Nauvis: rocks and trees as a real surface places them (#16, slice 1) - #593

Merged
wormeyman merged 7 commits into
mainfrom
nauvis-real-surface-trees
Nov 28, 2026
Merged

wormeyman merged 7 commits into
mainfrom
nauvis-real-surface-trees

Conversation

@wormeyman

Copy link
Copy Markdown
Collaborator

Nauvis: rocks and trees as a real surface places them (#16, slice 1)

At one tile per pixel (the app's preview), the Nauvis trees, rocks and all views now draw the rocks and trees a real surface places, at the game's own positions. Before, trees blended a tree density over every pixel, and rocks used a salted roll per overlay. Neither put anything at a real entity's position. Other zooms are unchanged.

This is the first slice of #16. The spawners need it first: they sit later in each chunk's random stream than the fish, rocks and trees, so they can only be exact once every earlier group spends the right draws.

What the game does, and the port

  • One random stream per chunk. It serves the fish first (one draw per water tile), then the rocks (big-rock and big-sand-rock are one group), then the fifteen forest trees, then the five dead and dry trees, each alone in its group. The resources, spawners, worms, oil and uranium come after. The sort and every box, layer and control come from the prototypes at runtime.
  • The five dead and dry trees are new (trees/entities.rs). All 29 fields match the game at 1,873 of 1,873 positions.
  • Fish stand on the tile corner and draw nothing extra (new Positioning::Grid).
  • Apply runs in COLUMNS order (x outer, y inner), not rows. Rows misplaces 6 of 33,481, each one beside a chunk corner. Aquilo and Gleba apply in columns order too since Gleba and Aquilo: apply chunks in columns order, as the game does (#589) #590.
  • The generator skips tree noise where the tree cannot place. The placements match the exact path, and every positive value is bit-identical.

Grades

  • Whole 1024 window at seed 123456, with resources, enemies and cliffs off: 33,481 of 33,481 fish, rocks and trees at the game's positions and nothing else (release, ignored test).
  • Three 128-tile windows in the gate: 1,134, 182 and 1,096, all exact. There are seven controls: rows order, strict overlap, a placed entity holding its map-gen box, no apply, raw tiles, no fish group and no chunk ring. Each one goes red.
  • Through the module (test/wasmNauvisEntityParity.spec.ts): trees, rocks and all differ in 0 of 1,048,576 pixels from the game's entities painted on our terrain. 128- and 256-pixel tiles stitch to the whole render byte for byte.
  • Against the map a player gets, the same output matches 32,555 of the game's 32,635 fish, rocks and trees. It has 926 the game lacks: 621 are within 3.5 tiles of a cliff, 289 sit on an ore tile, 2 are both, and 14 are a few tiles from a cliff, ore, oil well or spawner. Frozen at 3,040 tree pixels and 78 rock pixels. Those are later steps: cliffs block trees, ores remove trees (ResourceEntity::postSetup), and spawners in earlier chunks block trees.

The planted breaks and the two gaps are in docs/rust-wasm-port.md. The gaps: the dead trees' parenthesised tail is graded at tier 1 only, and the point kernel at integer corners places the same entities as the chunk grid.

Re-frozen Nauvis counts

No existing frozen Nauvis count or digest moved. Every nauvis:render tier-3 row and every tier-2 fold is off one tile per pixel, so none of them reaches the new path. tiledEqualityAppGeometry and the app-plan seam tests now exercise it and still pass. The rock check in real_surface_counts.rs still grades the salted roll, which other zooms still draw, and a comment there says so. The new frozen values are: tree pixels against the default map, 3,040; rock pixels against the default map, 78; the replay windows, 1,134, 182 and 1,096; the seven controls; and the per-probability positive counts.

Fast and High (#592)

Nauvis's real-surface path now reads the app's Accuracy setting too. High is the render graded above. Fast ("X1") places the window's own chunks only, with no ring and no correction margin, the same rule as Gleba and Aquilo. Frozen in test/wasmNauvisEntityParity.spec.ts, whole 1024 window:

view, reference Fast px High px
trees, trees arm 307 0
rocks, trees arm 35 0
all, trees arm 329 0
trees, the map a player gets 3,341 3,040

Seams: sixteen Fast 256-pixel tiles differ from one Fast render at 1,273 pixels (trees) and 155 (rocks). High stitches to 0. Terrain is byte-identical at both settings. All four counts match the prototype's measurements exactly.

Cost

Measured in the app, Nauvis at seed 123456, headless Chrome with no DevTools client, 15-worker pool on hammond. Median of 7, the three arms interleaved; main is 669cab8 (#592).

view main High Fast
terrain 456 ms 461 ms 462 ms
trees 598 ms 985 ms 529 ms
rocks 553 ms 1,003 ms 533 ms
all 912 ms 1,200 ms 753 ms

With the app's default (Fast), every Nauvis view is now as fast as main or faster. High costs +65% on trees, +81% on rocks and +32% on all. Two things cost time there: the 23 fields at every land tile of the window and its ring, and correcting the ring's tiles. One cheaper option was measured and not taken: reading the ring's tiles out of the window's own correction. It brought all to 1,154 ms against 1,340 ms in a noisier 5-run comparison, but it put 1 tree pixel wrong on the whole window. The module grew from 563,325 to 582,073 bytes.

Plan for the rest of #16

  1. Spawners and worms (next). They come after the ores in the stream. Every land tile spends exactly one ore draw with no jitter, so their place in the stream needs only the land-tile count, which is already exact. It does not need the ore fields. Still needed: spawner on-grid positioning (all 48 game spawners sit at tile centres), the spawner group's probabilities over EnemyBaseField with the chunk penalty batch, the four worm probabilities, and apply against the trees and rocks placed here. In the default window there are 48 spawners and 47 small worms, and none is within 6 tiles of a cliff. The app shows 75 spawners today. Capture arm: cliffs off, resources on, with tree_removal_probability = 0 in data-final-fixes, so the ores still draw but remove nothing.
  2. Resources (ores, then crude oil and uranium). This needs exact ore probabilities and richness, and the resource layer has no exact count yet. It also needs postSetup tree removal, taken as the expected outcome the way Gleba's stone does it. That accounts for the 289 extra trees on ore tiles.
  3. Nauvis cliffs on a real surface, applied before each chunk's entities, as in Gleba slice 5. That accounts for the 621 extra trees beside cliffs, the 9 extra rocks, and the cascade of 14.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Kd6o1d34pJNr7M9RVWCV2c

wormeyman and others added 7 commits November 28, 2026 01:02
At one tile per pixel the Nauvis trees, rocks and all views draw the
rocks and trees a real surface places, through the game's per-chunk
generator and the apply step, instead of a tree density blend and a
salted rock roll. Other zooms are unchanged.

- The stream, read from the prototypes at runtime: fish, huge-rock,
  big-rock and big-sand-rock (one group), 15 forest trees, 5 dead and
  dry trees, then the ores, spawners, worms, oil and uranium.
- The five dead and dry tree probabilities are new; all 29 fields match
  calculate_tile_properties at 1,873 of 1,873 positions.
- Fish stand on the tile corner (Positioning::Grid) and draw nothing
  extra.
- Chunks apply in COLUMNS order: rows misplaces 6 of 33,481, each beside
  a chunk corner.
- Whole 1024 window at seed 123456, later groups off: 33,481 of 33,481
  at the game's positions; 0 of 1,048,576 pixels through the module.
- Default map: 32,555 of 32,635 matched, 926 extra beside cliffs and on
  ore tiles (later slices). Frozen at 3,040 tree and 78 rock pixels.
- all: 914 -> 1,220 ms in the app (median of 7).

New fixtures from scripts/probes/nauvis-real-surface-entities, with
PROVENANCE entries. engine.wasm rebuilt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kd6o1d34pJNr7M9RVWCV2c
One global setting beside the preview, "Accuracy: Fast / High", Fast by
default, kept in the UI store under fmw.accuracy and saved at once. The
preview re-renders when it changes.

High is the graded real-surface render, unchanged. Fast places the
window's own chunks only, with no ring and no correction margin. Only
Gleba's and Aquilo's real-surface entity views read it; terrain and the
other views are byte-identical at both settings.

ABI v3: a u32 accuracy at offset 56 of the common prefix (0 High, 1 Fast)
and four bytes of padding, so COMMON_BYTES is 64 and every block moves by
8. An unknown value is the new BadAccuracy status. The round-trip fixture
is now wasm-request.v3.json, re-verified by verify-wasm-request.py.

Fast's frozen counts against the real-surface fixtures (1024 window):
Gleba all 1,730 px (High 5); Aquilo all 10, resources 3, rocks 7 (High 0).
Seams: Gleba 2,177 px over sixteen 256 px tiles, Aquilo 432 over
sixty-four 128 px tiles (High 0 on both).

The note under entity views: "Entities match this map as the game first
generates it. Exploring in a different order can change some of them."

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kd6o1d34pJNr7M9RVWCV2c
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kd6o1d34pJNr7M9RVWCV2c
Merge the Fast / High branch, and give Nauvis's real-surface path the same
X1 reach: Fast places the window's own chunks with no ring and no
correction margin. Frozen against the captures: trees arm trees 307 px,
rocks 35, all 329 (High 0 each); default-map trees 3,341 (High 3,040);
256-pixel seams 1,273 (trees) and 155 (rocks).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kd6o1d34pJNr7M9RVWCV2c
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kd6o1d34pJNr7M9RVWCV2c
@coderabbitai

coderabbitai Bot commented Nov 28, 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 12 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: 72b83691-f077-44bd-ae8f-5ba331d7f691
Commits

Reviewing files that changed from the base of the PR and between 669cab8 and e4fd321.

Files ignored due to path filters: 1

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

  • crates/fmw-noise/src/fixtures.rs
  • crates/fmw-noise/src/fixtures/nauvis_entities.rs
  • crates/fmw-noise/src/placement/generate.rs
  • crates/fmw-noise/src/placement/mod.rs
  • crates/fmw-noise/src/placement/nauvis.rs
  • crates/fmw-noise/src/placement/real_surface_counts.rs
  • crates/fmw-noise/src/rocks/field.rs
  • crates/fmw-noise/src/trees/entities.rs
  • crates/fmw-noise/src/trees/field.rs
  • crates/fmw-noise/src/trees/mod.rs
  • crates/fmw-noise/src/trees/shared.rs
  • crates/fmw-wasm/src/render.rs
  • docs/noise/entity-generation-NOTES.md
  • docs/rust-wasm-port.md
  • scripts/probes/nauvis-real-surface-entities/README.md
  • scripts/probes/nauvis-real-surface-entities/capture.ts
  • scripts/verify-rust.sh
  • test/fixtures/PROVENANCE.json
  • test/fixtures/oracle-nauvis-real-surface-entities-default.seed123456.json
  • test/fixtures/oracle-nauvis-real-surface-trees.seed123456.json
  • test/wasmNauvisEntityParity.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 9e515be into main Nov 28, 2026
16 checks passed
@wormeyman
wormeyman deleted the nauvis-real-surface-trees branch November 28, 2026 21:03
@wormeyman

Copy link
Copy Markdown
Collaborator Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Action not completed

Pull request is closed.


Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 14 minutes.

@wormeyman

Copy link
Copy Markdown
Collaborator Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Action not completed

Pull request is closed.

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