Build Horizon Rust parity foundations and differential validation
Add version-bound core, world data, geometry, generation and feature implementations with native client/server comparison tools and scoped evidence reports. Apply Horizon project branding. Workspace tests, Clippy and 147 Python tests passed. Full 51-family survival and expanded provider comparisons are still running; complete gameplay parity and a playable Rust client remain unfinished. Private game artifacts and the isolated simple-block placement work are excluded.
This commit is contained in:
@@ -0,0 +1,133 @@
|
||||
# Biome lookup
|
||||
|
||||
Horizon implements Java Edition **26.3** block-to-quart biome lookup. `BiomeZoom`
|
||||
accepts the obfuscated biome seed and chooses among eight jittered quart corners
|
||||
in vanilla order, retaining strict distance ties and signed coordinate wrapping.
|
||||
The caller resolves the selected quart coordinate through its biome provider.
|
||||
Direct noise-biome queries bypass this selection and shift block coordinates;
|
||||
floating-point positions are floored with Java's saturating integer conversion.
|
||||
|
||||
`obfuscate_seed` computes the vanilla SHA-256 transform of the little-endian world
|
||||
seed and reads the first eight digest bytes as a little-endian signed long. The
|
||||
core keeps a fixed-input implementation without adding runtime dependencies.
|
||||
|
||||
Run `python3 tools/test_biome_zoom_parity.py`. The
|
||||
[local report](../benchmarks/rust-biome-zoom-2026-10-06/scoped-parity.json) records
|
||||
**256,933 matching lines per reference JAR**: **4,104 seed hashes**, **169,408 block
|
||||
queries** and **83,421 floating-position queries**. Actual vanilla `BiomeManager`
|
||||
methods call a traced resolver; the suite compares selected quart coordinates,
|
||||
direct queries and source replacement retaining the same zoom seed. Seed hashes
|
||||
also match Python `hashlib` independently.
|
||||
|
||||
The corpus includes dense neighborhoods, negative quart boundaries, both signed
|
||||
integer extremes, distant coordinates, randomized seeds/positions, and double
|
||||
NaNs, infinities and subnormals. Source and fixture hashes are captured, changes
|
||||
during validation invalidate the result, and reference artifacts stay private.
|
||||
CI includes the comparison; remote outcomes have not been observed.
|
||||
|
||||
This validates coordinate selection, not biome storage, biome-source generation,
|
||||
chunk blending, or complete generated worlds.
|
||||
|
||||
|
||||
## Chunk biome storage
|
||||
|
||||
`BiomeChunk<T>` stores each section's 64 quart-resolution biome values. Reads clamp
|
||||
quart Y to the chunk and wrap quart X/Z into its local grid. Fills visit sections
|
||||
bottom to top and query each section in X/Y/Z order. Each completed section is
|
||||
committed; a resolver failure retains the failing section's previous values.
|
||||
Inclusive generation bounds select all intersecting sections.
|
||||
|
||||
Run `python3 tools/test_biome_chunk_parity.py`. The
|
||||
[local chunk report](../benchmarks/rust-biome-chunk-2026-10-06/scoped-parity.json)
|
||||
records **478,340 matching lines per reference JAR** across **20 fixtures** and
|
||||
**160 fills**, including **21,120 quart-biome queries**. Native `ProtoChunk` and
|
||||
`LevelChunkSection` methods supply the reference behavior. Tests use synthetic
|
||||
holder identities, up to 512 distinct values, repeated fills, provider failures
|
||||
at calls 0/63/64/65, generation bounds cutting through sections, and the complete
|
||||
supported aligned vertical range. The reference chunk is at BIOMES status.
|
||||
|
||||
This storage uses dense arrays and compares biome values rather than vanilla's
|
||||
internal palette layout. Packet/save integration and chunk lifecycle transitions
|
||||
remain separate work. Clipped generation bounds must remain within the chunk;
|
||||
invalid bounds return an error before mutation.
|
||||
|
||||
|
||||
## Chunk biome generation
|
||||
|
||||
The [generation report](../benchmarks/rust-biome-generation-2026-10-06/scoped-parity.json)
|
||||
records **383,072 matching lines per JAR** across **252 fixtures**, **322 fills**,
|
||||
**341,504 stored biome values** and **35,910 subsequent block-position lookups**.
|
||||
Run `python3 tools/test_biome_generation_parity.py` to compare against actual
|
||||
`ChunkGenerator.doCreateBiomes`, invoked through `NoiseBasedChunkGenerator`.
|
||||
|
||||
Rust compiles the climate fields of all seven bundled terrain routers, samples
|
||||
the chunk's quart volume, searches its multi-noise parameter table and fills
|
||||
biome sections. The suite pairs each router with both Overworld and Nether
|
||||
presets, both random modes and three seed/coordinate combinations. Repeated
|
||||
fills create fresh density contexts while retaining nearest-search state.
|
||||
Generation bounds also exercise omitted top and bottom sections. Subsequent
|
||||
block lookups use seeded fuzzy selection and clamped chunk reads.
|
||||
|
||||
Both JARs independently export the preset tables and must agree: **7,594 Overworld
|
||||
entries** and **5 Nether entries**. Rust imports those quantized tables; preset
|
||||
builders remain unported. Registry-bound source codecs are described below. Reference holders
|
||||
supply identities without evaluating biome properties. The comparison uses empty
|
||||
blending and no below-zero retrogen. An additional 168 fixtures generate chunks through fixed, checkerboard and End
|
||||
sources using every bundled terrain router. They cover real seeded End erosion,
|
||||
the central-island boundary and wrapped checkerboard shifts. The [surface-stage integration](material-surfaces.md#chunk-surface-stage) now
|
||||
links a 3×3 biome neighborhood to terrain filling and surface application, using
|
||||
stored neighbor biome lookups. Saved biome palettes and complete world generation
|
||||
remain pending.
|
||||
|
||||
|
||||
## Fixed, checkerboard and End sources
|
||||
|
||||
`FixedBiomeSource` always returns its configured value. `CheckerboardBiomeSource`
|
||||
preserves masked Java shifts, wrapped addition and floor-modulo selection,
|
||||
including duplicate values and unrestricted constructor scales. It supports up to
|
||||
8,192 values; an empty list returns a typed lookup error. Its vanilla JSON codec
|
||||
has the narrower scale range 0–62, with a default of 2.
|
||||
|
||||
`EndBiomeSource` returns the central biome without querying erosion inside the
|
||||
64-chunk radius. Outside that circle it samples erosion at the containing chunk's
|
||||
center and wrapped block Y, then applies vanilla's highlands/midlands/islands/
|
||||
barrens thresholds. Sampler errors propagate without substituting a biome.
|
||||
|
||||
Run `python3 tools/test_biome_source_parity.py`. The
|
||||
[local source report](../benchmarks/rust-biome-source-2026-10-06/scoped-parity.json)
|
||||
records **1,306,096 matching lines per JAR**, covering **457 fixtures** and
|
||||
**1,147,984 queries**. Actual native source methods supply the results. The corpus
|
||||
includes all 63 codec-valid checkerboard scales, unrestricted runtime scales,
|
||||
empty/duplicate/512-value lists, extreme coordinates, exact End threshold
|
||||
neighbors, NaN/infinity samples and failing erosion providers. Ordered erosion
|
||||
sampling coordinates are compared. This source-level suite supplies constant
|
||||
End density values; seeded density and chunk generation are validated separately.
|
||||
|
||||
|
||||
## Registry-bound source codecs
|
||||
|
||||
`BiomeSourceCatalog` decodes and canonically encodes fixed, checkerboard, End and
|
||||
multi-noise definitions against known biome, tag and preset registries. Named
|
||||
biomes, direct or tagged biome sets, inline climate lists, and named or inline
|
||||
preset holders retain vanilla selection and fallback behavior. The catalog
|
||||
validates references before returning a definition.
|
||||
|
||||
`BiomeSourceDefinition::resolve` builds a `ResolvedBiomeSource` using imported
|
||||
quantized preset tables. A worker resolver retains multi-noise search state,
|
||||
prepares climate volumes only for multi-noise sources, and exposes one query API
|
||||
for all four source kinds. Chunk generation and the surface-stage neighborhood
|
||||
now use this API; surface integration decodes the source configuration itself.
|
||||
|
||||
Run `python3 tools/test_biome_source_codec_parity.py`. The
|
||||
[local codec report](../benchmarks/rust-biome-source-codec-2026-10-06/scoped-parity.json)
|
||||
records **363,121 matching lines per JAR** across **40,481 inputs**, using all
|
||||
**67 biome definitions** and **86 biome tags**. The native `BiomeSource.CODEC`
|
||||
supplies parsing, canonical encoding, possible-biome sets and queries at seven
|
||||
positions. The corpus covers every quantized climate step from −2 to 2, scale
|
||||
bounds and numeric narrowing, malformed fields, duplicate keys, holder sets,
|
||||
and inline-list preference and fallback to presets. Encoding comparisons use
|
||||
serialized JSON numeric values, rather than Java's widened float values.
|
||||
|
||||
Full inline biome definitions, native preset builders, live registry ownership
|
||||
and reloads, biome-search helpers, blending, and complete generated worlds remain
|
||||
pending. The bounded catalog is not a complete registry lifecycle implementation.
|
||||
@@ -0,0 +1,33 @@
|
||||
# Biome temperatures
|
||||
|
||||
Horizon implements Java Edition **26.3** biome temperature sampling, including the
|
||||
frozen modifier, height adjustment, rain/snow thresholds, precipitation selection
|
||||
and the small frozen-ocean iceberg melt predicate. The fixed seeded simplex and
|
||||
noise-stack sources use the existing Rust noise implementation.
|
||||
|
||||
`BiomeTemperatureSettings` supplies the immutable inputs. `BiomeTemperature` is a
|
||||
per-biome, per-worker cache, corresponding to vanilla's thread-local cache. Its
|
||||
1,024-entry insertion order does not change on hits. Keys use packed block
|
||||
positions and omit sea level, preserving both coordinate aliases and cached
|
||||
results across sea-level changes. NaN values are recomputed, including vanilla's
|
||||
eviction behavior when a cached NaN is queried at capacity.
|
||||
|
||||
Run `python3 tools/test_biome_temperature_parity.py`. The
|
||||
[local report](../benchmarks/rust-biome-temperature-2026-10-06/scoped-parity.json)
|
||||
records **836,659 matching output lines per reference JAR** over **387 fixtures**,
|
||||
including **12 thread-isolation fixtures**. The original Java transport invokes
|
||||
actual biome methods and inspects native ordered cache contents. Test inputs
|
||||
include arbitrary base-temperature bits, threshold neighbors, both modifiers,
|
||||
precipitation enabled/disabled, extreme coordinates, sea-level overflow, packed
|
||||
aliases, cache hits/eviction and actual native threads with separate Rust workers.
|
||||
|
||||
The oracle constructs native climate settings and biomes with only the fields
|
||||
these methods use. Climate-setting parsing now covers all **67 bundled biome definitions** and
|
||||
**183 codec inputs**, including float rounding, overflow, field validation and
|
||||
modifier defaults. Full biome codecs, climate encoding, world-dependent snow/ice placement,
|
||||
automatic thread-local ownership for a shared
|
||||
Rust biome object remain pending. Source/fixture hashes guard the comparison;
|
||||
raw reference artifacts stay private under `.local`.
|
||||
|
||||
[Material temperature and biome conditions](material-conditions.md) now use these
|
||||
climate settings and cached temperature calculations in a separate integration suite.
|
||||
@@ -0,0 +1,25 @@
|
||||
# Block-state JSON codecs
|
||||
|
||||
`BlockStateJsonCodec` implements compact and full Java Edition **26.3** block-state
|
||||
JSON forms over the imported `BlockRegistry`, with integer property kinds supplied
|
||||
alongside the registry. Compact encoding uses a block name for the default state;
|
||||
full encoding uses an `id` object and properties for blocks with multiple states.
|
||||
|
||||
Missing or invalid properties retain their defaults. Unknown property names are
|
||||
ignored. Integer properties accept Java decimal strings, including signs, leading
|
||||
zeroes and JDK 25 BMP decimal digits; enum and boolean properties use exact names.
|
||||
This codec is separate from `BlockRegistry::resolve`, whose descriptor validation
|
||||
continues to reject invalid properties.
|
||||
|
||||
Run `python3 tools/test_block_state_codec_parity.py`. The
|
||||
[local report](../benchmarks/rust-block-state-codec-2026-10-06/scoped-parity.json)
|
||||
records **221,261 matching output lines per reference JAR**, covering all
|
||||
**35,723 states**, **1,286 blocks**, **146 integer properties** and **185,538 decoding
|
||||
inputs**. Tests exercise default/full encoding, namespaces, invalid types,
|
||||
property fallback, integer overflow and duplicate fields.
|
||||
|
||||
The two authenticated JARs must export identical state metadata. Exports and raw
|
||||
comparison traces remain private under `.local`. The public report contains
|
||||
metadata and hashes. This validates codec behavior over imported identities;
|
||||
block gameplay, registry lifecycle, warning messages and arbitrary malformed
|
||||
JSON/unpaired-surrogate text remain outside the tested scope.
|
||||
+126
@@ -0,0 +1,126 @@
|
||||
# Carving
|
||||
|
||||
Horizon implements Java Edition **26.3** carving-mask storage and traversal.
|
||||
`CarvingMask` packs cells in Y/Z/X order into 64-bit words. Its column iterator
|
||||
finds contiguous marked runs and splits them into inclusive vertical intervals,
|
||||
using word scans without allocating a list of individual cells or columns.
|
||||
|
||||
`try_visit_mut` retains vanilla callback behavior: adding cells during traversal
|
||||
changes subsequent run searches, while an already selected run keeps its original
|
||||
boundaries. Callback failures stop immediately and retain prior mutations.
|
||||
Coordinate arithmetic wraps like Java, including positive out-of-range aliases;
|
||||
negative indices return an error. Rust bounds height to 1–4,064 and positive growth
|
||||
to 2^24 bits. Invalid construction and allocation limits are explicit errors.
|
||||
|
||||
Run `python3 tools/test_carving_mask_parity.py`. The
|
||||
[local report](../benchmarks/rust-carving-mask-2026-10-06/scoped-parity.json)
|
||||
records **45,742 matching output lines per reference JAR**, across **28 fixtures**
|
||||
and **6,988 operations**. The native `CarvingMask` supplies all reference results.
|
||||
The corpus includes sparse and fully filled masks, duplicate insertions, word and
|
||||
column boundaries, extreme signed coordinates, positive aliases, negative-index
|
||||
failures, and successful or failing callbacks that add cells during traversal.
|
||||
All corpus indices remain below 2^20. Reference artifacts remain private and
|
||||
source/fixture hashes guard validation.
|
||||
|
||||
This comparison covers masks. The combined generation check below also covers
|
||||
neighbor biome selection and carver seeding; complete generated worlds remain pending.
|
||||
|
||||
## Applying masks to terrain
|
||||
|
||||
`apply_carving_mask` traverses each marked interval from top to bottom, applying
|
||||
an optional caller-supplied predicate before block or aquifer queries. The
|
||||
resolved `minecraft:uncarvable` tag prevents replacement. Grass and mycelium mark
|
||||
a surface encountered within the current interval, including when the aquifer
|
||||
returns no replacement. Subsequent exposed dirt beneath carved cells is restored
|
||||
through `top_material`. Block changes update WG heightmaps; fluid postprocessing
|
||||
retains vanilla order and duplicates. Later errors preserve prior effects.
|
||||
|
||||
The [combined surface-stage report](../benchmarks/rust-material-stage-2026-10-06/scoped-parity.json)
|
||||
records **6,733,382 matching lines per JAR**, including **158 carving passes** and
|
||||
**21,757,952 block values** across noise filling, surface building and carving.
|
||||
Actual `NoiseBasedChunkGenerator.applyCarvingMask` supplies the reference results;
|
||||
its existing aquifer is wrapped to trace ordered requests, results and fluid
|
||||
scheduling decisions. The test applies explicit masks, filtered and unfiltered,
|
||||
with grass/mycelium/dirt and uncarvable blocks, repeated writes and disjoint runs.
|
||||
The filter is synthetic; native blending-filter generation remains pending.
|
||||
|
||||
Run `python3 tools/test_material_stage_parity.py`. Unit tests additionally verify
|
||||
that filters and uncarvable tags skip aquifer calls, a surface observation survives
|
||||
an absent aquifer result, and later aquifer failure preserves earlier surface
|
||||
restoration and its fluid postprocessing even when aquifer scheduling is disabled.
|
||||
|
||||
|
||||
|
||||
## Shared shape primitives
|
||||
|
||||
`carve_ellipsoid` visits candidate cells in X/Z/descending-Y order, retaining
|
||||
vanilla's exclusive lower Y bound, Y−0.5 normalization, chunk clipping and ordered
|
||||
skip callbacks. Output failures preserve earlier marked cells. `can_reach` uses
|
||||
wrapped step differences and float-rounded thickness before double-distance math.
|
||||
Traversal has a 2^24-candidate work bound.
|
||||
|
||||
Run `python3 tools/test_carving_geometry_parity.py`. The
|
||||
[geometry report](../benchmarks/rust-carving-geometry-2026-10-06/scoped-parity.json)
|
||||
records **106,699 matching lines per JAR**, across **690 ellipsoids** and **5,536
|
||||
reachability queries**. Actual `WorldCarver.carveEllipsoid` and `canReach` supply
|
||||
the reference results. Tests compare normalized skip inputs, marked-cell order,
|
||||
partial failures and final mask intervals, with distant/overflowing coordinates,
|
||||
clipped bounds, degenerate radii, NaNs, infinities and subnormals. NaN trace values
|
||||
are canonicalized. The seeded cave/canyon paths below use these primitives. Gaussian provider codecs remain separate work.
|
||||
|
||||
|
||||
## Seeded cave and canyon paths
|
||||
|
||||
`CaveCarver` decodes cave definitions and reproduces start selection, rooms,
|
||||
thickness bias, randomized tunnel movement and branching. `CanyonCarver` decodes
|
||||
canyon definitions and reproduces height-dependent width factors, varying radii
|
||||
and randomized path movement. Both preserve float/double operation order and
|
||||
vanilla's quantized trigonometry. Their local path RNG is always the legacy
|
||||
algorithm, independently of the caller's outer random mode.
|
||||
|
||||
Run `python3 tools/test_cave_carver_parity.py` and
|
||||
`python3 tools/test_canyon_carver_parity.py`. The
|
||||
[cave report](../benchmarks/rust-cave-carver-2026-10-06/scoped-parity.json) records
|
||||
**882,005 matching lines per JAR** across **415 fixtures** and **739 requested
|
||||
carve invocations**. All three bundled cave definitions are independently
|
||||
imported from both JARs. The
|
||||
[canyon report](../benchmarks/rust-canyon-carver-2026-10-06/scoped-parity.json)
|
||||
records **1,094,517 matching lines per JAR** for the bundled canyon and custom
|
||||
shapes across four generation heights.
|
||||
|
||||
The native `WorldCarver.DIRECT_CODEC` and actual cave/canyon methods supply
|
||||
reference results. Comparisons include ordered cell writes with duplicates,
|
||||
mask intervals, partial output failures and subsequent random longs. Both random
|
||||
modes, repeated invocation, distant/overflowing coordinates and neighboring/far
|
||||
origins are covered. Custom shapes force branching, floor and width variation,
|
||||
degenerate radii and failure boundaries; malformed selected fields are tested.
|
||||
|
||||
Rust bounds a cave call to 4,096 starts, a canyon to 4,096 steps and 4,064 width
|
||||
entries, and either call to 2^24 candidate cells through a shared traversal budget.
|
||||
Budget exhaustion retains prior mask writes. Gaussian provider codecs,
|
||||
encoding, blending and complete worlds remain pending; these suites invoke
|
||||
individual carvers directly. The combined stage check covers neighbor selection and seeding.
|
||||
|
||||
|
||||
## Biome-selected neighboring carvers
|
||||
|
||||
`CarverCatalog` resolves named and inline carvers while preserving ordered holder
|
||||
lists and repeated references. `generate_carving_mask` visits the 17×17 origin
|
||||
neighborhood in X/Z order. Each carver receives a legacy random stream initialized
|
||||
from the world seed plus its list ordinal and the origin chunk coordinates, then
|
||||
runs its native start-selection and shape path. The mask clips below the ceiling
|
||||
with vanilla's seven-block allowance, or without that allowance for upgrading
|
||||
chunks. Source errors stop generation before mask application.
|
||||
|
||||
The combined stage report includes **42 procedural carving passes** through actual
|
||||
`NoiseBasedChunkGenerator.generateCarvers`, after noise filling and surface work
|
||||
and before the explicit-mask stress passes. Biome selection uses uncached quart
|
||||
queries and retains the source's prior search state from biome filling. Carved
|
||||
surface restoration switches fuzzy lookup to that raw source. All four bundled
|
||||
carvers and all seven terrain settings are available to biome selection; the
|
||||
native biome settings retain actual carver lists with empty placed-feature lists.
|
||||
|
||||
Unit tests cover origin order with coordinate overflow, upgrading bounds,
|
||||
invalid bounds before source calls, early source failure and duplicate holder
|
||||
identity. Tagged carver sets, region-neighbor caching, nonempty blending,
|
||||
retrogen integration, placed features and complete generated worlds remain pending.
|
||||
@@ -0,0 +1,283 @@
|
||||
# Horizon collision geometry
|
||||
|
||||
The version target is Minecraft Java Edition **26.3**. Geometry is a simulation
|
||||
foundation; Horizon still has no Rust client, live world, or entity simulation.
|
||||
|
||||
`horizon-core::geometry` provides `Vec3`, `Aabb`, `Axis`, `Direction`, `BlockHit`,
|
||||
and immutable `VoxelShape` values. Coordinates are doubles. Arithmetic keeps
|
||||
vanilla's operation order, signed zero, NaN comparisons, normalization threshold,
|
||||
and collision epsilon. It does not enable approximate or fused simulation math.
|
||||
|
||||
Implemented vector operations include addition/subtraction, vector-to, component
|
||||
products, scaling, normalization, dot/cross products, interpolation, projection,
|
||||
distance/length, horizontal vectors and finite/equality checks. Rotations, look
|
||||
directions, alignment, axis replacement, direction offsets, and pitch/yaw extraction
|
||||
are also implemented. The full Vec3 API and entity integration remain absent.
|
||||
|
||||
Trig uses vanilla's 65,536-entry float sine table with double angle scaling and
|
||||
Java long narrowing. The table is generated from the pinned formula in Rust;
|
||||
the geometry suite compares every generated entry against the runtime table.
|
||||
Inverse trig narrows to float at vanilla's conversion points. These comparisons
|
||||
validate the tested platform; other platforms need the same bit comparisons.
|
||||
|
||||
Bounding boxes normalize endpoints with Java-compatible min/max. Queries include
|
||||
half-open containment, strict intersection, transforms, distances, ray clipping,
|
||||
block-coordinate construction with wrapping integer endpoints, setters, next-value
|
||||
deflation, and swept-box collision tests. A disjoint `intersect` preserves vanilla's
|
||||
constructor normalization rather than introducing a different empty-box rule.
|
||||
|
||||
Shapes keep exact coordinate arrays and a packed occupancy grid. Greedy boxes are
|
||||
cached once in vanilla order. Collision-distance queries use occupied grid cells;
|
||||
ray and closest-point queries reuse the cached boxes. Column minima/maxima use
|
||||
vanilla's cyclic perpendicular coordinates and infinity for empty/outside cells.
|
||||
Cube shapes retain arithmetic
|
||||
lookup; moved shapes use array lookup even for a zero offset. Ray hits preserve
|
||||
face tie ordering, endpoint exclusion, tolerances, and the 0.001 inside-hit nudge.
|
||||
Boolean shape joins and overlap predicates preserve cube, identical,
|
||||
disjoint and epsilon-merger behavior. Shape operations reject truth tables that
|
||||
fill two empty cells, as vanilla does. Per-axis cube-coordinate metadata survives
|
||||
partial merges and is checked when importing cached shapes. Box construction
|
||||
preserves thin-box rejection and up to 1/8 cube quantization. Optimized joins
|
||||
reconstruct greedy boxes in vanilla order. Face/edge extraction and shape rotations remain absent.
|
||||
|
||||
Discrete axis extrema are retained separately from occupied cells. A box can
|
||||
quantize to no occupied cells while retaining a finite minimum/maximum on other
|
||||
axes. That state affects vanilla's lower-block floor-height lookup. Empty joins
|
||||
also preserve their integer sentinel extrema; optimization and moving an empty
|
||||
shape return the canonical empty shape.
|
||||
|
||||
Shape clones preserve identity and share immutable coordinate, occupancy and box
|
||||
storage. New shapes keep separate identities even when their grids are equal.
|
||||
This preserves alias-sensitive join shortcuts and avoids copying large grids
|
||||
when an operation returns an existing shape. The cache importer shares equal
|
||||
grid storage while retaining the distinct vanilla shape identities.
|
||||
|
||||
`resolve_shape_movement` ports vanilla's movement resolver over a supplied shape
|
||||
list: Y first, then horizontal axes in movement-magnitude order, translating the
|
||||
box by resolved motion before each axis query. `candidate_step_heights` preserves
|
||||
float narrowing, duplicate identity, current-Y exclusion, and sorted candidate
|
||||
heights. `resolve_step_movement` adds the initial collision and step-up decision,
|
||||
including landing-height adjustment, a second collider query, and the first
|
||||
candidate improving horizontal movement. `entity_collision_bounds` preserves
|
||||
the initial entity query bounds. These helpers take caller-selected colliders;
|
||||
they do not choose world/entity shapes, set grounding, change velocity, or apply
|
||||
inside-block effects.
|
||||
|
||||
The step-up corpus calls the actual private `Entity.collide` method for **17,680
|
||||
cases** per JAR. Reference fixtures supply entity inputs and controlled
|
||||
block/entity/border shape lists; vanilla performs the movement decisions. Query
|
||||
bounds and results are compared bit for bit. This verifies the decision with
|
||||
those inputs, not live world selection or entity state transitions.
|
||||
|
||||
`block_floor_height` returns the selected shape's maximum Y, or lazily queries
|
||||
the lower shape only when the current one is empty. Its 12,000-case corpus also
|
||||
checks the lower supplier's invocation count against `BlockGetter`.
|
||||
|
||||
`traverse_blocks` visits blocks in vanilla ray order, including its endpoint nudge,
|
||||
strict corner comparisons, early callback return, integer wrap and signed-zero
|
||||
endpoint equality. It accepts finite rays and an explicit visit budget. Invalid
|
||||
geometry or exceeding that budget returns a typed error; earlier callbacks remain
|
||||
applied. Actual block/fluid ray selection is a separate integration task.
|
||||
|
||||
Inclusive block-box iterators preserve X/Y/Z order, while directional iterators
|
||||
preserve vanilla's movement-dependent axis order and corner signs. AABB iteration
|
||||
includes floored maximum faces. They return independent position values and
|
||||
reject true volumes above the positive Java-int domain, instead of reproducing
|
||||
overflowed Java iteration counts.
|
||||
|
||||
`sweep_intersected_blocks` ports movement-path visits from
|
||||
`BlockGetter.forEachBlockIntersectedBetween`: tiny movement, the initial box,
|
||||
ray-clipped footprints, packed-position deduplication, final box, step indices,
|
||||
and early callback stops. Stationary/tiny movement avoids a deduplication-set
|
||||
allocation. Inputs and computed geometry must be finite; a caller-selected work
|
||||
budget counts ray steps and iterator candidates, including suppressed duplicates.
|
||||
Earlier callbacks are not rolled back on an error. Block effects still need
|
||||
their own implementations and integration with entity movement.
|
||||
|
||||
`horizon-world::collision::CachedCollisionRegistry` imports a private local export
|
||||
of vanilla cache data. The export includes DataVersion, all state descriptors,
|
||||
deduplicated shapes, coordinate-kind metadata, discrete extrema, and a per-state
|
||||
cache index. Import verifies every state ID
|
||||
against the block registry. Section lookup also requires the same borrowed registry.
|
||||
Imported nonempty extrema must agree with occupancy; empty extrema must be in
|
||||
the grid's domain or match vanilla's empty-join sentinel triple. Extrema form part
|
||||
of the grid-sharing key, so equal occupancy does not erase different metadata.
|
||||
There is no fallback shape for an unsupported state: `None` means block behavior
|
||||
must select it, while a cached empty shape is a valid `Some` value.
|
||||
|
||||
This covers the cached branch of the **no-context** `BlockState.getCollisionShape`
|
||||
method. Vanilla's overload taking `CollisionContext` always calls block behavior;
|
||||
the cache cannot establish entity collision parity. Dynamic and entity-dependent
|
||||
selection, neighboring blocks, world borders, movement integration, fluids, block
|
||||
effects, and live collision broad-phase queries still need implementation.
|
||||
|
||||
Run the comparisons after preparing the pinned artifacts:
|
||||
|
||||
```sh
|
||||
python3 tools/test_geometry_parity.py
|
||||
python3 tools/test_collision_parity.py
|
||||
```
|
||||
|
||||
Both suites invoke actual vanilla methods from the authenticated client and server
|
||||
JARs. They compare canonical double bits, including infinities/NaNs, rather than
|
||||
using a numerical tolerance. The geometry corpus includes empty and sparse grids,
|
||||
greedy decomposition, overlapping boxes, rays, tiny movements and IEEE boundaries.
|
||||
It compares **1,320,187 output lines per JAR**, including **2,400 integer-box
|
||||
iterator cases**, **2,400 AABB iterator cases**, and **9,022 movement-path traces**.
|
||||
The registry suite exercises cached shape queries through resident section IDs,
|
||||
translation at negative and world-border coordinates, and invalid import rejection.
|
||||
Its export records **35,524 cached states**, **199 uncached states**, **6,093
|
||||
shape identities**, and **330 distinct grids**. The comparison runs **213,144 queries** plus state/box/identity checks,
|
||||
producing **1,097,456 matching output lines per JAR**. These counts describe this
|
||||
branch and corpus; they are not a gameplay coverage percentage.
|
||||
|
||||
Raw grids admit at most 1,048,576 cells with strictly increasing, non-NaN
|
||||
coordinates. Oversized or malformed imports/joins return typed errors. This
|
||||
bounded library API does not reproduce Java's complete exception/object surface.
|
||||
|
||||
All exported data, test inputs, reference output, and compiled adapters remain
|
||||
under gitignored `.local/`. Success reports record exact sources, inputs, outputs,
|
||||
and reference hashes. A runner removes its prior success report before running
|
||||
and rejects edits to the captured sources during validation. Passing these suites
|
||||
does not prove whole-game parity or any FPS/render-distance improvement.
|
||||
|
||||
Checked-in [geometry metadata](../benchmarks/rust-geometry-2026-10-05/scoped-parity.json)
|
||||
and [cached-collision metadata](../benchmarks/rust-collision-2026-10-05/scoped-parity.json)
|
||||
identify their tested source versions. Reports cover their recorded snapshots;
|
||||
later changes require fresh validation.
|
||||
|
||||
Entity obstruction now evaluates ordered candidate snapshots, excluded entity
|
||||
identity, spectator/removal/building flags, shared root-vehicle identity and
|
||||
voxel-shape intersection. Empty shapes skip the query; candidate collection
|
||||
finishes before obstruction evaluation. Unit-block queries translate in floating
|
||||
point, including integer-coordinate boundaries. Run
|
||||
`python3 tools/test_entity_obstruction_parity.py` to compare against the actual
|
||||
vanilla `EntityGetter` default methods and entity metadata queries.
|
||||
|
||||
The [entity-obstruction report](../benchmarks/rust-entity-obstruction-2026-10-06/scoped-parity.json)
|
||||
records **15,121 matching output lines per JAR** over composite shapes, boundary
|
||||
contacts, thin boxes, metadata filters, vehicle roots and injected query failures.
|
||||
The Java fixture privately allocates entity snapshots without running their
|
||||
constructors. Entity lifecycle, spatial indexing and vehicle-tree maintenance
|
||||
remain separate implementation work. Workspace tests, warning-free Clippy and
|
||||
**138 Python tests** passed at this snapshot.
|
||||
|
||||
Legacy block solidity now uses explicit definition overrides and cached collision
|
||||
bounds, with force-on precedence and native mean-size/height thresholds. The
|
||||
no-context replaceable and liquid flags are kept independently. Solid rendering
|
||||
uses the occlusion definition flag and a full-shape test over imported raw
|
||||
occlusion geometry. Import validates the pinned
|
||||
DataVersion, full state identities and complete block definitions before building
|
||||
a shared property table. Predicates query this table in constant time.
|
||||
|
||||
`python3 tools/test_block_properties_parity.py` compares all **35,723 states** and
|
||||
**18,096 synthetic cache/flag/shape cases**, including adjacent floating-point values
|
||||
around solidity thresholds and both occlusion flag values. The [block-properties report](../benchmarks/rust-block-properties-2026-10-06/scoped-parity.json)
|
||||
records **143,361 matching lines per JAR**. Definition flags, collision and raw
|
||||
occlusion data are private runtime inputs; Rust calculates solidity and solid
|
||||
rendering. The report was produced in an isolated staging copy and archived only
|
||||
after the integrated sources and copied fixtures matched every recorded hash.
|
||||
Item/fluid-context replacement and collision with live entities remain separate work.
|
||||
|
||||
Face selection now preserves native cube-axis shortcuts, epsilon sample points,
|
||||
slice coordinates and clamped parent extrema, including sparse slices whose
|
||||
native bounds differ from occupied boxes. Repeated queries share face identities.
|
||||
The FULL, CENTER and RIGID support tests execute against the selected shape.
|
||||
`python3 tools/test_face_support_parity.py` compares **1,615 input shapes** and
|
||||
nested faces, producing **595,686 matching lines per JAR** in the
|
||||
[face-support report](../benchmarks/rust-face-support-2026-10-06/scoped-parity.json).
|
||||
The [refreshed geometry report](../benchmarks/rust-geometry-2026-10-06/scoped-parity.json)
|
||||
also retains **1,320,187 matching lines per JAR** after face slicing was added.
|
||||
Block-specific support-shape selection is a separate layer.
|
||||
|
||||
Registered support caches now derive FULL/CENTER/RIGID masks from privately
|
||||
imported support geometry and share results by shape identity. The importer
|
||||
checks the data kind and full state identities. `None` explicitly requests
|
||||
uncached behavior; it never becomes an assumed unsupported face.
|
||||
`python3 tools/test_block_support_parity.py` compares **35,524 cached states**
|
||||
across six directions and three support kinds, while retaining **199 uncached
|
||||
states**. The [cached-support report](../benchmarks/rust-block-support-2026-10-06/scoped-parity.json)
|
||||
records **248,867 matching lines per JAR**.
|
||||
|
||||
Face-cache storage is now lazy and attached to shape identity. Clones share it;
|
||||
new identities and moved shapes start with an empty cache. A regression test
|
||||
checks that cached faces do not retain their parent after it is dropped. The
|
||||
face and geometry differential suites passed again after this allocation change,
|
||||
as did workspace tests, Clippy and **140 Python tests**. No FPS claim is inferred
|
||||
from these library checks.
|
||||
|
||||
Dynamic support selection now handles bamboo collision offsets, dripstone and
|
||||
sulfur-spike thickness/direction, the empty-context scaffolding support shape,
|
||||
powder snow, and shulker animation-state support faces. Moving-piston lookup
|
||||
preserves missing/wrong block-entity behavior and delegates active entity shape
|
||||
calculation to the world. The [dynamic-support report](../benchmarks/rust-dynamic-support-2026-10-06/scoped-parity.json)
|
||||
records **4,867,780 matching lines per JAR** over **107,308 fixtures** covering all
|
||||
**199 uncached states**, coordinate boundaries, block-entity snapshots and query
|
||||
failures. Run `python3 tools/test_dynamic_support_parity.py` to reproduce it.
|
||||
The current suite also compares no-entity-context collision geometry in **60,161
|
||||
fixtures**, including **13,014 shulker progress fixtures**. Shulker collision
|
||||
bounds retain native float interpolation and differ from animation-state support
|
||||
faces. `BlockCollisionRegistry` dispatches cached and dynamic collision queries;
|
||||
entity movement contexts and block-entity lifecycle remain separate work.
|
||||
Workspace tests, warning-free Clippy and seven focused Python tests passed.
|
||||
|
||||
Moving-piston collision now selects stationary extended bases and moving heads,
|
||||
translates shapes using native float progress arithmetic, and honors the
|
||||
movement-direction collision exclusion. Interpolation preserves float operation
|
||||
order, including negative partial ticks and IEEE edge cases. The separate
|
||||
collision-related state used for entity pushing retains its own sticky/head
|
||||
rules; entity pushing itself is not implemented by this module.
|
||||
|
||||
`python3 tools/test_piston_shape_parity.py` compares **102,315 fixtures**,
|
||||
including every registered moved state and **10,000 raw float interpolation
|
||||
cases**. The [piston-shape report](../benchmarks/rust-piston-shape-2026-10-06/scoped-parity.json)
|
||||
records **1,096,811 matching lines per JAR**. This corpus uses absent block
|
||||
entities for moved-block collision selection. Workspace tests, warning-free
|
||||
Clippy and **142 Python tests** passed. Tick progression and live world mutation
|
||||
remain separate work.
|
||||
|
||||
The refreshed dynamic-support corpus also includes **9,216 active piston
|
||||
snapshots**, composing block-entity lookup with piston collision generation and
|
||||
all support tests. It compares extension/retraction, source heads, progress
|
||||
boundaries, collision exclusions and query failures. These snapshots do not
|
||||
exercise piston ticks, pushed entities or chunk updates.
|
||||
|
||||
The archived block-survival snapshot executes 42 rule kinds with 54 distinct rule/tag
|
||||
bindings over registry-bound solid flags, air identity, support tags and
|
||||
FULL/CENTER/RIGID geometry. The verified snapshot covers **1,274 block definitions
|
||||
and 34,758 states**; unsupported definitions return an explicit error. Candidate
|
||||
properties select attachment direction, hanging state, door/plant halves and
|
||||
pale moss carpet's serialized `bottom` property. Pressure plates and cactus
|
||||
flowers preserve repeated neighbor reads. Downward center support applies the
|
||||
unstable-bottom-center tag only where native helpers do. Upper doors require the
|
||||
same block below; upper double plants also require its lower half. Crop survival
|
||||
checks brightness against 8 before querying support; farmland preserves its
|
||||
conditional second read above, and dripleaf stems read both neighbors. Sugar cane,
|
||||
lily pads, frogspawn, spore blossoms, small dripleaves and tall seagrass preserve
|
||||
their independent fluid queries, source/full-water requirements and tag checks.
|
||||
Growing plants preserve head/body identity and kelp support restrictions.
|
||||
Scaffolding recomputes neighbor distance in native order; chorus plants and flowers
|
||||
preserve branching reads and early exits. Piston heads validate base type, facing
|
||||
and extension. Mangrove propagules, speleothems, pitcher crops, bells and shelf
|
||||
mushrooms use their version-specific attachment rules.
|
||||
|
||||
Interrupted runs can be resumed with `python3 tools/test_block_survival_parity.py --resume`.
|
||||
The runner verifies source, environment, fixture and compiled-artifact hashes
|
||||
before reusing completed stages. A changed output is regenerated; changed inputs
|
||||
require a fresh run without `--resume`. Checkpoints stay under `.local`, and
|
||||
a parity report is written only after both native comparisons pass.
|
||||
|
||||
`python3 tools/test_block_survival_parity.py` compares actual native `canSurvive`
|
||||
calls in both pinned JARs. The [block-survival report](../benchmarks/rust-block-survival-2026-10-06/scoped-parity.json)
|
||||
records **14,574,905 matching output lines per JAR** across **4,501,019 fixtures**.
|
||||
Each supported candidate state is exercised; behavior representatives are tested
|
||||
against every neighbor state, changing repeated reads, integer-coordinate
|
||||
wrapping, absent/closed/open shulker snapshots and injected block/entity query
|
||||
failures, plus light thresholds, independent fluid sequences and fluid-query
|
||||
failures. Native method ownership
|
||||
and support-tag fields supply private
|
||||
definition metadata; survival results are calculated in Rust. Workspace tests,
|
||||
Clippy, the prior **145-test Python suite**, and five focused harness tests passed.
|
||||
This establishes the recorded survival
|
||||
scope, not full placement, neighbor updates, unsupported plant rules or complete
|
||||
block gameplay.
|
||||
@@ -52,7 +52,7 @@ measurements yielded the same medians:
|
||||
| Plain `Object` | 16 | 8 |
|
||||
|
||||
[Raw platform results](../benchmarks/object-headers-2026-10-03) come from
|
||||
[CI run 37153955462](https://github.com/ludovic111/minecraft-optimization-lab/actions/runs/37153955462).
|
||||
[CI run 37153955462](https://github.com/ludovic111/Horizon/actions/runs/37153955462).
|
||||
Each platform has nine measured batches per type/mode across three JVM forks.
|
||||
The hosted ARM Mac has three logical CPUs and is not the user's M2 Pro.
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ Hosted medians and nearest-rank p95 over 20 measured trials:
|
||||
The upstream Mac maximum was 108.892 ms; its requested 50 ms sleep overshot.
|
||||
The wakeable Mac maximum also shows scheduler variability. The hosted ARM Mac
|
||||
has three logical CPUs and is not the user's M2 Pro. [Raw trials](../benchmarks/idle-queue-2026-10-03)
|
||||
are from [CI run 37155695460](https://github.com/ludovic111/minecraft-optimization-lab/actions/runs/37155695460).
|
||||
are from [CI run 37155695460](https://github.com/ludovic111/Horizon/actions/runs/37155695460).
|
||||
|
||||
This isolates idle wakeup, including enqueue/pop overhead. It does not simulate
|
||||
the existing 250 ms debounce, preprocessing, chunk generation, meshing, network
|
||||
|
||||
@@ -0,0 +1,502 @@
|
||||
# Compiled density evaluation
|
||||
|
||||
Horizon targets the repository-pinned Minecraft Java Edition **26.3**. The
|
||||
`horizon_core::density` module implements selected compiled samplers and an initial
|
||||
integrated graph compiler. Complete graph coverage and terrain generation remain pending.
|
||||
|
||||
Implemented samplers:
|
||||
|
||||
- Constants, including signed zero and nonfinite values.
|
||||
- Context-bound blend alpha, blend offset and structure density; blend-density wrappers.
|
||||
- Axis gradients with clamped, repeating and mirrored repeating coordinates.
|
||||
- Unshifted noise and both XZ and XYZ shifted-noise specializations.
|
||||
- Shift, shift-A and shift-B offset noise; old blended terrain noise; outer End
|
||||
island density.
|
||||
- Euclidean, squared Euclidean, Manhattan and Chebyshev distance metrics and
|
||||
distance-to-point evaluation.
|
||||
- X/Y/Z coordinate slices and the combined XZ bulk specialization.
|
||||
- Coarse-grid interpolation with positive horizontal and vertical cell sizes.
|
||||
- Surface-height searches and their compiled horizontal slice.
|
||||
- Nested cubic splines, lazy coordinate evaluation and spline range analysis.
|
||||
- Absolute value, negation, square, cube, square root, logarithm, reciprocal, sign, squeeze
|
||||
and leaky ReLU.
|
||||
- Floor, nearest, ceiling and truncation to integer or sampled multiples.
|
||||
- Addition, subtraction, multiplication, division, minimum and maximum, including
|
||||
their constant-operand specializations; clamping.
|
||||
- Powers with general, constant-base and constant-exponent samplers.
|
||||
- Range choice with general or constant branches, and linear interpolation with
|
||||
general or constant endpoints; single- and multi-threshold interval selection.
|
||||
|
||||
Immutable samplers share children and noise sources through `Arc`. A worker owns
|
||||
its `SamplerContext`, which retains temporary vectors for nested bulk evaluation
|
||||
and returns them on typed errors. `clear_scratch` releases the retained buffers.
|
||||
This avoids allocating a temporary vector for each repeated evaluation after
|
||||
warm-up; no whole-game performance improvement has been measured.
|
||||
|
||||
## World fields and references
|
||||
|
||||
`WorldFields` stores immutable sampler bindings for blend alpha, blend offset and
|
||||
structure density, plus an optional `DensityBlender` provider. A worker attaches
|
||||
these with `SamplerContext::with_world_fields`; changing them clears its cached
|
||||
densities. Context-bound samplers resolve the binding on each scalar or bulk call
|
||||
and delegate with the same context. Missing bindings use constants 1, 0 and 0,
|
||||
respectively, including constant bulk tail writes. Custom fallbacks are supported.
|
||||
Declared metadata remains independent of the bindings: alpha has range `[0,1]`,
|
||||
offset and structure density have infinite ranges, and their axis masks are X/Z,
|
||||
X/Z and X/Y/Z. Uniform-axis rewriting follows that metadata even for synthetic
|
||||
bindings which vary along omitted axes.
|
||||
|
||||
`BlendDensitySampler` evaluates its input first. Absent or empty providers return
|
||||
that result unchanged; other providers transform the logical volume in Z/X/Y
|
||||
order while preserving the input's tail writes. Graph range and axes come solely
|
||||
from the input. Differential checks cover absent and actual vanilla EMPTY Blender
|
||||
contexts. Provider delegation/order tests do **not** validate the still missing
|
||||
nonempty old-world blending algorithm or structure-density producer.
|
||||
|
||||
Direct reference holders compare by their value; registered holders compare by
|
||||
holder identity. `register_function` creates an immutable named holder and
|
||||
`function` retrieves it. Raw compilation delegates through its value. Optimization
|
||||
inlines one holder layer before detecting cache nodes, preserving vanilla's
|
||||
ordering and nested-wrapper behavior. A holder whose child changes during
|
||||
rewriting is replaced by that child directly. These choices affect constant
|
||||
specializations and cache allocation, and are checked against actual vanilla
|
||||
holder records, named registries and the compiler.
|
||||
|
||||
## Graph compilation
|
||||
|
||||
`density::graph` defines immutable constants, gradients, eleven unary operations,
|
||||
six binary operations, powers, rounding, clamps, range choices, lerps, interval selection,
|
||||
distance-to-point, slices, caches, interpolation, surface searches, nested splines,
|
||||
registered normal/shifted noise, offset noise, old blended noise and outer End
|
||||
island density, context-bound world fields, blend-density wrappers and direct/named
|
||||
reference holders.
|
||||
Definitions reference earlier nodes in the same graph;
|
||||
construction rejects nesting beyond 256 nodes. For ordinary float fields,
|
||||
structural interning distinguishes signed zeros and canonicalizes NaN payloads,
|
||||
matching Java record equality.
|
||||
Precompiled input bindings carry caller-supplied ranges and axis dependencies;
|
||||
the compiler trusts this metadata. Bindings have distinct identities.
|
||||
|
||||
`DensityCompiler::get_sampler` prepares shared caches, slices uniform axes, then
|
||||
compiles and memoizes the root. Cache IDs belong to that compiler: worker contexts
|
||||
must not reuse cache cells across compiler instances. Failed preparation consumes
|
||||
its allocated ID and retains any successfully prepared children; retrying a failed
|
||||
root does not return a cached failure. `compile_raw` bypasses rewriting and rejects
|
||||
unprepared cache definitions.
|
||||
|
||||
Compilation integrates range propagation with min/max specialization and scalar
|
||||
short-circuit bounds. Strictly disjoint min/max ranges can eliminate a sampler,
|
||||
but both children compile before that decision. Touching ranges retain the branch.
|
||||
Literal operands select dedicated arithmetic paths, including reciprocal
|
||||
multiplication for a literal right-hand divisor. These choices affect float bits,
|
||||
child evaluation and buffer tails. Uniform-axis rewriting introduces zero slices
|
||||
in X/Z/Y order, combines adjacent X/Z slices, and reduces child volumes while
|
||||
retaining coordinate strides.
|
||||
|
||||
The differential suite compares these passes with vanilla's actual
|
||||
`DensityFunctionCompiler` across 368 independent unseeded graphs, 64 mixed seeded
|
||||
graphs and six seeded failure cases, with 18,282 successful root compilation
|
||||
requests. It checks declared ranges and axes, structural equality, cache-ID counts,
|
||||
memoized sampler identity, failure state, scalar/bulk values and child call counts.
|
||||
Some bound inputs deliberately use synthetic metadata to exercise compiler
|
||||
decisions; those cases do not validate terrain metadata or seeded terrain output.
|
||||
Serialized codecs, concrete world-field producers and complete terrain integration
|
||||
remain pending.
|
||||
|
||||
`DensityCompiler::new_seeded` fixes the world seed and random algorithm for the
|
||||
compiler's lifetime. Registered noise definitions use canonical namespaced registry
|
||||
identifiers; duplicate names are rejected. Ordinary noise instances reuse a sampler
|
||||
created from the world positional factory and the identifier's hash. The
|
||||
`minecraft:nether/temperature` and `minecraft:nether/vegetation` keys bypass that
|
||||
map and create legacy Nether biome samplers from the world seed and seed plus one,
|
||||
respectively. The addition wraps as Java `long`. `get_noise_sampler` exposes this
|
||||
lookup for callers needing the same registered sources.
|
||||
|
||||
Old blended terrain noise uses the world seed directly in legacy mode and the
|
||||
positional `minecraft:terrain` stream in modern mode. Noise compilation retains
|
||||
literal positive-zero tests when choosing unshifted, XZ and XYZ implementations;
|
||||
negative-zero shifts retain the shifted path. Shift functions compile in X/Z/Y
|
||||
order, while the XYZ sampler evaluates them in X/Y/Z order. Declared noise ranges
|
||||
come from their registered definitions; axis dependencies combine nonzero scales
|
||||
with all shift functions.
|
||||
|
||||
The seeded oracle constructs vanilla's actual `RandomState` with a frozen test
|
||||
noise registry, then uses its compiler and compile context. Constructor-only
|
||||
material inputs use zero-noise fixtures; this does not validate material rules or
|
||||
surface generation. The corpus includes extreme signed seeds, both algorithms,
|
||||
instance identity, special Nether failures, offsets, blended noise and mixed
|
||||
cached/interpolated/spline graphs. The graph API still expects registered,
|
||||
canonical identifiers. The [world-generation codec suite](world-generation.md)
|
||||
now loads and compares all bundled noise and density registry definitions against
|
||||
the actual registry-aware codecs. Complete chunk generation remains pending.
|
||||
|
||||
`EndIslandSampler` uses a legacy stream initialized directly from the world seed,
|
||||
regardless of the world noise algorithm. It discards 17,292 random draws before
|
||||
constructing simplex noise with skipped offsets. The island search retains
|
||||
vanilla's strict noise threshold, float arithmetic, integer wrapping and division
|
||||
toward zero for negative coordinates. Its declared range is `[-0.84375, 0.5625]`,
|
||||
and its dependency mask is X/Z. Bulk sampling computes each horizontal column
|
||||
once, repeats the result over Y and preserves the output tail. The center island
|
||||
is supplied by the surrounding terrain graph; this source supplies outer islands.
|
||||
|
||||
Spline coordinates can reference graph functions directly through
|
||||
`CubicSpline<FunctionId>`. Graph rewriting visits parent coordinates before nested
|
||||
values, retaining repeated coordinate occurrences and point order. Compilation
|
||||
shares structurally identical coordinate inputs, validates each unique coordinate
|
||||
range immediately after compiling it, and then creates the existing spline
|
||||
sampler. Graph range analysis remains lazy: a NaI coordinate can stop range lookup
|
||||
before visiting a nested value even when compilation later rejects that value's
|
||||
coordinate. Errors follow their respective traversal paths. Spline point arrays
|
||||
use Java's bit-based equality, including canonical NaNs and distinct signed zeros.
|
||||
The graph nesting bound includes paths through nested spline values and coordinate
|
||||
definitions.
|
||||
|
||||
Interval-selection definitions retain threshold order, duplicates and nonfinite
|
||||
values. Their declared range covers all branches without asking for the selector's
|
||||
range; their axis dependencies include both the selector and every branch. The
|
||||
Rust definition API requires one more branch than thresholds and limits the list
|
||||
to 256 branches. The JSON decoder separately requires ordered thresholds and a
|
||||
minimum of two branches. Its ordering retains Java's float comparator, including
|
||||
distinct signed zeros; equal consecutive thresholds are allowed.
|
||||
Threshold lists retain vanilla's separate equality and hashing rules: opposite
|
||||
zeros compare equal but hash differently; separate lists containing NaN compare
|
||||
unequal. Thresholds use an immutable `Arc` so rewritten definitions preserve list
|
||||
identity. Interning tracks equality classes and signed-zero hash differences,
|
||||
including cancellation through parent definitions. `DensityGraph::java_equals`
|
||||
exposes equality separately from interned IDs and compiler cache reuse.
|
||||
Distance-to-point definitions declare all three axes and `[0, infinity]`, and
|
||||
compile to the checked wrapping-coordinate metric sampler.
|
||||
|
||||
## Scalar and bulk behavior
|
||||
|
||||
Power graphs compile both children in base/exponent order before selecting a
|
||||
specialization. A literal base takes precedence over a literal exponent. Otherwise,
|
||||
literal exponents with absolute values one half, one, two or three select square
|
||||
root, identity, square or cube. Negative exponents wrap those specialized samplers
|
||||
in a reciprocal. Other exponents return directly from the fallback power sampler,
|
||||
which uses the original signed exponent. These paths retain distinct float
|
||||
arithmetic and signed-zero behavior.
|
||||
General samplers evaluate both operands without zero/one shortcuts and retain
|
||||
base writes if exponent evaluation fails. Constant-operand bulk samplers also
|
||||
transform buffer tails.
|
||||
|
||||
`RoundSampler` implements floor, nearest, ceiling and truncation to integer or
|
||||
sampled multiples. Nearest uses Java's float-to-int rounding: ties go toward
|
||||
positive infinity, NaNs become zero, and extreme values saturate to the signed
|
||||
32-bit integer domain before conversion back to float. Floor, ceiling and
|
||||
truncation retain nonfinite float values. A zero multiple returns the input,
|
||||
preserving its signed zero and NaN behavior; the multiple still evaluates after
|
||||
the input. Other multiples use float division, integer rounding and float
|
||||
multiplication in that order.
|
||||
|
||||
Only a literal-one graph multiple selects the integer specialization. It modifies
|
||||
the input buffer, including its tail. A sampled multiple uses a volume-sized
|
||||
temporary after the input and requires an exactly volume-sized output through
|
||||
this Rust API. Failure in the multiple leaves input writes visible. Range
|
||||
propagation evaluates the multiple's range first, divides the input range, maps
|
||||
the rounding operation over the endpoints and multiplies by the multiple range.
|
||||
|
||||
All densities are `f32`; noise coordinates and scales are `f64`. Gradient
|
||||
coordinate arithmetic wraps as Java `int`, including overflow of the endpoint
|
||||
difference and `MIN / -1`. Repeating gradients use floor division, not truncation.
|
||||
A zero repeating period returns a typed error at evaluation time. Clamped
|
||||
zero-width gradients retain the reference floating-point behavior.
|
||||
|
||||
Scalar and bulk evaluation deliberately remain separate. Unshifted noise bulk
|
||||
sampling calls the noise source's bulk kernel, whose arithmetic can differ from
|
||||
scalar Perlin evaluation. Shifted noise evaluates child volumes first and then
|
||||
samples its source using those values. XYZ evaluates shifts in X, Y, Z order;
|
||||
XZ omits the Y addition entirely. Inserting a synthetic zero would change signed
|
||||
zero behavior.
|
||||
|
||||
Scalar multiplication and division return positive zero without evaluating the
|
||||
right child when the left child is zero. Scalar minimum and maximum can skip the
|
||||
right child using their supplied compiled range bounds. Bulk binary operations
|
||||
evaluate both child volumes. Bulk minimum and maximum replace a value only on a
|
||||
strict comparison; their handling of NaNs and equal signed zeros therefore differs
|
||||
from scalar `Math.min` and `Math.max`. Constant-operand min/max retain that same
|
||||
scalar/bulk distinction. Constant multiplication and division do not inherit the
|
||||
generic scalar zero shortcut.
|
||||
|
||||
Range choice samples its selector first and evaluates only the selected branch
|
||||
for a scalar query. Bulk range choice evaluates the in-range branch first, then
|
||||
the selector, then the out-of-range branch, retaining earlier output writes when
|
||||
a later child fails. Interpolation evaluates only the selected endpoint at alpha
|
||||
zero or one in scalar queries; bulk interpolation evaluates its dynamic endpoint
|
||||
volumes before selecting or blending values. Constant endpoints avoid allocating
|
||||
a scratch vector. Neither path clamps alpha to the unit interval.
|
||||
|
||||
Interval selection preserves threshold order and chooses the first strictly
|
||||
higher threshold, or the last branch. NaN comparisons fall through. Scalar
|
||||
queries run only the selected branch; bulk queries evaluate the selector and
|
||||
then every branch in order before replacing output values. A contiguous scratch
|
||||
vector holds branch volumes, with an exact-volume slice passed to each child.
|
||||
The Rust constructor requires one more branch than thresholds and caps the
|
||||
number of branches at 256. The JSON decoder validates threshold order; it does
|
||||
not sort the list.
|
||||
|
||||
A slice's length is its logical density-buffer size. Constants fill that whole
|
||||
slice. Unshifted noise clears it before accumulation. Gradients overwrite only
|
||||
the volume's cells; shifted noise retains whatever its X child wrote outside the
|
||||
volume. Unary operators transform the whole logical buffer after their child
|
||||
returns. Binary, general range-choice, interval selection and interpolation bulk evaluation require exactly a volume-sized buffer,
|
||||
matching the valid size of its temporary right-hand buffer. Horizon rejects an
|
||||
oversized multi-input output before evaluating children; Java's accidental reads beyond
|
||||
the temporary array and backing-pool capacity are outside this bounded API.
|
||||
Short buffers are always rejected before writes. Errors from evaluated children
|
||||
retain earlier writes, and scratch storage is returned for reuse.
|
||||
|
||||
## Coordinate slicing
|
||||
|
||||
`SliceSampler` fixes an X, Y or Z coordinate, or both X and Z. Scalar requests
|
||||
replace those coordinates before calling the child. Bulk requests sample a
|
||||
reduced volume once, then copy its samples into the repeated columns or planes.
|
||||
The reduced descriptor retains the original steps on all axes, including fixed
|
||||
axes, so cached children see the same descriptor as vanilla. Expansion uses
|
||||
column copies or fills and does not repeat child sampling.
|
||||
|
||||
When every fixed axis already has size one and the requested minimum coordinate,
|
||||
the sampler passes the original output directly to its child. This distinction
|
||||
preserves child writes outside the volume and partial writes on errors. Otherwise
|
||||
the child receives scratch storage; its failure leaves the caller's output
|
||||
untouched, and successful expansion writes only the volume's cells. Graph-level
|
||||
slice insertion and combining adjacent X/Z slice definitions remain compiler work.
|
||||
The corpus checks all four compiled forms, nested slices, cached children,
|
||||
unchanged and reduced volumes, call counts, buffer tails and integer boundaries.
|
||||
|
||||
## Grid interpolation
|
||||
|
||||
`InterpolatedSampler` accepts positive XZ and Y cell sizes. A scalar request at
|
||||
an exact grid point delegates to the child's scalar method. Other points sample
|
||||
a `2 × 2 × 2` corner volume through the child's bulk method, then interpolate X,
|
||||
Y and Z in that order. Negative positions use floor division and remainders;
|
||||
corner coordinates retain Java integer wrapping.
|
||||
|
||||
An aligned bulk volume whose steps equal the cell sizes delegates directly to
|
||||
the child; size-one axes may have other steps. Other volumes sample a coarse
|
||||
grid covering the requested block extent. The bulk path blends Z, then X, and
|
||||
advances each Y column through repeated float additions. Scalar interpolation
|
||||
uses division for its fractions; bulk interpolation uses precomputed reciprocal
|
||||
multiplication. These differences can change low bits even with simple linear
|
||||
input and are retained intentionally. End corners are clamped to the last coarse
|
||||
sample when the output ends exactly on a grid point.
|
||||
|
||||
For strided output, vanilla first evaluates a full block-resolution volume with
|
||||
sizes equal to output sizes times steps, then selects the strided cells. Horizon
|
||||
preserves that extent, including trailing blocks, the child's volume descriptor,
|
||||
and the repeated-addition rounding. Scratch vectors are retained in the context.
|
||||
The interpolating paths write only volume cells; direct delegation retains the
|
||||
child's tail behavior. A failed coarse-grid child leaves the caller unchanged.
|
||||
Invalid derived volumes are rejected through the bounded volume API; accidental
|
||||
Java array behavior for overflowing or unallocatable extents is outside this
|
||||
scope. The JSON decoder loads interpolation nodes with positive cell sizes.
|
||||
Automatic insertion by the chunk-generation pipeline remains pending.
|
||||
|
||||
## Surface-height search
|
||||
|
||||
`FindTopSurfaceSampler` evaluates its upper bound, rounds it downward onto the
|
||||
cell-height grid using the pinned float-to-integer floor behavior, then samples
|
||||
density at descending grid heights. It returns the first strictly positive
|
||||
sample, or the lower bound. Zero and NaN densities do not stop the search. When
|
||||
the aligned upper height is at or below the lower bound, it returns immediately
|
||||
without sampling density, including at the equal-height boundary.
|
||||
|
||||
`compile_surface_search` adds the Y=0 slice used by vanilla's function compiler.
|
||||
This forces the upper bound to be evaluated at Y=0 and repeats horizontal results
|
||||
through the requested volume. The raw sampler accepts only one Y layer for bulk
|
||||
requests. It first samples all upper bounds into the output, then searches columns
|
||||
in Z/X order, replacing each successful result. A later child failure preserves
|
||||
earlier results and the remaining upper-bound values. The surrounding slice can
|
||||
instead isolate those partial writes in scratch storage.
|
||||
|
||||
The constructor requires positive cell height. Manually constructed searches
|
||||
whose descending height overflows return a typed error; wrapped nonterminating
|
||||
searches are outside this bounded API. The differential corpus covers ordinary
|
||||
finite bounds, exceptional float bounds with immediate crossings, grid alignment,
|
||||
Y slicing, invalid multi-layer raw calls, cached children, NaN/zero crossings,
|
||||
short circuits, buffer tails and child failures.
|
||||
|
||||
## Cubic splines
|
||||
|
||||
`CubicSpline` represents a constant or an immutable set of points. Each point has
|
||||
a location, derivative and nested spline value. `SplineSampler::new` resolves
|
||||
coordinate IDs against a density-sampler table and assigns compact local IDs in
|
||||
parent-first traversal order. Repeated IDs share one coordinate cache. Structural
|
||||
deduplication of equivalent density definitions remains graph-compiler work.
|
||||
|
||||
Evaluation retains vanilla's binary interval search, including behavior for
|
||||
manually supplied equal, unsorted or NaN locations. An endpoint extends linearly;
|
||||
a zero derivative returns the endpoint value without multiplying a possibly
|
||||
nonfinite coordinate. Interior evaluation samples the left nested value before
|
||||
the right, then performs the float cubic correction in the reference order.
|
||||
A constant NaN may occur as a nested value, but vanilla rejects it as the root of
|
||||
a compiled constant sampler; Horizon preserves that distinction.
|
||||
|
||||
Scalar queries compute coordinates lazily and retain non-NaN values for the
|
||||
remainder of that query. NaN results are queried again when the same coordinate
|
||||
is needed. Bulk evaluation walks output cells, evaluating a coordinate's entire
|
||||
child volume only when a selected branch first needs it. Those buffers remain
|
||||
available through the call, including NaN cells. Unselected coordinates are not
|
||||
evaluated. A later lazy child failure retains completed output cells, and Horizon
|
||||
returns acquired buffers to the context on both success and error.
|
||||
|
||||
Constant roots fill the entire logical output slice. Nonconstant splines use an
|
||||
exact-volume output; oversized output would read beyond coordinate buffers in
|
||||
the reference and is rejected by the bounded Rust API. Spline nesting is bounded
|
||||
to 256 levels, and empty point lists or unresolved coordinate IDs are rejected.
|
||||
|
||||
Range analysis accepts coordinate ranges from the enclosing graph. It preserves
|
||||
endpoint extension, child range evaluation order, all-point bounds and the
|
||||
conservative derivative correction used by vanilla. A NaI coordinate stops
|
||||
analysis before child ranges are evaluated. Invalid finite/nonfinite arithmetic
|
||||
returns an interval error; the implementation does not substitute tighter bounds
|
||||
or a numerically different cubic-extrema calculation. The JSON decoder loads
|
||||
nested spline graphs, preserves their point order and requires explicit
|
||||
derivatives. Spline builders and complete terrain integration remain pending.
|
||||
|
||||
## Cached evaluation
|
||||
|
||||
`SamplerContext::cached()` enables context-owned cache cells; the default context
|
||||
continues to evaluate cache wrappers directly. `CachingDensitySampler` shares
|
||||
immutable child samplers while keeping cached data in the context. IDs are
|
||||
bounded to `0..=65535`, and the API rejects recursive evaluation of the same cache
|
||||
cell. `DensityCompiler` allocates IDs for supported graph definitions. Callers
|
||||
constructing cache samplers directly must supply consistent IDs themselves.
|
||||
|
||||
A scalar request first checks its last-value cache, using vanilla's packed block
|
||||
position as the key. This intentionally retains key collisions for coordinates
|
||||
outside the packed domain. A NaN value is never a last-value hit. Next, a request
|
||||
may read an exact lattice sample from the cached volume. Off-lattice positions
|
||||
miss; lookup retains Java's wrapped relative coordinates and extent products.
|
||||
A volume hit does not update the last scalar key, and replacing a volume does not
|
||||
invalidate that scalar entry. These details matter because bulk noise can round
|
||||
differently from a fresh scalar sample.
|
||||
|
||||
A bulk request reuses its cached buffer when every volume descriptor field
|
||||
matches. Otherwise it evaluates the child into a private retained buffer and
|
||||
copies to the caller only on success. Vanilla installs that cache entry before
|
||||
calling the child: a failed child can leave a partially written cached volume
|
||||
that a later request reads without recomputation. Horizon preserves the writes
|
||||
and the entry. Unwritten values are initialized to zero; failure comparisons use
|
||||
a vanilla context with a zero-initializing arena. Unwritten data from vanilla's
|
||||
global recycling pool is not claimed to match. Cached bulk output must have
|
||||
exactly the volume's size; invalid lengths are rejected before child evaluation.
|
||||
`clear_caches()` releases stored values and buffers for context lifecycle use.
|
||||
|
||||
The differential corpus tests enabled and disabled caches, nested nodes, scalar
|
||||
key collisions, NaN misses, repeated volumes, replacing volumes, on/off-lattice
|
||||
queries and child failures. Counting wrappers report actual child scalar and
|
||||
bulk calls as well as output bits, so a correct value produced through the wrong
|
||||
cache path cannot silently pass the trace comparison.
|
||||
|
||||
## Terrain noise composition
|
||||
|
||||
The offset-noise compilers preserve the pinned version's evaluation paths. Shift
|
||||
and shift-A use a noise sampler with quarter-scale coordinates followed by a
|
||||
separate multiplication by four. Shift-A sets the vertical scale to zero.
|
||||
Shift-B samples `(z / 4, x / 4, 0)` in scalar calls. Its bulk path constructs a
|
||||
transposed horizontal plane, accumulates noise into that plane with amplitude
|
||||
four, then repeats each result through its Y column. It leaves the output tail
|
||||
untouched. These paths are checked with Perlin, simplex, smeared and modern
|
||||
normal-noise stacks, from both random streams.
|
||||
|
||||
`BlendedNoise` creates the minimum-limit, maximum-limit and main stacks in that
|
||||
order from the caller's random stream. The two limit stacks contain 16 smeared
|
||||
layers each; the main stack contains eight. Layers are created from high to low
|
||||
frequency, retaining the version's double-precision amplitude calculation before
|
||||
the float conversion. The compiled sampler adds `0.5` to the main result, clamps
|
||||
it to `[0, 1]`, then interpolates the limit samplers. This composition reuses the
|
||||
checked scalar/bulk sampler implementations, including their evaluation order.
|
||||
Its declared range is computed separately from the limit-stack parameters.
|
||||
|
||||
The public `create_blended_fbm` helper also supports first octaves from `-4095`
|
||||
through zero. It rejects requests outside that work bound before consuming RNG
|
||||
state. Invalid ranges are rejected at stack build time after layer construction,
|
||||
matching vanilla's draw consumption within the supported bound. Serialized
|
||||
parameter restrictions remain integration work; the graph compiler now supplies
|
||||
the compile context's `terrain` seed lookup. The comparison corpus includes the bundled overworld/nether
|
||||
and End parameter sets, valid random parameters, nonfinite inputs, constructor
|
||||
failures, post-construction RNG state, octave metadata and scalar/bulk outputs.
|
||||
|
||||
Distance-to-point evaluation subtracts coordinates as wrapping Java integers
|
||||
before converting to floats. It retains the reference float arithmetic and
|
||||
square-root conversion order, rather than using a double-precision hypot.
|
||||
Metric tests also exercise arbitrary float inputs, including NaNs and infinities.
|
||||
|
||||
## Interval analysis
|
||||
|
||||
`Interval` implements checked exact, symmetric and general bounds; NaI and
|
||||
infinite ranges; endpoint and interval hulls; addition, subtraction,
|
||||
multiplication, division, min/max, reciprocal, absolute value, square, sign,
|
||||
powers, logarithms, clamp, monotonic endpoint mapping and linear interpolation.
|
||||
|
||||
Power propagation handles exact and interval exponents separately, including
|
||||
signed-zero bases, negative bases with integer exponent bounds, infinite
|
||||
exponents and NaI endpoint hulls. Negative-base ranges preserve vanilla's
|
||||
floating-point neighbor checks when probing odd/even integer exponents.
|
||||
Logarithmic ranges intersect the valid nonnegative domain before endpoint
|
||||
mapping. A fully negative range becomes NaI. Square-root graph ranges use the
|
||||
power interval with exponent one half, retaining valid endpoints even when
|
||||
some input values produce NaN.
|
||||
|
||||
These operations preserve vanilla's special rules. Multiplication treats a zero
|
||||
bound times infinity as positive zero. The reciprocal of an exact zero interval
|
||||
is NaI; an interval spanning both sides of zero maps to infinite bounds. Hulls
|
||||
ignore NaI members unless all members are NaI. Monotonic mapping skips NaI and
|
||||
otherwise evaluates both endpoints before rejecting a NaN result. It accepts a
|
||||
caller-supplied transformation; neither implementation proves monotonicity.
|
||||
|
||||
Interpolation range analysis has distinct finite- and infinite-endpoint paths.
|
||||
It uses range-specific zero products and infinity handling, rather than calling
|
||||
the scalar density interpolator. Interval construction also canonicalizes a
|
||||
negative-zero lower bound when the upper bound is one, matching the reference's
|
||||
cached `[0, 1]` instance. NaI compares equal to itself, and signed-zero endpoints
|
||||
compare numerically equal. `java_hash_code` exposes vanilla's endpoint-bit hash
|
||||
separately: implementing Rust `Hash` with that function would violate Rust's
|
||||
requirement that equal keys have equal hashes for some signed-zero intervals.
|
||||
|
||||
## Validation and limits
|
||||
|
||||
Run `python3 tools/test_density_parity.py` after preparing the pinned artifacts
|
||||
with `python3 tools/test_rust_parity.py --prepare`. The original Java adapter
|
||||
instantiates the actual vanilla sampler classes; it does not duplicate their
|
||||
arithmetic. Both the client and server JARs process the same deterministic corpus
|
||||
as the release Rust binary. Reference artifacts are checksum-verified, and source
|
||||
hashes must remain unchanged during a run. Finite outputs and signed zeros are
|
||||
compared by bits, with NaNs canonicalized.
|
||||
|
||||
The corpus includes all axes and tiling modes, raw floating-point inputs,
|
||||
nonfinite values, overflowing block coordinates, both RNG streams, Perlin,
|
||||
simplex and smeared noise, nested shift graphs, repeated bulk evaluations,
|
||||
logical buffer tails, unary and binary combinations, scalar short circuits,
|
||||
zero-period failures and partial writes. The runner removes an old success report
|
||||
before artifact verification, so a failed run cannot retain a stale success.
|
||||
|
||||
The [recorded local comparison](../benchmarks/rust-density-2026-10-05/scoped-parity.json)
|
||||
matched **15,524,627 output lines per reference JAR**.
|
||||
|
||||
The separate [float-log comparison](../benchmarks/rust-float-log-2026-10-05/scoped-parity.json)
|
||||
exhaustively matched **all 4,294,967,296 float input bit patterns** for the compiled
|
||||
scalar logarithm against both JARs on the recorded Linux/JDK runtime. Signed zeros,
|
||||
subnormals, infinities and NaNs are included; NaN results use Java's canonical
|
||||
`Float.floatToIntBits` representation. This does not establish double-precision
|
||||
logarithm parity or other-platform math parity. Reproduce it with:
|
||||
|
||||
```bash
|
||||
python3 tools/test_float_log_parity.py --exhaustive
|
||||
```
|
||||
|
||||
The default command checks 1,048,576 inputs around domain and rounding boundaries
|
||||
and is configured in CI. The density suite covers bulk composition and graph
|
||||
range propagation separately.
|
||||
|
||||
Private inputs, output dumps and reference classes remain under
|
||||
`.local/rust-density-parity/`. Only the metadata report belongs in
|
||||
`benchmarks/rust-density-2026-10-05/`. Local results are Linux evidence;
|
||||
configured Windows/macOS CI checks are not a claim that those remote jobs ran.
|
||||
|
||||
Pending work includes remaining graph definitions, serialized graphs,
|
||||
serialized registries, concrete structure-density and nonempty old-world blending
|
||||
providers, and full seeded chunk generation.
|
||||
This suite establishes only the operations and inputs it exercises;
|
||||
it does not establish whole-game parity or an FPS/render-distance improvement.
|
||||
@@ -56,7 +56,7 @@ earlier patched return produce different caller durations; these measurements
|
||||
describe the rejected-submission path, not normal task throughput. Linux CI runs
|
||||
the applied hooks; Windows and ARM Mac CI compile the fixture and production mod.
|
||||
|
||||
In [Linux CI run 37158922187](https://github.com/ludovic111/minecraft-optimization-lab/actions/runs/37158922187),
|
||||
In [Linux CI run 37158922187](https://github.com/ludovic111/Horizon/actions/runs/37158922187),
|
||||
[the raw fixture result](../benchmarks/dispatch-retry-2026-10-04/linux-applied-hooks.json)
|
||||
reported 216,987,192 caller allocation bytes and 63,790 rejections upstream,
|
||||
versus 103,384 caller bytes and 6 rejections with the hook. Caller wall times were
|
||||
|
||||
@@ -0,0 +1,543 @@
|
||||
# Feature placement
|
||||
|
||||
Horizon implements eighteen Java Edition **26.3** placement modifiers: count,
|
||||
square spread, three-axis offset, height range, rarity filtering, random-chance
|
||||
filtering, fixed positions, random selection among modifiers, heightmap positions, surface-relative
|
||||
thresholds, water-depth filtering, both noise-based count forms, cuboid placement,
|
||||
count-on-every-layer scans, predicate filtering, vertical environment scans and biome filtering.
|
||||
|
||||
Placement preserves callback order, duplicate positions, wrapping coordinates,
|
||||
provider sampling and random draw consumption. Fixed positions are filtered by
|
||||
the origin's chunk X/Z. Random-choice nesting is bounded to depth 256 and 65,536
|
||||
modifier nodes; lists are bounded to 8,192 entries. Consumer failures retain
|
||||
previous emissions and consumed draws. Probability-range decoding distinguishes
|
||||
negative zero from positive zero, matching the native codec.
|
||||
|
||||
Run `python3 tools/test_placement_parity.py`. The
|
||||
[local report](../benchmarks/rust-placement-2026-10-06/scoped-parity.json) records
|
||||
**1,268,600 matching lines per reference JAR**, across **520 definitions** and
|
||||
**21,840 seeded fixtures**, with **70,080 requested modification calls** and **17,280 direct count queries**. Actual
|
||||
`PlacementModifier.CODEC` and modifier callbacks supply the reference results.
|
||||
The corpus tests both random modes, relative-height overflow, nested choices,
|
||||
malformed fields, repeated calls, consumers that draw randomness and failures
|
||||
before or after earlier emissions.
|
||||
|
||||
This suite uses an actual placement context backed by a world proxy with traced synthetic heightmaps.
|
||||
Additional block predicates, full feature registries, registry integration,
|
||||
Gaussian providers, encoding and complete generated worlds remain pending.
|
||||
|
||||
|
||||
## Modifier chains
|
||||
|
||||
`FeaturePlacer` collects a modifier's outputs before processing its descendants,
|
||||
preserving sibling order through a reusable pending stack. Actual feature callbacks
|
||||
share the modifier random stream. Boolean results accumulate without skipping later
|
||||
placements. An empty chain calls the feature directly. Errors retain pending and
|
||||
modified-position buffers, matching vanilla when the same placer is used again.
|
||||
|
||||
Run `python3 tools/test_feature_placement_parity.py`. The
|
||||
[chain report](../benchmarks/rust-feature-placement-2026-10-06/scoped-parity.json)
|
||||
records **548,461 matching lines per JAR**. Actual native `FeaturePlacer` executes
|
||||
native modifiers and a synthetic feature sink, comparing emitted positions,
|
||||
feature results, consumed randomness and repeated calls after failures. This tests
|
||||
the execution machinery; the separate feature suite below connects it to initial block-writing algorithms.
|
||||
|
||||
Rust bounds chains to 1,024 modifiers and per-call work/pending buffers to 2^20.
|
||||
Unit tests reject oversized chains before feature calls or random draws and stop
|
||||
multiplicative count expansion after bounded partial progress.
|
||||
|
||||
|
||||
## Heightmap queries
|
||||
|
||||
`PlacementContext` supplies generation bounds, the world minimum and heightmap
|
||||
queries. These are separate: the world minimum can differ from the generator's
|
||||
minimum. Heightmap placement emits only above the world minimum. Surface-relative
|
||||
thresholds use 64-bit sums; water-depth subtraction retains Java integer wrapping.
|
||||
Queries and emitted positions retain native order, and query errors stop the
|
||||
current operation without drawing randomness or emitting a replacement position.
|
||||
|
||||
Both suites include ordinary/extreme synthetic heights, all six map types,
|
||||
distinct world/generator minima, default/reversed threshold ranges and injected
|
||||
query failures. This validates how modifiers consume heightmaps; connecting
|
||||
feature generation to complete world regions remains pending.
|
||||
|
||||
|
||||
## Noise-based counts
|
||||
|
||||
Noise-based and noise-threshold counts share vanilla's fixed biome-information
|
||||
simplex noise. They preserve the float noise result before double arithmetic,
|
||||
ceiling/narrowing behavior and strict threshold comparison. They consume no caller
|
||||
random draws. `repetitions` exposes counts without expanding position lists.
|
||||
|
||||
Primitive comparisons include extreme ratios, factors, offsets and thresholds,
|
||||
including count-only queries that can return enormous counts safely. Chain tests
|
||||
exercise ordinary noise counts together with other modifiers and feature callbacks.
|
||||
Emitting repeating modifiers remains bounded to 4,096 repetitions in Rust.
|
||||
|
||||
|
||||
Cuboid placement samples Y size, then independent X and Z sizes, before emitting
|
||||
positions in X/Y/Z order. Its extents are inclusive. Edge and interior controls
|
||||
are independent, and coordinates wrap. The suites cover all four control
|
||||
combinations, provider variation, maximum decoded extents, consumer failures and
|
||||
cuboids embedded in modifier chains.
|
||||
|
||||
|
||||
## Layered placement
|
||||
|
||||
Count-on-every-layer placement samples its count provider at every loop-condition
|
||||
check, including the final check. Each attempt draws X/Z offsets, queries the
|
||||
motion-blocking heightmap and scans down for the requested surface layer. Air
|
||||
states and exact water/lava blocks count as empty. Bedrock is excluded as ground;
|
||||
other blocks, including bubble columns, are potential ground. Emissions and count
|
||||
sampling interleave, sharing the caller's random stream.
|
||||
|
||||
The suites compare traced synthetic strata containing these block kinds, random
|
||||
count providers, repeated passes and injected height/block/consumer failures.
|
||||
`LayerBlock` is a query classification supplied by the world; complete block
|
||||
behavior and region-backed feature generation remain pending. A shared 65,536-step
|
||||
budget bounds scans, including when world queries supply extreme heights.
|
||||
|
||||
|
||||
## Initial block-writing features
|
||||
|
||||
`BasicFeature` implements the void start platform, End islands and the End
|
||||
arrival platform. The world supplies block reads and mutations; required block
|
||||
states bind through its registry. The algorithms preserve write order, update
|
||||
flags, wrapped coordinates, ignored false mutation results and partial effects
|
||||
when a world operation fails. End-island radius sampling retains native draw order.
|
||||
|
||||
Run `python3 tools/test_basic_feature_parity.py`. The
|
||||
[feature report](../benchmarks/rust-basic-feature-2026-10-06/scoped-parity.json)
|
||||
records **1,820,614 matching lines per JAR**. Actual feature codecs and native place
|
||||
methods operate on a mutable world proxy. Both random modes, multiple seeds,
|
||||
nearby/far chunks, extreme coordinates, rejected writes, thrown failures and
|
||||
repeated placements are compared, including complete accumulated stored states.
|
||||
Native `setBlockAndUpdate` executes its actual default method, exposing its flags.
|
||||
The suite also composes these features with modifier chains, sharing the mutable
|
||||
world and random stream and reusing placer buffers after failures.
|
||||
`place_with_context` gives feature callbacks the same world used by modifiers.
|
||||
|
||||
This covers feature algorithms against a supplied mutation interface. Actual chunk
|
||||
mutation, neighbor updates, lighting, entities/drops, complete feature registries
|
||||
and generated worlds remain pending. The End-platform generation path does not
|
||||
request the separate block-destruction/drop behavior used by portal recreation.
|
||||
|
||||
|
||||
## Predicate filters and environment scans
|
||||
|
||||
Logical predicates (`true`, `not`, `all_of`, `any_of`) preserve ordered
|
||||
short-circuiting, including empty-list identities. Inside-world-bounds predicates
|
||||
apply wrapping offsets before checking the world's inclusive height bounds.
|
||||
Their offset codec retains Java's wrapping absolute-value behavior for the
|
||||
minimum signed integer. These five predicate kinds also work inside filters and
|
||||
vertical scans; state-dependent predicates remain pending.
|
||||
|
||||
Environment scans check the initial allowed condition before the target, then
|
||||
move one block at a time. They stop immediately outside build height. A failed
|
||||
allowed condition after a move still permits the final target test at that
|
||||
position. The codec limits scans to 1–32 steps; shared work and nesting budgets
|
||||
also bound directly constructed predicates and scans.
|
||||
|
||||
Both placement suites compare actual native codecs and predicate execution,
|
||||
traced world-bound queries, short-circuiting, wrapped offsets, invalid directions,
|
||||
step limits and query failures. Unit tests exercise oversized trees and scans
|
||||
that would otherwise traverse billions of positions.
|
||||
|
||||
|
||||
## Resident feature regions
|
||||
|
||||
`TerrainRegion` routes block reads/writes by signed chunk coordinates and lazily
|
||||
primes missing heightmaps. It requires consistent vertical bounds and registry
|
||||
identity across resident chunks. Its placement context supplies generation bounds,
|
||||
world bounds, heightmaps and layer classifications from those same chunks.
|
||||
`TerrainFeatureAccess` shares that region with feature algorithms and forwards
|
||||
all writes and flags to a caller-supplied mutation callback.
|
||||
|
||||
Run `python3 tools/test_feature_region_parity.py`. The
|
||||
[region report](../benchmarks/rust-feature-region-2026-10-06/scoped-parity.json)
|
||||
records **28,922,634 matching lines per JAR** across 192 fixtures and 2,304 requested
|
||||
placements. Actual native features and `FeaturePlacer` operate over a world proxy
|
||||
backed by nine `ProtoChunk`s per fixture. The comparison includes both heightmap
|
||||
groups, count/square/heightmap/layered chains, repeated writes, missing neighbors,
|
||||
rejected writes, failures, update flags, random state, final raw sections and
|
||||
packed heightmaps.
|
||||
|
||||
The region corpus also runs a composed sequence of configured fill layers over
|
||||
the same live chunks: water, horizontal logs, air and an out-of-height layer.
|
||||
This connects block-state decoding, nested feature execution, shared placement
|
||||
and chunk heightmap updates; the standalone fill-layer suite below covers
|
||||
integer-property parsing and per-column query ordering in more detail.
|
||||
Single-block replacement and scattered ore also execute against those resident
|
||||
chunks, sharing the updated state, heightmaps, failure policy and random stream.
|
||||
|
||||
The reference proxy supplies storage mutation. This verifies the connection
|
||||
between features, placement queries and resident chunks; actual region write
|
||||
zones, POIs, block entities, postprocessing, lighting and the full feature registry
|
||||
remain pending. Unit tests check mixed-registry/bounds rejection, negative chunk
|
||||
routing, missing-neighbor errors and mutation-callback flag/return handling.
|
||||
|
||||
|
||||
## Inline feature composition
|
||||
|
||||
`FeatureDefinition` and `PlacedFeatureDefinition` compose the initial block-writing
|
||||
features with no-op, sequence, boolean choice, uniform choice, chance-based
|
||||
choice and weighted-choice features. Sequences stop on the first false child. Selectors return the
|
||||
chosen child's result directly. Child modifiers and features share world state
|
||||
and randomness; each sequence uses one fresh placer across its children.
|
||||
Native single-object holder-set shorthand is accepted for sequence/uniform lists.
|
||||
|
||||
Run `python3 tools/test_feature_graph_parity.py`. The
|
||||
[graph report](../benchmarks/rust-feature-graph-2026-10-06/scoped-parity.json) records
|
||||
**737,779 matching lines per JAR** for actual native feature codecs and nested
|
||||
placement. Cases include empty/malformed lists, singleton and nested choices,
|
||||
zero/one probabilities, negative zero, false child results, partial writes, world
|
||||
failures, repeated calls and top-level modifier chains.
|
||||
|
||||
Decode depth, node count and list size are bounded. Feature/placed-feature visits
|
||||
and nested modifier-chain execution share a runtime budget. Unit tests cover deep
|
||||
decoding, large trees and modifier expansion that reaches no leaf features.
|
||||
Weighted choices retain zero-weight children and return false without random draws
|
||||
when their total weight is zero. Positive totals preserve the existing bounded
|
||||
weighted draw algorithm. `OptionalWeightedList` keeps this behavior separate from
|
||||
the nonempty weighted lists required by integer/height providers. The graph suite
|
||||
covers empty/zero lists, integer narrowing, invalid/overflowing weights and nested
|
||||
choices; both provider suites also pass after the shared implementation change.
|
||||
The resource resolver below adds named holders and tags. Encoders and the full
|
||||
feature registry remain pending.
|
||||
|
||||
|
||||
## Named feature resources
|
||||
|
||||
`FeatureCatalog` stores an immutable resource snapshot and resolves requested
|
||||
feature or placed-feature roots. Named children, compact singleton holder sets,
|
||||
mixed named/inline lists and ordered placed-feature tags expand into executable
|
||||
trees. Resolution preserves numeric JSON fields, validates unselected children
|
||||
and bounds dependency depth and expanded nodes. Duplicate canonical resource
|
||||
names, missing dependencies and cycles return errors.
|
||||
|
||||
Run `python3 tools/test_feature_catalog_parity.py`. The
|
||||
[catalog report](../benchmarks/rust-feature-catalog-2026-10-06/scoped-parity.json)
|
||||
records **1,734,390 matching lines per JAR** against actual registry-aware holder
|
||||
codecs, registered feature snapshots and native `TagLoader`. It compares nine
|
||||
named features, fourteen placed features, five tag files, nested/duplicate references,
|
||||
optional/required missing tags, namespace shorthand and subsequent execution.
|
||||
Configured fill layers, single-block replacements and scattered ore bind block-state
|
||||
metadata through named roots, nested tags and modifier chains. Block-set
|
||||
predicates execute through filters, ordered volumes and environment scans against
|
||||
the mutable world, including repeated placement after earlier writes and flowing-water replacement
|
||||
that changes later fluid-predicate results.
|
||||
|
||||
Empty named tags retain a native distinction from empty inline lists: a sequence
|
||||
can resolve an empty tag and succeed, while a uniform selector resolves it and
|
||||
then fails its zero-bound random choice. The inline list codecs reject empty
|
||||
lists during decoding. These cases and their random-state effects are compared.
|
||||
|
||||
The resource API validates requested reachable roots, allowing unused unported
|
||||
resources to remain in the snapshot. Complete datapack loading, live reloads,
|
||||
registry ownership/identity semantics and all feature algorithms remain pending.
|
||||
|
||||
## Configured fill layers
|
||||
|
||||
`FeatureBlockBindings` binds block-state JSON against the pinned registry and its
|
||||
integer-property metadata. `FillLayerFeature` visits 16 by 16 columns in native
|
||||
X/Z order, queries the world minimum for each column and replaces only air states.
|
||||
It preserves wrapping coordinates, write flags, ignored false write results and
|
||||
early termination on world errors. Placement consumes no random draws.
|
||||
|
||||
Run `python3 tools/test_fill_layer_parity.py`. The
|
||||
[fill-layer report](../benchmarks/rust-fill-layer-2026-10-06/scoped-parity.json)
|
||||
records **1,305,274 matching lines per JAR**, including codec inputs for all
|
||||
35,723 pinned states, compact/full states, integer properties, invalid-property
|
||||
defaults, height bounds, extreme coordinates, rejected writes and injected query,
|
||||
read and write failures. Both random implementations retain matching subsequent
|
||||
state. This comparison uses observable mutable storage; complete region effects
|
||||
and full generated worlds remain pending.
|
||||
|
||||
## Replacement rules
|
||||
|
||||
`RuleTest` implements all ten pinned replacement-rule kinds: constant true,
|
||||
negation, all/any, block identity, exact block state, block tags, inclusive height
|
||||
range and the two random block/state matches. Logical rules preserve ordering and
|
||||
short-circuiting. Random rules draw only after matching identity, including at
|
||||
zero/one probability; their codecs allow probabilities outside that interval.
|
||||
|
||||
Run `python3 tools/test_rule_test_parity.py`. The
|
||||
[rule report](../benchmarks/rust-rule-test-2026-10-06/scoped-parity.json) records
|
||||
**1,890,716 matching lines per JAR**, covering every block/state identity, all
|
||||
300 bundled block tags, absent and empty-path tags, malformed inputs, reversed
|
||||
height ranges, nested logic and subsequent draws from both random streams.
|
||||
Decode depth, node count and list size are bounded, including branching inputs.
|
||||
|
||||
Bindings share immutable sets of state IDs for blocks and resolved tags.
|
||||
Native tag identifiers permit an empty path, which remains distinct from a
|
||||
missing field. These predicates do not establish complete ore generation or
|
||||
structure-processor behavior.
|
||||
|
||||
## Single-block replacement
|
||||
|
||||
`ReplaceBlockFeature` applies ordered rule/state pairs at an origin. It re-reads
|
||||
the current state for each candidate and stops at the first match, regardless of
|
||||
whether the write returns true. Empty or unmatched target lists still succeed;
|
||||
read/write errors stop evaluation with the preceding mutations and RNG state
|
||||
intact. Target decoding shares the graph's node budget when nested in a feature.
|
||||
|
||||
Run `python3 tools/test_replace_block_parity.py`. The
|
||||
[replacement report](../benchmarks/rust-replace-block-2026-10-06/scoped-parity.json)
|
||||
records **303,678 matching lines per JAR** for actual native codecs and placement,
|
||||
including rule ordering, shared random state, update flags, rejected writes,
|
||||
partial failures, repeated mutations and invalid unselected targets.
|
||||
|
||||
## Scattered ore
|
||||
|
||||
`ScatteredOreFeature` samples the native attempt count, consumes six float draws
|
||||
for each offset (including zero spread), rounds with Java's tie behavior and
|
||||
captures the candidate state once per attempt. Matching target rules then apply
|
||||
the configured air-exposure probability and ordered directional neighbor checks.
|
||||
The first accepted target writes with flag 2; a false write result is ignored.
|
||||
|
||||
Run `python3 tools/test_scattered_ore_parity.py`. The
|
||||
[scattered-ore report](../benchmarks/rust-scattered-ore-2026-10-06/scoped-parity.json)
|
||||
records **758,484 matching lines per JAR** across 11,544 fixtures and 23,088
|
||||
requested placements. Cases include size/discard codec boundaries, empty targets,
|
||||
solid/mixed worlds, each of the six air-neighbor directions, wrapping positions,
|
||||
partial failures, rejected writes and both shared random streams.
|
||||
|
||||
Ordinary ore veins use a separate bulk-section mutation path and remain pending.
|
||||
A private Linux/JDK 25 probe also found 4,935 bit differences among 2,581,112
|
||||
double sine/cosine results for sampled ore angles when using Rust platform math.
|
||||
Those intermediates are not yet validated for vein geometry; no exact double-trig
|
||||
parity is claimed.
|
||||
This scoped feature comparison does not establish biome decoration or full
|
||||
generated-world parity.
|
||||
|
||||
## Bulk section access
|
||||
|
||||
`TerrainBulkAccess` exclusively borrows resident chunks and caches sections by
|
||||
vanilla's packed section key. Raw reads retain cave/void air even when normal
|
||||
chunk reads collapse an all-air section to AIR. Outside-height reads return AIR
|
||||
before resolving a chunk. Raw writes maintain section occupancy but leave chunk
|
||||
heightmaps untouched; region write permissions remain the caller's responsibility.
|
||||
|
||||
Run `python3 tools/test_bulk_section_parity.py`. The
|
||||
[bulk report](../benchmarks/rust-bulk-section-2026-10-06/scoped-parity.json) records
|
||||
**959,640 matching lines per JAR** against actual `BulkSectionAccess` and resident
|
||||
`ProtoChunk`s. It covers every state, primed/lazy heightmaps, missing chunks,
|
||||
vertical boundaries, packed-coordinate aliases, cache reset and complete final
|
||||
section/heightmap data. The exclusive Rust borrow replaces Java's acquire/release
|
||||
locks within this resident-region API; concurrent section ownership remains pending.
|
||||
|
||||
## Biome feature ordering
|
||||
|
||||
`build_features_per_step` combines ordered biome feature lists using placed-feature
|
||||
object identities. It assigns encounter indices, orders graph traversal by step
|
||||
and index, detects cycles and reverses DFS completion order to produce each step's
|
||||
feature list and identity-to-index mapping. Equal feature payloads remain separate
|
||||
when their identities differ. Traversal uses an explicit stack and bounded input
|
||||
work; tests include a 50,000-feature dependency chain.
|
||||
|
||||
Run `python3 tools/test_feature_sort_parity.py`. The
|
||||
[ordering report](../benchmarks/rust-feature-sort-2026-10-06/scoped-parity.json)
|
||||
records **411,751 matching lines per JAR** across 3,871 fixtures. Native
|
||||
`FeatureSorter` receives identity-distinct dummy payloads for synthetic graphs and
|
||||
the feature lists from all 67 bundled biomes, including shuffled/subset combinations.
|
||||
Cycles, duplicate references, cross-step reuse, empty steps and index lookups are
|
||||
compared. Cycle diagnostic minimization/text and complete decoration remain pending.
|
||||
|
||||
## World-generation random streams
|
||||
|
||||
`WorldgenRandom` applies vanilla's legacy bit-sampling interface to legacy or
|
||||
xoroshiro sources. Longs and doubles retain their multi-draw assembly, bounded
|
||||
integers retain legacy rejection and each bit request increments a wrapping count.
|
||||
Reseeding preserves the counter. Forks and positional factories delegate to the
|
||||
underlying source and return its normal draw behavior through a transparent variant.
|
||||
|
||||
Run `python3 tools/test_worldgen_random_parity.py`. The
|
||||
[random-adapter report](../benchmarks/rust-worldgen-random-2026-10-06/scoped-parity.json)
|
||||
records **238,800 matching lines per JAR** for 119,100 operations in 300 fixtures.
|
||||
It includes one to three nested wrappers, arbitrary signed bit-width shifts,
|
||||
failed bounds, parent/child streams, positional UTF-16 hashes and decoration,
|
||||
feature, large-feature, salted and slime-chunk seeds with int/long overflow.
|
||||
Gaussian sampling, concurrent use and complete chunk decoration remain pending.
|
||||
|
||||
## Biome placement filtering
|
||||
|
||||
`Biome` requires the invocation's top placed feature before querying the biome and
|
||||
its generation settings. `place_with_biome_check` establishes that context for
|
||||
the current modifier chain; a nested ordinary placer starts without it. Biome
|
||||
resolution and membership are supplied by the world. Native membership treats
|
||||
structurally equal placed-feature copies as equal, while feature ordering uses
|
||||
object identities.
|
||||
|
||||
Run `python3 tools/test_biome_placement_parity.py`. The
|
||||
[biome-filter report](../benchmarks/rust-biome-placement-2026-10-06/scoped-parity.json)
|
||||
records **121,423 matching lines per JAR** for 27,456 requested placements across
|
||||
9,152 fixtures. Actual `BiomeFilter` and `FeaturePlacer` compare missing roots,
|
||||
equal copies, different features, ordered queries, nested ordinary placement,
|
||||
injected failures and repeated calls with retained buffers. Both random sources
|
||||
are tested directly and through `WorldgenRandom`. Complete registry membership,
|
||||
biome sampling integration and chunk decoration remain pending.
|
||||
|
||||
## Decoration feature scheduling
|
||||
|
||||
`FeatureDecorationPlan` owns immutable biome generation lists and their globally
|
||||
ordered step features. It reads the surrounding nine chunks in X-first order,
|
||||
intersects their resident biomes with the generator's possible-biome set and
|
||||
executes the sorted union of global feature indices for each step. Each root
|
||||
receives its decoration/feature seed and a shared placer. False results do not
|
||||
skip subsequent roots. Errors retain previous work and the current-feature
|
||||
marker; successful completion clears the marker.
|
||||
|
||||
Run `python3 tools/test_decoration_parity.py`. The
|
||||
[decoration report](../benchmarks/rust-decoration-2026-10-06/scoped-parity.json)
|
||||
records **337,398 matching lines per JAR** across 2,188 fixtures and 4,376 requested
|
||||
decoration calls. Actual `ChunkGenerator.applyBiomeDecoration` runs with
|
||||
structures disabled, resident `ProtoChunk` biome palettes and traced feature
|
||||
sinks. All 67 bundled biome feature lists participate. Sparse selections,
|
||||
excluded biomes, step gaps, cycles, coordinate overflow, biome-check modifiers,
|
||||
false returns and query/placement/progress failures are compared. Rust bounds
|
||||
extreme signed chunk neighborhoods and input work explicitly. Structure
|
||||
decoration, real feature payloads in this suite and full chunk lifecycle remain
|
||||
pending.
|
||||
|
||||
## Decoration over resident chunks
|
||||
|
||||
`BiomeRegion` connects quart biome sections to seeded block-position biome zoom.
|
||||
`TerrainRegion::biome_at` checks the selected chunk's generation stage before
|
||||
reading its biome. Premature reads fail even if raw palette values already exist;
|
||||
decoration's initial palette collection can still inspect those raw values.
|
||||
|
||||
Run `python3 tools/test_decoration_region_parity.py`. The
|
||||
[resident decoration report](../benchmarks/rust-decoration-region-2026-10-06/scoped-parity.json)
|
||||
records **36,173,951 matching lines per JAR** for 240 fixtures and 480 requested
|
||||
decoration calls. Java's actual decoration entry point places three basic
|
||||
features, configured fill-layer sequences, replacements and scattered ore into
|
||||
nine `ProtoChunk`s. Uniform/mixed biome palettes, biome zoom, global scheduling,
|
||||
feature seeds, biome filters, named biome-set and volume predicates, live
|
||||
heightmaps, repeated decoration and rejected
|
||||
or failed writes execute together. Every final raw block and heightmap word is
|
||||
compared, including EMPTY, BIOMES and TERRAIN stage behavior. Workspace tests,
|
||||
Clippy and 137 Python tests passed after this integration.
|
||||
|
||||
The world transport supplies storage mutation. Actual `WorldGenRegion` write
|
||||
zones, retrogen, POIs, block entities, postprocessing, lighting, structures and
|
||||
the complete noise-to-decoration lifecycle remain pending.
|
||||
|
||||
## Block-state providers
|
||||
|
||||
`BlockStateProvider` supports simple states, weighted states, random blocks,
|
||||
rotation, property copying, randomized integer properties, three noise-based
|
||||
providers and rule-based selection. Direct decoding preserves the exclusive choice
|
||||
between a full state object and a typed provider. Random block choices retain
|
||||
holder/tag order and duplicates. Empty choices return no optional state, while
|
||||
ordinary sampling reads the existing world state. Rotation chooses a direction
|
||||
before sampling its nested provider, changes only compatible axis/facing
|
||||
properties and preserves other properties. Fixed directions consume no direction
|
||||
draw. Property copying preserves only compatible property families. Integer
|
||||
sampling leaves states without the named integer property unchanged without
|
||||
drawing a value; invalid sampled values fail after consuming the draw. Shared
|
||||
compact state layouts avoid rebuilding property maps during these transforms.
|
||||
|
||||
Noise providers use independently seeded legacy noise and preserve the native
|
||||
float/double coordinate conversions. Threshold selection preserves conditional
|
||||
random draws. Dual noise computes the selected candidate directly: the other
|
||||
candidates are pure noise queries without random or world side effects.
|
||||
Rule-based providers evaluate conditions in order, continue after empty optional
|
||||
results and sample their fallback only after all rules are exhausted. Current
|
||||
conditions cover true, not, all-of, any-of, world bounds, height ranges, block tags
|
||||
volume matching and registry-bound block/fluid/biome sets. Height-range predicates reconstruct generation bounds per
|
||||
evaluation; volume matching visits X, Z, then Y and stops on the first failure.
|
||||
World adapters supply tag membership and fallible generation-bound queries. The
|
||||
height-range comparison currently exercises ordinary LevelAccessor bounds; the
|
||||
WorldGenLevel server/generator lookup branch is not covered by this fixture.
|
||||
|
||||
Interrupted runs can be resumed with `python3 tools/test_state_provider_parity.py --resume`.
|
||||
The runner verifies source, environment, fixture and compiled-artifact hashes
|
||||
before reusing completed stages. A changed output is regenerated; changed inputs
|
||||
require a fresh run without `--resume`. Checkpoints stay under `.local`, and
|
||||
a parity report is written only after both native comparisons pass.
|
||||
|
||||
Run `python3 tools/test_state_provider_parity.py`. The
|
||||
[provider report](../benchmarks/rust-state-provider-2026-10-06/scoped-parity.json)
|
||||
records **105,340,143 matching lines per JAR**, with 299,507 codec inputs
|
||||
and 39,270,062 requested samples across ten provider kinds. Every pinned state is decoded and tested
|
||||
under all six fixed rotations; random/nested rotations, both sampling methods,
|
||||
empty tags, weighted boundaries, fallback query failures and four random-stream
|
||||
combinations are compared. Every target state is also tested against
|
||||
representatives of all compatible property values, including cross-block copies
|
||||
and integer-property boundaries. The native harness verifies that the pinned
|
||||
property-family signatures are unambiguous; Rust validates the Cartesian state
|
||||
tables before binding their transitions. Noise cases include all eight bundled
|
||||
provider definitions, coordinate boundaries, extreme scales, variety
|
||||
selection and malformed codec inputs. Rule cases cover ordered empty results,
|
||||
fallbacks, nested rules, bound-query failures and wrapping coordinates. Block-tag
|
||||
cases cover every tag against all block defaults and the two bundled rule-based
|
||||
definitions against every state. Volume comparisons include exact read order and
|
||||
early exits, while Rust-only tests bound pathological nested evaluation work. Workspace
|
||||
tests, Clippy and 137 Python tests passed at this stage.
|
||||
|
||||
The unobstructed predicate validates its optional integer-vector offset but
|
||||
ignores it during evaluation, matching the pinned Java implementation. The
|
||||
comparison checks exact translated unit-block bounds, a null excluded entity,
|
||||
true/false world results, nested volumes and query failures.
|
||||
|
||||
`BiomePredicateBindings` resolves biome names and holder tags to IDs in the
|
||||
world's owning registry snapshot. The comparison covers every pinned biome and
|
||||
every bundled biome tag, empty sets, missing names, query failures and nested
|
||||
volume/short-circuit conditions. Decoration shares the same `BiomeId` identity.
|
||||
|
||||
`FluidStateTable` derives fluid identity, amount, falling/source flags and own
|
||||
height from the pinned block descriptors. The harness compares every state,
|
||||
including falling source water in all eight waterlogged copper grates. Fluid
|
||||
predicates compare all five fluid kinds, holder lists and every bundled fluid tag
|
||||
against every block state. This covers contained fluid state, not spreading or
|
||||
entity interactions.
|
||||
|
||||
`StateProviderCatalog` resolves named holder references from an immutable resource
|
||||
snapshot. Holder, direct and typed entry points retain their distinct decoding
|
||||
semantics, including ambiguous state/provider objects. The comparison registers
|
||||
all eight bundled definitions plus nested fixture resources and checks missing
|
||||
names, nested references and later random draws. Unused resources are not
|
||||
evaluated; Rust tests reject reachable cycles, duplicate canonical names and
|
||||
excessive expansion. Full datapack registry loading/reloading remains separate.
|
||||
|
||||
Recursive provider decoding is bounded to depth 128 and shares a 65,536-node
|
||||
budget with rules, predicates and integer providers; holder/rule lists are bounded
|
||||
to 8,192 entries. Additional predicates, complete registry loading, block survival
|
||||
and complete feature placement remain pending.
|
||||
|
||||
Solid and replaceable predicates now bind immutable property tables to the same
|
||||
block registry as provider and feature decoding. Their offsets, state reads,
|
||||
short-circuit composition, empty optional-child fallthrough and read failures
|
||||
are compared across the entire state registry. Together with the earlier kinds,
|
||||
**14 block-predicate kinds** are covered in the state-provider report. Full
|
||||
workspace tests, warning-free Clippy and **139 Python tests** passed at this
|
||||
integration snapshot. Face support and block survival still need implementation.
|
||||
|
||||
The has-sturdy-face predicate now decodes native directions and bounded offsets,
|
||||
then delegates the ordered state/support query to its placement world. The
|
||||
state-provider comparison covers all **35,524 cached states**, six directions,
|
||||
read failures and composed predicates, bringing the scoped corpus to **15
|
||||
predicate kinds**. Dynamic state support is not established by this integration
|
||||
report; unavailable world behavior remains an explicit query error. Workspace
|
||||
tests, warning-free Clippy and **140 Python tests** passed at this snapshot.
|
||||
|
||||
Unified block-support dispatch now extends that predicate corpus to all **35,723
|
||||
states**, including the **199 dynamic states** with absent block entities and
|
||||
injected block-entity query failures. The updated provider report covers the
|
||||
combined path. Shulker animation snapshots are covered separately by the dynamic
|
||||
support suite; active moving-piston shape generation and block-entity lifecycle
|
||||
remain outside this integration snapshot. Workspace tests, Clippy and **141
|
||||
Python tests** passed.
|
||||
|
||||
The `would_survive` predicate now decodes a candidate block state and bounded
|
||||
offset, then invokes survival at the translated position without placing it.
|
||||
Both provider and feature bindings use the shared block-state codec; placement
|
||||
chains forward the survival query. The refreshed provider report records
|
||||
**105,340,143 matching lines per JAR**, **299,507 inputs**, **39,270,062 requested
|
||||
samples** and **16 predicate kinds**. Its survival snapshot covers 15 rules,
|
||||
1,138 definitions and 31,171 candidate states, with each rule tested against the
|
||||
entire neighbor-state registry, malformed definitions, wrapped offsets,
|
||||
short-circuit conditions, optional-child fallthrough and query failures.
|
||||
Unsupported survival definitions remain errors. This report does not establish
|
||||
full block placement or every block's survival behavior. Workspace tests,
|
||||
warning-free Clippy and **143 Python tests** passed at this snapshot.
|
||||
@@ -0,0 +1,57 @@
|
||||
# Heightmaps
|
||||
|
||||
Horizon implements the six heightmap types in the pinned Minecraft Java Edition
|
||||
**26.3**. Each map stores 256 relative column heights in padded 64-bit words.
|
||||
World-surface predicates use `isAir`; ocean-floor predicates use the version's
|
||||
`blocks_motion_in_heightmap` block tag. Motion-blocking maps also include nonempty
|
||||
fluid states, with the separate no-leaves tag for that variant.
|
||||
|
||||
`HeightmapState` supplies block behavior and tag membership. `HeightmapChunk`
|
||||
supplies the vertical extent, highest occupied section and block reads. The map
|
||||
owns its packed data and checks that a supplied chunk has the same bounds. Its
|
||||
current constructor accepts positive, aligned ranges within the vanilla noise
|
||||
settings codec domain; zero-height and arbitrary runtime accessors are outside
|
||||
this bounded API.
|
||||
|
||||
Updates retain the early return for blocks below the top two positions. Removing
|
||||
a qualifying surface scans downward until another qualifying block is found.
|
||||
Priming scans X, then Z, then descending Y, sharing each block read across the
|
||||
selected maps. It skips exact AIR blocks and stops a column when all selected
|
||||
maps have found a surface. If a column finds nothing, its existing value remains.
|
||||
This also applies to re-priming after a raw-data length mismatch.
|
||||
|
||||
Raw imports preserve every bit when the word count matches, including padding,
|
||||
unused slots and values above the build height. Column addressing retains Java's
|
||||
wrapped `x + z * 16` calculation; invalid final indices return typed errors. The
|
||||
Rust API does not expose a mutable alias to its internal words.
|
||||
|
||||
Run the differential suite with:
|
||||
|
||||
```sh
|
||||
python3 tools/test_heightmap_parity.py
|
||||
```
|
||||
|
||||
The [local metadata report](../benchmarks/rust-heightmap-2026-10-06/scoped-parity.json)
|
||||
records **1,671,668 matching output lines per reference JAR**, checked separately
|
||||
against the authenticated client and server. It covers all **35,723 block states**,
|
||||
all six predicate and persistence/client flags, and **100 chunk fixtures** with
|
||||
86,806 state writes, 54,306 column queries, 516 priming calls, 378 raw-data loads
|
||||
and additional update-only error cases. Selected fixtures compare exact ordered
|
||||
block reads. Cases include section and vertical bounds, leaves, fluid-bearing
|
||||
states, air variants, removal rescans, empty-column retention, packed padding,
|
||||
invalid raw lengths and wrapped column indices.
|
||||
|
||||
Air/fluid facts and state identities are exported independently from each JAR and
|
||||
required to agree. These are private test inputs, not ports of block behavioral
|
||||
methods. Rust resolves heightmap tag membership using its tag loader and the
|
||||
300 bundled block-tag resources. The reference binds those resources to the
|
||||
actual vanilla block registry and invokes `Heightmap` on `ProtoChunk` instances.
|
||||
Only in-memory section storage is used; placeholder biome holders do not exercise
|
||||
biome properties or section codecs.
|
||||
|
||||
Source and fixture changes during a run invalidate its report. Raw resources,
|
||||
state exports and comparison traces stay under ignored `.local`; the checked-in
|
||||
report contains metadata and hashes. CI runs this suite on its configured
|
||||
platforms; the local result does not establish those remote results. Chunk
|
||||
lifecycle integration, generated terrain, lighting and playable gameplay remain
|
||||
pending.
|
||||
@@ -7,7 +7,7 @@ The Linux software-rendering observations do not predict an M2 speedup.
|
||||
|
||||
## Import after installing Prism
|
||||
|
||||
1. Download [horizon-mac-starter-0.21.0.zip](https://github.com/ludovic111/minecraft-optimization-lab/releases/download/v0.21.0/horizon-mac-starter-0.21.0.zip)
|
||||
1. Download [horizon-mac-starter-0.21.0.zip](https://github.com/ludovic111/Horizon/releases/download/v0.21.0/horizon-mac-starter-0.21.0.zip)
|
||||
and extract it in Finder.
|
||||
2. In Prism, choose **Add Instance > Import**, then select
|
||||
`horizon-m2-balanced-0.21.0.mrpack` from the extracted folder. The individual
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
# Numeric material conditions
|
||||
|
||||
Horizon evaluates the pinned Java Edition **26.3** hole, steepness, height,
|
||||
water, stone-depth, vertical-gradient, noise-threshold, biome-membership, temperature
|
||||
preliminary-surface and negated material conditions.
|
||||
`MaterialConditions` owns each worker's context and compiled conditions, keeping
|
||||
cache lifetimes tied to that worker. Column updates invalidate both column and
|
||||
block conditions; block updates leave column caches intact. Secondary surface
|
||||
noise is shared and sampled lazily once per column revision.
|
||||
|
||||
Height and layer arithmetic preserves signed integer wrapping. Vertical gradients
|
||||
resolve anchors during compilation, derive named positional random factories and
|
||||
preserve the boundary order even with equal or reversed bounds. Stone depth uses
|
||||
the appropriate floor/ceiling depth and Java's floating-point mapping and casts.
|
||||
`MaterialSurface` implements the surface input interface used by this worker.
|
||||
|
||||
Run `python3 tools/test_material_condition_parity.py`. The
|
||||
[local report](../benchmarks/rust-material-condition-2026-10-06/scoped-parity.json)
|
||||
records **5,627,426 matching output lines per reference JAR** across **245 fixtures**,
|
||||
**11,288 initially compiled conditions** and **217,969 context operations**.
|
||||
The original Java transport constructs actual vanilla conditions and calls their
|
||||
compiled evaluators against actual context updates. Secondary sampler queries
|
||||
are traced to compare lazy evaluation and cache reuse. Tests include both random
|
||||
algorithms, integer extremes, nonfinite secondary values, floor/ceiling selection,
|
||||
reversed gradient bounds, repeated evaluations and late compilation.
|
||||
|
||||
For isolation, the native context's surface depth is supplied after each column
|
||||
update, and secondary noise comes from a traced constant sampler. Full seeded
|
||||
surface queries have a [separate comparison](material-surfaces.md). Sources and
|
||||
fixtures are authenticated, and raw reference artifacts stay under `.local`.
|
||||
|
||||
The comparison also covers **8,609 codec inputs**, all **eight bundled material
|
||||
condition definitions**, forward/nested references, canonical encoding and numeric
|
||||
conversions. Immutable registry loading rejects missing/cyclic references and
|
||||
duplicate canonical names without publishing partial results.
|
||||
|
||||
This scope excludes live biome-tag reloads, registry-owner
|
||||
validation and arbitrary provider failures. Chunk application has a
|
||||
[separate comparison](material-surfaces.md#chunk-surface-stage). Runtime trees
|
||||
are bounded to 256 levels and 8,192 registered conditions per worker; these limits
|
||||
are explicit resource bounds, not vanilla gameplay claims.
|
||||
|
||||
The same comparison now includes **6,271 initially compiled material rules**:
|
||||
block results, ordered sequences, conditional rules and seeded terracotta bands.
|
||||
It checks empty/singleton/nested sequences, first-match short circuiting, late
|
||||
compilation, band-index failures and separate context/application coordinates.
|
||||
[Bundled rule loading](material-rule-libraries.md) now integrates these runtime
|
||||
rules; rule encoding remains pending.
|
||||
|
||||
Noise thresholds share lazy suppliers by canonical noise name and dimension mode.
|
||||
Column-only suppliers still call the three-coordinate sampler with Y fixed at
|
||||
zero. The comparison includes all 64 bundled noises under both random algorithms,
|
||||
traced mutable inputs, repeated updates, late binding and nonfinite thresholds.
|
||||
`MaterialNoiseSources` supplies lazy named samplers from the world positional
|
||||
factory. Encoded numeric values are compared as double bits to preserve values
|
||||
independently of JSON number formatting, including Gson NaN/Infinity output.
|
||||
|
||||
Biome membership and temperature checks use the climate fields of all 67 bundled
|
||||
biomes. Tests cover possible-biome constant folding, shared biome lookup caches,
|
||||
column/block updates, null lookups, thrown lookup failures and same-revision
|
||||
retries that retain earlier condition results. A missing result after a failed
|
||||
first evaluation remains an error. Worker condition evaluation returns typed errors.
|
||||
|
||||
Named biome-tag conditions resolve all **86 bundled tags** through the tag loader
|
||||
and retain their tag identity when encoded. Comparisons cover nested references,
|
||||
optional missing members, duplicate entries, empty tags, namespace aliases,
|
||||
possible-biome folding and conditional-rule application. Registry snapshots are
|
||||
immutable; live tag reloads remain pending.
|
||||
|
||||
Preliminary heights use a lazily populated unit-spaced XZ density plane, with
|
||||
scalar sampling outside it. `MaterialDensitySources` accepts the compiled
|
||||
preliminary-surface root and its world sampler context. The comparison checks
|
||||
column minimum caching, Y-only updates, ignored original volume strides, partial
|
||||
failed fills, retries, floor conversions, infinities/NaN and integer wrapping.
|
||||
The preliminary plane is bounded to 1,048,576 samples.
|
||||
|
||||
Ore-vein rules accept three compiled density roots. Density and richness fill
|
||||
the expected chunk volume at compilation; gap sampling stays lazy. Cached
|
||||
lookups require an exact lattice position. Density queries use the block context;
|
||||
random choices use application coordinates and the seeded `minecraft:ore` stream.
|
||||
Tests cover both random algorithms, draw order, repeated calls, independent
|
||||
coordinates, nonfinite runtime values, raw-ore chances and failed compilation.
|
||||
Debug ore-vein visualization flags are outside this gameplay scope.
|
||||
|
||||
Material density storage is bounded to 32,768 bindings, 1,048,576 samples per
|
||||
eager volume and 16,777,216 retained eager samples per context. Bundled rule
|
||||
decoding has a [separate comparison](material-rule-libraries.md); rule encoding
|
||||
remains pending. The surface-stage comparison integrates these density bindings.
|
||||
@@ -0,0 +1,36 @@
|
||||
# Material-rule libraries
|
||||
|
||||
`MaterialRuleLibrary` loads the pinned Java Edition **26.3** rule resources against
|
||||
block-state, condition, noise and density registries. It supports block rules,
|
||||
ordered sequences, conditional rules, terracotta bands, ore veins and nested named
|
||||
rule references. Loading is atomic; missing references, cycles and duplicate
|
||||
canonical names return errors. Limits are 8,192 registered definitions, 65,536
|
||||
parsed nodes and 256 nested levels.
|
||||
|
||||
The library owns a density compiler configured for one world seed and random
|
||||
mode. `rule(name)` resolves a runtime tree and lazily compiles its density roots.
|
||||
Binding that tree to `MaterialConditions` performs per-chunk density sampling.
|
||||
`named_density(name)` shares the compiler with preliminary-surface sampling.
|
||||
`compile_router` and `compile_aquifer` bind configurations decoded into the same
|
||||
density registry before it is passed to the library. Their samplers share the
|
||||
material roots' cache namespace, so noise filling and surface application can
|
||||
reuse a worker context. Workers need matching world random settings and separate
|
||||
cached sampler contexts.
|
||||
|
||||
Run `python3 tools/test_material_rule_library_parity.py`. The
|
||||
[local report](../benchmarks/rust-material-rule-library-2026-10-06/scoped-parity.json)
|
||||
records **678,174 matching output lines per reference JAR**, including **665,712
|
||||
rule applications** and **142 codec inputs** across 12 fixtures. The test loads all
|
||||
**42 bundled rules**, **8 conditions**, **55 densities**, **64 noises**, **67 biome
|
||||
climates** and **86 biome tags** from both authenticated reference JARs. It also
|
||||
checks synthetic forward references and constant-density ore rules.
|
||||
|
||||
Comparisons use actual seeded noise and ore densities, strided chunk caches,
|
||||
scalar fallback, varying biomes/depths/heights, possible-biome sets and distinct
|
||||
context/application coordinates. Surface depth and secondary noise are supplied
|
||||
context inputs; preliminary density is zero to isolate rule evaluation.
|
||||
|
||||
The [surface stage](material-surfaces.md#chunk-surface-stage) now applies these
|
||||
rules to chunks. Rule/density encoding, live reload, registry-owner checks and
|
||||
playable integration remain pending. The report establishes
|
||||
this tested scope, not complete vanilla gameplay parity or an FPS improvement.
|
||||
@@ -0,0 +1,125 @@
|
||||
# Seeded material surfaces
|
||||
|
||||
Horizon implements the pinned Java Edition **26.3** material system's terracotta
|
||||
band generation, band lookup, surface depth and secondary surface-noise query.
|
||||
These primitives now feed the [chunk surface stage](#chunk-surface-stage).
|
||||
|
||||
`ClayBands` generates all 192 entries from the supplied clay-band random stream.
|
||||
It preserves orange placement, colored-band widths and overwrites, white/gray
|
||||
adjacency checks and conditional random draws. `MaterialSurface` derives that
|
||||
stream from the world's root positional factory using `minecraft:clay_bands`.
|
||||
Its surface-depth query uses a fresh position-derived random stream.
|
||||
|
||||
Band lookup rounds the float noise offset with Java's tie and saturation rules,
|
||||
then uses wrapped integer addition and signed remainder. A negative final index
|
||||
returns `None`, corresponding to vanilla's array-index failure. Surface-depth
|
||||
arithmetic promotes the sampled float to double before applying coefficients and
|
||||
truncating to an integer. Secondary noise similarly retains the float-to-double
|
||||
conversion.
|
||||
|
||||
Run:
|
||||
|
||||
```sh
|
||||
python3 tools/test_material_surface_parity.py
|
||||
```
|
||||
|
||||
The [local report](../benchmarks/rust-material-surface-2026-10-06/scoped-parity.json)
|
||||
records **122,988 matching output lines per reference JAR**, covering **277 fixtures**
|
||||
and **5,263 surface-query positions**. The original Java transport invokes actual
|
||||
`MaterialSystem` methods and its real constructor. Comparisons include both random
|
||||
algorithms, direct and derived streams, preconsumed random inputs, every band
|
||||
entry, subsequent random draws, real bundled noise definitions and constant-noise
|
||||
overrides for rounding boundaries, infinities, NaNs and extreme coordinates.
|
||||
|
||||
Reference artifacts and noise resources are authenticated, source/fixture changes
|
||||
invalidate the report, and raw inputs/outputs stay private under `.local`. CI
|
||||
includes this comparison on its configured platforms; the local result does not
|
||||
establish remote outcomes. Subsequent suites cover rule binding, biome-specific
|
||||
extensions and chunk surface application.
|
||||
|
||||
[Vertical anchors](vertical-anchors.md), used by material conditions, now have a
|
||||
separate differential implementation and codec comparison.
|
||||
|
||||
[Numeric material conditions](material-conditions.md) now evaluate surface inputs
|
||||
with worker-owned caches. [Bundled rule libraries](material-rule-libraries.md)
|
||||
bind the pinned material definitions and their ore-density samplers.
|
||||
|
||||
## Biome-specific column extensions
|
||||
|
||||
`MaterialExtensions` implements eroded-badlands pillars and frozen-ocean icebergs.
|
||||
It preserves noise coordinate arithmetic, temperature-dependent melting, seeded
|
||||
random draw order, repeated column reads and property-independent block identity.
|
||||
The column provider controls out-of-height reads and write clipping; failed calls
|
||||
retain earlier writes. Each extension call is bounded to 1,048,576 iterations.
|
||||
|
||||
Run `python3 tools/test_material_extension_parity.py`. The
|
||||
[local extension report](../benchmarks/rust-material-extension-2026-10-06/scoped-parity.json)
|
||||
records **233,100 matching lines per JAR** across **410 fixtures** and **3,920
|
||||
extension calls**. It compares ordered noise/read/write traces and complete
|
||||
columns, including both random modes, all 67 biome climates, actual seeded noises,
|
||||
constant threshold/nonfinite inputs, air/water variants and provider failures.
|
||||
The chunk surface stage integrates these extensions with heightmaps and fluid
|
||||
postprocessing.
|
||||
|
||||
|
||||
## Chunk surface stage
|
||||
|
||||
`build_surface` traverses columns in vanilla X/Z order and scans down each column,
|
||||
maintaining stone-depth and water-level counters. It applies bound material rules,
|
||||
eroded-badlands pillars and frozen-ocean icebergs. Writes update both world-generation
|
||||
heightmaps and append fluid-postprocessing offsets in order, including duplicates.
|
||||
Generation bounds clip writes while scans retain the chunk's full height. The
|
||||
worker returns its density context to the caller on success and typed failure;
|
||||
previous writes remain visible after failure.
|
||||
|
||||
Run `python3 tools/test_material_stage_parity.py`. The
|
||||
[local stage report](../benchmarks/rust-material-stage-2026-10-06/scoped-parity.json)
|
||||
records **6,733,382 matching output lines per reference JAR**, covering **79 fixtures**,
|
||||
**42 terrain fills**, **42 procedural carving passes**, **106 surface builds** and **21,757,952 block values**. The reference invokes actual
|
||||
`MaterialSystem.buildSurface` on vanilla `ProtoChunk` instances. Comparisons include
|
||||
complete sections, packed heightmaps, ordered postprocessing and biome queries.
|
||||
Fixtures exercise both random modes, the bundled rule registries, real seeded
|
||||
noises, empty and populated chunks, cavities, nondefault solids, clipped writes,
|
||||
primed and lazy heightmaps, and repeated builds sharing density contexts.
|
||||
Generated fixtures run actual `NoiseBasedChunkGenerator.doFill` followed by surface
|
||||
application on the same native noise chunk. Rust shares a compiler and worker
|
||||
context across both stages. All seven bundled terrain routers and aquifer
|
||||
configurations are tested with multiple seeds and distant positive/negative
|
||||
coordinates, comparing full chunk state before and after surface application.
|
||||
|
||||
Synthetic initial chunks use a supplied block-position biome resolver. Generated
|
||||
terrain fixtures first generate a 3×3 biome neighborhood through actual
|
||||
`ChunkGenerator.doCreateBiomes`, using multi-noise presets or the End source.
|
||||
The comparison checks **378 biome chunks** and **400,896 biome cells**, then
|
||||
performs seeded `BiomeManager` lookups against those stored neighbor biomes.
|
||||
Both block and quart lookup traces are compared. Rust imports independently
|
||||
authenticated preset tables; their builders remain separate work.
|
||||
Generated fixtures additionally select and run biome carvers across the 17×17
|
||||
origin neighborhood, comparing uncached biome queries and the complete terrain
|
||||
state after procedural carving. They then apply explicit masks twice as a stress
|
||||
check. See [carving integration](carving.md#biome-selected-neighboring-carvers).
|
||||
The neighborhood decodes its source JSON through the registry-bound biome-source
|
||||
catalog and uses the shared resolved-source worker API. Block air/fluid metadata
|
||||
is imported from both authenticated JARs. Native preset builders, full inline biome
|
||||
codecs, feature/structure stages, nonempty blending, lighting
|
||||
and complete generated worlds
|
||||
remain pending. A separate Rust test verifies that successful builds, eager binding
|
||||
failures and late biome-provider failures preserve density caches and world fields,
|
||||
and that late failure retains prior chunk writes and fluid offsets.
|
||||
CI includes the stage gate; remote results have not been observed.
|
||||
|
||||
|
||||
## Surface material beneath carved blocks
|
||||
|
||||
`top_material` binds a fresh one-cell material context at the supplied position,
|
||||
using clamped neighboring heightmap gradients and one stone block above and below.
|
||||
Submerged queries set water height to Y+1; dry queries use the vanilla sentinel.
|
||||
Possible-biome restrictions are omitted, as in vanilla's method. The returned
|
||||
state is left for the carving stage to apply. Both successful and failed queries
|
||||
retain the caller's density context; the query itself does not change blocks.
|
||||
|
||||
The surface-stage comparison includes **7,584 top-material queries** against
|
||||
actual `MaterialSystem.topMaterial`, at column edges and interiors, around sea
|
||||
level and immediately outside vertical bounds, in both dry and submerged contexts.
|
||||
The latest combined report records **6,733,382 matching lines per JAR**. Unit tests
|
||||
also check failure-state retention and the omission of possible-biome shortcuts.
|
||||
@@ -0,0 +1,96 @@
|
||||
# Horizon noise-generation scope
|
||||
|
||||
The target is the repository-pinned Minecraft Java Edition **26.3**. The Rust
|
||||
samplers live in `crates/horizon-core/src/noise/` and use the checked legacy or
|
||||
xoroshiro streams. They are a world-generation foundation; Horizon does not yet
|
||||
generate complete vanilla chunks or run a playable Rust game.
|
||||
|
||||
## Implemented behavior
|
||||
|
||||
- Gradient offsets and all 256 permutation entries, including the three random
|
||||
draws consumed when simplex offsets are disabled.
|
||||
- 26.3 Perlin 2D/3D sampling, single-precision interpolation and accumulation into
|
||||
caller-supplied derivative arrays. Smeared Perlin uses its adjusted Y component
|
||||
for gradient dots and the original component for interpolation. Its inherited
|
||||
derivative method samples the unsmeared field.
|
||||
- Simplex 2D/3D sampling with both offset modes, double-precision corner arithmetic
|
||||
and single-precision return values. The second 2D coordinate uses the Y offset.
|
||||
- Normal coordinate wrapping with the Far Lands debug flag disabled, including
|
||||
the fast-path boundary immediately below 2^24.
|
||||
- Positive strided density volumes with Z/X/Y flat ordering, Java-wrapping block
|
||||
coordinates, bulk Perlin/smeared-Perlin gradient reuse, scalar simplex volumes,
|
||||
repeated scaled accumulation and untouched buffer tails.
|
||||
- Ordered noise stacks, nested sampling, flattened stack composition, layer
|
||||
access and range arithmetic. Zero-amplitude layers are retained. Flattening
|
||||
rescales each layer before sampling and can differ from a nested stack.
|
||||
- Normal-noise octave selection, frequencies, amplitude modifiers, compensated
|
||||
amplitude sums, enabled/disabled/legacy normalization and the parity factory.
|
||||
Modern creation forks two positional factories and derives each octave from
|
||||
its name, then interleaves the two sets of Perlin layers.
|
||||
- Legacy Nether biome initialization, including reverse octave construction,
|
||||
exactly 262 integer draws for skipped octaves, rejected positive octaves and
|
||||
the RNG state left by initialization failures. Its two stacks are flattened in
|
||||
sequence, preserving their distinct accumulation order.
|
||||
|
||||
The bulk Perlin kernel adds X/Z gradient contributions before Y. Calling the
|
||||
scalar sampler repeatedly would rearrange those operations and can change the
|
||||
result. Rust preserves the bulk path and caches its eight gradients while the
|
||||
Y cell remains unchanged. These are implementation choices checked for behavior;
|
||||
no whole-game frame-rate or generation-speed improvement has been measured.
|
||||
|
||||
## Validation
|
||||
|
||||
After preparing the pinned artifacts with `python3 tools/lab.py prepare`, run:
|
||||
|
||||
```sh
|
||||
cargo test --workspace
|
||||
cargo clippy --workspace --all-targets -- -D warnings
|
||||
python3 tools/test_noise_parity.py
|
||||
```
|
||||
|
||||
The original Java adapter invokes the actual downloaded classes on both client
|
||||
and server JARs. It exposes offsets, permutations, octave parameters and layer
|
||||
weights for comparison, and calls the reference scalar and bulk methods.
|
||||
Artifacts and dependencies are authenticated against the repository lock and
|
||||
the official bundled checksums. Generated corpus/output and compiled adapters
|
||||
remain private under `.local/rust-noise-parity/`.
|
||||
|
||||
The corpus covers both random streams; offset and lattice boundaries; very large
|
||||
coordinates; signed zero, subnormals, infinities and NaNs; negative and zero
|
||||
amplitudes; rejected ranges; nested and flattened stacks; octave gaps; all three
|
||||
normalization modes; empty definitions; and modern/legacy RNG consumption.
|
||||
Finite values and signed zeros are compared by bits. NaN payloads/signs are
|
||||
canonicalized on both sides, matching Java's `floatToIntBits`/`doubleToLongBits`.
|
||||
|
||||
The local run matches **1,443,539 output lines per reference JAR**. This is a
|
||||
count of output records, including repeated checks, not distinct gameplay
|
||||
behaviors or a coverage percentage. The metadata-only
|
||||
[scoped report](../benchmarks/rust-noise-2026-10-05/scoped-parity.json) records
|
||||
source/input/output hashes and reference identities. The runner removes a prior
|
||||
success report before running and rejects source changes during validation.
|
||||
CI includes the suite on Linux, Windows and Apple Silicon macOS; the recorded
|
||||
local result is Linux, not proof that remote jobs or physical gameplay passed.
|
||||
|
||||
## API limits and remaining integration
|
||||
|
||||
Rust returns typed errors and uses immutable shared samplers. Density dimensions
|
||||
and strides must be positive, total volume must fit a Java signed array index,
|
||||
and a short output buffer is rejected before any writes. Vanilla can overflow
|
||||
its volume-size arithmetic or partially write before an array exception; those
|
||||
invalid-buffer behaviors are outside this bounded API.
|
||||
|
||||
The normal-noise builder limits allocation to 4,096 octaves; the legacy
|
||||
initializer also limits reverse construction to 4,096 octave steps. Requests
|
||||
beyond these limits fail before RNG draws. Vanilla's serialized definition
|
||||
codec limits octave count to 32. Rust's builder owns a snapshot of parameters;
|
||||
Java object identity, mutable builder-list aliases, equality/hash methods and
|
||||
the complete Java API surface are not reproduced.
|
||||
|
||||
The direct normal-noise JSON codec is now implemented and checked against every
|
||||
bundled noise definition in the [world-generation codec suite](world-generation.md).
|
||||
The density registry loader is also compared against all bundled definitions.
|
||||
Remaining noise initializers, complete terrain-router integration,
|
||||
aquifers, surface rules, biome/feature/structure placement and complete chunk
|
||||
generation still require implementation and integration evidence. Gaussian
|
||||
sampling remains absent from the RNG API pending exact logarithm behavior.
|
||||
No generated-world or full gameplay parity claim follows from this suite.
|
||||
@@ -8,6 +8,13 @@ Inspect both pinned game JARs locally, retain bytecode as the reference, and mea
|
||||
|
||||
Whole-game translation is a long-term research objective. Decompiled Java is an inspection artifact, not the original source tree: build configuration, comments, tooling history, and some source-level constructs cannot be recovered faithfully. A mechanically translated Rust game would also have to preserve behavior, data formats, networking and rendering. An isolated hot-path replacement is a useful first experiment.
|
||||
|
||||
The Rust rewrite now has an original `horizon-core` foundation and a bytecode
|
||||
differential runner for selected position, random-stream and packed-storage
|
||||
operations. [Rust parity status](rust-parity.md) distinguishes that tested slice
|
||||
from the unimplemented gameplay and renderer. This establishes compatibility
|
||||
testing infrastructure; it does not select an FPS bottleneck or supply a playable
|
||||
Rust client.
|
||||
|
||||
## Local code map
|
||||
|
||||
These entry points were verified present in the decompiled 26.3 client. Paths below are relative to `.local/minecraft/26.3/sources/client/net/minecraft/`; shared/server logic can also be inspected in the dedicated-server tree.
|
||||
|
||||
@@ -5,7 +5,7 @@ Version 0.2.0 targets Minecraft 26.3 / Fabric 0.19.5 / Java 25. This is an initi
|
||||
## Local checks
|
||||
|
||||
- Official client runs through a Wayland virtual screen in built-in limited demo mode, without Microsoft credentials. Normal Mac play uses licensed Prism sign-in.
|
||||
- Balanced stack (Sodium, Lithium, FerriteCore, ImmediatelyFast, EntityCulling, Distant Horizons, Fabric API, Horizon Lab) reaches the menu, loads the demo world, logs in locally, renders terrain, and saves/quits.
|
||||
- Balanced stack (Sodium, Lithium, FerriteCore, ImmediatelyFast, EntityCulling, Distant Horizons, Fabric API, Horizon) reaches the menu, loads the demo world, logs in locally, renders terrain, and saves/quits.
|
||||
- DH generates and accepts the current configuration schema: 128-chunk LOD radius, two background threads at 0.5 run-time ratio, priority 3. No old-version guessed config keys.
|
||||
- A missing desktop AWT component in the local headless JRE initially caused a DH cloud-texture error. Installing the complete Java 25 runtime resolved it; this was an environment issue, not a packaged mod change.
|
||||
- Native libraries are chosen by OS and architecture, including ARM64 selection when the official manifest has OS-only rules. Builds use portable `/` ZIP paths on Windows too.
|
||||
@@ -167,4 +167,4 @@ terrain generation and steady-state rendering are separate workloads.
|
||||
|
||||
## Release content
|
||||
|
||||
Packs embed only the original MIT Horizon Lab JAR and config. Mod/game/library downloads retain upstream licenses and are checked against pinned hashes. No game JAR, class, decompiled source, asset, world or credential is committed or uploaded in a starter. The narrow publication allowance is for original Java under `dev/horizonlab`, and the built JAR checks its emitted class namespace.
|
||||
Packs embed only the original MIT Horizon JAR and config. Mod/game/library downloads retain upstream licenses and are checked against pinned hashes. No game JAR, class, decompiled source, asset, world or credential is committed or uploaded in a starter. The narrow publication allowance is for original Java under `dev/horizonlab`, and the built JAR checks its emitted class namespace.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Measuring resident process memory
|
||||
|
||||
Horizon Lab 0.6.0 records process RSS alongside JVM heap and nonheap pools. RSS
|
||||
Horizon 0.6.0 records process RSS alongside JVM heap and nonheap pools. RSS
|
||||
counts resident pages belonging to the Minecraft process, including native
|
||||
allocations and mapped pages. It helps detect cases where reducing heap use
|
||||
merely moves memory elsewhere. It is not unique physical-memory ownership or
|
||||
|
||||
@@ -0,0 +1,381 @@
|
||||
# Horizon Rust rewrite status
|
||||
|
||||
The behavior target is the repository's pinned **Minecraft Java Edition 26.3**.
|
||||
One-to-one vanilla gameplay parity is the acceptance criterion. It has **not**
|
||||
been reached: Horizon's Rust code does not yet run a client, server, or simulation.
|
||||
It can read and export region files and access saved and resident block sections.
|
||||
Scheduled block/fluid queues can now collect and dispatch callbacks with
|
||||
vanilla-checked ordering; the actual block/fluid behavior is still absent.
|
||||
Double-precision geometry and voxel-grid queries are implemented, with a registry
|
||||
adapter for vanilla's no-context cached collision branch.
|
||||
Base noise samplers, octave stacks, normal-noise definitions and bulk density
|
||||
sampling are implemented. Compiled density samplers now evaluate constants, gradients,
|
||||
shifted noise, all eleven unary operators, rounding and selected arithmetic operations. An initial density graph compiler
|
||||
integrates range analysis, specialization, uniform-axis slicing, shared caches,
|
||||
nested splines and seeded noise;
|
||||
complete graph coverage, serialized graphs and generated terrain remain absent.
|
||||
The playable Java performance packs remain available during development.
|
||||
|
||||
## Implemented foundation
|
||||
|
||||
`crates/horizon-core` is a dependency-free Rust library with no unsafe code.
|
||||
It uses small integer position values, exclusively owned RNG state, and packed
|
||||
64-bit storage. These choices avoid Java object overhead in this slice; no
|
||||
whole-game memory, FPS, or render-distance gain has been measured.
|
||||
|
||||
| Area | Implemented and checked operations | Remaining scope |
|
||||
| --- | --- | --- |
|
||||
| Positions | Block, section, and chunk packing/unpacking; wrapping block offsets; block-to-section/chunk conversion; section-relative packet positions; block-state storage indices; region coordinates/local indices; bounded inclusive/directional block-box iteration | Remaining iterators, world bounds and entity/world integration |
|
||||
| Simulation geometry | Selected Vec3 operations, quantized trig/rotations, normalized AABB bounds and transforms, finite block traversal/swept visitation, ray faces, immutable cube/array voxel grids, greedy boxes, collision distances, column heights, closest points, lazy floor height, box quantization and Boolean/optimized joins; movement resolution over supplied shapes, step candidates and step-up decisions/query bounds | Shape rotations/faces/edges, entity-context shape selection, full entity movement and side effects |
|
||||
| Legacy random stream | Seeding/reseeding; int, bounded/inclusive/exclusive int, long, boolean, float, double; triangular float/double draws; fork; consume count; positional factories and Java UTF-16 string hashes | Gaussian sampling, threading-error behavior and remaining world-generation call sites |
|
||||
| Xoroshiro random stream | 64-bit seed expansion; explicit 128-bit state including all-zero fallback; the same selected random operations as above; positional factories and MD5-derived seeds with Java UTF-8 surrogate handling | Gaussian sampling, serialization and remaining world-generation call sites |
|
||||
| Noise generation | 26.3 Perlin/simplex/smeared Perlin; permutation construction and coordinate wrap; Perlin derivatives; cached/scalar density-volume accumulation; nested/flattened stacks; normal-noise octave weights and normalization; modern and legacy Nether seeding | Serialized noise definitions, density graphs, complete chunk generation, biome/feature/structure integration |
|
||||
| Density evaluation | Compiled constants, clamped/repeating/mirrored gradients, unshifted and XZ/XYZ shifted noise; offset-noise variants, old blended noise, outer End islands and distance-to-point; all eleven unary operators, six binary operators, powers, rounding, constant-operand specializations, min/max, clamp, range choice, interval selection and linear interpolation; separate scalar/bulk paths, nested scratch buffers, context-bound blend alpha/offset/structure samplers, absent/empty blend-density wrappers, context-owned scalar/volume caches, coordinate slices, coarse-grid interpolation, surface searches and nested cubic splines | Codecs, structure-density producers, nonempty old-world blending and terrain integration |
|
||||
| Density graph compilation | Immutable definitions for constants, gradients, arithmetic/selection operations, powers, rounding, distance-to-point, slices, caches, interpolation, surface search, nested splines, outer End islands and normal/offset/blended noise; context fields, blend-density wrappers, direct/named reference holders; range/axis metadata, constant and disjoint-range specialization, uniform-axis rewriting, cache-ID allocation/deduplication, memoized roots, spline coordinate sharing/validation, world-seed lookup and failure state | Codecs, concrete world-field producers and complete terrain integration |
|
||||
| Density range analysis | Checked interval constructors, hulls, arithmetic/min/max, reciprocal, abs/square/sign, powers/logarithms, clamp, monotonic endpoint mapping, finite/infinite interpolation, predicates, equality and Java hashes; conservative spline range propagation; integration with supported graph definitions | Propagation through remaining graph definitions |
|
||||
| Packed palette-index storage | Widths 1–32; allocation; imported raw words; reads; writes returning old values; unpack; fill; padding/tail preservation; invalid-write rejection | Remaining network container integration |
|
||||
| World data | Named/network NBT, modified UTF-8, mixed lists; gzip/zlib/uncompressed/lz4-java codecs; region exports including external chunks; block/biome saved palettes | Complete save lifecycle, data fixing, concurrent saves and recovery |
|
||||
| Resident block sections | Pinned block-state registry import, defaults, numeric IDs, uniform sections, packed palette growth, freed-slot reuse and compaction; cached collision shape lookup bound to the same registry | Block behavior, entity-context collision shapes, light and full chunk-lifecycle integration |
|
||||
| Heightmaps | Six type predicates and flags, packed heights, updates/removal rescans, shared priming, raw imports and length-mismatch fallback; all pinned states and mutation fixtures compared | Block air/fluid behavior and chunk-lifecycle integration |
|
||||
| Scheduled ticks | Chunk queues, level collection/drain ordering, duplicate suppression, seven priorities, saved delays, chunk eligibility, callback mutations, area removal/copying, saved block/fluid NBT | Actual block/fluid callbacks, neighbor updates, tick-time and chunk-lifecycle integration |
|
||||
|
||||
Packet-relative positions use X/Z/Y ordering; block-state storage indices use
|
||||
Y/Z/X ordering. Negative coordinate conversion must floor rather than truncate.
|
||||
The legacy RNG must retain Java's signed-int arithmetic and rejection rules;
|
||||
the xoroshiro RNG has a different bounded-int algorithm and bit selection.
|
||||
Positional factories preserve signed coordinate hashing and each stream's distinct
|
||||
seed derivation. The hash API accepts UTF-16 units so malformed surrogate sequences
|
||||
retain Java's replacement behavior. Gaussian sampling is still absent: a private
|
||||
probe found bit differences between Java `Math.log` and the platform logarithm,
|
||||
which must be resolved before its values and cached-draw behavior can be claimed.
|
||||
Storage entries never cross a word boundary. Vanilla's fill operation also
|
||||
writes padding and unused tail bits; imported words retain their original bits
|
||||
when a slot is changed. These details are covered by the differential corpus.
|
||||
|
||||
Rust APIs return typed errors instead of Java exceptions. Storage lengths and
|
||||
indices use `usize`; raw decoded values use `u32` bit patterns. Writes reject
|
||||
values above the nonnegative Java-int domain, including at width 32. Test output
|
||||
casts raw imported width-32 reads back to signed Java ints for comparison.
|
||||
Negative lengths and the complete Java object/API surface are not supported.
|
||||
|
||||
## Reproduce validation
|
||||
|
||||
Requires Rust 1.85 or newer, Python 3.10 or newer, and JDK 25. From the checkout:
|
||||
|
||||
```sh
|
||||
cargo test --workspace
|
||||
cargo clippy --workspace --all-targets -- -D warnings
|
||||
python3 tools/test_rust_parity.py --prepare
|
||||
python3 tools/test_world_parity.py
|
||||
python3 tools/test_tick_parity.py
|
||||
python3 tools/test_geometry_parity.py
|
||||
python3 tools/test_collision_parity.py
|
||||
python3 tools/test_noise_parity.py
|
||||
python3 tools/test_density_parity.py
|
||||
python3 tools/test_worldgen_parity.py
|
||||
python3 tools/test_heightmap_parity.py
|
||||
python3 tools/test_terrain_parity.py
|
||||
python3 tools/test_structure_density_parity.py
|
||||
python3 tools/test_material_surface_parity.py
|
||||
python3 tools/test_material_condition_parity.py
|
||||
python3 tools/test_material_stage_parity.py
|
||||
python3 tools/test_biome_zoom_parity.py
|
||||
python3 tools/test_biome_chunk_parity.py
|
||||
python3 tools/test_biome_generation_parity.py
|
||||
python3 tools/test_biome_source_parity.py
|
||||
python3 tools/test_anchor_parity.py
|
||||
python3 tools/test_biome_temperature_parity.py
|
||||
python3 tools/test_float_log_parity.py
|
||||
```
|
||||
|
||||
`--prepare` regenerates the local reference artifacts from the existing lock;
|
||||
omit it after preparation to run without downloads. The runner verifies the
|
||||
official manifest and both game downloads, the server's inner game JAR, and each
|
||||
server dependency against pinned/bundled hashes. The original Java test adapter
|
||||
calls vanilla classes directly; it does not substitute a Java reimplementation
|
||||
of the Rust algorithms. The same corpus runs against client and server code.
|
||||
The fixtures need no display, account, assets, or world generation.
|
||||
|
||||
The deterministic corpus contains coordinate extremes, all 4,096 local section
|
||||
positions, 8,192 random coordinate/offset queries, boundary and random signed
|
||||
seeds, mixed RNG operations, fork/reseed/consume checks, invalid bounds, and
|
||||
all 32 storage widths at boundary and 4,096-entry sizes. It also imports words
|
||||
containing all set bits and compares the raw padding and fill results. The
|
||||
current run produces **1,634,520 matching output lines per reference JAR**.
|
||||
It includes 4,400 positional-factory commands and 5,000 random-helper commands,
|
||||
with overflowing integer intervals, hash padding boundaries and malformed UTF-16.
|
||||
This count includes repeated checks and raw entries; it is not a count of
|
||||
distinct vanilla behaviors or a percentage of game coverage.
|
||||
|
||||
Artifacts remain gitignored under `.local/rust-parity/`: corpus, Rust output,
|
||||
client/server output, compiled oracle, and `report.json`. The report records
|
||||
source/input/output hashes, reference identities, tool versions, and matched
|
||||
line counts. A prior success report is removed before a new run can fail.
|
||||
CI runs the same comparison in addition to offline Rust and Python checks.
|
||||
The checked-in [scoped validation report](../benchmarks/rust-core-2026-10-05/scoped-parity.json)
|
||||
contains only metadata and digests from the local run, not game code or artifacts.
|
||||
|
||||
The additional [world-data suite](world-data.md) checks NBT and region
|
||||
interoperability, saved palettes, all 35,723 registered block-state IDs, and
|
||||
resident sections after repeated mutation. The corresponding
|
||||
[scoped report](../benchmarks/rust-world-2026-10-05/scoped-parity.json)
|
||||
records client/server reference hashes and the tested source hashes.
|
||||
|
||||
The [scheduled-tick suite](scheduled-ticks.md) adds 25,815 commands including
|
||||
2,096 tick invocations, producing 97,776 matching output lines per reference.
|
||||
It also verifies block/fluid tick save codecs and a persisted region chunk.
|
||||
The [geometry and cached-collision suites](collision-geometry.md) check numerical
|
||||
boundaries and runtime block-state shape data, with separate
|
||||
[geometry](../benchmarks/rust-geometry-2026-10-05/scoped-parity.json) and
|
||||
[cached-collision](../benchmarks/rust-collision-2026-10-05/scoped-parity.json)
|
||||
metadata reports. All differential runners reject changed source hashes during a run before publishing
|
||||
a success report. Historic reports describe their own recorded source versions.
|
||||
|
||||
The [noise suite](noise-generation.md) checks base sampling, derivative and bulk
|
||||
arithmetic, nested/flattened stacks, normal-noise normalization and both modern
|
||||
and legacy Nether initialization. Its [scoped report](../benchmarks/rust-noise-2026-10-05/scoped-parity.json)
|
||||
records the tested sources and both reference artifacts.
|
||||
|
||||
The [density suite](density-functions.md) checks compiled scalar and bulk samplers,
|
||||
including gradients, nested shifted noise, arithmetic, caching, axis slicing and
|
||||
coarse-grid interpolation, surface searches and nested splines with range analysis;
|
||||
it also compares the initial graph compiler with vanilla's compiler. Its
|
||||
[scoped report](../benchmarks/rust-density-2026-10-05/scoped-parity.json) records
|
||||
**15,524,627 matching output lines per reference JAR**. That suite constructs graphs through its transport. Serialized registry
|
||||
comparisons are covered separately below; generated terrain remains pending.
|
||||
|
||||
The [float-log report](../benchmarks/rust-float-log-2026-10-05/scoped-parity.json)
|
||||
records exhaustive compiled scalar comparisons for all **4,294,967,296 float bit
|
||||
patterns** against both JARs on the local Linux/JDK runtime, with canonical NaN
|
||||
results. Double-precision logarithms and other-platform math remain separate
|
||||
validation work.
|
||||
|
||||
The [world-generation codec suite](world-generation.md) checks every bundled
|
||||
normal-noise JSON definition and all 55 bundled density definitions against
|
||||
vanilla's actual registry-aware codecs. It compares decoded octave metadata,
|
||||
graph ranges and axes, raw and optimized compilation, cache allocation and
|
||||
seeded scalar and strided bulk sampling. Its
|
||||
[scoped report](../benchmarks/rust-worldgen-2026-10-06/scoped-parity.json) records
|
||||
**961,693 matching output lines per reference JAR**. All seven bundled eight-field
|
||||
routers and their climate samplers are also
|
||||
compared, including quart-coordinate wrapping and float/long quantization.
|
||||
Climate search-tree construction and warm/fresh ties are checked across the
|
||||
bounded API. Scalar and prepared-volume multi-noise biome resolvers are implemented
|
||||
using private imported built-in parameter tables and compared against vanilla
|
||||
scalar and bulk biome resolvers. Climate parameter codecs, vertical terrain bounds and the global fluid picker/
|
||||
disabled-aquifer path are also compared. Noise-based aquifer configuration and
|
||||
fluid-pressure selection are implemented, with differential checks for seeded
|
||||
decisions, sampling order, caches and failure recovery. Tag codecs, stacked resource
|
||||
replacement and bounded dependency resolution are compared across all 300 bundled
|
||||
block tags and synthetic missing-reference/cycle fixtures. Complete terrain
|
||||
integration remains pending.
|
||||
|
||||
The [heightmap suite](heightmaps.md) records **1,671,668 matching output lines per
|
||||
reference JAR** across all 35,723 block states and 100 chunk fixtures. Rust resolves
|
||||
tag membership; block air/fluid facts are private, independently verified imports.
|
||||
Actual vanilla heightmaps compare predicates, mutations, packed words, priming and
|
||||
selected ordered block reads. Chunk-lifecycle integration remains pending.
|
||||
|
||||
The [noise-fill suite](terrain-filling.md) now compares **7,950,873 output lines per
|
||||
reference JAR** across 114 fixtures and 200 fills. Final density, aquifers, resident
|
||||
sections, world-generation heightmaps and fluid postprocessing are integrated for
|
||||
this stage. The surface stage has a separate comparison; biome, feature and
|
||||
structure stages remain pending.
|
||||
|
||||
The [structure-density sampler](structure-density.md) matches **1,360,095 output
|
||||
lines per reference JAR**, including ordered rigid-piece/junction contributions
|
||||
and scalar/bulk clipping. Live structure discovery and placement remain pending.
|
||||
|
||||
The [vertical-anchor suite](vertical-anchors.md) matches **181,632 output lines per
|
||||
reference JAR**, including four anchor codecs, runtime overflow, nested exclusive
|
||||
fields and generation bounds.
|
||||
|
||||
The [material-surface primitives](material-surfaces.md) match **122,988 output
|
||||
lines per reference JAR** for seeded terracotta bands, band lookup and surface
|
||||
noise queries. Subsequent suites cover rule evaluation and surface application.
|
||||
|
||||
The [numeric material-condition suite](material-conditions.md) matches **5,627,426
|
||||
output lines per reference JAR** for eleven condition forms and their column/block
|
||||
cache transitions, including codecs, all eight bundled condition definitions and
|
||||
block/sequence/conditional/terracotta-band rule composition.
|
||||
The chunk surface comparison below integrates these rules.
|
||||
|
||||
The [biome-temperature suite](biome-temperatures.md) matches **836,659 output lines
|
||||
per reference JAR** for temperature modifiers, precipitation decisions and ordered
|
||||
cache behavior, including thread isolation and climate fields from all 67 bundled
|
||||
biome definitions. Full weather placement remains pending.
|
||||
|
||||
The [surface-extension suite](material-surfaces.md#biome-specific-column-extensions)
|
||||
matches **233,100 output lines per reference JAR** for badlands pillars and
|
||||
frozen-ocean icebergs, including ordered column reads/writes and both random modes.
|
||||
|
||||
The [bundled material-rule suite](material-rule-libraries.md) matches **678,174
|
||||
output lines per reference JAR**, including 665,712 rule applications across all
|
||||
42 bundled definitions and the pinned biome, noise and density registries.
|
||||
The [chunk surface stage](material-surfaces.md#chunk-surface-stage) matches
|
||||
**6,733,382 output lines per reference JAR** across 79 fixtures, 42 terrain fills
|
||||
and 106 surface builds, followed by 158 carving-mask passes, including 21,757,952 block values, heightmaps, fluid
|
||||
postprocessing and ordered biome queries. It tests all seven bundled terrain
|
||||
settings through both stages with shared density contexts and vanilla fuzzy
|
||||
biome lookup against 378 generated neighbor biome chunks (400,896 stored cells).
|
||||
Preset builders and complete generated worlds remain pending.
|
||||
|
||||
The [biome-lookup suite](biome-lookup.md) matches **256,933 output lines per
|
||||
reference JAR** for seed obfuscation, eight-corner fuzzy selection, direct quart
|
||||
queries and source replacement. Seed hashes also match an independent SHA-256
|
||||
implementation. [Chunk biome storage](biome-lookup.md#chunk-biome-storage) matches
|
||||
**478,340 lines per JAR** across 160 fills, including section-atomic failure
|
||||
behavior and clamped reads. [Chunk biome generation](biome-lookup.md#chunk-biome-generation)
|
||||
matches **383,072 lines per JAR** across 322 fills, including both imported
|
||||
multi-noise presets and fixed/checkerboard/End sources through all seven terrain
|
||||
routers. Preset builders and complete world generation remain pending.
|
||||
|
||||
The [fixed/checkerboard/End source suite](biome-lookup.md#fixed-checkerboard-and-end-sources)
|
||||
matches **1,306,096 lines per JAR**, including 1,147,984 biome queries and ordered
|
||||
End erosion sampling. [Registry-bound source codecs](biome-lookup.md#registry-bound-source-codecs)
|
||||
match **363,121 lines per JAR** across 40,481 inputs, including canonical encoding,
|
||||
possible-biome sets and resolved queries. Chunk generation and surface integration
|
||||
share the resolved-source API. Inline biome definitions and complete registry
|
||||
lifecycle behavior remain pending.
|
||||
|
||||
The [carving-mask suite](carving.md) matches **45,742 lines per JAR** across
|
||||
28 fixtures, including packed column ranges, coordinate wrapping and mutations
|
||||
retained after failing traversal callbacks. Mask application is included in the
|
||||
surface-stage suite. [Shared carving geometry](carving.md#shared-shape-primitives)
|
||||
matches **106,699 lines per JAR**, including 690 ellipsoids and 5,536 reachability
|
||||
queries. [Seeded cave/canyon paths](carving.md#seeded-cave-and-canyon-paths) match
|
||||
**882,005** and **1,094,517 lines per JAR**, respectively. The combined stage suite
|
||||
also covers 42 procedural carving passes, including neighboring biome selection
|
||||
and ordinal carver seeds. Full-world integration remains pending.
|
||||
|
||||
The [feature-placement primitives](feature-placement.md) match **1,268,600 lines per
|
||||
JAR** across seventeen modifier kinds, including callback failures and shared random
|
||||
state. [Modifier-chain execution](feature-placement.md#modifier-chains) matches
|
||||
**548,461 lines per JAR**, including feature callback failures and reused pending
|
||||
buffers. [Initial block-writing features](feature-placement.md#initial-block-writing-features)
|
||||
match **1,820,614 lines per JAR** for the void platform, End islands and End arrival
|
||||
platform. Remaining feature algorithms and complete world integration remain pending.
|
||||
|
||||
The [scalar value-provider suite](value-providers.md) matches **429,920 lines per
|
||||
JAR** across 504 definitions and 5,040 seeded fixtures, including exact random
|
||||
stream consumption. [Anchored height providers](value-providers.md#anchored-height-providers)
|
||||
match **507,660 lines per JAR**, including all four anchors and overflowing contexts.
|
||||
Weighted lists include zero weights, nested choices and maximum totals. Gaussian
|
||||
distributions and provider encoding remain pending.
|
||||
|
||||
The [block-state JSON codec suite](block-state-codecs.md) matches **221,261 output
|
||||
lines per reference JAR**, covering every registered state and compact/full
|
||||
encoding plus malformed-property fallback. Block gameplay remains pending.
|
||||
|
||||
## Work required for a playable rewrite
|
||||
|
||||
| Subsystem | Current Rust status | Required parity evidence |
|
||||
| --- | --- | --- |
|
||||
| Registries, block states, items and data components | Block-state IDs, property descriptors and defaults imported and checked; items/components absent | Registry lifecycle, remaining registries, data components and behavior |
|
||||
| World/chunk storage, NBT and region files | Bounded NBT, four codecs, region export, saved and resident section palettes | Generated-save integration, entity/POI integration, upgrades, live saves and crash recovery |
|
||||
| Terrain, biomes, structures and lighting | Seeded noise/density graphs, bundled registry and router loading, climate sampling/search and imported-table multi-noise biome resolution, aquifer decisions, noise-stage filling and surface-stage application implemented; complete terrain generation absent | Remaining terrain/biome codecs and world fields, seeded generated-chunk comparisons, biome/feature/structure placement, chunk lifecycle and light propagation |
|
||||
| Tick scheduling, blocks, fluids and redstone | Scheduled queues, eligibility, callback mutations and saved tick data implemented; block/fluid/redstone behavior absent | Actual block/fluid state transitions, neighbor updates, world integration and end-to-end ordered traces |
|
||||
| Entities, AI, movement and combat | Bounding-box and voxel collision geometry implemented; live entities absent | Context-dependent collision/physics and tick traces, spawning, pathfinding, damage, equipment and lifecycle |
|
||||
| Survival, inventory, crafting and progression | Not implemented | Recipes, item transitions, hunger/health, effects, experience and advancement behavior |
|
||||
| Dimensions, portals, weather and game rules | Not implemented | Cross-dimension state, transitions, time/weather and rule-dependent behavior |
|
||||
| Multiplayer, protocol, authentication and commands | Not implemented | Packet/codec fixtures, vanilla interoperability, reconnects and command behavior |
|
||||
| Rendering, resources, sound, UI and input | Not implemented | Resource compatibility, render/culling correctness, controls and playable interaction tests |
|
||||
| Performance and platform support | Not measured for a Rust game | Repeated matched gameplay workloads, frame/tick distributions, memory and physical GPU tests |
|
||||
|
||||
The next simulation milestone is integrating the checked scheduler and
|
||||
registry-backed sections with actual block behavior and neighbor updates. World
|
||||
generation now has noise-stage filling, aquifers and surface-stage application;
|
||||
biome assignment and remaining generation stages need work,
|
||||
followed by complete seeded-world comparisons. A renderer needs
|
||||
actual block models, neighboring sections and light data. Simplified geometry
|
||||
alone cannot establish vanilla behavior. Performance tuning must preserve the
|
||||
validated simulation and use measured workloads; changing render distance,
|
||||
simulation distance or terrain detail invalidates an equal-workload speed claim.
|
||||
|
||||
No finite corpus proves every vanilla behavior. Future milestones need broader
|
||||
version-specific differential suites and playable integration checks. The
|
||||
project will report implemented/validated scope rather than label a partial
|
||||
port as 100% parity.
|
||||
|
||||
The [pre-light chunk-stage comparison](terrain-filling.md#block-writes-across-generation-stages)
|
||||
adds **8,090,090 matching lines per JAR** for stage-dependent block mutation and
|
||||
heightmap selection, including insertion/removal of every pinned state. This does
|
||||
not establish the complete chunk lifecycle or region integration.
|
||||
|
||||
The [resident feature-region comparison](feature-placement.md#resident-feature-regions)
|
||||
adds **28,922,634 matching lines per JAR** for basic features, configured fill layers, replacements and scattered ore sharing
|
||||
modifier chains and resident neighboring chunks, including live heightmap updates.
|
||||
World-region side effects and complete feature generation remain pending.
|
||||
|
||||
The [inline feature-graph comparison](feature-placement.md#inline-feature-composition)
|
||||
adds **737,779 matching lines per JAR** for nested sequences and random selectors,
|
||||
including short-circuit results, shared randomness and partial mutations.
|
||||
|
||||
The [named feature-resource comparison](feature-placement.md#named-feature-resources)
|
||||
adds **1,734,390 matching lines per JAR** for registry-aware feature/placed-feature
|
||||
holders, ordered tags and subsequent nested execution. Complete registry loading,
|
||||
reloads and remaining feature algorithms are still pending.
|
||||
|
||||
The [configured fill-layer comparison](feature-placement.md#configured-fill-layers)
|
||||
adds **1,305,274 matching lines per JAR** for block-state binding and ordered
|
||||
column placement, including decoding every pinned block state. Complete feature
|
||||
generation and gameplay remain pending.
|
||||
|
||||
The [replacement-rule comparison](feature-placement.md#replacement-rules) adds
|
||||
**1,890,716 matching lines per JAR** for all ten native predicate kinds, bound
|
||||
state/tag identities and ordered random evaluation. Complete ore and structure
|
||||
generation remain pending.
|
||||
|
||||
The [single-block replacement comparison](feature-placement.md#single-block-replacement)
|
||||
adds **303,678 matching lines per JAR** for ordered rule-driven block mutations,
|
||||
rejected writes, failures and subsequent random state.
|
||||
|
||||
The [scattered-ore comparison](feature-placement.md#scattered-ore) adds
|
||||
**758,484 matching lines per JAR** for attempt offsets, ordered air-exposure checks,
|
||||
rule evaluation and block mutations. Ordinary ore veins and complete biome
|
||||
decoration remain pending.
|
||||
|
||||
The [bulk-section comparison](feature-placement.md#bulk-section-access) adds
|
||||
**959,640 matching lines per JAR** for cached raw section access, every block state,
|
||||
all-air reads and unchanged heightmaps. This supplies storage behavior needed by
|
||||
ordinary ore generation; vein geometry and concurrent ownership remain pending.
|
||||
|
||||
The [biome feature-order comparison](feature-placement.md#biome-feature-ordering)
|
||||
adds **411,751 matching lines per JAR** for identity-based ordering, cycles and
|
||||
step index mappings, including every bundled biome's feature lists. This does
|
||||
not yet execute complete chunk decoration.
|
||||
|
||||
The [world-generation random-adapter comparison](feature-placement.md#world-generation-random-streams)
|
||||
adds **238,800 matching lines per JAR** for native bit sampling, counters, forks,
|
||||
nested wrappers and decoration/feature seeding. Gaussian sampling and complete
|
||||
chunk decoration remain pending.
|
||||
|
||||
The [biome-placement comparison](feature-placement.md#biome-placement-filtering)
|
||||
adds **121,423 matching lines per JAR** for top-feature contexts, native generation
|
||||
settings membership, query order, nested ordinary placers and partial failures.
|
||||
Complete biome sampling integration and chunk decoration remain pending.
|
||||
|
||||
The [decoration scheduler comparison](feature-placement.md#decoration-feature-scheduling)
|
||||
adds **337,398 matching lines per JAR** through the native chunk-decoration entry
|
||||
point, with structures disabled and traced feature sinks. It covers resident
|
||||
biome selection, global ordering, per-feature seeds and failure/progress state;
|
||||
complete feature algorithms and chunk lifecycle remain pending.
|
||||
|
||||
The [resident decoration comparison](feature-placement.md#decoration-over-resident-chunks)
|
||||
adds **36,173,951 matching lines per JAR** for native chunk decoration combining
|
||||
biome storage/zoom, generation-stage guards, scheduling, implemented feature
|
||||
graphs, block writes and live heightmaps. It compares complete final resident
|
||||
sections; structures, lighting and the full generation lifecycle remain pending.
|
||||
|
||||
The [block-state provider comparison](feature-placement.md#block-state-providers)
|
||||
adds **105,340,143 matching lines per JAR** for ten state-provider kinds, including
|
||||
all eight bundled provider definitions. It includes every state under six
|
||||
directions, property transforms, nested draw order and empty selections. Rule-based
|
||||
selection includes twelve predicate kinds, ordered conditions, empty results and
|
||||
query failures. Named holder references are resolved through immutable resource
|
||||
snapshots. Additional predicates, complete registry loading and complete feature placement remain pending.
|
||||
|
||||
The [contained-fluid comparison](world-data.md#contained-fluid-states) adds
|
||||
**239,190 matching lines per JAR** for fluid-state mapping, liquid-block conversion
|
||||
and surface/camera height queries. It covers every pinned block state and query
|
||||
failures; fluid spreading, entity interactions and rendering remain pending.
|
||||
@@ -0,0 +1,136 @@
|
||||
# Horizon scheduled ticks
|
||||
|
||||
The Rust scheduler targets the repository-pinned **Minecraft Java Edition
|
||||
26.3**. It implements scheduled block/fluid queue mechanics and saved tick
|
||||
lists. Actual block/fluid updates, random ticks, block events, neighbor updates,
|
||||
redstone behavior and a running game world remain unimplemented.
|
||||
|
||||
## Behavior
|
||||
|
||||
`horizon_core::ticks` supplies `TickPriority`, `ScheduledTick`, `SavedTick`,
|
||||
`ChunkTicks` and `LevelTicks`. A numeric `TickTypeId` represents a registry-owned
|
||||
block or fluid type. Block and fluid scheduling use separate `LevelTicks`
|
||||
instances. Callers supply identities, game time, sub-tick counters, eligibility,
|
||||
per-call tick limits and behavior callbacks.
|
||||
|
||||
The first request for a type and position wins, even if a duplicate has an
|
||||
earlier trigger time or a higher priority. A chunk queue orders by signed
|
||||
trigger time, then one of seven priorities, then signed sub-tick order. Once
|
||||
heads are due, **different chunks compete by priority and sub-tick order**.
|
||||
Consequently, globally sorting every tick by trigger time changes execution.
|
||||
Within the selected chunk, draining stops when its next head loses to the
|
||||
competing chunk head, exceeds the time bound, or exhausts the tick limit.
|
||||
|
||||
Equal comparator keys follow the pinned Java array heap behavior. Deadline
|
||||
traversal follows the pinned fastutil long-map layout, including resizing,
|
||||
collision shifts and wrapped iterator removals. These details matter when
|
||||
loaded ticks in different chunks share priority and negative sub-tick order.
|
||||
They are covered by differential tests rather than replaced with a new tie
|
||||
breaker. The heap stores tick records inline and retains collection capacity
|
||||
between frames. Area operations probe small chunk grids directly and visit
|
||||
only loaded chunks for large sparse areas, preserving X/Z traversal order.
|
||||
No game FPS or memory gain has been measured.
|
||||
|
||||
Collection happens before callbacks. A callback can schedule, query, clear,
|
||||
copy, disable or unload chunks; newly scheduled ticks wait for the next
|
||||
collection. `has_scheduled` covers container queues and pending saved ticks;
|
||||
`will_tick_this_tick` covers the remaining collected queue. The current callback
|
||||
has already moved to the already-run list. Vanilla's lazily built membership
|
||||
set can remain stale after an area clear; that behavior is preserved until
|
||||
cleanup. Area copying includes already-run, collected and queued ticks and
|
||||
places copied sub-tick orders after the copied source range with wrapping
|
||||
signed-long arithmetic.
|
||||
|
||||
Disabled chunks retain due entries. Removing a container returns its queue
|
||||
for saving or later reinsertion; collected callbacks still run. Scheduling into
|
||||
an absent chunk returns `MissingChunk` and does not enqueue. The Rust API adds
|
||||
invariant checks for duplicate chunk insertion, wrong-chunk contents and invalid
|
||||
collection phase transitions. These checks differ from Java's unchecked API
|
||||
and logging, while preserving the tested valid lifecycle.
|
||||
|
||||
## Persistence and use
|
||||
|
||||
Saved ticks hold a signed 32-bit relative delay. Packing narrows the wrapped
|
||||
time difference as Java does and stably sorts active ticks by sub-tick order.
|
||||
Pending saved entries precede active entries. Unpacking assigns orders from
|
||||
`-saved_count` through `-1` and adds delays with signed-long wrapping. Vanilla
|
||||
does not deduplicate a saved list during unpack; duplicate entries and their
|
||||
membership behavior are retained.
|
||||
|
||||
`horizon_world::tick_data` bridges the vanilla `i`, `x`, `y`, `z`, `t`, `p`
|
||||
fields to type IDs through caller-supplied names. `ChunkData::saved_ticks`
|
||||
loads a pending container and filters out positions belonging to other chunks;
|
||||
`set_saved_ticks` writes packed entries while preserving unrelated root data.
|
||||
The separate block/fluid name lookup is required because their IDs are not
|
||||
the resident section's block-state IDs.
|
||||
|
||||
```rust
|
||||
use horizon_core::{position::ChunkPos, ticks::{LevelTicks, ScheduledTick}};
|
||||
use horizon_world::{chunk::ChunkData, tick_data::TickKind};
|
||||
|
||||
fn run_saved_blocks(
|
||||
chunk: &mut ChunkData,
|
||||
now: i64,
|
||||
resolve: impl FnMut(&str) -> Option<horizon_core::ticks::TickTypeId>,
|
||||
name: impl FnMut(horizon_core::ticks::TickTypeId) -> Option<String>,
|
||||
run: impl FnMut(&mut LevelTicks, ScheduledTick),
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let pos: ChunkPos = chunk.position();
|
||||
let mut pending = chunk.saved_ticks(TickKind::Block, resolve)?;
|
||||
pending.unpack(now);
|
||||
let mut level = LevelTicks::default();
|
||||
level.add_chunk(pos, pending)?;
|
||||
level.tick(now, 65_536, |_| true, run)?;
|
||||
let pending = level.remove_chunk(pos).unwrap();
|
||||
chunk.set_saved_ticks(TickKind::Block, &pending.pack(now), name)?;
|
||||
Ok(())
|
||||
}
|
||||
```
|
||||
|
||||
The caller supplies the behavior callback. A game integration must check the
|
||||
current block/fluid type, invoke its actual behavior,
|
||||
apply resulting state/neighbor/light changes, and persist remaining queues
|
||||
through the chunk lifecycle. The scheduler alone does not provide gameplay.
|
||||
|
||||
## Validation
|
||||
|
||||
```sh
|
||||
cargo test --workspace
|
||||
cargo clippy --workspace --all-targets -- -D warnings
|
||||
python3 tools/test_tick_parity.py --prepare
|
||||
```
|
||||
|
||||
The runner authenticates both official reference JARs and dependencies against
|
||||
the repository lock and bundled hashes. An original Java adapter invokes the
|
||||
actual `LevelTicks`, `LevelChunkTicks`, `ScheduledTick`, `SavedTick` and
|
||||
`TickPriority` classes; expected traces are not computed by another port.
|
||||
|
||||
The corpus has **25,815 commands**, including **2,096 tick invocations**, and
|
||||
produces **97,776 matching output lines per reference JAR**. It covers:
|
||||
|
||||
- All priorities, overdue chunk competition, exact comparator ties, duplicate
|
||||
requests and signed time/order extremes.
|
||||
- Map growth/shrink, collisions crossing the table boundary, limited draining,
|
||||
disabled chunks, unloading and restoration.
|
||||
- Pending-list duplicates, save packing, negative load orders and repeated
|
||||
save/reload with changed game time.
|
||||
- Membership queries and rescheduling, clearing, copying, unloading or
|
||||
disabling chunks during callbacks.
|
||||
- Eight deterministic randomized scenarios with queue snapshots, saves,
|
||||
eligibility changes and area operations.
|
||||
|
||||
A separate adapter uses the actual block and fluid `SavedTick` registry codecs.
|
||||
Rust loads, filters, unpacks, polls, reschedules and saves **251 block ticks and
|
||||
251 fluid ticks**. Vanilla checks the resulting NBT and a Rust-written region
|
||||
chunk. Fixtures include duplicate saved entries, out-of-chunk coordinates,
|
||||
negative delays, overflowing times and numeric NBT coercions including NaNs,
|
||||
infinities and narrowed longs.
|
||||
|
||||
Offline tests cover phase guards, eligibility, callback deferral, ordering,
|
||||
area membership, copying, invalid data and atomic saved-list updates. CI runs
|
||||
this suite alongside core and world-data comparisons. Evidence stays under
|
||||
`.local/rust-tick-parity/`; success reports are cleared before each run and
|
||||
source hashes must remain unchanged during validation. The checked-in
|
||||
[scoped report](../benchmarks/rust-ticks-2026-10-05/scoped-parity.json) contains
|
||||
metadata and hashes only. Line counts are corpus observations, not gameplay
|
||||
coverage percentages or proof of complete vanilla parity.
|
||||
@@ -54,7 +54,7 @@ snapshot. Waiting state contains only six booleans and a tick count; arbitrary
|
||||
screen names, messages and paths are excluded. An unsuccessful research run
|
||||
remains unsuccessful. Playable shader/backend defaults remain unchanged.
|
||||
|
||||
Diagnostic repeat [37199837867](https://github.com/ludovic111/minecraft-optimization-lab/actions/runs/37199837867)
|
||||
Diagnostic repeat [37199837867](https://github.com/ludovic111/Horizon/actions/runs/37199837867)
|
||||
uses the richer diagnostics. Both cases again hit the 240-second timeout and
|
||||
require bounded termination. OpenGL initializes its device and loads a world
|
||||
with a player, no overlay, an active window and no pause; a screen remains
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
# Structure terrain-adaptation density
|
||||
|
||||
`horizon_core::density::Beardifier` implements the pinned Java Edition **26.3**
|
||||
structure-density sampler from supplied ordered rigid pieces, jigsaw junctions
|
||||
and an affected bounding box. It supports `NONE`, `BURY`, `BEARD_THIN`, `BEARD_BOX`
|
||||
and `ENCAPSULATE` adjustments. Live structure discovery, filtering and placement
|
||||
remain separate work.
|
||||
|
||||
The sampler retains float accumulation order, wrapped coordinate arithmetic,
|
||||
ground-level deltas, the 24-by-24-by-24 kernel and vanilla's inverse-square-root
|
||||
approximation. Its kernel is computed once from the formula. No extracted vanilla
|
||||
kernel data is stored in the source tree. The immutable sampler can be attached
|
||||
to `WorldField::Beardifier` and shared between worker contexts.
|
||||
|
||||
Scalar reads return zero outside the affected box. Bulk reads clear the entire
|
||||
output, including an oversized tail, then scan the clipped strided volume.
|
||||
Vanilla floors the lower clipping index rather than rounding it upward, so a
|
||||
first bulk sample can be outside the scalar bounds. Horizon preserves this
|
||||
scalar/bulk distinction. A missing affected box produces zero even if component
|
||||
lists are nonempty. Bounds supplied to the Rust constructor must already be
|
||||
normalized; short output buffers return a typed error before mutation.
|
||||
|
||||
Run:
|
||||
|
||||
```sh
|
||||
python3 tools/test_structure_density_parity.py
|
||||
```
|
||||
|
||||
The [local report](../benchmarks/rust-structure-density-2026-10-06/scoped-parity.json)
|
||||
records **1,360,095 matching output lines per reference JAR** across **183 fixtures**,
|
||||
**28,093 scalar queries** and **339 volumes**. The original Java adapter calls the
|
||||
actual `Beardifier` constructor and samplers. Cases include every adjustment mode,
|
||||
the full junction kernel neighborhood, ground offsets, overlapping components,
|
||||
reversed accumulation order, null/empty bounds, floor clipping, output tails and
|
||||
extreme wrapped coordinates. Float outputs are compared by raw bits with
|
||||
canonical NaNs.
|
||||
|
||||
The report records the authenticated JARs, source and fixture hashes. Raw outputs
|
||||
stay private under `.local`. CI runs the comparison on its configured platforms;
|
||||
the local `Math.pow`-derived kernel check does not establish cross-platform math
|
||||
parity. The [noise-fill comparison](terrain-filling.md) also checks supplied structure
|
||||
density through final-density and aquifer graphs. Structure-start selection,
|
||||
invalid-box repair and complete structure terrain generation remain pending.
|
||||
@@ -0,0 +1,88 @@
|
||||
# Noise-stage terrain filling
|
||||
|
||||
Horizon now connects final-density sampling, aquifer selection, resident block
|
||||
sections, world-generation heightmaps and fluid postprocessing for the pinned
|
||||
Minecraft Java Edition **26.3**. This implements the initial noise fill, before
|
||||
the [surface stage](material-surfaces.md#chunk-surface-stage), features and
|
||||
structure placement.
|
||||
|
||||
`TerrainChunk` owns registry-backed `BlockSection` palettes, non-air counts,
|
||||
optional heightmaps and per-section postprocessing offsets. Raw section reads
|
||||
retain stored cave/void air; chunk reads collapse an all-air section to AIR, as
|
||||
vanilla `ProtoChunk` does. Block air/fluid behavior and tag membership come from a
|
||||
`TerrainBlockStates` provider tied to the same immutable registry.
|
||||
|
||||
`fill_noise` samples the entire final-density volume before writing blocks. It
|
||||
then visits increasing Z, increasing X and decreasing Y. Aquifer results use the
|
||||
default solid block when absent. Exact default AIR results skip writes, preserving
|
||||
any prior block at that position. Other states are written before updating
|
||||
`OCEAN_FLOOR_WG`, then `WORLD_SURFACE_WG`. A scheduled aquifer result with nonempty
|
||||
fluid appends its packed offset; repeated offsets are retained in insertion order.
|
||||
|
||||
The aquifer and final-density sampler share a context. The caller constructs the
|
||||
aquifer first, then compiles final density through the same compiler. The Rust
|
||||
fill API accepts a full 16-by-16 chunk footprint with unit steps and a positive
|
||||
vertical subrange inside its bounded chunk. Typed failures retain earlier writes
|
||||
and sampler/aquifer state. Developer diagnostic surface markers are outside this
|
||||
regular-gameplay path.
|
||||
|
||||
Run the differential comparison with:
|
||||
|
||||
```sh
|
||||
python3 tools/test_terrain_parity.py
|
||||
```
|
||||
|
||||
The [local report](../benchmarks/rust-terrain-2026-10-06/scoped-parity.json) records
|
||||
**7,950,873 matching output lines per reference JAR**, checked against both client
|
||||
and server. **114 fixtures** perform **200 fills**; **61 fixtures** enable noise-based
|
||||
aquifers. Cases include all seven bundled routers, their aquifer configurations,
|
||||
both random algorithms, multiple seeds and positive/negative chunk coordinates,
|
||||
synthetic density roots, nondefault fluid-bearing states, prefilled chunks,
|
||||
partial-height fills and repeated fills using the same caches. An additional
|
||||
24 fixtures bind rigid-piece and junction density through the actual noise chunk,
|
||||
including synthetic final-density and aquifer roots that consume that field.
|
||||
|
||||
After every fill, the suite compares every raw section state, both packed
|
||||
heightmaps, the final fluid-scheduling flag and every ordered postprocessing
|
||||
offset. The reference invokes actual vanilla `NoiseChunk` and
|
||||
`NoiseBasedChunkGenerator.doFill`, with empty blending and empty or supplied structure-density fields.
|
||||
Rust resolves bundled tags and compiles density and aquifer roots itself.
|
||||
Block identities/properties and air/fluid facts are private exports, generated
|
||||
independently by both authenticated JARs and required to agree. Importing these
|
||||
facts does not implement the underlying block behaviors. Placeholder material
|
||||
and biome holders are never evaluated in this fill-only comparison.
|
||||
|
||||
Reports capture source and fixture hashes, and the runner rejects changes during
|
||||
validation. CI includes the comparison on its configured platforms; the local
|
||||
report does not establish remote results. Complete generated terrain still needs
|
||||
biome assignment, structures, features, nonempty
|
||||
blending and live structure discovery, lighting and chunk lifecycle integration. These
|
||||
results do not establish a playable client or whole-game performance improvements.
|
||||
|
||||
The [combined surface-stage suite](material-surfaces.md#chunk-surface-stage) now
|
||||
checks noise filling followed by surface application through shared density
|
||||
contexts for all seven bundled terrain settings.
|
||||
|
||||
|
||||
## Block writes across generation stages
|
||||
|
||||
`PreLightChunkStage` represents the six statuses from empty through features.
|
||||
`TerrainChunk::set_block_worldgen` maintains the two world-generation maps through
|
||||
biomes, then the four final maps at terrain/features. Assigning a stage alone
|
||||
neither clears nor primes maps. Writes update existing selected maps first and
|
||||
then prime missing selected maps; maps belonging to earlier stages retain their
|
||||
stored values. This also preserves native behavior when an earlier stage is
|
||||
assigned again.
|
||||
|
||||
Run `python3 tools/test_chunk_stage_parity.py`. The
|
||||
[stage report](../benchmarks/rust-chunk-stage-2026-10-06/scoped-parity.json) records
|
||||
**8,090,090 matching lines per reference JAR** across 32 fixtures. Every pinned
|
||||
block state is inserted and removed under both map groups. The comparison uses
|
||||
actual `ProtoChunk.setBlockState` and persisted-status assignment, checking returned
|
||||
old states, chunk reads, map presence/heights, packed map words and raw sections.
|
||||
It also covers forward/backward transitions, explicit priming, empty-section AIR
|
||||
writes, out-of-height writes and wrapping X/Z coordinates.
|
||||
|
||||
This implements stage-dependent storage mutation. Scheduling, saved status
|
||||
metadata, retrogen, lighting, block entities and complete region behavior remain
|
||||
pending.
|
||||
@@ -0,0 +1,63 @@
|
||||
# World-generation value providers
|
||||
|
||||
Horizon implements the scalar distributions needed by the pinned Java Edition
|
||||
**26.3** cave and canyon definitions. `FloatProvider` supports constant, uniform
|
||||
and trapezoid distributions. `IntProvider` supports constant, uniform, biased and
|
||||
very biased distributions, trapezoids, recursively clamped sources and weighted lists.
|
||||
|
||||
Decoding retains vanilla numeric narrowing, field defaults and validation rules.
|
||||
Sampling preserves float operation order, wrapping integer bounds and the number
|
||||
of random draws. Symmetric integer trapezoids use vanilla's distinct two-draw
|
||||
subtraction path. Constant float codecs normalize both signed zeros to positive
|
||||
zero. Invalid random bounds return an error without silently replacing a result.
|
||||
|
||||
Run `python3 tools/test_value_provider_parity.py`. The
|
||||
[local report](../benchmarks/rust-value-provider-2026-10-06/scoped-parity.json)
|
||||
records **429,920 matching lines per vanilla JAR**, across **504 definitions** and
|
||||
**5,040 seeded fixtures**. The suite invokes actual provider codecs, reads declared
|
||||
bounds and compares up to 64 samples per valid fixture. Every sample is followed
|
||||
by a random long, checking draw consumption as well as output. Both random modes,
|
||||
signed zeros, overflow, equal/reversed ranges, negative plateaus, malformed fields,
|
||||
duplicate keys and sampling failures are covered.
|
||||
|
||||
Gaussian providers and canonical provider encoding remain pending. A local
|
||||
Gaussian-math probe found double-bit differences between the host Rust logarithm
|
||||
and the pinned JVM; using the system logarithm directly would not establish exact
|
||||
Gaussian parity.
|
||||
This scoped comparison does not establish complete carver or world-generation
|
||||
parity. Provider definitions use a bounded decoder; nested integer clamps are
|
||||
limited to depth 256 and 65,536 total provider nodes.
|
||||
|
||||
|
||||
## Anchored height providers
|
||||
|
||||
`HeightProvider` supports constant, uniform, biased, very biased, trapezoid and weighted
|
||||
heights using all four vertical-anchor kinds. Empty resolved ranges return the
|
||||
vanilla fallback without drawing randomness. Very biased heights preserve the
|
||||
guarded inclusive draws, while trapezoid heights retain their distinct sampling
|
||||
behavior even for symmetric bounds. Anchor resolution and bound arithmetic wrap
|
||||
as signed Java integers.
|
||||
|
||||
Run `python3 tools/test_height_provider_parity.py`. The
|
||||
[height-provider report](../benchmarks/rust-height-provider-2026-10-06/scoped-parity.json)
|
||||
records **507,660 matching lines per JAR**. The suite compares actual
|
||||
`HeightProvider.CODEC` parsing and up to 32 samples per valid definition/context,
|
||||
with subsequent random longs. It covers all four anchors, ordinary and overflowing
|
||||
generation contexts, empty/equal ranges, defaults and invalid inner/plateau fields,
|
||||
and anchor-versus-dispatch preference. Warning logs are excluded. Height-provider encoding remains pending.
|
||||
|
||||
|
||||
## Weighted choices
|
||||
|
||||
Weighted integer and height providers retain entry order, nested providers and
|
||||
zero-weight entries. Integer bounds include zero-weight entries even though they
|
||||
cannot be selected. Every selection consumes one bounded draw, including a
|
||||
singleton of weight one. Total weights must be positive and no greater than
|
||||
2,147,483,647; native constructor rejections are recorded as decode errors.
|
||||
|
||||
Rust stores cumulative weights and selects by binary search, avoiding allocation
|
||||
proportional to total weight. The differential suites cover totals on either side
|
||||
of vanilla's 64-weight selector threshold, maximum and overflowing totals, nested
|
||||
choices, malformed entries and exact subsequent random state. Each list is bounded
|
||||
to 8,192 entries, with a shared 65,536-node budget across nested provider decoding.
|
||||
Unit tests check those allocation limits and reject oversized branching trees.
|
||||
@@ -0,0 +1,22 @@
|
||||
# Vertical anchors
|
||||
|
||||
Horizon implements the pinned Java Edition **26.3** vertical anchors: absolute,
|
||||
above bottom, below top and relative to sea level. Runtime resolution preserves
|
||||
signed integer wrapping. Codec parsing and encoding enforce the vanilla field
|
||||
range, preserve decimal truncation and integer wrapping, and follow the nested
|
||||
exclusive alternatives even when multiple fields appear in one object.
|
||||
|
||||
`WorldGenerationContext` carries the minimum, height and sea level. Its generator
|
||||
adapter chooses the larger minimum and smaller height independently, matching
|
||||
vanilla; this differs from intersecting the vertical intervals.
|
||||
|
||||
Run `python3 tools/test_anchor_parity.py`. The
|
||||
[local report](../benchmarks/rust-anchor-2026-10-06/scoped-parity.json) records
|
||||
**181,632 matching output lines per reference JAR**, across **192 fixtures**,
|
||||
**74,112 codec inputs** and **107,328 runtime anchors**. The original Java
|
||||
transport calls the actual codecs, helper constructors and generation context,
|
||||
including the native noise-based chunk generator for bounds comparisons.
|
||||
|
||||
Sources and fixtures are hash-checked before publishing results. Raw reference
|
||||
output stays under `.local`. These tests cover anchor behavior and the three
|
||||
context values, not complete material rules, level access or JSON diagnostic text.
|
||||
@@ -67,7 +67,7 @@ terrain completion times alongside foreground performance and CPU use.
|
||||
## Hosted executor measurements
|
||||
|
||||
[Raw platform results](../benchmarks/worker-pacing-2026-10-03/) came from
|
||||
[CI run 37147381649](https://github.com/ludovic111/minecraft-optimization-lab/actions/runs/37147381649),
|
||||
[CI run 37147381649](https://github.com/ludovic111/Horizon/actions/runs/37147381649),
|
||||
using the 50,000-job workload and the revised overshoot credit. Median worker CPU
|
||||
seconds per elapsed second across three runs were:
|
||||
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
# Horizon world data
|
||||
|
||||
`crates/horizon-world` implements part of the Rust rewrite's storage layer for
|
||||
the repository-pinned Java Edition **26.3**, data version **5023**. It reads and
|
||||
exports region files and provides block-section access. Lighting, world generation,
|
||||
networking and rendering remain unimplemented. Scheduled block/fluid queues now
|
||||
integrate with saved tick lists, but their gameplay callbacks remain unimplemented.
|
||||
|
||||
## Commands
|
||||
|
||||
Build the standalone tools with `cargo build --release -p horizon-world`.
|
||||
The binary is `target/release/horizon-world` (`.exe` on Windows).
|
||||
|
||||
```sh
|
||||
target/release/horizon-world inspect /path/to/world/region/r.0.0.mca
|
||||
target/release/horizon-world get-block /path/to/world/region/r.0.0.mca 0 64 0
|
||||
target/release/horizon-world copy-region /path/to/world/region/r.0.0.mca /path/to/export/r.0.0.mca
|
||||
target/release/horizon-world copy-region /path/to/world/region/r.0.0.mca /path/to/lz4-export/r.0.0.mca lz4
|
||||
target/release/horizon-world edit-block-data /path/to/world/region/r.0.0.mca /path/to/edited/r.0.0.mca 0 64 0 minecraft:oak_log axis=y
|
||||
target/release/horizon-world nbt-copy /path/to/level.dat /path/to/level-uncompressed.nbt gzip none
|
||||
target/release/horizon-world --help
|
||||
```
|
||||
|
||||
Use offline input and a separate export directory. Output filenames must retain
|
||||
the source region coordinates. Existing destination regions and external chunk
|
||||
files are refused. An unchanged export preserves chunk payloads and timestamps;
|
||||
an explicitly recompressed export preserves decoded NBT values, subject to
|
||||
vanilla's canonicalization. Region allocation layout may change.
|
||||
|
||||
`get-block` reports the stored descriptor; string descriptors can omit default
|
||||
properties. `edit-block-data` changes an existing saved section's block data and
|
||||
preserves other chunk fields. It does **not** perform a gameplay placement:
|
||||
heightmaps, light, block entities, ticks and neighbor updates are not updated.
|
||||
The raw command accepts descriptors without validating them against a loaded
|
||||
registry. The library's `BlockRegistry::resolve` validates properties and
|
||||
supplies defaults, and `BlockSection` uses that registry for resident storage.
|
||||
|
||||
## Implementation
|
||||
|
||||
NBT handles all tag types, named and unnamed network roots, Java modified UTF-8
|
||||
including unpaired UTF-16 surrogates, and 26.3 heterogeneous list wrappers.
|
||||
Compound key order is not preserved; duplicate keys resolve to their last
|
||||
value. Java's negative-zero normalization on loading and NaN canonicalization
|
||||
on writing are reproduced. Defaults bound encoded/decoded NBT to 64 MiB,
|
||||
one million wire nodes and 512 container levels. These are application limits,
|
||||
not a reproduction of Java's allocation accounting or exception behavior.
|
||||
|
||||
Region codecs are gzip, zlib, uncompressed and **lz4-java block framing**.
|
||||
The latter includes the pinned library's 28-bit xxHash checksum adapter.
|
||||
Region headers, chunk lengths, sector overlap and external `.mcc` chunks are
|
||||
validated. Chunk coordinates use floor division at negative boundaries.
|
||||
|
||||
Exports build a temporary region, sync file content, then publish using a
|
||||
hard link that fails if the destination exists. Failed writers cannot publish;
|
||||
normal error cleanup removes their temporary and newly created external files.
|
||||
The filesystem must support hard links. This is an offline export mechanism:
|
||||
concurrent source modification, crash recovery, directory fsync and in-place
|
||||
save transactions are not implemented.
|
||||
|
||||
Saved palettes support uniform zero-bit sections and padded packed words for
|
||||
4,096 block entries or 64 biome entries. Resident `BlockSection` stores numeric
|
||||
state IDs through a shared, borrowed registry. Uniform sections have no word
|
||||
array. Changes reuse unused palette slots; replacing a unique value can update
|
||||
its slot without repacking 4,096 entries. Width changes repack only when needed.
|
||||
Explicit compaction removes unused slots and reduces the packed width.
|
||||
|
||||
The registry loader checks data version, duplicate states, default IDs and
|
||||
block-name coverage. The local oracle exports all 35,723 state identities and
|
||||
defaults from vanilla. This imports identities, not block implementations,
|
||||
shapes or behavior. Registry exports and game-derived fixtures stay in `.local/`.
|
||||
Chunk access requires data version 5023; older saves need an unimplemented
|
||||
data-fixing layer. `BlockRegistry::resolve` rejects invalid property descriptors. The separate
|
||||
[block-state JSON codec](block-state-codecs.md) reproduces vanilla property
|
||||
fallback for compact and full JSON forms.
|
||||
|
||||
`ChunkData::saved_ticks` reads `block_ticks` or `fluid_ticks`, resolves type
|
||||
identities through a caller-supplied registry lookup, and filters positions
|
||||
outside the chunk as vanilla does. `set_saved_ticks` writes a queue's packed
|
||||
relative delays while preserving other root fields. IDs here identify block or
|
||||
fluid types, not block states. Missing tick lists are empty. Numeric fields use
|
||||
vanilla's integer narrowing and floating-point conversion. Unknown types and
|
||||
malformed entries return errors; vanilla's logging/partial-result paths are not
|
||||
reproduced. [Scheduler integration and its separate suite](scheduled-ticks.md).
|
||||
|
||||
## Validation
|
||||
|
||||
```sh
|
||||
cargo test --workspace
|
||||
cargo clippy --workspace --all-targets -- -D warnings
|
||||
python3 tools/test_rust_parity.py --prepare
|
||||
python3 tools/test_world_parity.py
|
||||
python3 tools/test_tick_parity.py
|
||||
```
|
||||
|
||||
The world runner verifies the pinned artifacts, generates fixtures by invoking
|
||||
actual vanilla classes, processes them with Rust, and reads the results with
|
||||
both official client and server code. Each reference checks:
|
||||
|
||||
- 32 NBT format/codec conversions covering every tag type, UTF-16 edge cases,
|
||||
mixed lists, floating-point canonicalization and oversized byte arrays.
|
||||
- 44 edited/compacted palette cases, comparing 123,776 individual values across
|
||||
uniform, local and global vanilla palette transitions.
|
||||
- 48 region chunk reads covering four codecs, copying, recompression, a stored
|
||||
block edit, negative positions and oversized external chunks.
|
||||
- All 35,723 exported block-state IDs and their serialized registry data.
|
||||
- 8,192 resident values: a section with 4,096 distinct states, followed by the
|
||||
result of 100,000 mixed block replacements checked against an independent
|
||||
array of expected IDs. Rust additionally checks each returned old value,
|
||||
periodic compaction, every registry ID through one slot, and uniform collapse.
|
||||
|
||||
Offline tests cover malformed lengths, truncation, NBT limits, corrupt checksums,
|
||||
invalid palette indices, sector corruption, the inline/external size boundary,
|
||||
unknown-field preservation, failed-writer cleanup and destination collisions.
|
||||
CI runs both differential suites. Run artifacts and logs stay under
|
||||
`.local/rust-world-parity/`; a stale top-level success report is removed before
|
||||
each run. The checked-in [report](../benchmarks/rust-world-2026-10-05/scoped-parity.json)
|
||||
contains metadata and hashes only.
|
||||
|
||||
These are synthetic storage fixtures, not a generated world's full save/load
|
||||
lifecycle or playable integration test. They establish the reported tested
|
||||
scope; they do not establish complete vanilla parity or any FPS improvement.
|
||||
|
||||
|
||||
## Contained fluid states
|
||||
|
||||
`FluidStateTable` derives the fluid carried by each pinned block state: empty,
|
||||
water or lava, source/flowing identity, amount and falling status. Waterlogged
|
||||
copper grates carry falling source water. `FluidBlockBindings` binds constant-time
|
||||
conversion back to liquid block identities, including the collapse of liquid
|
||||
levels 8–15 to their shared falling-fluid block representation.
|
||||
|
||||
`FluidHeightWorld` supplies above-fluid and downward-face support queries.
|
||||
Ordinary height returns a full block when matching fluid is above; camera height
|
||||
first checks downward support above a source. Empty fluids skip world queries.
|
||||
Coordinates wrap as Java integers, and query failures preserve evaluation order.
|
||||
The adapter owns block-support geometry; this interface does not implement every
|
||||
block's support shape.
|
||||
|
||||
Run `python3 tools/test_fluid_parity.py`. The
|
||||
[fluid report](../benchmarks/rust-fluid-2026-10-06/scoped-parity.json) records
|
||||
**239,190 matching lines per JAR**. It compares all 35,723 block states, five fluid
|
||||
identities, every fluid-family pair, own-height bits, source/falling/full flags and
|
||||
legacy block conversion. The 40,344 world fixtures request 80,688 surface/camera
|
||||
height queries, including coordinate overflow and injected failures. The support
|
||||
fixtures use actual vanilla stone and air states. Fluid spreading, scheduled
|
||||
updates, entity interactions and rendering remain pending. Workspace tests,
|
||||
Clippy and 137 Python tests passed at this stage.
|
||||
@@ -0,0 +1,192 @@
|
||||
# World generation
|
||||
|
||||
Horizon targets the repository-pinned Minecraft Java Edition **26.3**.
|
||||
`horizon_world::worldgen::decode_noise` implements its direct normal-noise JSON
|
||||
codec. `DensityRegistry` decodes named density definitions and `NoiseRouter`
|
||||
loads the eight router roots against the same graph. `AquiferConfig` binds the six
|
||||
aquifer density roots, and `NoiseBasedAquifer` implements underground fluid and
|
||||
pressure selection. Complete terrain generation remains pending.
|
||||
|
||||
The decoder reads numeric tokens directly from `serde_json::value::RawValue`.
|
||||
This preserves decimal precision and the sign of integer `-0`, avoiding a
|
||||
double-precision intermediate before float density decoding. Integer
|
||||
fields retain Gson's truncation toward zero and wrapping to the low 32 bits,
|
||||
including decimal and exponent forms.
|
||||
|
||||
Noise definitions require a base octave in `[-32,32]`. Defaults are one octave,
|
||||
unit base amplitude, enabled normalization and an empty amplitude-modifier list.
|
||||
Octave counts range from 1 to 32. Nonempty modifier lists must contain exactly
|
||||
that many values. Amplitude bounds retain vanilla's floating-point comparator
|
||||
ordering: negative zero is below the modifier lower bound of positive zero.
|
||||
Normalization accepts booleans or the string `"legacy"`. Null optional fields
|
||||
use their defaults; unknown keys are ignored and duplicate keys retain the last
|
||||
value.
|
||||
|
||||
The API accepts strict JSON. Gson's additional permissive syntax is outside this
|
||||
decoder's scope. Construction failures return typed errors; comparison checks
|
||||
classification and values rather than Java exception messages.
|
||||
|
||||
After preparing the pinned artifacts, run:
|
||||
|
||||
```sh
|
||||
python3 tools/test_worldgen_parity.py
|
||||
cargo test --workspace
|
||||
cargo clippy --workspace --all-targets -- -D warnings
|
||||
```
|
||||
|
||||
The original Java transport uses vanilla's actual `NormalNoise.DIRECT_CODEC`,
|
||||
then its normal and legacy Nether initializers. The suite compares every bundled
|
||||
noise resource, six world seeds, both random streams and both initialization
|
||||
paths. Additional cases check codec defaults, normalization modes, field bounds,
|
||||
invalid types, nulls, duplicate/unknown keys, decimal integer conversion, signed
|
||||
zero and synthetic parameters. Comparisons include octave metadata,
|
||||
normalization/range bits, scalar noise and parent random state after success or
|
||||
failure. Raw registry contents and outputs remain private under `.local`.
|
||||
|
||||
The density loader resolves forward references into distinct immutable named
|
||||
holders. Numeric and object roots retain direct-value semantics. Its graph is
|
||||
loaded atomically, with typed errors for missing references and cycles. It
|
||||
implements the bundled function kinds, including nested splines, shifted noise,
|
||||
interval selection, rounding, surface searches and context-bound fields. Graph
|
||||
nesting and interval branches are bounded at 256; inline noise holders remain
|
||||
pending. These bounds are explicit limits of the Rust API.
|
||||
|
||||
The registry comparison decodes all **55 bundled density definitions** using
|
||||
vanilla's actual registry-aware codecs and the **64 bundled noise resources**.
|
||||
It compares ranges, axis dependencies, compilation failures, cache allocation,
|
||||
seeded scalar values and repeated strided volumes in raw and optimized modes.
|
||||
Density roots are checked through one compiler per seed and mode. Nonempty
|
||||
blending and structure fields are outside these fixtures.
|
||||
|
||||
The local run produced **961,693 matching output lines per reference JAR**. The
|
||||
[metadata report](../benchmarks/rust-worldgen-2026-10-06/scoped-parity.json) records
|
||||
source hashes, reference identities and resource digests. The runner authenticates
|
||||
both artifacts, verifies that their registry resources agree, removes stale success
|
||||
reports and rejects source or fixture changes during validation. CI includes the suite on
|
||||
its configured platforms; the recorded local run does not establish remote
|
||||
results or gameplay parity.
|
||||
|
||||
The router loader requires all eight fields in vanilla declaration order. It
|
||||
retains named holder identity and compiles every field through one shared cache
|
||||
namespace. Failed router decoding leaves the registry graph intact. All seven
|
||||
bundled preset routers now match the pinned JARs across six seeds,
|
||||
both random algorithms and raw/optimized compilation. Single-layer surface
|
||||
volumes and invalid multilayer surface requests are both checked. This API
|
||||
decodes the router
|
||||
object. The vertical `NoiseSettings` and optional `aquifers` members are also decoded;
|
||||
complete generator settings and material configuration remain pending.
|
||||
|
||||
`NoiseSettings` in 26.3 contains only minimum Y and height. Its JSON fields are
|
||||
bounded to `[-2032,2031]` and `[0,4064]`. The guard checks the wrapped upper limit
|
||||
first, then height alignment and minimum alignment to 16. The runtime create
|
||||
helper applies those guards without the JSON field bounds. Height-accessor
|
||||
clamping retains wrapped arithmetic, unaligned results and negative heights for
|
||||
disjoint ranges. The suite compares bundled noise members, runtime and codec
|
||||
construction, integer conversion and extreme accessor bounds.
|
||||
|
||||
Climate sampling converts quart positions to block coordinates with wrapped
|
||||
32-bit shifts, evaluates all six fields in order with the same context, and
|
||||
quantizes using float multiplication followed by Java's saturating long cast.
|
||||
The suite compares vanilla's actual climate sampler binding and 4,116 quantization
|
||||
fixtures covering random float bits, subnormals, NaNs, infinities and saturation.
|
||||
The climate parameter decoder accepts scalar intervals, two-element lists and
|
||||
objects with `min`/`max` fields. Endpoints use directly parsed floats in `[-2,2]`,
|
||||
with Java float comparator ordering before quantization. Parameter points require
|
||||
all six coordinates and an offset in `[0,1]`; negative-zero offsets fail that
|
||||
lower bound. Codec comparisons include precision-sensitive decimals, missing
|
||||
fields, invalid types and duplicate keys.
|
||||
|
||||
The immutable climate search tree now reproduces vanilla's stable construction
|
||||
order, 19-child default, wrapped interval distance and squared fitness, pruning,
|
||||
and previous-result tie handling. A searcher owns its previous leaf and borrows
|
||||
one index, preventing cache reuse across unrelated indices. Indexed and brute
|
||||
lookup intentionally retain their respective tie behavior. The suite compares
|
||||
all supported branching values 2..32, sizes around branch powers, duplicate
|
||||
entries, a 65,536-entry tree and extreme signed-long ranges/targets. The entry
|
||||
bound and typed failures are explicit Rust API limits.
|
||||
|
||||
`MultiNoiseBiomeSource` resolves biome identifiers through scalar climate sampling
|
||||
and prepared quart volumes. Bulk preparation evaluates six fields in declaration
|
||||
order and retains their float buffers; each query quantizes those stored values.
|
||||
Scalar and bulk queries share one previous-result state, so their query order
|
||||
retains vanilla's tie behavior. The bounded API rejects coordinates outside a
|
||||
prepared volume.
|
||||
|
||||
The runner exports built-in parameter tables independently from both authenticated
|
||||
JARs, requires them to agree and keeps them private. These contain 7,594 Overworld
|
||||
entries covering 56 biome identifiers and five Nether entries. Rust loads the
|
||||
quantized tables using a Horizon import format. This is an import of built-in
|
||||
data; the preset builders and vanilla biome codecs remain pending. The reference
|
||||
uses actual `MultiNoiseBiomeSource` resolvers with keyed registration holders.
|
||||
These checks resolve identities without evaluating biome properties or gameplay.
|
||||
Both tables are exercised against every router, including cross-preset fixtures;
|
||||
this does not establish End biome-source behavior.
|
||||
|
||||
The report records table and fixture digests. Source or private fixture changes
|
||||
during a comparison invalidate its success report.
|
||||
|
||||
The global fluid picker and disabled-aquifer path are now implemented. Lava
|
||||
selection uses Y below `min(-54, sea_level)`; other positions use the default
|
||||
fluid status. Fluid status lookup returns its state only below its level.
|
||||
Disabled aquifers use the default solid block for positive density;
|
||||
nonpositive or NaN density calls the picker, and this path never schedules fluid
|
||||
updates. The reference comparison uses the actual global picker lambda and
|
||||
`Aquifer.createDisabled`, counting picker calls and checking default state
|
||||
identities. Regular-mode fixtures cover sea-level cutoffs, extreme coordinates,
|
||||
subnormal density, signed zeros, NaNs and infinities. Developer fluid-disable
|
||||
behavior is outside this corpus.
|
||||
|
||||
The noise-based aquifer implementation retains the six-field configuration's
|
||||
binding order, seeded positional cell generation, nearest-cell ties, pressure
|
||||
barriers, surface sampling, fluid levels and update scheduling. One context is
|
||||
shared across all density roots. Cell locations and statuses belong to each
|
||||
chunk aquifer; surface values are snapped to quart coordinates and cached.
|
||||
Global fluid statuses use exact state identity where vanilla does, while lava,
|
||||
water and air predicates classify blocks, including nondefault liquid states,
|
||||
cave air and void air. Dry cells use the version's `WAY_BELOW_MIN_Y` value
|
||||
`-32512`; this differs from the global developer-disable status's `-4064`.
|
||||
|
||||
The Rust API limits grids to 16,777,216 cells and constructor surface volumes to
|
||||
2,097,152 samples, checks array bounds and returns typed errors. It preserves
|
||||
wrapped grid indexing within that domain, including vanilla's final-index
|
||||
aliasing. Allocation failures and invalid oversized grids are outside the
|
||||
comparison corpus. Read-only cache inspection does not populate caches.
|
||||
|
||||
The noise-based comparison uses actual vanilla configuration decoding and aquifer
|
||||
construction. It checks fluid states, scheduling flags, sampler call order and
|
||||
values, global picker calls and final location/status/surface caches. Fixtures
|
||||
include all bundled aquifer configurations, both seeded random factories,
|
||||
strided volume extents, repeated/reversed queries, nonfinite density/sampler
|
||||
values, malformed roots and injected failures followed by retries. The runner
|
||||
requires every injected failure to occur. Developer fluid-disable behavior is
|
||||
outside these regular-mode checks. This does not validate complete generated
|
||||
chunks or the registry-backed block classification adapter independently.
|
||||
|
||||
`TagDefinitions` decodes tag entries and files, applies resource-stack replacement,
|
||||
and resolves required and optional dependencies before building ordered, deduplicated
|
||||
memberships. Missing required references omit the affected tag while unrelated tags
|
||||
remain available. Lookup order and required flags retain the pinned runtime's hash
|
||||
bucket and dependency traversal behavior. A valid JSON resource that fails its tag
|
||||
codec can introduce an empty tag; invalid replacement leaves earlier entries intact.
|
||||
|
||||
The comparison checks all **300 bundled block-tag files** against **1,286 block
|
||||
identifiers** exported independently from both JARs. Synthetic fixtures cover
|
||||
replacement, malformed files, missing references, cycles, duplicate members and
|
||||
lookup order. The API is bounded to 8,192 definitions and dependency depth 256;
|
||||
Java hash-tree buckets and pathological self-recursive dependency searches remain
|
||||
unsupported. These checks cover tag loading, not the gameplay behavior of members.
|
||||
|
||||
The separate [heightmap implementation and comparison](heightmaps.md) now checks
|
||||
all six types, packed data, updates and priming against actual vanilla chunks.
|
||||
|
||||
The [noise-fill stage](terrain-filling.md) now integrates final density, aquifers,
|
||||
registry-backed sections, world-generation heightmaps and fluid postprocessing.
|
||||
Complete terrain still requires material and surface rules, nonempty world fields,
|
||||
biome/feature/structure placement and complete generated-chunk validation. No rendering, frame-rate or complete gameplay claim follows from
|
||||
these decoder checks.
|
||||
|
||||
|
||||
Subsequent [biome lookup and chunk suites](biome-lookup.md) now validate fuzzy
|
||||
block-to-quart selection, section-atomic biome fills and multi-noise chunk
|
||||
assignment through actual `ChunkGenerator.doCreateBiomes`. The original report
|
||||
above remains a record of its narrower tested source snapshot.
|
||||
Reference in New Issue
Block a user