Skip to content

Aquilo: wells and icebergs, placed as a real surface places them (#553) - #585

Merged
wormeyman merged 2 commits into
mainfrom
aquilo-real-surface
Nov 28, 2026
Merged

wormeyman merged 2 commits into
mainfrom
aquilo-real-surface

Conversation

@wormeyman

@wormeyman wormeyman commented Nov 28, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #553.

What changes

Aquilo's all, resources and rocks views now draw the wells and icebergs a real surface places, not the game's map preview. Eric's rule: accuracy to what the map will actually look like beats matching the preview.

The gap was real, and almost all of it was icebergs. The game's own counts at map seed 123456 (preview by --report-quantities, real by a force-generated surface):

window preview real surface
-256..255 551 198
-512..511 (the app's default view) 1,501 635

Big icebergs alone were 1,310 against 460 in the 1024 window.

The port follows the Gleba recipe:

  • The entity stream reads the corrected tiles. Every land tile is an iceberg candidate and spends a draw, so the shore decides every later draw.
  • The queue is applied. Chunks in row-major order, and an entity whose box meets (or touches) one already placed on a shared collision layer is dropped. Wells block wells and icebergs block icebergs. The two masks share no layer.
  • The render corrects and places the window's chunks plus one ring, so the app's worker tiles stitch to the whole picture.

Grades

  • New fixture oracle-aquilo-real-surface-entities.seed123456.json (scripts/probes/aquilo-real-surface-entities): every well and iceberg on the map a player gets over -512..511. Re-running it wrote the same bytes.
  • The shipped path places all 635 at the game's positions to the 1/256 tile, and nothing else. Without the ring, 3 are wrong.
  • The three views match that surface at every one of the 1,048,576 pixels. The app's 128-pixel tiles stitch to the whole render byte for byte.
  • On the older 640 surface, the replay on our corrected tiles gives 209 of 209. On the raw tiles it gives 86 of 209 (222 placed).
  • The full preview PNG is now a reference: 5,692 entity pixels there against our 4,716.

Planted breaks

Each was run through the rebuilt module and the Rust tests, then reverted.

break what went red
no apply step (the preview's rule) all 1,107 px, resources 30, rocks 1,088; whole window 1,493 placed
touching boxes do not collide all 168, rocks 169; whole window 607 of 651
raw tiles in the stream all 1,960, resources 338, rocks 1,685; whole window 345 of 650
no chunk ring all 10, resources 3, rocks 7; the 128-px tiles stop stitching
paint order reversed all 72 px and the overlap test
chunks in columns order instead of rows nothing went red

The last row is a gap. Neither capture tells row-major from column-major (Gleba's could not either). Row-major stays because #492 measured it against a spiral and the reverse order.

Cost

The app's preview, Aquilo at seed 123456, headless Chrome with no DevTools client, the 15-worker pool on hammond, median of 7 interleaved runs. Both arms are the same production build with only engine.wasm swapped, since nothing else under src/ changed.

view main this branch
terrain 230 ms 232 ms
all 257 ms 347 ms (+35%)

The all ranges do not overlap (250 to 264 against 333 to 353). The cost is the ring of chunks, which the planted break shows is needed. The module grew from 548,809 to 554,359 bytes.

Not done

  • The wells' tile rewrite. Each well's created_effect turns nearby water into snow and ice: 2,756 tiles of the default window, up to 5 tiles from a well. Part of it is a random cluster, so a tile of the preview cannot reproduce it. It moves no entity (a stripped run placed the same entities).
  • The paint order where a well and an iceberg share a tile is still the preview's measured rule (the earlier autoplace group on top). How a player's map draws two overlapping entities was not measured.
  • Other zooms now draw no entity, like Gleba. The app's preview is always at one tile per pixel.

Gate

On hammond: pnpm run verify:lint passed. The full pnpm vp test passed (120 files, 1,405 tests, 3 skipped). bash scripts/verify-rust.sh passed: 623 + 60 + 2 Rust tests, the poison phase, the engine.wasm byte check and cargo deny. The poison list gains fixtures::aquilo_real_surface::aquilo_entities_replay_the_real_surface, which places 0 of 69 and 0 of 43 when poisoned.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Kd6o1d34pJNr7M9RVWCV2c

Summary by CodeRabbit

  • New Features
    • Aquilo renders now show entity placements that match the game’s real surface, including corrected terrain tiles and placement order.
    • Entity rendering works across tiled views, with surrounding chunks considered for more consistent placement.
  • Bug Fixes
    • Corrected mismatches in Aquilo entity positions and render output; updated visual checks reflect the real-surface results.
  • Documentation
    • Updated Aquilo rendering notes with parity results and known limitations. Added guidance for capturing and verifying real-surface entity data.

wormeyman and others added 2 commits November 27, 2026 20:36
The all, resources and rocks views drew the game's map preview, which reads
the raw tiles and skips the apply step. The game's own counts at map seed
123456: 1,501 queued by the preview over -512..511 against 635 on a real
surface (551 against 198 over -256..255), almost all big icebergs.

Following the Gleba recipe, the entity stream now reads the corrected tiles,
each chunk's queue is applied row-major with touching boxes colliding on a
shared layer, and the render places the window's chunks plus one ring
(placement::aquilo::real_surface_window). Other zooms draw no entity.

New fixture oracle-aquilo-real-surface-entities.seed123456.json (probe
scripts/probes/aquilo-real-surface-entities): the map a player gets over
the default window. The shipped path places all 635 at the game's
positions; the three views match it at every pixel; the 640 surface replays
209 of 209 on our corrected tiles. The full preview PNG is a reference now.
11 of 14 aquilo:render digests re-frozen. The all view costs 257 -> 347 ms
in the browser (terrain unchanged).

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

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Aquilo entity rendering now uses corrected tiles and collision-aware, ordered placement. Tile-aligned WASM renders build a chunk-ring surface window and paint its entities. New capture data and tests compare placement and rendered views with a captured Factorio surface.

Changes: Aquilo real-surface entity rendering

Layer / File(s) Summary
Queue generation and real-surface application
crates/fmw-noise/src/placement/aquilo.rs, crates/fmw-noise/src/fixtures.rs
Aquilo queue generation accepts optional tile lookups. Application supports real-surface, strict-overlap, and preview modes; real-surface placement rejects touching boxes on shared layers. real_surface_window builds corrected tiles and placements across the requested chunk ring.
Real-surface render integration
crates/fmw-wasm/src/render.rs, docs/noise/aquilo-NOTES.md, docs/rust-wasm-port.md
Tile-aligned entity views use the real-surface window, filter placements by view, and paint footprints by rank. The documentation records render behavior, parity results, and chunk-ring handling.
Replay, capture, and render validation
crates/fmw-noise/src/fixtures.rs, crates/fmw-noise/src/fixtures/aquilo_real_surface.rs, scripts/probes/aquilo-real-surface-entities/*, test/fixtures/*, test/wasmAquiloRenderParity.spec.ts, scripts/verify-rust.sh, docs/noise/entity-generation-NOTES.md
Replay tests compare game, corrected, and raw tile inputs and application modes. The capture probe records entities, generated chunks, and tile rewrites. Fixture-based tests verify entity positions and render parity; render checksums are updated.

Estimated code review effort: 4 (Complex) | ~60 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant Renderer as WASM renderer
  participant Window as real_surface_window
  participant Buffer as Render buffer
  Renderer->>Window: Request corrected window and entity ring
  Window-->>Renderer: Return terrain and placed entities
  Renderer->>Buffer: Paint terrain and filtered entity footprints
Loading

Possibly related issues

  • #400 — Tracks grading Aquilo wells and icebergs against real-surface placement; this PR changes the overlay placement to use that behavior.
  • #535 — Describes the difference between preview and real-surface collision behavior; this PR adds collision-aware application and updates the Aquilo documentation.

Possibly related PRs

Merge Risk: Minimal · up to ac62b · assessed changes only

Path filters excluded changed files. This rating applies only to the assessed changes.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names Aquilo wells and icebergs and says they are placed as a real surface places them. The changeset does this. It moves entity generation to corrected tiles, adds chunk-queue collision han…
Linked Issues check Passed Issue #553 requires four coding changes: (1) collision handling in the shipped path, with row-major chunk order and touching boxes counted as hits; (2) tile correction for iceberg candidates; (3) a me…
Out of Scope Changes check Passed Every change maps to #553 or supports it. Engine changes in placement/aquilo.rs and fixtures.rs implement the collision step, the tile correction, and the chunk ring. fmw-wasm/src/render.rs rout…
Full details: Title check

Explanation

The title names Aquilo wells and icebergs and says they are placed as a real surface places them. The changeset does this. It moves entity generation to corrected tiles, adds chunk-queue collision handling via Apply::RealSurface, and renders the real-surface window in the aquilo views. The title does not name the collision handling or the tile correction, and the PR number in the title is a reference to the linked issue. The title is specific enough for a teammate scanning history to identify the main change.

Full details: Linked Issues check

Explanation

Issue #553 requires four coding changes: (1) collision handling in the shipped path, with row-major chunk order and touching boxes counted as hits; (2) tile correction for iceberg candidates; (3) a measured preview-versus-real count for Aquilo; (4) changing the parity spec from grading the preview to grading the real surface. The PR meets each one based on the whole-PR summary. (1) aquilo.rs adds Apply::RealSurface, which drops queued entities whose boxes touch or overlap an earlier entity on a shared layer. apply(queues, rule) applies chunk queues in row-major order via queue_chunks/place_chunks. (2) real_surface_window builds a corrected-tile AquiloSurfaceWindow, and entity generation reads those tiles. (3) The PR body records counts for two windows (551 vs 198; 1,501 vs 635), gathered with a new probe scripts/probes/aquilo-real-surface-entities/capture.ts. The issue's suggested route was adding Aquilo to real-surface-counts/capture.py. The PR did not use that route. The issue presents this as a suggested next step, so the measurement itself satisfies the requirement. (4) test/wasmAquiloRenderParity.spec.ts now compares the all, resources, and rocks renders against terrain painted with the 635 in-window entities from the new fixture. It replaces the former full-preview pixel-parity test. Well tile rewrites (created_effect) are not modeled. The issue does not require them. The paint order for a shared well and iceberg tile is also not measured. The issue does not require that either.

Full details: Out of Scope Changes check

Explanation

Every change maps to #553 or supports it. Engine changes in placement/aquilo.rs and fixtures.rs implement the collision step, the tile correction, and the chunk ring. fmw-wasm/src/render.rs routes Aquilo entity views through real_surface_window. The updated tests, checksums, and the new real-surface fixture verify that behavior. The scripts/verify-rust.sh poison list adds the new replay test, and the PROVENANCE.json entry documents the new fixture. The notes and docs describe the changed behavior. The all view cost increase (257 ms to 347 ms) follows from the chunk ring the planted-break test shows is needed. Removal of AquiloEntities follows from the switch to the shared queue and apply pipeline. No change touches an unrelated planet or subsystem. The engine.wasm file is in ignored_files, so its contents were not inspected. Its byte-level consistency is not established here.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • 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

Recent review info

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: aa816302-ab8a-4f6d-b178-876058b9c5cf
Commits

Reviewing files that changed from the base of the PR and between fff5b29 and ac62b3f.

Files ignored due to path filters: 1

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

  • crates/fmw-noise/src/fixtures.rs
  • crates/fmw-noise/src/fixtures/aquilo_real_surface.rs
  • crates/fmw-noise/src/placement/aquilo.rs
  • crates/fmw-wasm/src/render.rs
  • docs/noise/aquilo-NOTES.md
  • docs/noise/entity-generation-NOTES.md
  • docs/rust-wasm-port.md
  • scripts/probes/aquilo-real-surface-entities/README.md
  • scripts/probes/aquilo-real-surface-entities/capture.ts
  • scripts/verify-rust.sh
  • test/fixtures/PROVENANCE.json
  • test/fixtures/oracle-aquilo-real-surface-entities.seed123456.json
  • test/fixtures/tier3-render-checksums.json
  • test/wasmAquiloRenderParity.spec.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@claude

claude Bot commented Nov 28, 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.

Aquilo overlays show the game's preview, not a real world (the other planets show a real world since #542)

1 participant