Skip to content

Gleba: terrace, climate and the 41-tile choice, exact at tier 1 (#454) - #557

Merged
wormeyman merged 5 commits into
mainfrom
gleba-terrain-tier1
Nov 26, 2026
Merged

wormeyman merged 5 commits into
mainfrom
gleba-terrain-tier1

Conversation

@wormeyman

@wormeyman wormeyman commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Part of #454. First Gleba slice: the terrace op, Gleba's climate stack and its 41-tile catalog in Rust, graded at tier 1 against the game. No ABI, render or app changes yet, so the app still shows "not available" for Gleba.

Result

Against test/fixtures/oracle-gleba-fields.seed123456.json (Factorio 2.1.23, surface seed forced to 123456, point kernel), everything is exact:

  • Climate: elevation, moisture, aux and temperature are each 1,024 of 1,024.
  • Tiles: all 41 tile probability columns are 1,024 of 1,024.
  • Tile winner: 957 of the 957 positions with a unique game winner match, and the per-tile win counts equal the fixture's winCounts. The other 67 positions are exact ties between variants of one tile family, and ours picks one of the tied tiles at all 67. The game's tie-break order is not known yet, so they are not graded.

The grade can fail

Every count was full on the first run, so each was checked by planting a break (each reverted afterwards):

planted break result
terrace as the identity elevation 834, and 26 tile columns below full
gleba_select constants folded in f64 aux 1,014, and 33 columns below full
no distortion on the starting cones natural-yumako-soil 918
the fertile spot field replaced by its basement value natural-yumako-soil 563
host libm sin in place of the game's own elevation 1,023

terrace's strict < at frac == strength is not reached by the fixture, so a unit test pins it.

What changed

  • eval/math.rs: terrace, all f32 as decoded from the 2.1.23 binary (NoiseOperations::Terrace::run). It has a poison::f64_result hook and two unit tests.
  • New expression modules: expressions/gleba_terrain.rs, gleba_starting.rs, gleba_stack.rs.
  • tiles/gleba_catalog.rs: the 41 tiles and one strict f32 argmax over them, with poison::index_result. The candidate order is the planet's autoplace_settings listing, as a stand-in until the game's order is read.
  • fixtures.rs: three tier-1 tests, all added to POISONED_TESTS, and each confirmed red under --features poison.
  • docs/rust-wasm-port.md: a row and a short "Gleba slice 1" section.
  • engine.wasm: rebuilt. The new code is reachable, so the bytes change. The wasm parity specs pass unchanged.

Gate

pnpm run verify:lint, the full pnpm vp test (133 files, 1,404 passed, 3 skipped) and scripts/verify-rust.sh (562 + 52 Rust tests, the poison check, the engine.wasm byte check) pass on this branch, rebased on #552.

Open

  1. The game's tile tie-break order for the 67 tied positions. A chunk-generation probe at those positions would settle it.
  2. Only the point kernel and default controls are graded. GlebaControls is wired through but untested away from 1.
  3. Next slice: the ABI block, render, and the tier-3 parity spec against oracle-preview-gleba-terrain.seed123456.png.

The game probes for stone, entities, enemies and cliffs are on #454.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Kd6o1dTdCEZ5JSjytamwMZ

Summary by CodeRabbit

  • New Features
    • Added Gleba terrain generation, including climate and elevation fields, starting-area features, and selection from 41 terrain tiles.
    • Added configurable controls for water and plant terrain characteristics.
    • Added a terrace operation for creating stepped values.
  • Documentation
    • Updated the Rust/WASM port status with Gleba terrain and tile-selection results.

wormeyman and others added 4 commits November 26, 2026 11:01
f32 at every step, strict comparison against the strength, NaN stays NaN.
Gleba's elevation will read it twice. Unit tests pin the mid-ramp, the
exact boundary, a negative step and the NaN case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kd6o1dTdCEZ5JSjytamwMZ
The four property fields (elevation, moisture, aux, temperature) and every
named expression the 41 tiles read, built once per render in a GlebaStack:
the starting cones, the spiral bridges, the two terraces, the fertile spot
field and the rockpools. Every step is f32 and the trig is the game's own
polynomial. The tile catalog holds the 41 probabilities and one strict
argmax, in the planet's autoplace listing order (the game's own candidate
order is not established, and the fixture's 67 tied positions cannot say).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kd6o1dTdCEZ5JSjytamwMZ
The module has no new reachable code; its bytes move because a shared file
(eval/math.rs) gained a function and the panic location records shifted.
The wasm parity specs pass (203 tests; one Nauvis timeout under a parallel
gate run passed when rerun alone).

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

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Adds Gleba terrain-field evaluation, starting-area cones, 41 tile probability formulas, and tile selection. Adds the terrace math operator and fixture checks for terrain values, tile scores, and winners.

Changes: Gleba terrain and tile selection

Layer / File(s) Summary
Terrain contracts and starting areas
crates/fmw-noise/src/expressions/gleba_terrain.rs, crates/fmw-noise/src/expressions/gleba_starting.rs, crates/fmw-noise/src/expressions/mod.rs
Adds Gleba terrain controls and field types, seed-derived starting-area values, and evaluation of 15 starting-area cones.
Terrain field evaluation
crates/fmw-noise/src/eval/math.rs, crates/fmw-noise/src/expressions/gleba_terrain.rs
Adds terrace with f32 arithmetic and poison handling. Gleba terrain evaluation prepares noise tables and calculates terrain fields, including elevation, moisture, temperature, and plant noise.
Tile probabilities and stack entry points
crates/fmw-noise/src/tiles/gleba_catalog.rs, crates/fmw-noise/src/tiles/mod.rs, crates/fmw-noise/src/expressions/gleba_stack.rs
Adds the 41-tile catalog, f32-rounded probability calculations, strict argmax resolution, and stack methods for evaluating fields and selecting a tile.
Fixture and verification coverage
crates/fmw-noise/src/fixtures.rs, scripts/verify-rust.sh, docs/rust-wasm-port.md
Adds fixture comparisons for terrain fields and tile scores, winner checks for tied and untied positions, poisoned-test entries, and Gleba port documentation.

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

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant GlebaStack
  participant GlebaTerrain
  participant gleba_catalog
  GlebaStack->>GlebaTerrain: eval_at(at)
  GlebaStack->>gleba_catalog: resolve_tile(fields)
  gleba_catalog->>gleba_catalog: probabilities(fields), then argmax(scores)
Loading

Possibly related issues

Merge Risk: Minimal · up to ffb6f · 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 the main change: a Gleba slice that adds the terrace operation, the climate fields, and the 41-tile choice, and it reports tier-1 parity. The raw summary confirms these additions in ma…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: a Gleba slice that adds the terrace operation, the climate fields, and the 41-tile choice, and it reports tier-1 parity. The raw summary confirms these additions in math.rs, gleba_terrain.rs, and gleba_catalog.rs. The title omits the starting-area and stack modules, which is acceptable because it need not cover every detail. The phrase 'exact at tier 1' is specific to the reported fixture results, and the title is 70 characters, within normal length. The title is a single sentence and is not vague.

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: 426bcfc4-a29c-41b7-800f-7d4dc96e5ffa
Commits

Reviewing files that changed from the base of the PR and between 216498c and ffb6f27.

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/eval/math.rs
  • crates/fmw-noise/src/expressions/gleba_stack.rs
  • crates/fmw-noise/src/expressions/gleba_starting.rs
  • crates/fmw-noise/src/expressions/gleba_terrain.rs
  • crates/fmw-noise/src/expressions/mod.rs
  • crates/fmw-noise/src/fixtures.rs
  • crates/fmw-noise/src/tiles/gleba_catalog.rs
  • crates/fmw-noise/src/tiles/mod.rs
  • docs/rust-wasm-port.md
  • scripts/verify-rust.sh

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 26, 2026

Copy link
Copy Markdown

Code review

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

(Light single-pass review: the terrace op, its tests and the verify-rust.sh poison list were read in full; the Gleba expression and catalog modules were not independently audited, and are covered by the tier-1 exact-match grading described in the PR.)

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