Author SHA1 Message Date
Fr0zkaandClaude Opus 5.5 f23ab7b9fa wip(L28): passage columns/routes culled per tile (BVH); cost back near L24, bit-identical to L27
GenerateMesh scopes passage queries to the tile's sample bounds with a feature AABB BVH plus
per-passage segment BVHs; L9 proof boxes use a passage-bound BVH. Whole view vs L24: FI ~0%, SW
+3.7% (reviewer interleaved). All hashes equal L27; all passage/route/proof audits pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CSFYgsdW8ejZSyiMf4qRSX
2026-10-21 07:42:16 +02:00
Fr0zkaandClaude Opus 5.5 07b3fe2852 wip(L27, side branch): passages cross open voids inside shared natural rock columns
Unsupported passage runs > 12.5 m become a solid relief-bearing column (ceiling/island to
ground, flared base) with the helix inside, for every recipe; FI anchor uses the same path.
All 4 styles x both recipes: 0/0/0, 0 open-air, naturalness pass; no-long-bridge audit (L26
fails it). Deterministic, Clang = GCC. Look approved; cost +35% SW / +19% FI blocks merge (L28).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CSFYgsdW8ejZSyiMf4qRSX
2026-10-21 04:14:14 +02:00
Fr0zkaandClaude Opus 5.5 37a223046c wip(L26, side branch): every passage style walkable in both recipes (0/0/0); SW bridges look wrong
All 4 styles x both recipes pass capsule, open-air and naturalness audits, and full-view hashes are
deterministic. But the SW passage crosses 355 m of open SurfaceWorld sky as a ~2 km fragmented rock
ramp, which is not natural. L27 replaces long bridges with a shared ceiling-to-ground rock column.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CSFYgsdW8ejZSyiMf4qRSX
2026-10-21 02:39:44 +02:00
Fr0zkaandClaude Opus 5.5 ef789aaa00 wip(L25, side branch): FI helix enclosed in a 13 m rock root; support never created in open air
Fixes the L24 ribbon (owner request). NOT merged: the open-air support gate leaves ~4,000 unsupported
samples on every SurfaceWorld-recipe passage style (TN -> SW), a walkability regression. L26 fixes that
on this branch. See Linux25/REPORT.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CSFYgsdW8ejZSyiMf4qRSX
2026-10-21 00:38:57 +02:00
Fr0zkaandClaude Opus 5.5 cb9236c265 wip(assembler): round L24 -- per-strate passage styles; natural Worm default; FI anchor island
Core plans inter-strate passages from each upper strate's FStratePassageConfig for every
generator: Straight / Worm (the new natural default: meander, variable radius, rough walls) /
Spiral / Cascading. A naturalness audit (no >8 m flat runs, >=0.20 m wall relief) fails on L23's
smooth tube. FloatingIslands selects Spiral, with a deterministic unique anchor island (ordinal 2)
joined to the bedrock floor by a rock root. The SW arrival no longer stamps flat shelves.
Capsule audits 0 blocked / 0 unsupported / 0 grade failures, all styles. Full-view hashes
deterministic W1/W8/W12, Clang = GCC (reviewer re-run). Evaluator 10, FI geometry 5.
KNOWN: the FI helix renders as a spiral ribbon in open air around the pillar instead of a tunnel
enclosed in rock; fix next round. Unreal edits uncompiled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CSFYgsdW8ejZSyiMf4qRSX
2026-10-20 21:42:21 +02:00
Fr0zkaandClaude Opus 5.5 71d09a8c52 wip(assembler): round L23 -- inter-strate passages planned from the resolved layout and carved
After L22 the FI -> SW passage no longer connected the strates (legacy owner-voxel coordinates,
lower end 23 m above SW), and Core never carved passages through the bands. Now the director
plans passages from the resolved layout (PlanResolvedLayoutPassagesV1; deterministic hash of
seed/strates/connection; placement disk from PassageConfig, 8-24 m around (0,0)); shared
composition applies generator field -> bands -> bounded passage carve and support shelf, opening
the bands only along the tunnel. Mouths bind to the strate routes. Capsule audit: 0 blocked /
0 unsupported (325,962 samples FI, 284,319 TunnelNetwork), negative controls detected; all 8
generator kinds exercised. SW away from the passage is bit-identical. Layout V3, evaluator 9.
Open: look not yet natural (stepped tube in FI void, terraced SW arrival); SW-as-upper route
planning fails; Unreal adapter uncompiled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CSFYgsdW8ejZSyiMf4qRSX
2026-10-20 18:22:12 +02:00
Fr0zkaandClaude Opus 5.5 55c26a05a7 wip(assembler): round L22 -- one 8 m layout chunk for every strate; real ceiling -> content -> bedrock
StrateLayoutChunkSizeMeters (world setting, default 8 m; owner decision) is resolved once in
the director/adapter and standalone loader; every generator reads the resolved width (no
CHUNK_SIZE / Core-tile inference). Every strate gets solid ceiling and bedrock bands from its
BoundarySealThickness in the shared composition path (diggable by default); faces come from the
shared boundary path. Owner world: FloatingIslands +8..-120 m (128 m, now with a bedrock floor),
SurfaceWorld -120..-632 m (unchanged; full-detail and exact-query hashes equal L21); the 60 m gap is
gone. The strict layout validator passes on the real world, with 0 endpoint dispatch
disagreements. Spawn/benchmark camera derived from route.front. Ledges under the islands gone
(reviewer capture). Evaluator 7, recipe schema 2, layout snapshot 2, FI geometry 4.
Open: SW cap profiles exceed the ceiling band (owner call); transitions still Hard; Unreal
setting/manager/adapter edits uncompiled here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CSFYgsdW8ejZSyiMf4qRSX
2026-10-20 12:03:14 +02:00
Fr0zkaandClaude Opus 5.5 8753f6dbe4 wip(assembler): round L21 -- resolved strate layout snapshot + validator (no world change)
Core ResolvedLayoutSnapshotV1 (canonical JSON, stable identity): per strate stable ID, generator,
recipe, interior bounds in metres, ceiling/bedrock bands as Core really applies them, transition
mode/width, dispatch provenance. Validator: compat mode reports today's deviations; strict mode
enforces ceiling -> content -> bedrock -> next ceiling (owner rule), two separate bands, nominal
contiguity, interpenetration only within the declared EVoxelStrateTransition width; 7 negative
controls rejected. Findings: SW built at -120..-632 m although the params say -60 m; a 60 m unowned
gap filled by analytic FI fallback; no active bedrock bands; transitions ignored by Core.
All L19 hashes unchanged (28 + 14 crossing runs). The Unreal adapter exports resolved_layout
(uncompiled here).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CSFYgsdW8ejZSyiMf4qRSX
2026-10-20 10:22:00 +02:00
Fr0zkaandClaude Opus 5.5 5d5447dc32 docs(assembler): Sol 6.1 review of the L20 strate/units design
Verdict: direction right; preserve today's bounds as compatibility data but reject overlaps in new
layouts; approve the LOD2 boundary fix with a precise affected region; one director-owned vertical
partition (strate interior / shared bedrock band / explicit void); bedrock = solid volume + explicit
LOD-stable surface; first step = versioned resolved-layout snapshot + validator, no output change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CSFYgsdW8ejZSyiMf4qRSX
2026-10-20 09:20:33 +02:00
Fr0zkaandClaude Opus 5.5 6f9c7bd652 docs(assembler): round L20 -- design for director / generators / mesher, layout in metres
Standalone/DESIGN_STRATA_UNITS_AND_LAYERS.md: maps today's code to the three layers, ranks 9
violations (top: no single physical stratum-bounds/interface record; SurfaceWorld 8 m vs
FloatingIslands 4 m per chunk), defines the director-resolved generator request/result contract,
moves seals/caps/voids/interfaces into shared composition, and proposes an explicit LOD-stable
interface surface for the L19 ledges. 6-step migration plan with "worlds don't move" checks;
owner decisions listed. No code or world change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CSFYgsdW8ejZSyiMf4qRSX
2026-10-20 08:53:03 +02:00
Fr0zkaandClaude Opus 5.5 811c4b7b17 wip(assembler): round L19 -- strate ceilings closed at every LOD; ledges diagnosed
The shared boundary-cap path now emits a cap wherever the field is solid just below a strate's
configured top (it previously required a solid-to-air crossing there) and checks a 5x5 perimeter
grid before suppressing a fallback cap. Strict audit: 0 misses / 0 edge gaps, LOD0-8.
farHorizonVersion 3 -> 4. SurfaceWorld LOD0-2, full detail and exact queries unchanged; 28/28
matrix plus 14/14 crossing; route parity and proofs pass.
Ledges: the lower stratum's terrain at the FI/SW interface, seen through the FI void, sampled at
0.5/1/2 m at LOD1-3 (up to 1.5 m / 7.7 m ring steps). Fix deferred to the units/layers round.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CSFYgsdW8ejZSyiMf4qRSX
2026-10-20 08:46:29 +02:00
Fr0zkaandClaude Opus 5.5 dcf0763ec5 wip(assembler): round L18 -- FloatingIslands false floors removed; shared strate ceiling
FI geometry v3 drops the all-XY lower boundary seal that created false floors (3.5/8 m); the
ceiling comes from the shared VF_ApplyUpperBoundarySeal and AppendStratumBoundaryCeilings path
for every generator, at each strate's own configured upper boundary (owner: every strate has a
ceiling). Far-LOD ceiling continuity: 0 gaps at LOD4-8. SurfaceWorld bit-identical to L14
(14 configs + 24 m crossing); FI deterministic (28-row matrix); route parity and proofs pass.
Unreal: FI geometryVersion 2->3 and the shared upper-seal helper extracted (UBT compile needed on
the owner PC). Open: small ceiling holes; lower-stratum LOD ring steps seen through the FI void.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CSFYgsdW8ejZSyiMf4qRSX
2026-10-20 07:55:53 +02:00
Fr0zkaandClaude Opus 5.5 87041290dd docs+tool(assembler): round L17 report; readable shading in the Linux capture tool
The capture tool gains --shade=readable (directional light, soft ambient, height tint) and an
optional --tile-edges overlay; display only. The L17 Core fix is NOT merged: its owner/Core chunk
scale change (8 m -> 4 m) moves every stratum and leaves the SurfaceWorld spawn camera over a void
(reviewer before/after renders). Kept on wip/l17-fi-scale. The FloatingIslands full-XY
boundarySeal cap is the likely real cause of the false floors and needs a separate minimal fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CSFYgsdW8ejZSyiMf4qRSX
2026-10-20 05:53:17 +02:00
Fr0zkaandClaude Opus 5.5 9a7c87e47b docs(assembler): round L16 report -- disk terrain cache design + prototype (code on side branch)
Lossless zlib halves the size; loaded tiles are exact; corrupt/stale files are rejected and
regenerated; zero cost when off. Code is on wip/l16-tile-cache until it is made Windows-safe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CSFYgsdW8ejZSyiMf4qRSX
2026-10-20 04:19:56 +02:00
Fr0zkaandClaude Opus 5.5 a6cd7cf339 docs(assembler): round L15 report -- no far-mesh saving fits the owner's pixel budget
Refine x2 at LOD4-8 would save 13.6% of whole view but smooths far crests and opens holes
(gate and captures agree); connector shortcuts open gaps. Default far output is unchanged; the
code is on side branch wip/l15-far-budget.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CSFYgsdW8ejZSyiMf4qRSX
2026-10-20 03:29:14 +02:00
Fr0zkaandClaude Opus 5.5 a176d0743a wip(assembler): round L14 -- far-LOD cost counted; no exact-output lever above 3% (opt-in counters)
Plain W12 far work: LOD6 2.59, LOD8 2.05, LOD4 1.57, LOD5 1.41, LOD7 1.16 worker-s. Ground/cap
refinement ~3.95 worker-s and LOD6 connector repair 1.40 worker-s (82% uncached formula calls)
build visible geometry; no bit-identical reduction proved. Adds opt-in far-shell column counters
(reviewed: no cost when off, interleaved 1.429 vs 1.419 s). All hashes, the crossing hash and route
parity are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CSFYgsdW8ejZSyiMf4qRSX
2026-10-20 02:33:48 +02:00
Fr0zkaandClaude Opus 5.5 976d012a86 wip(assembler): round L13 -- one density field for every route (multiplayer determinism fix)
Region pages fell back to the legacy GetDensityAt evaluator while the base shape used the Core
manifest field, so a tile's density (and sometimes mesh) depended on streaming history. Pages
are now bound to their world's base FStandaloneShapeWorld evaluator before publication; density,
lattice, detail, classification and solid queries all delegate to it. WorldAssemblyEvaluatorVersion
5 -> 6. Route-parity audit: fails on L12 (5/5); after the fix 0 mismatches over 87 tile pairs
(base/page, base/native-only, edited, two histories), 56 exact-query pairs, 2.3M page samples,
4 seeds/recipes. Page-tile proof audit: 1,274 blocks, 0 violations. The spawn and island worlds
are unchanged; crossing output changed as intended. Reviewer interleaved spawn: +1.1% (noise).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CSFYgsdW8ejZSyiMf4qRSX
2026-10-20 01:54:54 +02:00
Fr0zkaandClaude Opus 5.5 32b8670833 wip(assembler): round L12 -- region pages keep LOD1 block proofs: 24 m crossing 5x faster
Analytic region pages now retain the immutable shared manifest, so LOD1 page tiles get the L9
uniform-block proofs (71.7 -> 5.6 ms per tile). Reviewer W12 no-hash: 24 m crossing 0.898 ->
0.166 s; Luna: 1 km 5.89 -> 1.25 s. Spawn unchanged; all L1/FloatingIslands hashes and the 24 m
crossing hash unchanged (W1/W12).
KNOWN BUG (pre-existing, measured here): the same tile key yields different density from the base
shape (manifest field) than from a region page (legacy field), sometimes different mesh too, so
output depends on streaming history. To be fixed in L13.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CSFYgsdW8ejZSyiMf4qRSX
2026-10-20 01:07:47 +02:00
Fr0zkaandClaude Opus 5.5 b1cfaf53b8 wip(assembler): round L11 -- fix 24 m+ crossing crash; near ring ready 2x sooner at spawn
Crash: crossing tiles were coalesced into one huge rectangle, and BuildSpatialBins tried to
resize to ~4.3e17 bytes (std::bad_alloc; the L7 32 m failure had the same cause). Analytic
regions now skip unread dense bins and compile in world-aligned 128-voxel pages, published
together; out-of-range keys error before allocation. 24 m, 32 m and 1 km crossings pass
(1 km: 72 pages, peak RSS 700 MiB).
Spawn: World::isTileShapeFree proves LOD0 SurfaceWorld tiles that never read the cave shape;
those start before shape compile, and all others wait. Reviewer W12 no-hash: near ring 0.337 ->
0.159 s, whole view +2.1%. All SurfaceWorld/FloatingIslands hashes unchanged (W1/W8/W12, both
compilers, forced-overlap run). Unreal VoxelWorld.cpp adapter changed but NOT built here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CSFYgsdW8ejZSyiMf4qRSX
2026-10-20 00:28:58 +02:00
Fr0zkaandClaude Opus 5.5 b370908174 docs(assembler): round L10 report -- spawn waits on the full shape; 24 m crossing hits bad_alloc
First tile starts ~300 ms after cold start: plan 51 ms (serial), shape compile 223 ms (caves,
signs, detail band, far parents). The first SurfaceWorld tiles use the native heightfield and do
not read that shape, but generateTile requires the full base shape. 8/16 m crossings repeat no
compile (61 ms for 288 tiles); a 24 m crossing died with std::bad_alloc under the 6 GiB
address-space cap (cause unknown). Telemetry not committed (+1% when off).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CSFYgsdW8ejZSyiMf4qRSX
2026-10-19 23:44:52 +02:00
Fr0zkaandClaude Opus 5.5 7650abb755 wip(assembler): round L9 -- LOD1 skips proven-uniform blocks: 95% fewer samples, view ~2% faster
Step-2 (LOD1) tiles of native SurfaceWorld now prove 8-cell blocks uniform from exact heightfield
column extrema over the padded block (cells + normal halo) and skip their density fill; features,
edits, mixed strata and Unknown verdicts still fill. LOD1 samples 42,875 -> 2,063 per tile.
Audit: 80,502 skipped blocks (3 seeds) + 9,216 island blocks force-filled, 0 violations. All
SurfaceWorld and FloatingIslands hashes unchanged at W1/W8/W12, Clang off and GCC default.
Reviewer interleaved W12, no hashing: whole view 1.439 -> 1.409 s. L8 phase probes removed;
--profile-lod-work and --audit-uniform-block-proofs are opt-in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CSFYgsdW8ejZSyiMf4qRSX
2026-10-19 23:14:16 +02:00
Fr0zkaandClaude Opus 5.5 82813fb13b docs(assembler): round L8 report -- where the time goes after the shared cache
W12 L1 view: tile work 17.3 worker-s finishes 4 ms from ideal 12-way scaling; the remaining
~0.28 s is startup (shape compile 215 ms). Largest lever: LOD1 density-grid fill (3.35 worker-s;
proof blocks are gated to steps 1 and 8). LOD6's 4x columns = far connector-shell repair (1.38
worker-s). No code committed: the diagnostic instrumentation stays uncommitted for L9.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CSFYgsdW8ejZSyiMf4qRSX
2026-10-19 22:10:05 +02:00
Fr0zkaandClaude Opus 5.5 4b1108bf86 wip(assembler): round L7 -- shared column cache across workers: whole view 16-19% faster, world unchanged
SharedColumnCache.h: a world-owned, bounded 4-way second-tier cache of exact column values
(heightfield and floating islands), keyed by recipe/plan identity plus content hash, XY and island
id. Lock-free seqlock reads; set-local spin lock on misses. The FLazy thread-local tier stays
first. 83.6% of repeated column work was cross-worker; formula evaluations -60.9%.
W12 L1 view: Luna 2.165 -> 1.754 s; reviewer interleaved 2.059 -> 1.722 s. 8 m crossing new tiles
82 -> 52 ms. +66 MiB peak RSS. All hashes (whole view, per-LOD, exact queries, islands seed 0)
identical at W1/W8/W12, Clang off and GCC default. MSVC/UBT not compiled here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CSFYgsdW8ejZSyiMf4qRSX
2026-10-19 21:46:15 +02:00
Fr0zkaandClaude Opus 5.5 9898e057fd wip(assembler): rounds L5+L6 -- Linux far-terrain captures and screen-space gate (world unchanged)
Linux offscreen capture (EGL/GLES pbuffer; llvmpipe in the sandbox) and an opt-in screen-space gate
for LOD>=3 (normal distance projected at each LOD's closest display distance, 1 px at 1440p =
0.61 mrad). The gate rejects the S13 octave-drop and stride-2 controls, fault injections, and a
vertical-vs-screen control. Finding: today's far meshes differ from the field by up to 92 px, and
LOD swaps snap mesa rims by tens of px (p50 0 px), a silhouette effect of plain LOD switching. The
octave cutoff was dropped: nothing qualified, and octaves are a small share of far time. Off-path
cost: reviewer interleaved W12 within noise vs L4 (+0.6% median). Hashes = L4.
Largest far lever measured: column work outside noise, 34% of far worker time (duplicate XY across tiles).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ED33VnqepD4YY6gDAAA832
2026-10-19 21:10:08 +02:00
164 changed files with 16582 additions and 616 deletions

No files matched your search

+259 -5
View File
@@ -73,7 +73,7 @@ is the only density path; a degenerate (zero-height) strate has none and is open
| Maze | `FMazeGenerationParams` | `BuildMazeStack` | origin-directed spanning-tree corridors on a 3D lattice, with capped loop edges and a thread-local per-cell capsule cache | | Maze | `FMazeGenerationParams` | `BuildMazeStack` | origin-directed spanning-tree corridors on a 3D lattice, with capped loop edges and a thread-local per-cell capsule cache |
| SurfaceWorld | `FSurfaceGenerationParams` | `BuildSurfaceStack` | heightfield terrain: domain-warped continents+ridged mtns+detail, a low-freq **relief map** (`M`) that scales mountains/elevation for plains↔highland variety, **F20 heightfield terrain ops** (`Surface|Ops` — all default off ⇒ byte-identical): **Cliff** (slope-gated steepening — where the analytic structural slope > `CliffSlopeThreshold`, push the height away from the local mean by `CliffSharpness` ⇒ gentle slopes become sheer walls/canyon faces that hug real steep ground, gentle areas untouched; 4 structural resamples only when enabled), **Terrace** (relief-gated plateau quantize + `TerraceHardness` soft-round↔crisp-mesa), **LayerLines** (sedimentary sine shelves, slope-expressed) — pure per-column height remaps in the single oracle `ComputeSurfaceTerrainZ` (`SampleSurfaceStructuralZ` = pre-op raw height, re-sampled at an XY offset for Cliff's slope), biome-selected + border-blended for free via each biome's `SurfaceParams` + the height output-lerp; plus **phase-2 Overhang** (the first VOLUMETRIC op — real jutting shelves like a cliff lip): in `FOverhangShelfMod`, for AIR voxels in the window `(TerrainZ, TerrainZ+OverhangHeight]` above a steep slope, the heightfield is re-sampled UPHILL (toward the cliff) by a reach that GROWS with height and unioned in. Low in the window the shift is ~0 (borrows nearby low rock ⇒ stays air over the void); high up it reaches the far cliff (solid) ⇒ a shelf attached to the cliff, tapering out over the void with air underneath. Per-column `OverhangAmp`(=strength·slope-gate) + unit uphill dir `(DirX,DirY)` are resolved once in `ComputeSurfaceColumn` — the gradient sampled at the REACH scale (`OverhangReach`) so a point out over the void can "see" the cliff to know which way is uphill — and cached on `FSurfaceColumn`. It's genuine 3D (per-voxel structural re-eval), so it's gated hard to steep overhang columns; the union only ADDS rock (never removes), capped at `TerrainZ+OverhangHeight`, so `ClassifyTile` forces Mixed only in `(TerrainZ, TerrainZ+OverhangMargin]` (upward-only; margin = max `OverhangHeight`) — a shelf never holes a trivially-skipped tile, and only the thin cliff-edge band of air tiles is woken (NOT far-field like phase-3 spikes/holes). Overhang undersides classify as ground rock by the F17 rule (down-facing but below `TerrainZ`). Known v1 limit: applies at all LODs (Step-agnostic) — may alias far; gate to fine tiles later. Beaches at water line, high sky-cap ceiling. The cap is shapeable terrain in its own right (`ComputeSurfaceCeiling`, `Surface|Sky` params: `CeilingUndulation` broad inverted hills/valleys, `CeilingRidgeStrength` hanging ridgelines, `CeilingRoughness`+freq fine bumps, `CeilingWarp*`) — defaults (strengths 0, freq 0.04) = old flat-ish cap. (`Surface|Macro` params = the cheap precursor to biomes; `ReliefStrength=0` ⇒ old uniform terrain.) **Sky-cap vs ground is a PER-TRIANGLE surface class (F17), not a per-tile verdict**: the mesher classifies each unique vertex on the **worker** — only down-facing verts (`N.Z<-0.1`) pay a memoized `GetSurfaceHeightAt` column query; nearer `CeilSurf` ⇒ sky-cap, nearer `TerrainZ` ⇒ terrain overhang stays ground (a future SurfaceWorld cave roof — down-facing but below `TerrainZ` — also lands ground by the same rule; non-surface strates always ground). Triangles take the majority class of their 3 verts and are packed as **two contiguous index runs** (ground then cap, `FVoxelMeshData::NumCeilingTriangles`; skirts inherit their source triangle's run) → RMC **polygroups 0/1** → one **section per non-empty group** (`ApplyMeshToTile`, material slot = group index): slot 0 = strate `OverrideMaterial`/default (min-corner chunk), slot 1 = `CeilingMaterial` resolved at the tile's **TOP chunk** (mid as gap fallback, then min; fallback: ground material) — a coarse tile is 2^level chunks tall, so its min corner can sit in a lower strate/gap while the cap belongs to the strate above (this was the "far cap = ground material" residue), so the shadowless overhead rock is tinted separately instead of reading flat/bright. Shadow is **per section** via `FRealtimeMeshSectionConfig::bCastsShadow` (NOT the component `SetCastShadow` — RMC's proxy ignores the component flag; this is also why level≥2 far tiles only stopped casting once the section flag was wired): ground casts at level≤1, the cap section never casts, so the rock ceiling never shadows the terrain below it. History: v1 was a game-thread centre height-oracle (misclassified coarse far tiles → terrain material on the cap underside); v2 a whole-tile worker normal VOTE — which painted **mixed coarse tiles** (one far tile spanning terrain AND cap) entirely with the winner's material, and put sky material under terrain overhangs. The per-triangle class fixes both and is the identity channel caves/F8 will reuse. | | SurfaceWorld | `FSurfaceGenerationParams` | `BuildSurfaceStack` | heightfield terrain: domain-warped continents+ridged mtns+detail, a low-freq **relief map** (`M`) that scales mountains/elevation for plains↔highland variety, **F20 heightfield terrain ops** (`Surface|Ops` — all default off ⇒ byte-identical): **Cliff** (slope-gated steepening — where the analytic structural slope > `CliffSlopeThreshold`, push the height away from the local mean by `CliffSharpness` ⇒ gentle slopes become sheer walls/canyon faces that hug real steep ground, gentle areas untouched; 4 structural resamples only when enabled), **Terrace** (relief-gated plateau quantize + `TerraceHardness` soft-round↔crisp-mesa), **LayerLines** (sedimentary sine shelves, slope-expressed) — pure per-column height remaps in the single oracle `ComputeSurfaceTerrainZ` (`SampleSurfaceStructuralZ` = pre-op raw height, re-sampled at an XY offset for Cliff's slope), biome-selected + border-blended for free via each biome's `SurfaceParams` + the height output-lerp; plus **phase-2 Overhang** (the first VOLUMETRIC op — real jutting shelves like a cliff lip): in `FOverhangShelfMod`, for AIR voxels in the window `(TerrainZ, TerrainZ+OverhangHeight]` above a steep slope, the heightfield is re-sampled UPHILL (toward the cliff) by a reach that GROWS with height and unioned in. Low in the window the shift is ~0 (borrows nearby low rock ⇒ stays air over the void); high up it reaches the far cliff (solid) ⇒ a shelf attached to the cliff, tapering out over the void with air underneath. Per-column `OverhangAmp`(=strength·slope-gate) + unit uphill dir `(DirX,DirY)` are resolved once in `ComputeSurfaceColumn` — the gradient sampled at the REACH scale (`OverhangReach`) so a point out over the void can "see" the cliff to know which way is uphill — and cached on `FSurfaceColumn`. It's genuine 3D (per-voxel structural re-eval), so it's gated hard to steep overhang columns; the union only ADDS rock (never removes), capped at `TerrainZ+OverhangHeight`, so `ClassifyTile` forces Mixed only in `(TerrainZ, TerrainZ+OverhangMargin]` (upward-only; margin = max `OverhangHeight`) — a shelf never holes a trivially-skipped tile, and only the thin cliff-edge band of air tiles is woken (NOT far-field like phase-3 spikes/holes). Overhang undersides classify as ground rock by the F17 rule (down-facing but below `TerrainZ`). Known v1 limit: applies at all LODs (Step-agnostic) — may alias far; gate to fine tiles later. Beaches at water line, high sky-cap ceiling. The cap is shapeable terrain in its own right (`ComputeSurfaceCeiling`, `Surface|Sky` params: `CeilingUndulation` broad inverted hills/valleys, `CeilingRidgeStrength` hanging ridgelines, `CeilingRoughness`+freq fine bumps, `CeilingWarp*`) — defaults (strengths 0, freq 0.04) = old flat-ish cap. (`Surface|Macro` params = the cheap precursor to biomes; `ReliefStrength=0` ⇒ old uniform terrain.) **Sky-cap vs ground is a PER-TRIANGLE surface class (F17), not a per-tile verdict**: the mesher classifies each unique vertex on the **worker** — only down-facing verts (`N.Z<-0.1`) pay a memoized `GetSurfaceHeightAt` column query; nearer `CeilSurf` ⇒ sky-cap, nearer `TerrainZ` ⇒ terrain overhang stays ground (a future SurfaceWorld cave roof — down-facing but below `TerrainZ` — also lands ground by the same rule; non-surface strates always ground). Triangles take the majority class of their 3 verts and are packed as **two contiguous index runs** (ground then cap, `FVoxelMeshData::NumCeilingTriangles`; skirts inherit their source triangle's run) → RMC **polygroups 0/1** → one **section per non-empty group** (`ApplyMeshToTile`, material slot = group index): slot 0 = strate `OverrideMaterial`/default (min-corner chunk), slot 1 = `CeilingMaterial` resolved at the tile's **TOP chunk** (mid as gap fallback, then min; fallback: ground material) — a coarse tile is 2^level chunks tall, so its min corner can sit in a lower strate/gap while the cap belongs to the strate above (this was the "far cap = ground material" residue), so the shadowless overhead rock is tinted separately instead of reading flat/bright. Shadow is **per section** via `FRealtimeMeshSectionConfig::bCastsShadow` (NOT the component `SetCastShadow` — RMC's proxy ignores the component flag; this is also why level≥2 far tiles only stopped casting once the section flag was wired): ground casts at level≤1, the cap section never casts, so the rock ceiling never shadows the terrain below it. History: v1 was a game-thread centre height-oracle (misclassified coarse far tiles → terrain material on the cap underside); v2 a whole-tile worker normal VOTE — which painted **mixed coarse tiles** (one far tile spanning terrain AND cap) entirely with the winner's material, and put sky material under terrain overhangs. The per-triangle class fixes both and is the identity channel caves/F8 will reuse. |
| VerticalShafts | `FVerticalShaftParams` | `BuildVerticalShaftStack` | full-height shafts + horizontal connectors + partial ledges | | VerticalShafts | `FVerticalShaftParams` | `BuildVerticalShaftStack` | full-height shafts + horizontal connectors + partial ledges |
| FloatingIslands | `FFloatingIslandParams` | `BuildFloatingIslandStack` | asymmetric islands: flat land top + underside tapering to a point, lobed (domain-warped) outline, in an open void | | FloatingIslands | `FFloatingIslandParams` | `BuildFloatingIslandStack` | asymmetric islands: flat land top + underside tapering to a point, lobed (domain-warped) outline, beneath the shared ceiling at its configured strate upper boundary |
| Underwater | `FStrateGenerationParams` + water | (reuses `BuildTunnelNetworkStack`) | tunnel rock + high water table | | Underwater | `FStrateGenerationParams` + water | (reuses `BuildTunnelNetworkStack`) | tunnel rock + high water table |
All stacks share the convention: internal **positive=solid**, and `AppendStructuralPost` ends every All stacks share the convention: internal **positive=solid**, and `AppendStructuralPost` ends every
@@ -732,6 +732,15 @@ driven by `EditorBrush*` props.
its default member initialization was never observable; removing that generated TLS leaf avoids its default member initialization was never observable; removing that generated TLS leaf avoids
constructor work without changing a height or density. Integer queries still read the cached constructor work without changing a height or density. Integer queries still read the cached
payload, and fractional queries still use the same direct locals. payload, and fractional queries still use the same direct locals.
- **Core shared column cache (L7)**: `Heightfield2D` and FloatingIslands keep their `FLazy`
worker-local caches as the first tier. A world-owned, fixed-size four-way table is the second
tier, keyed by recipe and plan identity plus content hash, exact XY, and an optional exact
sub-domain identity (FloatingIslands uses the island stable ID). Hits read versioned atomic
entries without taking a lock; misses take only their set's spin lock, recheck, compute once, and
publish. The tables are bounded and die with the world after its tile work has drained. This
deliberately adds shared reads on column-cache hits while preserving the no-lock hot-path rule;
S14's purely worker-local cache remains the first lookup. Keep large worker-local storage behind
`FLazy`, and do not make cache values or keys depend on engine objects.
- **Sampler unknown-source audit**: the earlier plugin-side `FSurfaceColumn` constructor PCs no longer - **Sampler unknown-source audit**: the earlier plugin-side `FSurfaceColumn` constructor PCs no longer
occur after the trivial-payload change. The largest remaining LOD0 unknown cluster in the final occur after the trivial-payload change. The largest remaining LOD0 unknown cluster in the final
sampler raw CSV is `UnrealEditor-Core.dll + RVA 0xC080` (runtime PCs around sampler raw CSV is `UnrealEditor-Core.dll + RVA 0xC080` (runtime PCs around
@@ -1422,8 +1431,9 @@ density roots, including a 100 cm datum-offset negative control. See
evaluators keep their recorded cap behavior. The clip joins the exact near density root at the owning evaluators keep their recorded cap behavior. The clip joins the exact near density root at the owning
boundary without changing LOD0–3 density hashes. Future families with planar roofs must declare their boundary without changing LOD0–3 density hashes. Future families with planar roofs must declare their
cap height and bounds through the family plan/provider contract; the shared tile generator consumes cap height and bounds through the family plan/provider contract; the shared tile generator consumes
that declaration. FloatingIslands declares no planar roof, so open sky above a surface island is the that declaration. FloatingIslands uses the same resolved strate-boundary data flow: its upper seal
expected view. follows its plan's chunk range and the shared boundary-seal primitive, while SurfaceWorld keeps its
existing heightfield cap.
For each requested far SurfaceWorld XY column at LOD4–8, desired-tile selection adds cap-height For each requested far SurfaceWorld XY column at LOD4–8, desired-tile selection adds cap-height
bands only when they do not overlap an existing or already accepted 3D clipmap tile. The original bands only when they do not overlap an existing or already accepted 3D clipmap tile. The original
@@ -1462,8 +1472,9 @@ neighborhood have installed collision (or are explicitly collision-not-required)
now** — the active view has ground, horizon and the family-appropriate ceiling, with no exposed now** — the active view has ground, horizon and the family-appropriate ceiling, with no exposed
coverage hole or unexpected sky; (3) **refined soon** — each target LOD resolves within its stated coverage hole or unexpected sky; (3) **refined soon** — each target LOD resolves within its stated
time or travel distance after entering range. While moving, report the largest frame/time gap in time or travel distance after entering range. While moving, report the largest frame/time gap in
enclosure and maximum distance that unresolved work trails the pawn. FloatingIslands has open sky by enclosure and maximum distance that unresolved work trails the pawn. FloatingIslands is enclosed by a
design, so its enclosure check excludes a planar roof. planar roof at the upper boundary of its configured strate range; a taller strate places that roof
farther above its islands.
The shared `AVoxelWorld::UpdateChunksAroundPosition` scheduler serves both the Core snapshot path and The shared `AVoxelWorld::UpdateChunksAroundPosition` scheduler serves both the Core snapshot path and
Core-off legacy path. It admits the collision-critical 3×3 ring first. The measured S5 order remains Core-off legacy path. It admits the collision-critical 3×3 ring first. The measured S5 order remains
@@ -1797,6 +1808,249 @@ page was added: cross-worker repeats alone do not establish a net page-cache win
immutable-page lifetime rules would add ownership and memory cost. Round 18 changed no output or immutable-page lifetime rules would add ownership and memory cost. Round 18 changed no output or
recipe version. See [`Standalone/Research/WorldAssemblerM3/Round18/REPORT.md`](Standalone/Research/WorldAssemblerM3/Round18/REPORT.md). recipe version. See [`Standalone/Research/WorldAssemblerM3/Round18/REPORT.md`](Standalone/Research/WorldAssemblerM3/Round18/REPORT.md).
### 8.35 Shared Core column cache — World Assembler L7
L7 measured 1.34 million repeated formula evaluations on the W12 L1 view before sharing: 83.6%
were another worker's XY, 4.0% were same-worker repeats after eviction, and 12.0% were halo/normal
repeats. The world-owned shared second tier cut measured formula executions by 60.9% and improved
median whole-view-ready time by 19.0%; moving 8 m and generating 144 entering tiles improved median
wall time by 36.1%. Peak RSS rose by about 66 MiB. The cache is a bounded exact-value table rather
than published pages; no scheduling affinity or page prefetch was needed to clear the measured
whole-view threshold.
The thread-local first tier remains because it avoids shared atomics for local hits. The shared
table has no lock on hits; only a miss takes a set-local spin lock. FloatingIslands' cache identity
includes its island stable ID because distinct anchors can request the same XY with different
column metrics. All W1/W12 L1 hashes, exact queries, and the seed-0 FloatingIslands fixture match
the pre-L7 binary with Clang FP contraction off and GCC defaults. See
[`Standalone/Research/WorldAssemblerM3/Linux7/REPORT.md`](Standalone/Research/WorldAssemblerM3/Linux7/REPORT.md).
### 8.36 Route-invariant Core density — World Assembler M3 L13
For an unedited Core world, tile density, mesh, payload, and topology are a function of the world
manifest/recipe, seed, and tile key. The reviewed manifest field is authoritative: SurfaceWorld uses
its `Heightfield2D`, while FloatingIslands uses its `FloatingIslandFieldV1`. `World::densityAt` and
tile generation read the same `FStandaloneShapeWorld` instance. A compiled analytic region page
retains bounded spatial bins for page ownership and routing, but `SetSharedDensitySource` binds it to
that base shape before publication; density, lattice, detail, classification, and solid queries
delegate to the shared evaluator. This keeps exact queries, collision occupancy signs, page tiles,
and base tiles on one field. Player edits remain explicit versioned overlays on that world state.
The route-binding change increments `WorldAssemblyEvaluatorVersion` from 5 to 6. Do not restore a
page-local legacy evaluator: it disagrees with the reviewed field. Uniform-block proof audits must
fill and check page tiles against the evaluator they actually sample. This is the shared Core path;
the Unreal adapter and its asynchronous MPSC/Epoch flow are unchanged. See
[`Standalone/Research/WorldAssemblerM3/Linux13/REPORT.md`](Standalone/Research/WorldAssemblerM3/Linux13/REPORT.md).
### 8.37 Shared strate boundaries and FloatingIslands lower seal — World Assembler L18
`FStandaloneShapeWorld::GetResolvedStratumBounds` supplies one physical lower/upper-bound descriptor
to layer ranges, far-field sample protection, and far-shell continuity for every strate. SurfaceWorld
retains its exact `topChunkZ * 32` Core-voxel mapping and native heightfield cap. Native FloatingIslands
takes its resolved bounds from its plan, whose chunk range is converted through the serialized
owner/Core voxel ratio. Its version-3 field removes only the lower all-XY seal and calls the same
`VF_ApplyUpperBoundarySeal` primitive used by the shared two-sided `VF_ApplyBoundarySeal` for its upper
boundary. The ceiling therefore sits at that strate's own upper boundary, with the common
`boundarySealSubvoxels` thickness; there is no FloatingIslands-specific height. The recipe range is
un-inset to match the Unreal adapter. Versions 1 and 2 retain their serialized two-sided seals.
SurfaceWorld's field and output hashes remain unchanged. See
[`Standalone/Research/WorldAssemblerM3/Linux18/REPORT.md`](Standalone/Research/WorldAssemblerM3/Linux18/REPORT.md).
### 8.38 Closed shared boundary ceilings and LOD sampling audit — World Assembler L19
`AppendStratumBoundaryCeilings` fills a candidate cell when the authoritative field is solid just
inside that strate's configured upper boundary. It does not require the raw field to cross back to
air above the boundary: the ceiling itself closes the strate even when the field continues solid
through that plane. This avoids isolated holes where a coarse lattice node has no zero crossing.
`FFarMeshColumnIndex::HasDownwardCellCoverage` still suppresses a fallback quad only after its
interior and perimeter probes all hit the existing downward face. The L19 `farHorizonVersion` is 4
for this shared boundary-cap change; hashes remain direct at LOD0–3 and salted at LOD4–8. No density
query, stratum position, scale, or asynchronous route changes. The strict LOD0–8 roof and paired-edge
audit and the matched before/after captures are in
[`Standalone/Research/WorldAssemblerM3/Linux19/REPORT.md`](Standalone/Research/WorldAssemblerM3/Linux19/REPORT.md).
### 8.39 Resolved layout snapshots and nominal strate bands — World Assembler L21 (historical)
`ResolvedLayoutSnapshotV1` is a separate Core-owned record built from the resolved manager slots and
the native SurfaceWorld/FloatingIslands plans. It has a canonical JSON representation, schema version,
and stable FNV-1a identity. Its physical intervals use half-open micrometre coordinates; recipe anchors
retain their serialized fixed-point units. The Unreal adapter exports it beside `world_assembly`, so the
layout digest never salts a recipe, manifest, density, or mesh hash. The standalone exporter follows
the same builder after plan resolution. It runs once per plan request and is not read from density or
tile-worker loops.
Each record separates the nominal ceiling, content, and bedrock bands. A strict layout requires that
sequence for every strate and requires bedrock(N) to touch the next strate's ceiling(N+1). The two
bands remain separately owned. Gradient and Interleaved interfaces may declare interpenetration only
inside their explicit transition zone; Hard has zero effective width. The manager's `TransitionBlendChunks`
is expressed in owner-chunk metres. Interleaved's existing two-chunk domain warp extends its possible
fingers beyond the blend width and is recorded separately. Compatibility validation reports current
gaps, overlaps, ambiguities, inactive/missing bands, and unhonoured transitions while accepting them;
strict validation rejects them. Core dispatches per-strate recipe fields without applying that
parameter blend, even though the legacy manager helper implements it. Both band types default diggable,
with protection represented explicitly.
Compatibility facts from L21: native SurfaceWorld plan/query bounds use 32 Core voxels (8 m) per
dispatch chunk, while FloatingIslands converts the 32-voxel owner chunk through its 12.5/25 cm scale
(16 Core voxels, 4 m). In the prototype where the top slot is FloatingIslands, this leaves a nominal
60 m interval between the FI bottom (−60 m) and SurfaceWorld top (−120 m); the Core selectors fall
through to the compiled analytic FloatingIslands fallback there. Core does not apply the manager's
parameter blend at either recipe boundary. The FI v3 upper seal remains a ceiling inside its current
content range, and its missing lower bedrock is recorded without changing evaluation. See
[`Standalone/Research/WorldAssemblerM3/Linux21/REPORT.md`](Standalone/Research/WorldAssemblerM3/Linux21/REPORT.md).
### 8.40 Fixed-metre strate layout units and shared boundary volumes — World Assembler L22
`StrateLayoutChunkSizeMeters` is one world-level setting, defaulting to **8 m**, independent of the
legacy 32-voxel chunk and Core's 32³ storage tile. The director resolves the setting once to physical
micrometres and Core subvoxels; every generator plan and dispatch reads that snapshot. At a 25 cm Core
voxel, an 8 m layout chunk is 32 Core voxels (8192 1/256-voxel units); at 20 cm it is 40 Core voxels
(10240 units). The Core tile remains 32³ voxels and is not a layout chunk.
The owner's FI/SW intervals are contiguous: FloatingIslands occupies [−120,+8) m and SurfaceWorld
occupies [−632,−120) m. Each strate is ceiling → content → bedrock. Both solid, diggable boundary
bands use its generator's existing `BoundarySealThickness` and `BaseDensity`; `InterStrateGapChunks`
controls only spacing, and `EdgeSealThickness` remains horizontal. No new thickness parameter or hidden
band height was added. The shared composition layer emits both volumes for every generator and the
shared mesh path closes their visible ceiling and floor faces.
The snapshot is schema V2 and is consumed by bounds planning, native and legacy dispatch, solid-band
composition, and validation. Strict validation accepts the real owner layouts, and the boundary probe
audit agrees at all 27 sampled endpoints in both recipe modes. The owner authored Gradient transition
is recorded as an explicit Hard fallback with zero interpenetration; Gradient and Interleaved mixing
remain unimplemented and must not be inferred from the declared blend width. Seven validator negative
controls continue to reject malformed bands.
Evidence and owner caveats are in
[`Standalone/Research/WorldAssemblerM3/Linux22/REPORT.md`](Standalone/Research/WorldAssemblerM3/Linux22/REPORT.md).
### 8.41 Director-resolved inter-strate passages and walkable landings — World Assembler L23
Core passage geometry is derived after the director has resolved physical strate bands and native
route anchors. `PlanResolvedLayoutPassagesV1` joins every adjacent resolved pair. Its placement hash
uses `(seed, upper strate, lower strate, connection, salt)`; `PassageConfig.DistanceMax` is the
outer radius around world `(0,0)` (24 m for the owner's first interface), while `DistanceMin` is
the inner radius used when a mouth has no route anchor. A route-bound mouth reuses the upper
strate's departure or lower strate's arrival anchor, after checking it lies within `DistanceMax`.
The legacy `UVoxelStrateManager::GeneratePassages` and its owner-voxel control points remain the
legacy generator path; Core does not import the exported legacy `passages` array. The season
manifest carries recipes and plans, and the adapter rebuilds the resolved layout and its passages
from the current manager slots and route anchors each time it attaches the Core world.
`ApplyResolvedStrateComposition` composes the current generator field, applies the resolved ceiling
and bedrock bands, then unions the passage carve and floor support. Only the hashed capsule path
opens a band; the support strip stays below the player capsule. The lower mouth index splits the
monotone descent from the short route-bound landing tail, whose height may vary with the route.
Both route and passage audits sample the 0.34 m by 1.76 m capsule, support probes, and grade; the
negative control compiles the same world without passage carving and must detect a blocked capsule.
The L23 shared-field change is `WorldAssemblyEvaluatorVersion=9`. It does not change the L22 bands
or any generator's field away from a passage. The L23 report includes exact-query/hash comparisons,
the blocked control, captures, and the Windows adapter checklist. §8.10's cache, proof, streaming,
and async rules remain unchanged.
[`Standalone/Research/WorldAssemblerM3/Linux23/REPORT.md`](Standalone/Research/WorldAssemblerM3/Linux23/REPORT.md)
records the audit and captures.
### 8.42 Per-strate natural passages and the FloatingIslands anchor helix — World Assembler L24
`FStratePassageConfig.Style` now drives the shared Core planner for every generator. The default is
`Worm`; Straight, Spiral and Cascading remain selectable per upper strate. Passage radius, reach,
distance and style stay in the resolved-layout input, so equal seeds and route anchors produce equal
paths on every peer. The passage carver adds bounded, deterministic wall relief (`0.24 m` before the
gravity-facing attenuation) while its support tread follows the same route profile below the capsule.
FloatingIslands' owner config selects Spiral. A seed-derived anchor island near `(0,0)` is joined to
bedrock by a 6 m radius rock root. The 3 m helix descends from the island mouth to the `-119.5 m`
bedrock top inside that root, leaving at least the authored clearance around its 1.5 m bore, then
widens into the Worm route toward the SurfaceWorld arrival. The selected anchor is ordinal 2; the
other island ordinals and their placement hashes are unchanged. FloatingIslands recipe geometry is
version 5 and the shared passage evaluator is version 10; the resolved-layout snapshot stays V3.
The passage naturalness audit rejects a horizontal run above 8 m (segments flatter than 0.5 degrees)
or wall relief below 0.20 m peak-to-peak across at least 8 valid samples. The smooth-wall control
has zero relief and fails; the anchored Spiral has 0 m flat run and 0.793 m measured relief. Strict
layout controls, route binding, capsule clearance, support, grade, and the no-carve negative control
remain required. Passage-centered interval proofs remain unknown/fallback rather than falsely
certified. At the lower mouth, the shared layer now relies on native terrain plus the passage tread;
it does not stamp additional flat route-anchor shelves over the cave opening. The L24 report records
compiler/worker parity, unchanged SurfaceWorld hashes away from the route, captures and the Windows
adapter checklist.
The Linux offscreen capture tool accepts `--headlamp=on` to aim brighter readable shading from the
camera for interior views and `--clip-plane=NX,NY,NZ,D` to discard the plane's negative half-space for
cutaway views. Both affect captures only, not generated geometry.
[`Standalone/Research/WorldAssemblerM3/Linux24/REPORT.md`](Standalone/Research/WorldAssemblerM3/Linux24/REPORT.md)
records the evidence and owner-facing caveats.
### 8.43 Enclosed FloatingIslands helix and native-solid passage support — World Assembler L25
L24's support tread was composited into the passage field without requiring native solid terrain at
the support sample. A 6 m root could not contain the resolved helix either: the centreline reaches
5.562 m from the anchor axis and the mouth bore is 4.5 m. With the old root radius, the tread could
therefore read as a free-floating spiral outside the rock. This was not a unit conversion error.
The shared passage composer now emits route-mouth support, tread, and fallback support only where
the pre-passage native density is solid. The open-air audit samples each support footprint at 0.25 m
spacing and two depths, including route-mouth shelves; its L24 ungated-support control must report a
violation. The FI anchor root is now a relief-bearing 13.25 m nominal rock column. Across five
heights its measured radius is 12.0–13.375 m. Taking the maximum 5.562 m centreline radius and the
full 4.5 m mouth bore at every height gives a conservative minimum wall of 1.938 m, exceeding the
previous 1.5 m reserve. The authored mid-bore remains 3 m. The helix is selected from its route-bound
root point and joins the lower route before the tunnel hands off through the shared SW ceiling.
The configured FI Spiral passes the capsule/support/grade audit with zero blocked, unsupported, or
grade-failure samples; the L23 smooth-wall control fails naturalness and the L24 ungated-support
control fails the open-air audit. The other style overrides also pass the open-air audit, but their
capsule results are recorded individually in the L25 report because some overrides are not
walkable after floating support is suppressed. Evaluator version is 12, FI geometry version is 7,
and resolved-layout schema V3 remains unchanged. The L25 report records measurements, hashes,
captures, style results, and the single Unreal adapter version edit.
[`Standalone/Research/WorldAssemblerM3/Linux25/REPORT.md`](Standalone/Research/WorldAssemblerM3/Linux25/REPORT.md)
records the evidence and caveats.
### 8.44 Walkable passages as tunnels in rock — World Assembler L26
L25 correctly stopped support from appearing in native air, but its SurfaceWorld-recipe passages
still crossed a long open volume in the SurfaceWorld arrival strata. The segment map places that gap
inside SurfaceWorld (about `-146` to `-497 m`), after the TunnelNetwork transition; it is not TunnelNetwork
cave air. Both ends meet native rock. The shared Core planner now finds contiguous unsupported ranges
from the native field sign and caches them by resolved-layout identity. It adds a deterministic,
relief-bearing rock span only across those ranges. The span is at least 5 m wide, several metres thick,
and joins native rock at both ends. The passage carve then opens the bore through the added density,
leaving a grounded floor and rock walls/ceiling. SurfaceWorld away from the passage remains unchanged.
Native route support remains gated on pre-passage solid density. Before adding any support density, the
composer also checks the resolved player capsule, so neighboring floor segments cannot restore rock
inside the avatar path. This keeps all four style overrides walkable in both recipes. The bridge audit
measures its authored density field at 256 route sections, checks the 5 m width and connected ends, and
records a relief-bearing thickness range; the open-air audit still runs the L24 negative control.
The shared evaluator is version 13; FloatingIslands geometry remains version 7 and resolved-layout
schema V3 is unchanged. These changes are in Core and the standalone audit/capture path; no Unreal
adapter edit is required. The L26 report contains the eight-style table, hashes, captures and run history.
[`Standalone/Research/WorldAssemblerM3/Linux26/REPORT.md`](Standalone/Research/WorldAssemblerM3/Linux26/REPORT.md)
records the final evidence.
### 8.45 Tile-bounded passage evaluation — World Assembler M3 Linux L28
Each mesh tile scopes passage composition to the inclusive density-sample AABB, including the
mesher's normal halo. A conservative feature AABB BVH selects route segments, columns and mouth
support for that tile. A per-passage nearest-segment BVH bounds the long helix search; a separate
passage-bound BVH rejects far L9 proof boxes. An unindexed native-only proof object uses a conservative
linear fallback. No field, union order, serialized layout or recipe version changes.
The column's exact complex SDF is evaluated only in XY/Z feature candidates. A cheap density-aware
radial guard remains for samples sharing the column's Z slab: a positive column distance can still
lower positive base density, so skipping that guard needs an exact bound on the base field. This is
the remaining SurfaceWorld cost noted in the Linux L28 report. The passage candidate lists and
proof bounds preserve the L27 output.
[Linux28 report](Standalone/Research/WorldAssemblerM3/Linux28/REPORT.md)
records counts, parity, costs and audit caveats.
## 9. Multiplayer model (listen-server first, dedicated-friendly) ## 9. Multiplayer model (listen-server first, dedicated-friendly)
> **Status: transport is DESIGN ONLY — nothing is networked in-tree yet** (no `Replicated`/`HasAuthority`/RPCs; a > **Status: transport is DESIGN ONLY — nothing is networked in-tree yet** (no `Replicated`/`HasAuthority`/RPCs; a
+6 -3
View File
@@ -26,9 +26,12 @@ try to run anything.
- **Density sign: negative = solid, positive = air** (MC convention at the mesher). - **Density sign: negative = solid, positive = air** (MC convention at the mesher).
`FVoxelModification::Strength` negative = carve. *The #1 source of confusion.* `FVoxelModification::Strength` negative = carve. *The #1 source of confusion.*
- **Density functions take VOXEL coords, not cm.** The legacy plugin field uses 12.5 cm voxels; - **Density functions take VOXEL coords, not cm.** The legacy plugin field uses 12.5 cm voxels;
the opt-in Core field uses 25 cm voxels and its own tile keys. One legacy 32³ chunk is 4 m. the opt-in Core field uses 25 cm voxels and its own 32³-voxel storage tile. The legacy 32³ chunk
Conversions live in `VoxelTypes.h` and the Core bridge; do not mix scales in queries, anchors, edits, spans 4 m at 12.5 cm. Strate placement uses the separate world-level `StrateLayoutChunkSizeMeters`
or surface lookups. setting (8 m by default), resolved once and shared by every generator. At 25 cm that layout unit is
32 Core voxels; at 20 cm it is 40. Never infer the layout unit from `CHUNK_SIZE` or the Core tile.
Conversions live in `VoxelTypes.h`, the director, and the Core bridge; do not mix scales in queries,
anchors, edits, or surface lookups.
- **Determinism:** all randomness = hash of (coord, seed, strateIndex). No RNG state — same seed ⇒ - **Determinism:** all randomness = hash of (coord, seed, strateIndex). No RNG state — same seed ⇒
same world. Player edits (diff layer) are the only non-deterministic overlay. same world. Player edits (diff layer) are the only non-deterministic overlay.
- **Core world invariants:** Core density keeps the same sign (negative solid, positive air), but Core - **Core world invariants:** Core density keeps the same sign (negative solid, positive air), but Core
+110 -10
View File
@@ -29,7 +29,9 @@ A **density-field voxel terrain** plugin for Unreal Engine, built around undergr
### Core terminology ### Core terminology
| Term | Meaning | | Term | Meaning |
|------|---------| |------|---------|
| Chunk | 32×32×32 voxels (`CHUNK_SIZE`). Voxel = 12.5 cm (`VOXEL_SIZE`), so a chunk is 4 m. | | Legacy chunk | 32×32×32 voxels (`CHUNK_SIZE`). At the legacy 12.5 cm voxel size it spans 4 m; it is not the strate-layout unit or the Core tile. |
| Strate-layout chunk | World-level `StrateLayoutChunkSizeMeters`, default 8 m, shared by all generators and independent of voxel size. The director resolves it once and Core reads the resolved snapshot. At 25 cm it is 32 Core voxels; at 20 cm it is 40 Core voxels. |
| Core tile | Internal 32×32×32 Core voxel tile. Its metre size follows the Core voxel size and stays separate from the configurable layout chunk. |
| Density | Scalar field. `< 0` solid, `> 0` air, `0` = surface (`IsoLevel`). | | Density | Scalar field. `< 0` solid, `> 0` air, `0` = surface (`IsoLevel`). |
| Strate | Vertical layer of the world, stacked downward. Has its own generator + params. | | Strate | Vertical layer of the world, stacked downward. Has its own generator + params. |
| Generator type | Archetype per strate: `TunnelNetwork`, `FlatPlain`, `CrystalChamber`, `Maze`, `SurfaceWorld`, `VerticalShafts`, `FloatingIslands`, `Underwater`. See §8. | | Generator type | Archetype per strate: `TunnelNetwork`, `FlatPlain`, `CrystalChamber`, `Maze`, `SurfaceWorld`, `VerticalShafts`, `FloatingIslands`, `Underwater`. See §8. |
@@ -78,10 +80,12 @@ what generator type, and is there a passage/elevator SDF near here?"
Paths relative to `Source/VoxelForge/`. `Public/` = headers, `Private/` = impl. Paths relative to `Source/VoxelForge/`. `Public/` = headers, `Private/` = impl.
### 3.0 Human-scale generation contract (2026-10-01) ### 3.0 Human-scale generation contract (2026-10-01)
`VOXEL_SIZE` is **12.5 cm**; 32³ voxels make each chunk **4 m**. The gameplay capsule remains `VOXEL_SIZE` is **12.5 cm** for the legacy generator. Its 32³-voxel chunks span **4 m**. The
**0.34 m radius / 1.76 m tall** (**2.72 / 14.08 voxels**). The default strate envelope is world-level strate-layout unit is a separate setting with an **8 m default**; a 16-chunk strate is
**16 chunks / 512 voxels / 64 m**; serialized owner strate assets that still say 8 chunks must be therefore **128 m**, and a 64-chunk strate is **512 m**. Core still stores work in 32³-voxel tiles;
changed to 16. Research-field dimensions are authored in metres and converted at runtime. The live at 25 cm those tiles happen to span 8 m, but they are not the layout unit. The gameplay capsule remains
**0.34 m radius / 1.76 m tall** (**2.72 / 14.08 legacy voxels**). Research-field dimensions are authored
in metres and converted at runtime. The live
strate generator continues to read voxel-valued parameters from its assets, so those authored strate generator continues to read voxel-valued parameters from its assets, so those authored
dimensions become half as large in metres unless their asset values are doubled. dimensions become half as large in metres unless their asset values are doubled.
@@ -158,17 +162,19 @@ remains `0`, and lateral regions remain gated off.
| `VoxelForge.Build.cs` | Deps: Core, CoreUObject, Engine, **GameplayTags**, **RealtimeMeshComponent**, `VoxelForgeCore`. `AVoxelWorld::bUseVoxelForgeCore` opts into the Core runtime route; it defaults off. | | `VoxelForge.Build.cs` | Deps: Core, CoreUObject, Engine, **GameplayTags**, **RealtimeMeshComponent**, `VoxelForgeCore`. `AVoxelWorld::bUseVoxelForgeCore` opts into the Core runtime route; it defaults off. |
| `../../VoxelForgeCore/VoxelForgeCore.Build.cs` | C++20 runtime module. Reads `Standalone/Core/core_sources.txt`, validates one include shim per canonical source, and fails UBT on missing, extra, or mismatched shims. No unity/PCH; private copied implementation stays under `vfcore::detail`. | | `../../VoxelForgeCore/VoxelForgeCore.Build.cs` | C++20 runtime module. Reads `Standalone/Core/core_sources.txt`, validates one include shim per canonical source, and fails UBT on missing, extra, or mismatched shims. No unity/PCH; private copied implementation stays under `vfcore::detail`. |
| `../../VoxelForgeCore/Private/Manifest/VFCore_*.cpp` | Eighteen one-source UBT shims that include canonical files under `Standalone/`; they do not copy Core implementation. The API-boundary row includes `Core/src/VoxelForgeCore.cpp` directly. | | `../../VoxelForgeCore/Private/Manifest/VFCore_*.cpp` | Eighteen one-source UBT shims that include canonical files under `Standalone/`; they do not copy Core implementation. The API-boundary row includes `Core/src/VoxelForgeCore.cpp` directly. |
| `../../Standalone/Core/include/VoxelForgeCore/ThreadLocalStorage.h` | `VoxelForgeCoreThreadLocal::FLazy<T>`: thread-local handle that heap-allocates a worker-private cache on first use. All large Core and legacy caches use it (HeightfieldColumnCache, IslandColumnCache, GFloorReliefCache, GRoomGraphCache, GSurfColCache, tunnel/diff caches). See ARCHITECTURE §8.10. | | `../../Standalone/Core/include/VoxelForgeCore/ThreadLocalStorage.h` | `VoxelForgeCoreThreadLocal::FLazy<T>`: thread-local handle that heap-allocates a worker-private cache on first use. Large worker-local caches use it (HeightfieldColumnCache, IslandColumnCache, GFloorReliefCache, GRoomGraphCache, GSurfColCache, tunnel/diff caches). See ARCHITECTURE §8.10. |
| `../../Standalone/Core/include/VoxelForgeCore/SharedColumnCache.h` | Bounded four-way second-tier cache for exact per-column values. Readers use versioned atomic slots without a lock; misses use a set-local spin lock. World-owned lifetime, recipe/plan identity and content hashes, XY and optional sub-domain identity. SurfaceWorld and FloatingIslands share this mechanism; see ARCHITECTURE §8.35. |
| `../../Standalone/Core/src/CoreNamespacePreamble.h` | First include of every Core TU. Forces FP contraction off per compiler (Clang/MSVC/GCC pragmas; unknown compiler = `#error`) and defines `vfcore::fp_contract::selfTest`, which `World::compile` runs before building: a fused multiply-add (e.g. Clang `-ffp-contract=fast`) refuses world generation. The world depends on contraction (Linux2/Linux3 reports), so never remove either. | | `../../Standalone/Core/src/CoreNamespacePreamble.h` | First include of every Core TU. Forces FP contraction off per compiler (Clang/MSVC/GCC pragmas; unknown compiler = `#error`) and defines `vfcore::fp_contract::selfTest`, which `World::compile` runs before building: a fused multiply-add (e.g. Clang `-ffp-contract=fast`) refuses world generation. The world depends on contraction (Linux2/Linux3 reports), so never remove either. |
| `../../VoxelForgeCore/Private/ModuleEntry/` | Unreal module entry and an isolated `CoreMinimal.h` shim for the actual engine header. | | `../../VoxelForgeCore/Private/ModuleEntry/` | Unreal module entry and an isolated `CoreMinimal.h` shim for the actual engine header. |
| `../../Standalone/Core/include/VoxelForgeCore/VoxelForgeCore.h` | Standard-library-only public Core API. `VOXELFORGECORE_API` exports the API from the Unreal module and is empty for standalone builds. | | `../../Standalone/Core/include/VoxelForgeCore/VoxelForgeCore.h` | Standard-library-only public Core API. `VOXELFORGECORE_API` exports the API from the Unreal module and is empty for standalone builds. |
| `../../Standalone/Core/include/VoxelForgeCore/VoxelForgeCore.h` / `../../Standalone/Core/src/ResolvedLayoutInternal.h` | `ResolvedLayoutSnapshotV3`: physical layout-chunk width, versioned micrometre intervals, owned ceiling/content/bedrock bands, transition and dispatch provenance, recipe anchors, director-planned passages, canonical JSON/FNV identity, compatibility/strict validators, and negative-control audit. Built once from the director-resolved plan and consumed by bounds planning, Core dispatch, composition, and validation. §8.40–8.41. |
| `../../Standalone/Core/src/FloatingIslandsInternal.h` | Canonical standalone/Core floating-island planner, geometry-versioned field, manifest serializer, influence bounds, capsule-route checks, and thickness audit. | | `../../Standalone/Core/src/FloatingIslandsInternal.h` | Canonical standalone/Core floating-island planner, geometry-versioned field, manifest serializer, influence bounds, capsule-route checks, and thickness audit. |
| `Tools/VoxelForgeTest.ps1` | The single guarded test entry point. `-Scenario canonical|owner|probe|perf|tests|surface-fall|crossing|gate-stress|visual-edit|visual-lod|visual-gap-walk|visual-gap-inject|dig-motion|parity|horizon|horizon-render|determinism|region-eval|step2d|step2e|step2f|step2f-capture|step3-scale|step3-game`, optional `-Build`, `-Assets owner|default`, `-Cvars`, absolute `-Out`, `-Label`, `-HorizonLevel`, `-HorizonRenderDistanceChunks`, `-Step2fProfile=0..7`, `-Step2fCaptureView=inside|wall-closeup`, `-ParityExportSize=32|64|128`, `-ParityExportTile=x,y,z`, `-SharedDDC`, `-SampleDensityStacks`, `-StackSampleIntervalUs`, and `-RegionHashProbe -RegionWorkers N -RegionReferenceHash HASH`; stages the host/assets, isolates user/DDC/config state, serializes one Unreal launch at a time, enforces the 8 GiB/30-minute guards, waits for 6 GiB free RAM before launches, and emits compact `result.json`/`summary.txt` plus full logs. Parity can render its game leg with `-EnableRender` and compares the selected export region against the exact streamed tile hashes. `visual-gap-walk` records camera-frustum surface-point coverage at 6000 cm/s; `visual-gap-inject` proves an early component hide is detected; `dig-motion` logs per-frame vertical velocity, gate, support readiness, and movement mode. `-Cvars @{ 'voxel.TestGapAuditLegacyHandoff'=1 }` replays the old visibility handoff for A/B audit baselines. Horizon traces report desired/loaded tiles, resident stream geometry, worker seconds, steady wall time, and peak private memory; `horizon-render` captures the owner view; `step2f-capture` selects one of eight parameter sets, finds a positive-density camera point and aims at a sampled rock wall for an inside or wall-closeup view, then saves it under `Saved/Research/step2f/captures` (pass the persistent render DDC with `-SharedDDC`); `determinism` compares per-tile hashes across the default CRT path and `-voxel.CrtFma3=0`; `region-eval` compares the live path with the default-off editor chunk program on the 259³ lattice and five-seed probe set; `step2d` retains the earlier independent field; `step2e` retains its earlier benchmark; `step2f` compares frozen step 2e and the coherent field for all eight profiles on the same 259³ ring, applies geometry gates, and checks sound bounds, seams, and 1-vs-6-worker hashes. `-RegionHashProbe -RegionWorkers N -RegionReferenceHash HASH` checks a full-ring hash at another partition count. `-SampleDensityStacks` captures profiles, and `-StackSampleIntervalUs` sets the sampling interval. | `Tools/VoxelForgeTest.ps1` | The single guarded test entry point. `-Scenario canonical|owner|probe|perf|tests|surface-fall|crossing|gate-stress|visual-edit|visual-lod|visual-gap-walk|visual-gap-inject|dig-motion|parity|horizon|horizon-render|determinism|region-eval|step2d|step2e|step2f|step2f-capture|step3-scale|step3-game`, optional `-Build`, `-Assets owner|default`, `-Cvars`, absolute `-Out`, `-Label`, `-HorizonLevel`, `-HorizonRenderDistanceChunks`, `-Step2fProfile=0..7`, `-Step2fCaptureView=inside|wall-closeup`, `-ParityExportSize=32|64|128`, `-ParityExportTile=x,y,z`, `-SharedDDC`, `-SampleDensityStacks`, `-StackSampleIntervalUs`, and `-RegionHashProbe -RegionWorkers N -RegionReferenceHash HASH`; stages the host/assets, isolates user/DDC/config state, serializes one Unreal launch at a time, enforces the 8 GiB/30-minute guards, waits for 6 GiB free RAM before launches, and emits compact `result.json`/`summary.txt` plus full logs. Parity can render its game leg with `-EnableRender` and compares the selected export region against the exact streamed tile hashes. `visual-gap-walk` records camera-frustum surface-point coverage at 6000 cm/s; `visual-gap-inject` proves an early component hide is detected; `dig-motion` logs per-frame vertical velocity, gate, support readiness, and movement mode. `-Cvars @{ 'voxel.TestGapAuditLegacyHandoff'=1 }` replays the old visibility handoff for A/B audit baselines. Horizon traces report desired/loaded tiles, resident stream geometry, worker seconds, steady wall time, and peak private memory; `horizon-render` captures the owner view; `step2f-capture` selects one of eight parameter sets, finds a positive-density camera point and aims at a sampled rock wall for an inside or wall-closeup view, then saves it under `Saved/Research/step2f/captures` (pass the persistent render DDC with `-SharedDDC`); `determinism` compares per-tile hashes across the default CRT path and `-voxel.CrtFma3=0`; `region-eval` compares the live path with the default-off editor chunk program on the 259³ lattice and five-seed probe set; `step2d` retains the earlier independent field; `step2e` retains its earlier benchmark; `step2f` compares frozen step 2e and the coherent field for all eight profiles on the same 259³ ring, applies geometry gates, and checks sound bounds, seams, and 1-vs-6-worker hashes. `-RegionHashProbe -RegionWorkers N -RegionReferenceHash HASH` checks a full-ring hash at another partition count. `-SampleDensityStacks` captures profiles, and `-StackSampleIntervalUs` sets the sampling interval.
| Step-3 scale and game validation | `step3-scale` measures the same 519³ and 259³ six-worker lattices at 12.5 cm. The cached medians are 7.347496 s and 1.169567 s respectively; determinism and brick sound-proof audits pass. `step3-game` routes in-game generation through the brick evaluator and records tile timings, spawn fill, moving frames, and profile-switch rebuilds. The visible D3D12 run measured tile generation p50/p95/max 3.326/31.045/169.867 ms, full-detail L0 fill 12.369 s for 2,765 tiles, and moving-frame p50/p95/p99/max 4.856/8.922/13.090/80.575 ms. Switching profiles rebuilt 5,815 loaded tiles. Both high-resolution screenshot requests were logged, but the harness found only one fresh PNG and it is a blank pale viewport; no lit comparison capture is accepted. Raw output: `Saved/TestHarness/step3_game_visible_final`; scale output: `Saved/Research/step3/scale/step3_scale_cacheperf_v1`. | | Step-3 scale and game validation | `step3-scale` measures the same 519³ and 259³ six-worker lattices at 12.5 cm. The cached medians are 7.347496 s and 1.169567 s respectively; determinism and brick sound-proof audits pass. `step3-game` routes in-game generation through the brick evaluator and records tile timings, spawn fill, moving frames, and profile-switch rebuilds. The visible D3D12 run measured tile generation p50/p95/max 3.326/31.045/169.867 ms, full-detail L0 fill 12.369 s for 2,765 tiles, and moving-frame p50/p95/p99/max 4.856/8.922/13.090/80.575 ms. Switching profiles rebuilt 5,815 loaded tiles. Both high-resolution screenshot requests were logged, but the harness found only one fresh PNG and it is a blank pale viewport; no lit comparison capture is accepted. Raw output: `Saved/TestHarness/step3_game_visible_final`; scale output: `Saved/Research/step3/scale/step3_scale_cacheperf_v1`. |
| `Public/VoxelForgeModule.h` / `Private/VoxelForgeModule.cpp` | `FVoxelForgeModule` boilerplate (Startup/Shutdown just log). | | `Public/VoxelForgeModule.h` / `Private/VoxelForgeModule.cpp` | `FVoxelForgeModule` boilerplate (Startup/Shutdown just log). |
| `Source/VoxelForgeEditor/VoxelForgeEditor.Build.cs` / `Private/VoxelForgeExploreCommandlet.*` | Editor/commandlet-only `-run=VoxelForgeExplore`; schema-v1 owner-asset export check and BuildHost Core actor tests. `-coreworldassembly=PATH` supplies a reviewed manifest transiently to `-coreworldtest=1`; it does not save a data asset. `FStandaloneCoreAdapterScheduler` runs Core work at 1/8/16 workers; `VerifyStandaloneCoreAdapter` checks hashes and walkability. Existing bounded render/`VF_` walk/OBJ orchestration and research options remain editor/commandlet-only and are not linked by Game/Shipping. | | `Source/VoxelForgeEditor/VoxelForgeEditor.Build.cs` / `Private/VoxelForgeExploreCommandlet.*` | Editor/commandlet-only `-run=VoxelForgeExplore`; schema-v1 owner-asset export check and BuildHost Core actor tests. `-coreworldassembly=PATH` supplies a reviewed manifest transiently to `-coreworldtest=1`; it does not save a data asset. `FStandaloneCoreAdapterScheduler` runs Core work at 1/8/16 workers; `VerifyStandaloneCoreAdapter` checks hashes and walkability. Existing bounded render/`VF_` walk/OBJ orchestration and research options remain editor/commandlet-only and are not linked by Game/Shipping. |
| `Source/VoxelForge/Public/VoxelSettings.h` / `Private/VoxelSettings.cpp` | `UVoxelSettings` owns optional canonical world-assembly JSON and its Core digest. The editor file picker plus `ImportWorldAssemblyManifestJson` imports the reviewed manifest into the cooked settings asset and validates the recipe seed against the effective settings seed. | | `Source/VoxelForge/Public/VoxelSettings.h` / `Private/VoxelSettings.cpp` | `UVoxelSettings` owns optional canonical world-assembly JSON and its Core digest. The editor file picker plus `ImportWorldAssemblyManifestJson` imports the reviewed manifest into the cooked settings asset and validates the recipe seed against the effective settings seed. |
| `Source/VoxelForge/Private/VoxelForgeCoreAdapter.cpp` | Validates the optional manifest against each resolved `SurfaceWorld` slot (unique strate index and exact top/bottom chunks), then places canonical `world_assembly` JSON and its hash in the Core snapshot. Invalid plans fail Core initialization. | | `Source/VoxelForge/Private/VoxelForgeCoreAdapter.cpp` | Validates the optional manifest against each resolved `SurfaceWorld` slot (unique strate index and exact top/bottom chunks), then exports canonical `resolved_layout` separately from `world_assembly` and its hash. The layout digest does not alter recipe hashes. Invalid plans fail Core initialization. |
| `Source/VoxelForgeEditor/Private/VoxelForgeRegionEvalExperiment.*` | Six-worker lattice drivers for step 2c through step 2f. The original path still compares live `GetDensityAt` with the editor chunk program. Research modes assign contiguous batches dynamically so surface-heavy work balances across workers; steps 2e and 2f use 4³ proof bricks and stage each evaluated brick before copying contiguous X rows, while step 2d retains 8³. Each skip requires a macro Lipschitz bound plus the complete final-detail supremum; uncertain bricks retain every 12.5 cm detail sample. Timings split classification, point evaluation, and uniform fill; step 2f compares all profiles and hashes workers 1 and 6. | | `Source/VoxelForgeEditor/Private/VoxelForgeRegionEvalExperiment.*` | Six-worker lattice drivers for step 2c through step 2f. The original path still compares live `GetDensityAt` with the editor chunk program. Research modes assign contiguous batches dynamically so surface-heavy work balances across workers; steps 2e and 2f use 4³ proof bricks and stage each evaluated brick before copying contiguous X rows, while step 2d retains 8³. Each skip requires a macro Lipschitz bound plus the complete final-detail supremum; uncertain bricks retain every 12.5 cm detail sample. Timings split classification, point evaluation, and uniform fill; step 2f compares all profiles and hashes workers 1 and 6. |
| `Public/VoxelRedefinedDensityField.h` / `Private/VoxelRedefinedDensityField.cpp` | Two default-off `WITH_EDITOR` research fields, selected by `voxel.ResearchRedefinedDensityField` (step 2d) and `voxel.ResearchParameterizedCave` (steps 2e/2f). Step 2f retains a metre-scaled 2e baseline for its rejection audit. New profiles use strongly jittered, individually rotated elliptical rooms capped against nearest neighbors and curved cubic-Bezier passages with deterministic centerline and width variation along each edge. Room heights and feature rolls vary by cell; ledges, occasional pillars, stalactites/stalagmites, basin floors, and bounded hanging masses remain features. Point and brick detail sampling share independently rotated 96/48/24-sample bands and a smooth ridge response, preserving 12/6/3 m wavelengths at 12.5 cm per sample. The parameterized mesher evaluates the exact field through prepared 4³ bricks and the same sound skip proof in commandlet and editor-game meshing. In-editor and in-game profile changes invalidate and rebuild all loaded tiles. In an editor game with this field enabled, sealed-solid, out-of-layout, and outer-classifier verdicts are declined without changing their console switches. | | `Public/VoxelRedefinedDensityField.h` / `Private/VoxelRedefinedDensityField.cpp` | Two default-off `WITH_EDITOR` research fields, selected by `voxel.ResearchRedefinedDensityField` (step 2d) and `voxel.ResearchParameterizedCave` (steps 2e/2f). Step 2f retains a metre-scaled 2e baseline for its rejection audit. New profiles use strongly jittered, individually rotated elliptical rooms capped against nearest neighbors and curved cubic-Bezier passages with deterministic centerline and width variation along each edge. Room heights and feature rolls vary by cell; ledges, occasional pillars, stalactites/stalagmites, basin floors, and bounded hanging masses remain features. Point and brick detail sampling share independently rotated 96/48/24-sample bands and a smooth ridge response, preserving 12/6/3 m wavelengths at 12.5 cm per sample. The parameterized mesher evaluates the exact field through prepared 4³ bricks and the same sound skip proof in commandlet and editor-game meshing. In-editor and in-game profile changes invalidate and rebuild all loaded tiles. In an editor game with this field enabled, sealed-solid, out-of-layout, and outer-classifier verdicts are declined without changing their console switches. |
| `Private/Tests/VoxelForgeParameterizedGenerationTest.cpp` | Separate three-seed functional sweep for the step 2f parameterized field; passage landing air/floor brackets and arrival-to-exit walking routes are checked without changing the live-world tests. | | `Private/Tests/VoxelForgeParameterizedGenerationTest.cpp` | Separate three-seed functional sweep for the step 2f parameterized field; passage landing air/floor brackets and arrival-to-exit walking routes are checked without changing the live-world tests. |
@@ -180,7 +186,7 @@ remains `0`, and lateral regions remain gated off.
| Symbol | Line | Notes | | Symbol | Line | Notes |
|--------|------|-------| |--------|------|-------|
| `CHUNK_SIZE` (32) | 211 | Chunk dimensions. 64³ would cut draw calls but makes streaming too bursty; fps is fixed render-side instead. | | `CHUNK_SIZE` (32) | 211 | Chunk dimensions. 64³ would cut draw calls but makes streaming too bursty; fps is fixed render-side instead. |
| `VOXEL_SIZE` (12.5f cm) | 213 | World scale; one 32³ chunk is 4 m. | | `VOXEL_SIZE` (12.5f cm) | 213 | Legacy generator scale; `CHUNK_SIZE` 32 spans 4 m here. Keep separate from the 8 m default layout chunk and 32³ Core tile. |
| `EVoxelFace` enum | 266 | 6 cube faces. | | `EVoxelFace` enum | 266 | 6 cube faces. |
| `WorldToChunkCoord` | 287 | World cm → chunk coord (handles negatives via floor). | | `WorldToChunkCoord` | 287 | World cm → chunk coord (handles negatives via floor). |
| `VoxelMath::IsFiniteFast` / `IsFinite` | 24 / 45 | Exact IEEE bit test (`voxel.FastIsFinite` A/B switch). | | `VoxelMath::IsFiniteFast` / `IsFinite` | 24 / 45 | Exact IEEE bit test (`voxel.FastIsFinite` A/B switch). |
@@ -207,14 +213,16 @@ all eight archetypes; there is no other path. See [Docs/archive/OPSTACK-PLAN.md]
| `FVoxelBoxHypotheses` + `FVoxelBoxSdfInterval` + `VF_ForceHypotheses` / `VF_FoldEffect` / `VF_FoldOp` | The fold that turns a stack into an `EVoxelTileClass`, carrying the SDF interval between independent writers and consumers. Unknown is biased toward `Mixed`; the mapping and soundness rule are written out in the header. | | `FVoxelBoxHypotheses` + `FVoxelBoxSdfInterval` + `VF_ForceHypotheses` / `VF_FoldEffect` / `VF_FoldOp` | The fold that turns a stack into an `EVoxelTileClass`, carrying the SDF interval between independent writers and consumers. Unknown is biased toward `Mixed`; the mapping and soundness rule are written out in the header. |
### 3.2c Structural primitives — `Public/VoxelDensityPrimitives.h` ### 3.2c Structural primitives — `Public/VoxelDensityPrimitives.h`
`VF_ApplyOriginSpine` · `VF_ApplyBoundarySeal` · `VF_ApplyPassageCarving` · `VF_ApplyXYEdgeSeal` — `VF_ApplyOriginSpine` · `VF_ApplyBoundarySeal` · `VF_ApplyUpperBoundarySeal` · `VF_ApplyPassageCarving` · `VF_ApplyXYEdgeSeal` —
the four world invariants every archetype appends, with landing/floor geometry joined by the the four world invariants every archetype appends, with landing/floor geometry joined by the
manager passage post, **moved here 2026-07-27** so the generator and manager passage post, **moved here 2026-07-27** so the generator and
the operator stack share ONE copy. The XY helper is a radial smooth ramp in actor-space and is a the operator stack share ONE copy. The XY helper is a radial smooth ramp in actor-space and is a
true no-op when `WorldRadiusVoxels == 0`; `VF_XYEdgeSealForcedMarginOverBox` is the shared sound true no-op when `WorldRadiusVoxels == 0`; `VF_XYEdgeSealForcedMarginOverBox` is the shared sound
proof for `ClassifyBox` and T1.d's global shell skip. `VoxelGenerator.cpp` keeps same-named proof for `ClassifyBox` and T1.d's global shell skip. `VoxelGenerator.cpp` keeps same-named
`static FORCEINLINE` forwarders for `ApplyBoundarySeal` and `ApplyOriginSpine`; the passage and `static FORCEINLINE` forwarders for `ApplyBoundarySeal` and `ApplyOriginSpine`; the passage and
edge helpers are called directly. **Convention: INTERNAL (positive = solid); `VF_ApplyXYEdgeSealMC` is the output wrapper.** edge helpers are called directly. `VF_ApplyUpperBoundarySealValue` contains the common upper-band
math used by both one-sided and two-sided seals. **Convention: INTERNAL (positive = solid);
`VF_ApplyXYEdgeSealMC` is the output wrapper.**
### 3.2d Operator stack — `Public/VoxelDensityOpStack.h` + `Private/VoxelDensityOpStack.cpp` ### 3.2d Operator stack — `Public/VoxelDensityOpStack.h` + `Private/VoxelDensityOpStack.cpp`
⚠️ **This IS the game's generation path.** `GetDensityAt` builds the stack in its per-chunk refetch ⚠️ **This IS the game's generation path.** `GetDensityAt` builds the stack in its per-chunk refetch
@@ -1117,6 +1125,98 @@ restores the S13 path for the negative control. Runtime CVar capture lives in
cold-path decision are in cold-path decision are in
[`Standalone/Research/WorldAssemblerM3/Round18/REPORT.md`](Standalone/Research/WorldAssemblerM3/Round18/REPORT.md). [`Standalone/Research/WorldAssemblerM3/Round18/REPORT.md`](Standalone/Research/WorldAssemblerM3/Round18/REPORT.md).
### 3.21 LOD1 uniform-block proof — World Assembler M3 Linux9
`FStandaloneShapeWorld::IsNativeSurfaceBox` gates the step-2 proof to a single native SurfaceWorld
stratum. `ClassifyBoxDetailed(..., bUseNativeLatticeProof)` delegates to
`Heightfield2D::classifyLatticeBox`, whose ground/cap extrema cover the MC lattice and normal halo.
`UVoxelMarchingCubesMesher::GenerateMesh` sparsely fills only Mixed blocks and their sample halo;
Mixed/Unknown remains on the fill path. The headless `--audit-uniform-block-proofs` forces sample
verification, while `--profile-lod-work` reports per-LOD filled samples; both are off by default.
Implementation and evidence: [`Standalone/Research/WorldAssemblerM3/Linux9/REPORT.md`](Standalone/Research/WorldAssemblerM3/Linux9/REPORT.md).
### 3.22 Route-invariant Core density — World Assembler M3 Linux13
| Symbol | Canonical file | Role |
|---|---|---|
| `FStandaloneShapeWorld::SetSharedDensitySource`, `SharedDensitySource` | `Standalone/Core/src/ShapeWorldInternal.h`, bound before publication in `Standalone/Core/src/VoxelForgeCore.cpp` | Makes compiled analytic pages delegate field, lattice, detail, classification, and solid queries to the Core world's base shape; `WorldAssemblyEvaluatorVersion` is 6. |
The base manifest field is authoritative for tile generation and exact queries. See ARCHITECTURE
§8.36 and [`Standalone/Research/WorldAssemblerM3/Linux13/REPORT.md`](Standalone/Research/WorldAssemblerM3/Linux13/REPORT.md).
### 3.23 Shared strate boundaries and FloatingIslands seal — World Assembler M3 Linux18
| Symbol | Canonical file | Role |
|---|---|---|
| `FStandaloneShapeWorld::FResolvedStratumBounds`, `MakeResolvedStratumBounds`, `GetResolvedStratumBounds` | `Standalone/Core/src/ShapeWorldInternal.h` | Resolves each strate's physical lower/upper range and seal width for layer ranges, far-field sample protection, and far-shell continuity. Native FloatingIslands uses its plan's owner/Core ratio; SurfaceWorld retains its `32` Core voxels per slot chunk. |
| `VF_ApplyUpperBoundarySeal` / `VF_ApplyUpperBoundarySealValue` | `Standalone/Source/VoxelForge/Public/VoxelDensityPrimitives.h` and `Source/VoxelForge/Public/VoxelDensityPrimitives.h` | Shared one-sided top seal used by version-3 native FloatingIslands; the two-sided seal reuses the same upper-band math. |
Geometry version 3 removes the FI lower all-XY seal while retaining its ceiling through the shared
upper-bound path. Versions 1 and 2 retain their serialized two-sided behavior. See ARCHITECTURE §8.37
and [`Standalone/Research/WorldAssemblerM3/Linux18/REPORT.md`](Standalone/Research/WorldAssemblerM3/Linux18/REPORT.md).
### 3.24 Resolved inter-strate passages — World Assembler M3 L23
| Symbol | Canonical file | Role |
|---|---|---|
| `PlanResolvedLayoutPassagesV1`, `ResolvedLayoutPassageV1::lowerMouthControlIndex` | `Standalone/Core/src/ResolvedLayoutInternal.h`, public record in `VoxelForgeCore.h` | Plans deterministic fixed-metre passages from adjacent director-resolved strata, binds route departure/arrival mouths, and records the derived split between the monotone descent and route-bound landing tail. |
| `FStandaloneShapeWorld::ApplyResolvedStrateComposition`, `ApplyResolvedStratePassageCarves` | `Standalone/Core/src/ShapeWorldInternal.h` | Applies boundary bands first, then opens the passage capsule and supported floor along the passage for every native generator. |
| `--audit-resolved-layout-passages` | `Standalone/Source/StreamBenchmarkPipeline.h` | Samples passage capsules, floor support, mouth ownership/radius, in-strate route bindings, and a blocked-passage negative control. |
The evaluator version is 9. See ARCHITECTURE §8.41 and
[`Standalone/Research/WorldAssemblerM3/Linux23/REPORT.md`](Standalone/Research/WorldAssemblerM3/Linux23/REPORT.md).
### 3.25 Per-strate natural passages and FloatingIslands anchor helix — World Assembler L24
| Symbol | Canonical file | Role |
|---|---|---|
| `FStratePassageConfig::Style`, `EVoxelPassageStyle` | `Source/VoxelForge/Public/VoxelStrateTypes.h` | Selects Straight, Worm, Spiral or Cascading per upper strate; Worm is the default. |
| `PlanResolvedLayoutPassagesV1` | `Standalone/Core/src/ResolvedLayoutInternal.h` | Applies the selected style in the shared planner; a configured FI Spiral follows the anchor root into the bedrock and smoothly transitions into the inter-strate route. |
| Anchor root recipe fields and `EvaluateIslandSDF` | `Standalone/Core/src/FloatingIslandsInternal.h` | Add the seed-stable ordinal-2 island/root without changing other island placements; geometry version 5. |
| `ApplyResolvedStratePassageCarves` | `Standalone/Core/src/ShapeWorldInternal.h` | Applies deterministic rough wall relief and the supported route profile to all native generator fields. |
| `--audit-resolved-layout-passages` naturalness checks | `Standalone/Source/StreamBenchmarkPipeline.h` | Checks 8 m maximum flat run, 0.20 m minimum wall relief, capsule/support/grade, mouths, routes and the blocked-passage control. |
| `--headlamp=on`, `--clip-plane=NX,NY,NZ,D` | `Standalone/Source/LinuxOffscreenCapture.cpp` | Adds camera-directed light or discards the plane's negative half-space for offscreen cutaways; neither affects Core output. |
The shared evaluator is version 10, the FI recipe geometry is version 5, and resolved-layout schema
V3 is unchanged. See ARCHITECTURE §8.42 and
[`Standalone/Research/WorldAssemblerM3/Linux24/REPORT.md`](Standalone/Research/WorldAssemblerM3/Linux24/REPORT.md).
### 3.26 Enclosed FloatingIslands helix and open-air support gate — World Assembler L25
| Symbol | Canonical file | Role |
|---|---|---|
| `ApplyResolvedStratePassageCarves` | `Standalone/Core/src/ShapeWorldInternal.h` | Emits route-mouth support, tread and fallback support only over pre-passage native solid density, shared by every passage style. |
| `auditPassageOpenAir` / `--audit-resolved-layout-passages` | `Standalone/Source/StreamBenchmarkPipeline.h` | Samples the support footprint at 0.25 m spacing and two depths; compares against L24 ungated support as a required negative control. |
| Anchor root dimensions and relief | `Standalone/Core/src/FloatingIslandsInternal.h` | Raises the FI anchor root from a 6 m cylinder to a nominal 13.25 m relief-bearing rock column sized around the 3 m helix and 4.5 m mouth. |
| Passage route and root measures | `Standalone/Core/src/ResolvedLayoutInternal.h`, `Standalone/Core/include/VoxelForgeCore/VoxelForgeCore.h` | Binds the Spiral to the root and reports measured centreline/root clearance. |
The shared evaluator is version 12 and FI geometry version is 7; resolved-layout schema V3 is
unchanged. See ARCHITECTURE §8.43 and
[`Standalone/Research/WorldAssemblerM3/Linux25/REPORT.md`](Standalone/Research/WorldAssemblerM3/Linux25/REPORT.md).
### 3.27 Tunnels in native rock with grounded passage bridges — World Assembler L26
| Symbol | Canonical file | Role |
|---|---|---|
| `BuildPassageBridgePlan` / `PassageBridgeSignedDistance` | `Standalone/Core/src/ShapeWorldInternal.h` | Uses native density sign to plan cached, connected rock spans only across unsupported route ranges; shared by both recipes and all passage styles. |
| `PassageBridgeCache` | `Standalone/Source/OwnerWorldLoader.h` | Shares deterministic ranges by resolved-layout identity across shape instances. |
| `ApplyResolvedStratePassageCarves` | `Standalone/Core/src/ShapeWorldInternal.h` | Adds bridge density before carving the bore; gates native floor support on solid input and player-capsule clearance. |
| `auditPassageBridges` / `auditPassageOpenAir` / `--audit-resolved-layout-passages` | `Standalone/Source/StreamBenchmarkPipeline.h` | Measures bridge width, thickness, relief and connected ends; checks capsule support, open air, naturalness, route binding and the L24 negative control. |
| `PassageBridgeRangeAuditV1` / `passageBridgeRanges()` / `isPassageBridgeSample()` | `Standalone/Core/include/VoxelForgeCore/VoxelForgeCore.h`, `Standalone/Core/src/VoxelForgeCore.cpp` | Exposes audit-only bridge ranges and density queries to the standalone validator. |
The shared evaluator is version 13; FloatingIslands geometry remains version 7 and resolved-layout
schema V3 is unchanged. See ARCHITECTURE §8.44 and
[`Standalone/Research/WorldAssemblerM3/Linux26/REPORT.md`](Standalone/Research/WorldAssemblerM3/Linux26/REPORT.md).
### 3.28 Tile-bounded passage evaluation — World Assembler M3 Linux L28
| Symbol | Canonical file | Role |
|---|---|---|
| FScopedPassageTileQueries / BuildPassageFeatureTileList / ResolvedPassageIntersectsBox | Standalone/Core/src/ShapeWorldInternal.h; scope entered by GenerateMesh in Standalone/Core/src/VoxelForgeCore.cpp | Builds conservative per-tile route, column and mouth-support candidates from an AABB BVH; long paths use a nearest-segment BVH and L9 box checks use a separate passage-bound BVH. Empty native-only proof indexes fall back conservatively. The density arithmetic and serialized versions stay unchanged. |
See ARCHITECTURE §8.45 and
[Linux28 report](Standalone/Research/WorldAssemblerM3/Linux28/REPORT.md).
## 4. The density pipeline (most-edited hot path) ## 4. The density pipeline (most-edited hot path)
### 4.1 `GetDensityWithParams` (TunnelNetwork) — VoxelGenerator.cpp:3749 ### 4.1 `GetDensityWithParams` (TunnelNetwork) — VoxelGenerator.cpp:3749
@@ -32,6 +32,38 @@ namespace
using FCoreJsonWriter = TJsonWriter<TCHAR, TCondensedJsonPrintPolicy<TCHAR>>; using FCoreJsonWriter = TJsonWriter<TCHAR, TCondensedJsonPrintPolicy<TCHAR>>;
constexpr double OwnerVoxelSizeCm = VOXEL_SIZE; constexpr double OwnerVoxelSizeCm = VOXEL_SIZE;
float StrateBoundarySealThickness(const UVoxelStrateDefinition& Definition)
{
switch(Definition.GeneratorType)
{
case ECaveGeneratorType::SurfaceWorld:return Definition.SurfaceParams.BoundarySealThickness;
case ECaveGeneratorType::FloatingIslands:return Definition.FloatingIslandParams.BoundarySealThickness;
case ECaveGeneratorType::Maze:return Definition.MazeParams.BoundarySealThickness;
case ECaveGeneratorType::VerticalShafts:return Definition.VerticalShaftParams.BoundarySealThickness;
case ECaveGeneratorType::TunnelNetwork:
case ECaveGeneratorType::FlatPlain:
case ECaveGeneratorType::CrystalChamber:
case ECaveGeneratorType::Underwater:return Definition.GenerationParams.BoundarySealThickness;
}
return Definition.GenerationParams.BoundarySealThickness;
}
float StrateBoundarySolidDensity(const UVoxelStrateDefinition& Definition)
{
switch(Definition.GeneratorType)
{
case ECaveGeneratorType::SurfaceWorld:return Definition.SurfaceParams.BaseDensity;
case ECaveGeneratorType::FloatingIslands:return Definition.FloatingIslandParams.BaseDensity;
case ECaveGeneratorType::Maze:return Definition.MazeParams.BaseDensity;
case ECaveGeneratorType::VerticalShafts:return Definition.VerticalShaftParams.BaseDensity;
case ECaveGeneratorType::TunnelNetwork:
case ECaveGeneratorType::FlatPlain:
case ECaveGeneratorType::CrystalChamber:
case ECaveGeneratorType::Underwater:return Definition.GenerationParams.BaseDensity;
}
return Definition.GenerationParams.BaseDensity;
}
std::int64_t WorldAssemblyFixed(double Voxels) std::int64_t WorldAssemblyFixed(double Voxels)
{ {
return static_cast<std::int64_t>(std::llround( return static_cast<std::int64_t>(std::llround(
@@ -287,8 +319,10 @@ bool BuildSurfaceStratumPlan(const UVoxelStrateManager* StrateManager,
const FSurfaceGenerationParams Surface = StrateManager->GetSurfaceParamsForChunk(Chunk); const FSurfaceGenerationParams Surface = StrateManager->GetSurfaceParamsForChunk(Chunk);
const FBiomeContext BiomeContext = StrateManager->GetBiomeContextForChunk(Chunk); const FBiomeContext BiomeContext = StrateManager->GetBiomeContextForChunk(Chunk);
const UVoxelStrateDefinition* Definition = Slot.Definition; const UVoxelStrateDefinition* Definition = Slot.Definition;
const double BottomVoxel = static_cast<double>(Slot.BottomChunkZ) * CHUNK_SIZE; const double LayoutChunkVoxels = static_cast<double>(Recipe.layoutChunkWidthSubvoxels)
const double HeightVoxels = static_cast<double>(Slot.TopChunkZ - Slot.BottomChunkZ + 1) * CHUNK_SIZE; / WorldAssemblySubvoxelsPerVoxel;
const double BottomVoxel = static_cast<double>(Slot.BottomChunkZ) * LayoutChunkVoxels;
const double HeightVoxels = static_cast<double>(Slot.TopChunkZ - Slot.BottomChunkZ + 1) * LayoutChunkVoxels;
const FBiomeMapParams& Map = BiomeContext.Map; const FBiomeMapParams& Map = BiomeContext.Map;
Recipe.seed = static_cast<std::uint32_t>(StrateManager->GetWorldSeed()); Recipe.seed = static_cast<std::uint32_t>(StrateManager->GetWorldSeed());
Recipe.biomeCellSizeSubvoxels = WorldAssemblyFixed(Map.CellSize); Recipe.biomeCellSizeSubvoxels = WorldAssemblyFixed(Map.CellSize);
@@ -422,7 +456,7 @@ bool BuildSurfaceStratumPlan(const UVoxelStrateManager* StrateManager,
Shelf.minimumSubvoxels = {WorldAssemblyFixed(MinX), WorldAssemblyFixed(MinY), Shelf.minimumSubvoxels = {WorldAssemblyFixed(MinX), WorldAssemblyFixed(MinY),
std::max(WorldAssemblyFixed(BottomVoxel), LowestGround - WorldAssemblyFixed(4.0))}; std::max(WorldAssemblyFixed(BottomVoxel), LowestGround - WorldAssemblyFixed(4.0))};
Shelf.maximumSubvoxels = {WorldAssemblyFixed(MaxX), WorldAssemblyFixed(MaxY), Shelf.maximumSubvoxels = {WorldAssemblyFixed(MaxX), WorldAssemblyFixed(MaxY),
std::min(WorldAssemblyFixed((Slot.TopChunkZ + 1) * CHUNK_SIZE), std::min(WorldAssemblyFixed((Slot.TopChunkZ + 1) * LayoutChunkVoxels),
HighestGround + WorldAssemblyFixed(ShelfHeight + 4.0))}; HighestGround + WorldAssemblyFixed(ShelfHeight + 4.0))};
Shelf.parametersSubvoxels = {WorldAssemblyFixed(DirX), WorldAssemblyFixed(DirY), Shelf.parametersSubvoxels = {WorldAssemblyFixed(DirX), WorldAssemblyFixed(DirY),
WorldAssemblyFixed(ShelfHeight), WorldAssemblyFixed(Reach)}; WorldAssemblyFixed(ShelfHeight), WorldAssemblyFixed(Reach)};
@@ -440,17 +474,19 @@ bool BuildSurfaceStratumPlan(const UVoxelStrateManager* StrateManager,
bool BuildFloatingIslandStratumPlan(const UVoxelStrateManager* StrateManager, bool BuildFloatingIslandStratumPlan(const UVoxelStrateManager* StrateManager,
const FStrateSlot& Slot, VoxelForgeCore::WorldAssemblyManifest& Manifest, const FStrateSlot& Slot, VoxelForgeCore::WorldAssemblyManifest& Manifest,
double CoreVoxelSizeCm, FString& OutError) double CoreVoxelSizeCm, std::int64_t LayoutChunkWidthSubvoxels, FString& OutError)
{ {
using namespace VoxelForgeCore; using namespace VoxelForgeCore;
const FIntVector Chunk(0, 0, Slot.TopChunkZ); const FIntVector Chunk(0, 0, Slot.TopChunkZ);
const FFloatingIslandParams Params = StrateManager->GetFloatingIslandParamsForChunk(Chunk); const FFloatingIslandParams Params = StrateManager->GetFloatingIslandParamsForChunk(Chunk);
const FStratePassageConfig& Passage = Slot.Definition->PassageConfig;
WorldAssemblyFloatingIslandPlanV1 IslandPlan; WorldAssemblyFloatingIslandPlanV1 IslandPlan;
IslandPlan.strateIndex = Slot.StrateIndex; IslandPlan.strateIndex = Slot.StrateIndex;
IslandPlan.topChunkZ = Slot.TopChunkZ; IslandPlan.topChunkZ = Slot.TopChunkZ;
IslandPlan.bottomChunkZ = Slot.BottomChunkZ; IslandPlan.bottomChunkZ = Slot.BottomChunkZ;
auto& Recipe = IslandPlan.manifest.recipe; auto& Recipe = IslandPlan.manifest.recipe;
Recipe.geometryVersion = 2; Recipe.geometryVersion = 8;
Recipe.layoutChunkWidthSubvoxels = LayoutChunkWidthSubvoxels;
Recipe.seed = static_cast<std::uint32_t>(StrateManager->GetWorldSeed()); Recipe.seed = static_cast<std::uint32_t>(StrateManager->GetWorldSeed());
Recipe.ownerVoxelSizeMicrons = static_cast<std::uint32_t>(std::llround(OwnerVoxelSizeCm * 10000.0)); Recipe.ownerVoxelSizeMicrons = static_cast<std::uint32_t>(std::llround(OwnerVoxelSizeCm * 10000.0));
Recipe.coreVoxelSizeMicrons = static_cast<std::uint32_t>(std::llround(CoreVoxelSizeCm * 10000.0)); Recipe.coreVoxelSizeMicrons = static_cast<std::uint32_t>(std::llround(CoreVoxelSizeCm * 10000.0));
@@ -463,12 +499,10 @@ bool BuildFloatingIslandStratumPlan(const UVoxelStrateManager* StrateManager,
} }
Recipe.ownerToCoreScaleNumerator = Recipe.ownerVoxelSizeMicrons / ScaleGcd; Recipe.ownerToCoreScaleNumerator = Recipe.ownerVoxelSizeMicrons / ScaleGcd;
Recipe.ownerToCoreScaleDenominator = Recipe.coreVoxelSizeMicrons / ScaleGcd; Recipe.ownerToCoreScaleDenominator = Recipe.coreVoxelSizeMicrons / ScaleGcd;
const double CoreVoxelsPerOwnerChunk = static_cast<double>(CHUNK_SIZE) Recipe.layoutMinimumZSubvoxels = static_cast<std::int64_t>(Slot.BottomChunkZ)
* Recipe.ownerToCoreScaleNumerator / Recipe.ownerToCoreScaleDenominator; * LayoutChunkWidthSubvoxels;
Recipe.layoutMinimumZSubvoxels = WorldAssemblyFixed( Recipe.layoutMaximumZSubvoxels = static_cast<std::int64_t>(Slot.TopChunkZ + 1)
static_cast<double>(Slot.BottomChunkZ) * CoreVoxelsPerOwnerChunk); * LayoutChunkWidthSubvoxels;
Recipe.layoutMaximumZSubvoxels = WorldAssemblyFixed(
static_cast<double>(Slot.TopChunkZ + 1) * CoreVoxelsPerOwnerChunk);
Recipe.layoutCenterTopZSubvoxels = (Recipe.layoutMinimumZSubvoxels Recipe.layoutCenterTopZSubvoxels = (Recipe.layoutMinimumZSubvoxels
+ Recipe.layoutMaximumZSubvoxels) / 2; + Recipe.layoutMaximumZSubvoxels) / 2;
Recipe.islandDensityQ16 = WorldAssemblyQ16(FMath::Clamp(Params.IslandDensity, 0.0f, 1.0f)); Recipe.islandDensityQ16 = WorldAssemblyQ16(FMath::Clamp(Params.IslandDensity, 0.0f, 1.0f));
@@ -483,6 +517,28 @@ bool BuildFloatingIslandStratumPlan(const UVoxelStrateManager* StrateManager,
Recipe.roughnessSubvoxels = WorldAssemblyFixed(Params.SurfaceRoughness * OwnerToCoreScale); Recipe.roughnessSubvoxels = WorldAssemblyFixed(Params.SurfaceRoughness * OwnerToCoreScale);
Recipe.blendRadiusSubvoxels = WorldAssemblyFixed(Params.SDFBlendRadius * OwnerToCoreScale); Recipe.blendRadiusSubvoxels = WorldAssemblyFixed(Params.SDFBlendRadius * OwnerToCoreScale);
Recipe.boundarySealSubvoxels = WorldAssemblyFixed(Params.BoundarySealThickness * OwnerToCoreScale); Recipe.boundarySealSubvoxels = WorldAssemblyFixed(Params.BoundarySealThickness * OwnerToCoreScale);
const auto OwnerVoxelsToCoreQ=[&](double Value)
{
return static_cast<std::int64_t>(std::llround(Value*Recipe.ownerVoxelSizeMicrons
*WorldAssemblySubvoxelsPerVoxel/Recipe.coreVoxelSizeMicrons));
};
Recipe.anchorIslandOrdinal=Recipe.primaryIslandCount-1;
Recipe.anchorPlacementRadiusSubvoxels=OwnerVoxelsToCoreQ(Passage.DistanceMax);
const std::int64_t spiralRadius=OwnerVoxelsToCoreQ(Passage.SpiralRadius);
// Reserve at least a 1.5 m mid-bore through the anchor root.
constexpr double AnchorPassageMinimumBoreOwnerVoxels=12.0;
const std::int64_t mouthBore=std::max(OwnerVoxelsToCoreQ(Passage.MouthRadius),
OwnerVoxelsToCoreQ(12.0));
const std::int64_t bore=std::max(OwnerVoxelsToCoreQ(Passage.MidRadius),
OwnerVoxelsToCoreQ(AnchorPassageMinimumBoreOwnerVoxels));
const std::int64_t wallReserve=OwnerVoxelsToCoreQ(12.0);
Recipe.anchorMouthOffsetSubvoxels=spiralRadius+mouthBore+OwnerVoxelsToCoreQ(4.0);
const std::int64_t excursion=std::max(OwnerVoxelsToCoreQ(Passage.Wander),spiralRadius);
Recipe.anchorRootRadiusSubvoxels=excursion+bore+wallReserve;
Recipe.anchorIslandMinimumRadiusSubvoxels=std::max(Recipe.minimumRadiusSubvoxels,
Recipe.anchorMouthOffsetSubvoxels+mouthBore+OwnerVoxelsToCoreQ(4.0));
Recipe.anchorRootBottomZSubvoxels=Recipe.layoutMinimumZSubvoxels
+Recipe.boundarySealSubvoxels;
std::string PlanError; std::string PlanError;
const std::optional<FloatingIslandManifestV1> Planned = PlanFloatingIslandCluster(Recipe, PlanError); const std::optional<FloatingIslandManifestV1> Planned = PlanFloatingIslandCluster(Recipe, PlanError);
if (!Planned) if (!Planned)
@@ -758,6 +814,12 @@ bool AttachValidatedWorldAssembly(const UVoxelSettings* Settings,
const TSharedRef<FJsonObject>& Root, const TSharedRef<FJsonObject>& Root,
FString& OutError) FString& OutError)
{ {
const std::uint32_t LayoutChunkSizeMicrometres=StrateManager->GetStrateLayoutChunkSizeMicrometres();
const std::uint32_t CoreVoxelMicrometres=static_cast<std::uint32_t>(std::llround(CoreVoxelSizeCm*10000.0));
const std::int64_t LayoutChunkWidthSubvoxels=static_cast<std::int64_t>(std::llround(
static_cast<double>(LayoutChunkSizeMicrometres)*VoxelForgeCore::WorldAssemblySubvoxelsPerVoxel
/std::max<std::uint32_t>(1,CoreVoxelMicrometres)));
StrateManager->SetHardTransitionFallbackForAssembly(true);
FString ManifestJson; FString ManifestJson;
FString ManifestHash; FString ManifestHash;
if (!Settings->GetWorldAssemblyManifestJson(ManifestJson, ManifestHash, OutError)) if (!Settings->GetWorldAssemblyManifestJson(ManifestJson, ManifestHash, OutError))
@@ -783,6 +845,7 @@ bool AttachValidatedWorldAssembly(const UVoxelSettings* Settings,
{ {
VoxelForgeCore::WorldAssemblyManifest Generated; VoxelForgeCore::WorldAssemblyManifest Generated;
Generated.recipe.seed = static_cast<std::uint32_t>(StrateManager->GetWorldSeed()); Generated.recipe.seed = static_cast<std::uint32_t>(StrateManager->GetWorldSeed());
Generated.recipe.layoutChunkWidthSubvoxels=LayoutChunkWidthSubvoxels;
int32 SurfaceSlotCount = 0; int32 SurfaceSlotCount = 0;
int32 IslandSlotCount = 0; int32 IslandSlotCount = 0;
for (const FStrateSlot& Slot : StrateManager->GetLayout()) for (const FStrateSlot& Slot : StrateManager->GetLayout())
@@ -815,6 +878,7 @@ bool AttachValidatedWorldAssembly(const UVoxelSettings* Settings,
{ {
VoxelForgeCore::WorldAssemblyRecipeV1 SlotRecipe; VoxelForgeCore::WorldAssemblyRecipeV1 SlotRecipe;
SlotRecipe.seed = static_cast<std::uint32_t>(StrateManager->GetWorldSeed()); SlotRecipe.seed = static_cast<std::uint32_t>(StrateManager->GetWorldSeed());
SlotRecipe.layoutChunkWidthSubvoxels=LayoutChunkWidthSubvoxels;
VoxelForgeCore::WorldAssemblyStratumPlanV1 Stratum; VoxelForgeCore::WorldAssemblyStratumPlanV1 Stratum;
if (!BuildSurfaceStratumPlan(StrateManager, Slot, if (!BuildSurfaceStratumPlan(StrateManager, Slot,
SlotRecipe, Stratum, OutError)) SlotRecipe, Stratum, OutError))
@@ -829,7 +893,7 @@ bool AttachValidatedWorldAssembly(const UVoxelSettings* Settings,
else if (Type == ECaveGeneratorType::FloatingIslands) else if (Type == ECaveGeneratorType::FloatingIslands)
{ {
if (!BuildFloatingIslandStratumPlan(StrateManager, Slot, Generated, if (!BuildFloatingIslandStratumPlan(StrateManager, Slot, Generated,
CoreVoxelSizeCm, OutError)) CoreVoxelSizeCm, LayoutChunkWidthSubvoxels, OutError))
{ {
return false; return false;
} }
@@ -873,7 +937,11 @@ bool AttachValidatedWorldAssembly(const UVoxelSettings* Settings,
OutError = TEXT("floating-island override uses a different Core voxel size; regenerate the plan."); OutError = TEXT("floating-island override uses a different Core voxel size; regenerate the plan.");
return false; return false;
} }
if(Island.manifest.recipe.layoutChunkWidthSubvoxels!=LayoutChunkWidthSubvoxels)
{OutError=TEXT("floating-island override uses a different strate-layout chunk width; regenerate the plan.");return false;}
} }
if(Manifest->recipe.layoutChunkWidthSubvoxels!=LayoutChunkWidthSubvoxels)
{OutError=TEXT("world assembly manifest uses a different strate-layout chunk width; regenerate the plan.");return false;}
int32 SurfaceSlotCount = 0; int32 SurfaceSlotCount = 0;
int32 FloatingIslandSlotCount = 0; int32 FloatingIslandSlotCount = 0;
@@ -944,6 +1012,247 @@ bool AttachValidatedWorldAssembly(const UVoxelSettings* Settings,
MatchedStrateIndices.Add(Plan.strateIndex); MatchedStrateIndices.Add(Plan.strateIndex);
} }
// Keep the inspectable physical-layout export separate from the manifest identity: it is
// assembled from the same resolved slots/plans, but adding it must not salt evaluation hashes.
VoxelForgeCore::ResolvedLayoutSnapshotV3 Layout;
Layout.worldIdentity = std::string("owner-world/seed/")
+ std::to_string(StrateManager->GetWorldSeed());
Layout.ownerVoxelSizeMicrometres = static_cast<std::uint32_t>(std::llround(OwnerVoxelSizeCm * 10000.0));
Layout.coreVoxelSizeMicrometres = ExpectedCoreVoxelMicrons;
Layout.strateLayoutChunkSizeMicrometres=LayoutChunkSizeMicrometres;
Layout.strateLayoutChunkWidthSubvoxels=LayoutChunkWidthSubvoxels;
const auto generatorName = [](ECaveGeneratorType Type) -> const char*
{
switch (Type)
{
case ECaveGeneratorType::TunnelNetwork: return "TunnelNetwork";
case ECaveGeneratorType::FlatPlain: return "FlatPlain";
case ECaveGeneratorType::CrystalChamber: return "CrystalChamber";
case ECaveGeneratorType::Maze: return "Maze";
case ECaveGeneratorType::SurfaceWorld: return "SurfaceWorld";
case ECaveGeneratorType::VerticalShafts: return "VerticalShafts";
case ECaveGeneratorType::FloatingIslands: return "FloatingIslands";
case ECaveGeneratorType::Underwater: return "Underwater";
}
return "Unknown";
};
const auto transitionName = [](EVoxelStrateTransition Type) -> const char*
{
switch (Type)
{
case EVoxelStrateTransition::Gradient: return "Gradient";
case EVoxelStrateTransition::Hard: return "Hard";
case EVoxelStrateTransition::Interleaved: return "Interleaved";
}
return "Unknown";
};
const std::int64_t OwnerVoxelMicrons = Layout.ownerVoxelSizeMicrometres;
const auto FixedToMicrons = [ExpectedCoreVoxelMicrons](std::int64_t Fixed)
{
return static_cast<std::int64_t>(std::llround(static_cast<double>(Fixed)
* ExpectedCoreVoxelMicrons / VoxelForgeCore::WorldAssemblySubvoxelsPerVoxel));
};
std::vector<VoxelForgeCore::ResolvedLayoutPassageConfigV1> PassageConfigs;
for (const FStrateSlot& Slot : StrateManager->GetLayout())
{
if (Slot.Definition == nullptr) continue;
const FStratePassageConfig& AuthoredPassage = Slot.Definition->PassageConfig;
const auto OwnerVoxelsToCoreQ = [OwnerVoxelMicrons, ExpectedCoreVoxelMicrons](double Value)
{
return static_cast<std::int64_t>(std::llround(Value * OwnerVoxelMicrons
* VoxelForgeCore::WorldAssemblySubvoxelsPerVoxel / ExpectedCoreVoxelMicrons));
};
VoxelForgeCore::ResolvedLayoutPassageConfigV1 PassageConfig;
PassageConfig.upperStrateIndex = Slot.StrateIndex;
PassageConfig.connections = AuthoredPassage.Connections;
PassageConfig.style = static_cast<std::uint32_t>(AuthoredPassage.Style);
PassageConfig.mouthRadiusSubvoxels = std::max(OwnerVoxelsToCoreQ(AuthoredPassage.MouthRadius),
OwnerVoxelsToCoreQ(12.0));
PassageConfig.midRadiusSubvoxels = std::max(OwnerVoxelsToCoreQ(AuthoredPassage.MidRadius),
OwnerVoxelsToCoreQ(12.0));
PassageConfig.reachMinimumSubvoxels = OwnerVoxelsToCoreQ(AuthoredPassage.ReachMin);
PassageConfig.reachMaximumSubvoxels = OwnerVoxelsToCoreQ(AuthoredPassage.ReachMax);
PassageConfig.distanceMinimumSubvoxels = OwnerVoxelsToCoreQ(AuthoredPassage.DistanceMin);
PassageConfig.distanceMaximumSubvoxels = OwnerVoxelsToCoreQ(AuthoredPassage.DistanceMax);
PassageConfig.wanderSubvoxels = OwnerVoxelsToCoreQ(AuthoredPassage.Wander);
PassageConfig.segments = static_cast<std::uint32_t>(FMath::Clamp(AuthoredPassage.Segments,1,48));
PassageConfig.verticalWobbleSubvoxels = OwnerVoxelsToCoreQ(AuthoredPassage.VerticalWobble);
PassageConfig.spiralRadiusSubvoxels = OwnerVoxelsToCoreQ(AuthoredPassage.SpiralRadius);
PassageConfig.spiralTurnsQ16 = static_cast<std::int64_t>(std::llround(
static_cast<double>(AuthoredPassage.SpiralTurns)*65536.0));
PassageConfig.cascadeSteps = static_cast<std::uint32_t>(FMath::Clamp(AuthoredPassage.CascadeSteps,1,16));
PassageConfig.cascadeLedgeSubvoxels = OwnerVoxelsToCoreQ(AuthoredPassage.CascadeLedge);
PassageConfigs.push_back(PassageConfig);
const ECaveGeneratorType Type = StrateManager->GetGeneratorTypeForChunk(
FIntVector(0, 0, Slot.TopChunkZ));
VoxelForgeCore::ResolvedLayoutStratumV2 Item;
Item.strateIndex = Slot.StrateIndex;
Item.generatorKind = generatorName(Type);
Item.stableId = Layout.worldIdentity + "/strate/" + std::to_string(Slot.StrateIndex)
+ "/generator/" + generatorName(Type);
Item.recipeId = Type == ECaveGeneratorType::SurfaceWorld ? "SurfaceWorld.Heightfield2D"
: Type == ECaveGeneratorType::FloatingIslands ? "FloatingIslands.ClusterField"
: std::string("legacy.") + generatorName(Type);
Item.recipeVersion = Type == ECaveGeneratorType::SurfaceWorld ? Manifest->recipe.schemaVersion : 0;
Item.voxelSizeMicrometres = ExpectedCoreVoxelMicrons;
Item.interiorBottomMicrometres = static_cast<std::int64_t>(Slot.BottomChunkZ)
* LayoutChunkSizeMicrometres;
Item.interiorTopMicrometres = static_cast<std::int64_t>(Slot.TopChunkZ + 1)
* LayoutChunkSizeMicrometres;
Item.managerChunkWidthMicrometres = LayoutChunkSizeMicrometres;
Item.dispatchChunkWidthMicrometres = LayoutChunkSizeMicrometres;
Item.transitionMode = transitionName(Slot.Definition->TransitionType);
Item.transitionBlendChunks = Slot.Definition->TransitionBlendChunks;
Item.transitionWidthMicrometres = static_cast<std::int64_t>(Item.transitionBlendChunks)
* Item.managerChunkWidthMicrometres;
Item.transitionWarpAmplitudeMicrometres = Item.transitionMode == "Interleaved"
? 2 * Item.managerChunkWidthMicrometres : 0;
Item.transitionInterpenetrationMicrometres = 0;
Item.transitionHonouredInCore = Slot.Definition->TransitionType == EVoxelStrateTransition::Hard;
Item.transitionFallsBackToHard = Slot.Definition->TransitionType != EVoxelStrateTransition::Hard;
Item.transitionDispatchPath = Item.transitionFallsBackToHard
? "declared Gradient/Interleaved recorded; Core uses an explicit Hard transition fallback with zero interpenetration"
: "declared Hard transition is applied at this interface";
Item.managerLookup = "UVoxelStrateManager::GetGeneratorTypeForChunk; transition is controlled by upper strate";
if (Type == ECaveGeneratorType::SurfaceWorld)
{
Item.boundDispatchPath = "BuildSurfaceStratumPlan uses resolved layout chunk width from ResolvedLayoutSnapshotV3";
Item.queryDispatchPath = "NativeSurfaceDensityAt selects floor(CoreZ / resolved layout chunk width) from ResolvedLayoutSnapshotV3";
const auto Plan = std::find_if(Manifest->plan.strates.begin(), Manifest->plan.strates.end(),
[&Slot](const auto& Entry) { return Entry.strateIndex == Slot.StrateIndex; });
if (Plan != Manifest->plan.strates.end())
{
for (const auto& Profile : Manifest->recipe.biomes)
if (Profile.hasCapProfile)
{
VoxelForgeCore::ResolvedLayoutAnchorV2 Anchor;
Anchor.kind = "cap_profile";
Anchor.stableId = "biome/" + std::to_string(Profile.stableId);
Anchor.units = "1/256 Core voxel";
Anchor.values = { Profile.capHeightSubvoxels, Profile.capUndulationSubvoxels,
Profile.capWavelengthSubvoxels, Profile.capDetailAmplitudeSubvoxels,
Profile.capRidgeAmplitudeSubvoxels };
Item.anchors.push_back(std::move(Anchor));
}
for (std::size_t RouteIndex = 0; RouteIndex < Plan->route.size(); ++RouteIndex)
{
const auto& Point = Plan->route[RouteIndex];
VoxelForgeCore::ResolvedLayoutAnchorV2 Anchor;
Anchor.kind = "route_point"; Anchor.stableId = "route/" + std::to_string(RouteIndex);
Anchor.units = "1/256 Core voxel";
Anchor.values = { Point.positionSubvoxels[0], Point.positionSubvoxels[1],
Point.positionSubvoxels[2], Point.radiusSubvoxels };
Item.anchors.push_back(std::move(Anchor));
}
}
}
else if (Type == ECaveGeneratorType::FloatingIslands)
{
Item.boundDispatchPath = "BuildFloatingIslandStratumPlan uses resolved layout chunk width from ResolvedLayoutSnapshotV3";
Item.queryDispatchPath = "NativeFloatingIslandDensityAt selects floor(CoreZ / resolved layout chunk width) from ResolvedLayoutSnapshotV3";
const auto Plan = std::find_if(Manifest->floatingIslands.begin(), Manifest->floatingIslands.end(),
[&Slot](const auto& Entry) { return Entry.strateIndex == Slot.StrateIndex; });
std::int64_t SealMicrometres = 0;
if (Plan != Manifest->floatingIslands.end())
{
Item.interiorBottomMicrometres = FixedToMicrons(Plan->manifest.recipe.layoutMinimumZSubvoxels);
Item.interiorTopMicrometres = FixedToMicrons(Plan->manifest.recipe.layoutMaximumZSubvoxels);
Item.recipeVersion = Plan->manifest.recipe.geometryVersion;
for (std::size_t IslandIndex = 0; IslandIndex < Plan->manifest.plan.islands.size(); ++IslandIndex)
{
const auto& Island = Plan->manifest.plan.islands[IslandIndex];
VoxelForgeCore::ResolvedLayoutAnchorV2 Anchor;
Anchor.kind = "island_anchor"; Anchor.stableId = "island/" + std::to_string(IslandIndex);
Anchor.units = "1/256 Core voxel";
Anchor.values = { Island.centerSubvoxels[0], Island.centerSubvoxels[1],
Island.centerSubvoxels[2], Island.radiusSubvoxels, Island.topHalfSubvoxels };
Item.anchors.push_back(std::move(Anchor));
if(IslandIndex==Plan->manifest.recipe.anchorIslandOrdinal
&&Plan->manifest.recipe.geometryVersion>=5)
{
VoxelForgeCore::ResolvedLayoutAnchorV2 PassageAnchor;
PassageAnchor.kind="passage_anchor";
PassageAnchor.stableId="passage-anchor/island/"+std::to_string(IslandIndex);
PassageAnchor.units="1/256 Core voxel";
PassageAnchor.values={Island.centerSubvoxels[0],Island.centerSubvoxels[1],
Plan->manifest.recipe.anchorRootRadiusSubvoxels,
Plan->manifest.recipe.anchorMouthOffsetSubvoxels,
Plan->manifest.recipe.anchorPlacementRadiusSubvoxels,
Plan->manifest.recipe.anchorRootBottomZSubvoxels,
Island.radiusSubvoxels};
Item.anchors.push_back(std::move(PassageAnchor));
}
}
for (std::size_t RouteIndex = 0; RouteIndex < Plan->manifest.plan.route.size(); ++RouteIndex)
{
const auto& Point = Plan->manifest.plan.route[RouteIndex];
VoxelForgeCore::ResolvedLayoutAnchorV2 Anchor;
Anchor.kind = "route_point"; Anchor.stableId = "route/" + std::to_string(RouteIndex);
Anchor.units = "1/256 Core voxel";
Anchor.values = { Point.positionSubvoxels[0], Point.positionSubvoxels[1],
Point.positionSubvoxels[2], Point.radiusSubvoxels };
Item.anchors.push_back(std::move(Anchor));
}
}
}
else
{
Item.boundDispatchPath = "resolved manager slot scaled by ResolvedLayoutSnapshotV3 chunk width";
Item.queryDispatchPath = "legacy Core route selects manager chunk by floor(CoreZ / resolved layout chunk width)";
}
const std::int64_t SealMicrometres=static_cast<std::int64_t>(std::llround(
std::max(0.0f,StrateBoundarySealThickness(*Slot.Definition))*OwnerVoxelMicrons));
if(SealMicrometres<=0)
{OutError=FString::Printf(TEXT("Strate %d has no positive BoundarySealThickness for shared ceiling and bedrock bands."),Slot.StrateIndex);return false;}
const std::int64_t SolidDensityQ16=std::max<std::int64_t>(1,WorldAssemblyQ16(
std::max(0.05f,StrateBoundarySolidDensity(*Slot.Definition))));
Item.ceiling={"ceiling",Item.interiorTopMicrometres-SealMicrometres,
Item.interiorTopMicrometres,true,true,false,"solid ceiling from strate BoundarySealThickness; breakable by default",
"interior-facing lower surface","shared resolved-layout density band",SolidDensityQ16};
Item.bedrock={"bedrock",Item.interiorBottomMicrometres,
Item.interiorBottomMicrometres+SealMicrometres,true,true,false,
"solid bedrock floor from strate BoundarySealThickness; breakable by default",
"interior-facing upper surface","shared resolved-layout density band",SolidDensityQ16};
Item.content = { "content", Item.interiorBottomMicrometres,
Item.interiorTopMicrometres, true, true, false, "resolved generator interior",
"none", "none" };
Item.content.bottomMicrometres+=SealMicrometres;
Item.content.topMicrometres-=SealMicrometres;
Layout.strates.push_back(std::move(Item));
}
std::string PassagePlanError;
if (!VoxelForgeCore::PlanResolvedLayoutPassagesV1(Layout,
StrateManager->GetWorldSeed(), PassageConfigs, PassagePlanError))
{
OutError = FString::Printf(TEXT("Resolved inter-strate passage planning failed: %s"),
UTF8_TO_TCHAR(PassagePlanError.c_str()));
return false;
}
std::string LayoutError;
if (!Layout.finalize(LayoutError))
{
OutError = FString::Printf(TEXT("Core resolved-layout export failed: %s"), UTF8_TO_TCHAR(LayoutError.c_str()));
return false;
}
const std::string LayoutJson = Layout.ToJson();
Root->SetStringField(TEXT("resolved_layout_json"),UTF8_TO_TCHAR(LayoutJson.c_str()));
const auto SurfaceSpawnPlan=std::find_if(Manifest->plan.strates.begin(),Manifest->plan.strates.end(),
[](const auto& Plan){return !Plan.route.empty();});
if(SurfaceSpawnPlan!=Manifest->plan.strates.end())
{
const auto& Spawn=SurfaceSpawnPlan->route.front();
TSharedRef<FJsonObject> ViewerStart=MakeShared<FJsonObject>();
ViewerStart->SetBoolField(TEXT("found_open_space"),true);
ViewerStart->SetNumberField(TEXT("x"),static_cast<double>(Spawn.positionSubvoxels[0])
/VoxelForgeCore::WorldAssemblySubvoxelsPerVoxel);
ViewerStart->SetNumberField(TEXT("y"),static_cast<double>(Spawn.positionSubvoxels[1])
/VoxelForgeCore::WorldAssemblySubvoxelsPerVoxel);
ViewerStart->SetNumberField(TEXT("z"),static_cast<double>(Spawn.positionSubvoxels[2])
/VoxelForgeCore::WorldAssemblySubvoxelsPerVoxel);
Root->SetObjectField(TEXT("viewer_start"),ViewerStart);
}
const std::string CanonicalJson = Manifest->ToJson(); const std::string CanonicalJson = Manifest->ToJson();
if (CanonicalJson.empty()) if (CanonicalJson.empty())
{ {
@@ -1013,6 +1322,8 @@ bool VoxelForgeCoreAdapter::SerializeResolvedWorld(
// Override only the temporary schema copy. Clipmap tuning on the owner's asset is preserved. // Override only the temporary schema copy. Clipmap tuning on the owner's asset is preserved.
SettingsValue->AsObject()->SetNumberField(TEXT("ClipRadius"), CoreClipRadius); SettingsValue->AsObject()->SetNumberField(TEXT("ClipRadius"), CoreClipRadius);
SettingsValue->AsObject()->SetNumberField(TEXT("MaxClipLevel"), CoreMaxClipLevel); SettingsValue->AsObject()->SetNumberField(TEXT("MaxClipLevel"), CoreMaxClipLevel);
SettingsValue->AsObject()->SetNumberField(TEXT("StrateLayoutChunkSizeMeters"),
Settings->StrateLayoutChunkSizeMeters);
TSharedRef<FJsonObject> Root = MakeShared<FJsonObject>(); TSharedRef<FJsonObject> Root = MakeShared<FJsonObject>();
Root->SetNumberField(TEXT("schema_version"), 1); Root->SetNumberField(TEXT("schema_version"), 1);
@@ -1032,6 +1343,8 @@ bool VoxelForgeCoreAdapter::SerializeResolvedWorld(
Root->SetNumberField(TEXT("edge_seal_thickness"), Settings->EdgeSealThickness); Root->SetNumberField(TEXT("edge_seal_thickness"), Settings->EdgeSealThickness);
Root->SetNumberField(TEXT("total_strates"), StrateManager->GetNumStrates()); Root->SetNumberField(TEXT("total_strates"), StrateManager->GetNumStrates());
Root->SetNumberField(TEXT("inter_strate_gap_chunks"), Settings->InterStrateGapChunks); Root->SetNumberField(TEXT("inter_strate_gap_chunks"), Settings->InterStrateGapChunks);
Root->SetNumberField(TEXT("strate_layout_chunk_size_um"),
std::llround(Settings->StrateLayoutChunkSizeMeters*1000000.0));
Root->SetNumberField(TEXT("clip_radius"), CoreClipRadius); Root->SetNumberField(TEXT("clip_radius"), CoreClipRadius);
Root->SetNumberField(TEXT("max_clip_level"), CoreMaxClipLevel); Root->SetNumberField(TEXT("max_clip_level"), CoreMaxClipLevel);
Root->SetNumberField(TEXT("full_res_clip_levels"), Settings->FullResClipLevels); Root->SetNumberField(TEXT("full_res_clip_levels"), Settings->FullResClipLevels);
@@ -1099,12 +1412,15 @@ bool VoxelForgeCoreAdapter::SerializeResolvedWorld(
return false; return false;
} }
Root->SetArrayField(TEXT("density_samples"), {}); Root->SetArrayField(TEXT("density_samples"), {});
TSharedRef<FJsonObject> ViewerStart = MakeShared<FJsonObject>(); if(!Root->HasField(TEXT("viewer_start")))
ViewerStart->SetBoolField(TEXT("found_open_space"), false); {
ViewerStart->SetNumberField(TEXT("x"), 0.0); TSharedRef<FJsonObject> ViewerStart = MakeShared<FJsonObject>();
ViewerStart->SetNumberField(TEXT("y"), 0.0); ViewerStart->SetBoolField(TEXT("found_open_space"), false);
ViewerStart->SetNumberField(TEXT("z"), 0.0); ViewerStart->SetNumberField(TEXT("x"), 0.0);
Root->SetObjectField(TEXT("viewer_start"), ViewerStart); ViewerStart->SetNumberField(TEXT("y"), 0.0);
ViewerStart->SetNumberField(TEXT("z"), 0.0);
Root->SetObjectField(TEXT("viewer_start"), ViewerStart);
}
FString WriterBuffer; FString WriterBuffer;
TSharedRef<FCoreJsonWriter> Writer = TJsonWriterFactory<TCHAR, TSharedRef<FCoreJsonWriter> Writer = TJsonWriterFactory<TCHAR,
@@ -321,7 +321,7 @@ namespace
const FVector ChunkCenter( const FVector ChunkCenter(
(ChunkCoord.X + 0.5f) * (float)CHUNK_SIZE, (ChunkCoord.X + 0.5f) * (float)CHUNK_SIZE,
(ChunkCoord.Y + 0.5f) * (float)CHUNK_SIZE, (ChunkCoord.Y + 0.5f) * (float)CHUNK_SIZE,
(ChunkCoord.Z + 0.5f) * (float)CHUNK_SIZE); (ChunkCoord.Z + 0.5f) * Manager->GetStrateLayoutChunkWidthVoxels());
const float ChunkRadius = (float)CHUNK_SIZE * 0.8660254f + 3.0f; const float ChunkRadius = (float)CHUNK_SIZE * 0.8660254f + 3.0f;
const TArray<FVoxelPassage>& Passages = Manager->GetPassages(); const TArray<FVoxelPassage>& Passages = Manager->GetPassages();
Cache.FloorProjections.SetNum(Passages.Num()); Cache.FloorProjections.SetNum(Passages.Num());
@@ -1103,7 +1103,7 @@ static bool VF_FindWalkableTunnelAir(
const FIntVector ChunkCoord( const FIntVector ChunkCoord(
FMath::FloorToInt(Position.X / (float)CHUNK_SIZE), FMath::FloorToInt(Position.X / (float)CHUNK_SIZE),
FMath::FloorToInt(Position.Y / (float)CHUNK_SIZE), FMath::FloorToInt(Position.Y / (float)CHUNK_SIZE),
FMath::FloorToInt(Position.Z / (float)CHUNK_SIZE)); FMath::FloorToInt(Position.Z / Manager->GetStrateLayoutChunkWidthVoxels()));
const TArray<int32>& Nearby = VF_GetNearbyPassages(Manager, ChunkCoord); const TArray<int32>& Nearby = VF_GetNearbyPassages(Manager, ChunkCoord);
const TArray<FVoxelPassage>& Passages = Manager->GetPassages(); const TArray<FVoxelPassage>& Passages = Manager->GetPassages();
const FVoxelPassage* PassageData = Passages.GetData(); const FVoxelPassage* PassageData = Passages.GetData();
@@ -1138,7 +1138,7 @@ static bool VF_IsAnyPassageFloorAt(
const FIntVector ChunkCoord( const FIntVector ChunkCoord(
FMath::FloorToInt(Position.X / (float)CHUNK_SIZE), FMath::FloorToInt(Position.X / (float)CHUNK_SIZE),
FMath::FloorToInt(Position.Y / (float)CHUNK_SIZE), FMath::FloorToInt(Position.Y / (float)CHUNK_SIZE),
FMath::FloorToInt(Position.Z / (float)CHUNK_SIZE)); FMath::FloorToInt(Position.Z / Manager->GetStrateLayoutChunkWidthVoxels()));
const TArray<int32>& Nearby = VF_GetNearbyPassages(Manager, ChunkCoord); const TArray<int32>& Nearby = VF_GetNearbyPassages(Manager, ChunkCoord);
const TArray<FVoxelPassage>& Passages = Manager->GetPassages(); const TArray<FVoxelPassage>& Passages = Manager->GetPassages();
const FVoxelPassage* PassageData = Passages.GetData(); const FVoxelPassage* PassageData = Passages.GetData();
@@ -1169,6 +1169,17 @@ bool UVoxelStrateManager::Initialize(UVoxelSettings* Settings, int32 WorldSeed)
UE_LOG(LogTemp, Error, TEXT("[StrateManager] No settings provided!")); UE_LOG(LogTemp, Error, TEXT("[StrateManager] No settings provided!"));
return false; return false;
} }
if (!FMath::IsFinite(Settings->StrateLayoutChunkSizeMeters)
|| Settings->StrateLayoutChunkSizeMeters < 0.25f
|| Settings->StrateLayoutChunkSizeMeters > 64.0f)
{
UE_LOG(LogTemp, Error, TEXT("[StrateManager] StrateLayoutChunkSizeMeters must be in [0.25, 64] m."));
return false;
}
StrateLayoutChunkSizeMicrometres = static_cast<uint32>(std::llround(
static_cast<double>(Settings->StrateLayoutChunkSizeMeters) * 1000000.0));
StrateLayoutChunkWidthVoxels = static_cast<float>(
static_cast<double>(StrateLayoutChunkSizeMicrometres) / (10000.0 * VOXEL_SIZE));
FVoxelSeasonManifest SeasonManifest; FVoxelSeasonManifest SeasonManifest;
bool bUseSeason = false; bool bUseSeason = false;
@@ -1342,10 +1353,11 @@ bool UVoxelStrateManager::Initialize(UVoxelSettings* Settings, int32 WorldSeed)
Slot.Definition->FloatingIslandParams = SeasonStrate.Params.FloatingIslandParams; Slot.Definition->FloatingIslandParams = SeasonStrate.Params.FloatingIslandParams;
Slot.HeightInChunks = SeasonStrate.HeightInChunks; Slot.HeightInChunks = SeasonStrate.HeightInChunks;
Slot.TopChunkZ = SeasonStrate.TopWorldZ / CHUNK_SIZE - 1; const int32 LayoutChunkVoxels=FMath::RoundToInt(StrateLayoutChunkWidthVoxels);
Slot.BottomChunkZ = SeasonStrate.BottomWorldZ / CHUNK_SIZE; Slot.TopChunkZ = SeasonStrate.TopWorldZ / LayoutChunkVoxels - 1;
if (SeasonStrate.TopWorldZ % CHUNK_SIZE != 0 Slot.BottomChunkZ = SeasonStrate.BottomWorldZ / LayoutChunkVoxels;
|| SeasonStrate.BottomWorldZ % CHUNK_SIZE != 0 if (SeasonStrate.TopWorldZ % LayoutChunkVoxels != 0
|| SeasonStrate.BottomWorldZ % LayoutChunkVoxels != 0
|| Slot.TopChunkZ != CurrentTopZ || Slot.TopChunkZ != CurrentTopZ
|| Slot.BottomChunkZ != CurrentTopZ - (Slot.HeightInChunks - 1)) || Slot.BottomChunkZ != CurrentTopZ - (Slot.HeightInChunks - 1))
{ {
@@ -1525,8 +1537,8 @@ bool UVoxelStrateManager::SetComposerOverrideForStrate(
} }
VF_SetComposerRuntimeBounds( VF_SetComposerRuntimeBounds(
Override->Params, Override->Params,
(float)(TargetSlot->TopChunkZ + 1) * CHUNK_SIZE, (float)(TargetSlot->TopChunkZ + 1) * StrateLayoutChunkWidthVoxels,
(float)TargetSlot->BottomChunkZ * CHUNK_SIZE); (float)TargetSlot->BottomChunkZ * StrateLayoutChunkWidthVoxels);
Override->bUseRecipe = bUseRecipe; Override->bUseRecipe = bUseRecipe;
if (Recipe != nullptr) if (Recipe != nullptr)
{ {
@@ -1545,8 +1557,8 @@ bool UVoxelStrateManager::SetComposerOverrideForStrate(
Override->bUseRegions = true; Override->bUseRegions = true;
Override->Regions = *InRegions; Override->Regions = *InRegions;
VF_RekeyStrateRegionManifest(Override->Regions, CandidateSeed, StrateIndex); VF_RekeyStrateRegionManifest(Override->Regions, CandidateSeed, StrateIndex);
Override->Regions.StrateTopWorldZ = (float)(TargetSlot->TopChunkZ + 1) * CHUNK_SIZE; Override->Regions.StrateTopWorldZ = (float)(TargetSlot->TopChunkZ + 1) * StrateLayoutChunkWidthVoxels;
Override->Regions.StrateBottomWorldZ = (float)TargetSlot->BottomChunkZ * CHUNK_SIZE; Override->Regions.StrateBottomWorldZ = (float)TargetSlot->BottomChunkZ * StrateLayoutChunkWidthVoxels;
VF_SetStrateArchetypeRuntimeBounds(Override->Params, VF_SetStrateArchetypeRuntimeBounds(Override->Params,
Override->Regions.StrateTopWorldZ, Override->Regions.StrateTopWorldZ,
Override->Regions.StrateBottomWorldZ); Override->Regions.StrateBottomWorldZ);
@@ -1796,11 +1808,11 @@ void UVoxelStrateManager::GeneratePassages()
const FStratePassageConfig& Cfg = UpperDef->PassageConfig; const FStratePassageConfig& Cfg = UpperDef->PassageConfig;
// Upper strate floor and lower strate ceiling (differ when there's a bedrock gap). // Upper strate floor and lower strate ceiling (differ when there's a bedrock gap).
const float UpperTopZ = (float)(Upper.TopChunkZ + 1) * CHUNK_SIZE; const float UpperTopZ = (float)(Upper.TopChunkZ + 1) * StrateLayoutChunkWidthVoxels;
const float UpperBottomZ = (float)(Upper.BottomChunkZ) * CHUNK_SIZE; const float UpperBottomZ = (float)(Upper.BottomChunkZ) * StrateLayoutChunkWidthVoxels;
const float LowerTopZ = (float)(Lower.TopChunkZ + 1) * CHUNK_SIZE; const float LowerTopZ = (float)(Lower.TopChunkZ + 1) * StrateLayoutChunkWidthVoxels;
const float UpperMax = (float)Upper.HeightInChunks * CHUNK_SIZE * 0.9f; const float UpperMax = (float)Upper.HeightInChunks * StrateLayoutChunkWidthVoxels * 0.9f;
const float LowerMax = (float)Lower.HeightInChunks * CHUNK_SIZE * 0.9f; const float LowerMax = (float)Lower.HeightInChunks * StrateLayoutChunkWidthVoxels * 0.9f;
const float DistLo = FMath::Min(Cfg.DistanceMin, Cfg.DistanceMax); const float DistLo = FMath::Min(Cfg.DistanceMin, Cfg.DistanceMax);
const float DistHi = FMath::Max(Cfg.DistanceMin, Cfg.DistanceMax); const float DistHi = FMath::Max(Cfg.DistanceMin, Cfg.DistanceMax);
@@ -1930,7 +1942,7 @@ void UVoxelStrateManager::GeneratePassages()
LowerDef->FloatingIslandParams, LowerDef->FloatingIslandParams,
LowerQuerySeed, LowerQuerySeed,
LowerTopZ, LowerTopZ,
(float)(Lower.BottomChunkZ) * CHUNK_SIZE, (float)(Lower.BottomChunkZ) * StrateLayoutChunkWidthVoxels,
PX, PX,
PY, PY,
MaxLateralSnap, MaxLateralSnap,
@@ -1990,7 +2002,7 @@ void UVoxelStrateManager::GeneratePassages()
if (bAimedLowerAtPlayerFitPoint) if (bAimedLowerAtPlayerFitPoint)
{ {
const float LowerSealThickness = BoundarySealThicknessFor(*LowerDef); const float LowerSealThickness = BoundarySealThicknessFor(*LowerDef);
const float LowerBottomZ = (float)(Lower.BottomChunkZ) * CHUNK_SIZE; const float LowerBottomZ = (float)(Lower.BottomChunkZ) * StrateLayoutChunkWidthVoxels;
const float InnerBottomZ = LowerBottomZ + LowerSealThickness; const float InnerBottomZ = LowerBottomZ + LowerSealThickness;
const float InnerTopZ = LowerTopZ - LowerSealThickness; const float InnerTopZ = LowerTopZ - LowerSealThickness;
if (VoxelMath::IsFinite(SuggestedLowerPoint.X) if (VoxelMath::IsFinite(SuggestedLowerPoint.X)
@@ -2158,7 +2170,7 @@ void UVoxelStrateManager::GeneratePassages()
Cfg.MouthRadius, Cfg.MouthRadius,
LowerDoorDirection, LowerDoorDirection,
LowerTopZ, LowerTopZ,
(float)(Lower.BottomChunkZ) * CHUNK_SIZE, (float)(Lower.BottomChunkZ) * StrateLayoutChunkWidthVoxels,
LowerDef ? BoundarySealThicknessFor(*LowerDef) : 0.0f, LowerDef ? BoundarySealThicknessFor(*LowerDef) : 0.0f,
bAimedLowerAtPlayerFitPoint); bAimedLowerAtPlayerFitPoint);
Passage.UpperPoint = Passage.UpperLanding.StandingPoint; Passage.UpperPoint = Passage.UpperLanding.StandingPoint;
@@ -2583,8 +2595,8 @@ void UVoxelStrateManager::GeneratePassages()
if (bOpenSurfaceEntry && OriginSpineRadius > 0.0f && StrateLayout.Num() > 0) if (bOpenSurfaceEntry && OriginSpineRadius > 0.0f && StrateLayout.Num() > 0)
{ {
const FStrateSlot& Top = StrateLayout[0]; const FStrateSlot& Top = StrateLayout[0];
const float TopZ = (float)(Top.TopChunkZ + 1) * CHUNK_SIZE; const float TopZ = (float)(Top.TopChunkZ + 1) * StrateLayoutChunkWidthVoxels;
const float BottomZ = (float)Top.BottomChunkZ * CHUNK_SIZE; const float BottomZ = (float)Top.BottomChunkZ * StrateLayoutChunkWidthVoxels;
const float TopSeal = Top.Definition const float TopSeal = Top.Definition
? BoundarySealThicknessFor(*Top.Definition) : 0.0f; ? BoundarySealThicknessFor(*Top.Definition) : 0.0f;
const VoxelPassageGeometry::FOriginLandingGeometry OriginLanding = const VoxelPassageGeometry::FOriginLandingGeometry OriginLanding =
@@ -2607,7 +2619,7 @@ void UVoxelStrateManager::GeneratePassages()
// the top seal into the finite landing room; lower strate seals remain untouched. // the top seal into the finite landing room; lower strate seals remain untouched.
Entry.Radius = FMath::Max(OriginSpineRadius, Entry.Radius = FMath::Max(OriginSpineRadius,
VoxelPassageGeometry::MetersToVoxels(0.25f)); VoxelPassageGeometry::MetersToVoxels(0.25f));
Entry.UpperPoint = FVector(0.0f, 0.0f, TopZ + CHUNK_SIZE); Entry.UpperPoint = FVector(0.0f, 0.0f, TopZ + StrateLayoutChunkWidthVoxels);
// The capsule's lower tangent meets the room ceiling; it never bores through the // The capsule's lower tangent meets the room ceiling; it never bores through the
// room's floor or creates an origin column in strate 0. // room's floor or creates an origin column in strate 0.
Entry.LowerPoint = FVector( Entry.LowerPoint = FVector(
@@ -2671,7 +2683,7 @@ float UVoxelStrateManager::EvaluateModifierSDF(float WorldX, float WorldY, float
const FIntVector ChunkCoord( const FIntVector ChunkCoord(
FMath::FloorToInt(WorldX / (float)CHUNK_SIZE), FMath::FloorToInt(WorldX / (float)CHUNK_SIZE),
FMath::FloorToInt(WorldY / (float)CHUNK_SIZE), FMath::FloorToInt(WorldY / (float)CHUNK_SIZE),
FMath::FloorToInt(WorldZ / (float)CHUNK_SIZE)); FMath::FloorToInt(WorldZ / StrateLayoutChunkWidthVoxels));
// The shortlist is rebuilt once for a (manager, version, chunk) and is shared by the tube, // The shortlist is rebuilt once for a (manager, version, chunk) and is shared by the tube,
// landing, and floor paths. No source-fit stencil or topology search is allowed below it. // landing, and floor paths. No source-fit stencil or topology search is allowed below it.
@@ -2817,7 +2829,7 @@ void UVoxelStrateManager::ApplyPassageModifier(
const FIntVector ChunkCoord( const FIntVector ChunkCoord(
FMath::FloorToInt(WorldX / (float)CHUNK_SIZE), FMath::FloorToInt(WorldX / (float)CHUNK_SIZE),
FMath::FloorToInt(WorldY / (float)CHUNK_SIZE), FMath::FloorToInt(WorldY / (float)CHUNK_SIZE),
FMath::FloorToInt(WorldZ / (float)CHUNK_SIZE)); FMath::FloorToInt(WorldZ / StrateLayoutChunkWidthVoxels));
const TArray<int32>& Nearby = VF_GetNearbyPassages(this, ChunkCoord); const TArray<int32>& Nearby = VF_GetNearbyPassages(this, ChunkCoord);
const FVoxelPassage* PassageData = Passages.GetData(); const FVoxelPassage* PassageData = Passages.GetData();
const FVector Position(WorldX, WorldY, WorldZ); const FVector Position(WorldX, WorldY, WorldZ);
@@ -2910,7 +2922,7 @@ void UVoxelStrateManager::ApplyPassageLandingAir(
const FIntVector ChunkCoord( const FIntVector ChunkCoord(
FMath::FloorToInt(WorldX / (float)CHUNK_SIZE), FMath::FloorToInt(WorldX / (float)CHUNK_SIZE),
FMath::FloorToInt(WorldY / (float)CHUNK_SIZE), FMath::FloorToInt(WorldY / (float)CHUNK_SIZE),
FMath::FloorToInt(WorldZ / (float)CHUNK_SIZE)); FMath::FloorToInt(WorldZ / StrateLayoutChunkWidthVoxels));
const TArray<int32>& Nearby = VF_GetNearbyPassages(this, ChunkCoord); const TArray<int32>& Nearby = VF_GetNearbyPassages(this, ChunkCoord);
if (Nearby.Num() == 0) return; if (Nearby.Num() == 0) return;
@@ -3021,7 +3033,7 @@ void UVoxelStrateManager::ApplyPassageLandingFloorMC(
const FIntVector ChunkCoord( const FIntVector ChunkCoord(
FMath::FloorToInt(WorldX / (float)CHUNK_SIZE), FMath::FloorToInt(WorldX / (float)CHUNK_SIZE),
FMath::FloorToInt(WorldY / (float)CHUNK_SIZE), FMath::FloorToInt(WorldY / (float)CHUNK_SIZE),
FMath::FloorToInt(WorldZ / (float)CHUNK_SIZE)); FMath::FloorToInt(WorldZ / StrateLayoutChunkWidthVoxels));
const TArray<int32>& Nearby = VF_GetNearbyPassages(this, ChunkCoord); const TArray<int32>& Nearby = VF_GetNearbyPassages(this, ChunkCoord);
const FVoxelPassage* PassageData = Passages.GetData(); const FVoxelPassage* PassageData = Passages.GetData();
const FVector Position(WorldX, WorldY, WorldZ); const FVector Position(WorldX, WorldY, WorldZ);
@@ -3117,7 +3129,7 @@ void UVoxelStrateManager::ApplyPassageStructuralPostsMC(
const FIntVector ChunkCoord( const FIntVector ChunkCoord(
FMath::FloorToInt(WorldX / (float)CHUNK_SIZE), FMath::FloorToInt(WorldX / (float)CHUNK_SIZE),
FMath::FloorToInt(WorldY / (float)CHUNK_SIZE), FMath::FloorToInt(WorldY / (float)CHUNK_SIZE),
FMath::FloorToInt(WorldZ / (float)CHUNK_SIZE)); FMath::FloorToInt(WorldZ / StrateLayoutChunkWidthVoxels));
const TArray<int32>& Nearby = VF_GetNearbyPassages(this, ChunkCoord); const TArray<int32>& Nearby = VF_GetNearbyPassages(this, ChunkCoord);
if (Nearby.Num() == 0) return; if (Nearby.Num() == 0) return;
@@ -3244,7 +3256,7 @@ void UVoxelStrateManager::ApplyPassageNativeFloorMC(
const FIntVector ChunkCoord( const FIntVector ChunkCoord(
FMath::FloorToInt(WorldX / (float)CHUNK_SIZE), FMath::FloorToInt(WorldX / (float)CHUNK_SIZE),
FMath::FloorToInt(WorldY / (float)CHUNK_SIZE), FMath::FloorToInt(WorldY / (float)CHUNK_SIZE),
FMath::FloorToInt(WorldZ / (float)CHUNK_SIZE)); FMath::FloorToInt(WorldZ / StrateLayoutChunkWidthVoxels));
const TArray<int32>& Nearby = VF_GetNearbyPassages(this, ChunkCoord); const TArray<int32>& Nearby = VF_GetNearbyPassages(this, ChunkCoord);
if (Nearby.Num() == 0 if (Nearby.Num() == 0
|| VoxelPassageGeometry::VerticalShaftConnectorAirMarker()) || VoxelPassageGeometry::VerticalShaftConnectorAirMarker())
@@ -3435,7 +3447,7 @@ void UVoxelStrateManager::ApplyPassageLandingRoomFloorMC(
const FIntVector ChunkCoord( const FIntVector ChunkCoord(
FMath::FloorToInt(WorldX / (float)CHUNK_SIZE), FMath::FloorToInt(WorldX / (float)CHUNK_SIZE),
FMath::FloorToInt(WorldY / (float)CHUNK_SIZE), FMath::FloorToInt(WorldY / (float)CHUNK_SIZE),
FMath::FloorToInt(WorldZ / (float)CHUNK_SIZE)); FMath::FloorToInt(WorldZ / StrateLayoutChunkWidthVoxels));
const TArray<int32>& Nearby = VF_GetNearbyPassages(this, ChunkCoord); const TArray<int32>& Nearby = VF_GetNearbyPassages(this, ChunkCoord);
const FVoxelPassage* PassageData = Passages.GetData(); const FVoxelPassage* PassageData = Passages.GetData();
const FVector Position(WorldX, WorldY, WorldZ); const FVector Position(WorldX, WorldY, WorldZ);
@@ -5909,8 +5921,8 @@ bool UVoxelStrateManager::AnyLandingFloorAtLattice(
for (const FStrateSlot& Slot : StrateLayout) for (const FStrateSlot& Slot : StrateLayout)
{ {
if (Slot.Definition == nullptr) continue; if (Slot.Definition == nullptr) continue;
const float TopZ = (static_cast<float>(Slot.TopChunkZ) + 1.0f) * CHUNK_SIZE; const float TopZ = (static_cast<float>(Slot.TopChunkZ) + 1.0f) * StrateLayoutChunkWidthVoxels;
const float BottomZ = static_cast<float>(Slot.BottomChunkZ) * CHUNK_SIZE; const float BottomZ = static_cast<float>(Slot.BottomChunkZ) * StrateLayoutChunkWidthVoxels;
const float Seal = VF_BoundarySealThicknessForDefinition(*Slot.Definition); const float Seal = VF_BoundarySealThicknessForDefinition(*Slot.Definition);
const VoxelPassageGeometry::FOriginLandingGeometry Geometry = const VoxelPassageGeometry::FOriginLandingGeometry Geometry =
VoxelPassageGeometry::BuildOriginLandingGeometry( VoxelPassageGeometry::BuildOriginLandingGeometry(
@@ -5952,8 +5964,8 @@ bool UVoxelStrateManager::AnyOriginLandingNearBox(
for (const FStrateSlot& Slot : StrateLayout) for (const FStrateSlot& Slot : StrateLayout)
{ {
if (Slot.Definition == nullptr) continue; if (Slot.Definition == nullptr) continue;
const float TopZ = (static_cast<float>(Slot.TopChunkZ) + 1.0f) * CHUNK_SIZE; const float TopZ = (static_cast<float>(Slot.TopChunkZ) + 1.0f) * StrateLayoutChunkWidthVoxels;
const float BottomZ = static_cast<float>(Slot.BottomChunkZ) * CHUNK_SIZE; const float BottomZ = static_cast<float>(Slot.BottomChunkZ) * StrateLayoutChunkWidthVoxels;
if (VoxelPassageGeometry::OriginLandingRoomTouchesBox( if (VoxelPassageGeometry::OriginLandingRoomTouchesBox(
VoxelBox, TopZ, BottomZ, VoxelBox, TopZ, BottomZ,
VF_BoundarySealThicknessForDefinition(*Slot.Definition), VF_BoundarySealThicknessForDefinition(*Slot.Definition),
@@ -5973,8 +5985,8 @@ bool UVoxelStrateManager::AnyOriginLandingFloorNearBox(
for (const FStrateSlot& Slot : StrateLayout) for (const FStrateSlot& Slot : StrateLayout)
{ {
if (Slot.Definition == nullptr) continue; if (Slot.Definition == nullptr) continue;
const float TopZ = (static_cast<float>(Slot.TopChunkZ) + 1.0f) * CHUNK_SIZE; const float TopZ = (static_cast<float>(Slot.TopChunkZ) + 1.0f) * StrateLayoutChunkWidthVoxels;
const float BottomZ = static_cast<float>(Slot.BottomChunkZ) * CHUNK_SIZE; const float BottomZ = static_cast<float>(Slot.BottomChunkZ) * StrateLayoutChunkWidthVoxels;
if (VoxelPassageGeometry::OriginLandingFloorTouchesBox( if (VoxelPassageGeometry::OriginLandingFloorTouchesBox(
VoxelBox, TopZ, BottomZ, VoxelBox, TopZ, BottomZ,
VF_BoundarySealThicknessForDefinition(*Slot.Definition), VF_BoundarySealThicknessForDefinition(*Slot.Definition),
@@ -5998,8 +6010,8 @@ bool UVoxelStrateManager::AnyOriginLandingNearLattice(
for (const FStrateSlot& Slot : StrateLayout) for (const FStrateSlot& Slot : StrateLayout)
{ {
if (Slot.Definition == nullptr) continue; if (Slot.Definition == nullptr) continue;
const float TopZ = (static_cast<float>(Slot.TopChunkZ) + 1.0f) * CHUNK_SIZE; const float TopZ = (static_cast<float>(Slot.TopChunkZ) + 1.0f) * StrateLayoutChunkWidthVoxels;
const float BottomZ = static_cast<float>(Slot.BottomChunkZ) * CHUNK_SIZE; const float BottomZ = static_cast<float>(Slot.BottomChunkZ) * StrateLayoutChunkWidthVoxels;
const float Seal = VF_BoundarySealThicknessForDefinition(*Slot.Definition); const float Seal = VF_BoundarySealThicknessForDefinition(*Slot.Definition);
if (VoxelPassageGeometry::OriginLandingRoomTouchesLattice( if (VoxelPassageGeometry::OriginLandingRoomTouchesLattice(
VoxelBox, LatticeOrigin, Step, TopZ, BottomZ, Seal, OriginSpineRadius, VoxelBox, LatticeOrigin, Step, TopZ, BottomZ, Seal, OriginSpineRadius,
@@ -6036,8 +6048,8 @@ bool UVoxelStrateManager::AnyOriginLandingAirNearLattice(
{ {
continue; continue;
} }
const float TopZ = (static_cast<float>(Slot.TopChunkZ) + 1.0f) * CHUNK_SIZE; const float TopZ = (static_cast<float>(Slot.TopChunkZ) + 1.0f) * StrateLayoutChunkWidthVoxels;
const float BottomZ = static_cast<float>(Slot.BottomChunkZ) * CHUNK_SIZE; const float BottomZ = static_cast<float>(Slot.BottomChunkZ) * StrateLayoutChunkWidthVoxels;
const float Seal = VF_BoundarySealThicknessForDefinition(*Slot.Definition); const float Seal = VF_BoundarySealThicknessForDefinition(*Slot.Definition);
const VoxelPassageGeometry::FOriginLandingGeometry Geometry = const VoxelPassageGeometry::FOriginLandingGeometry Geometry =
VoxelPassageGeometry::BuildOriginLandingGeometry( VoxelPassageGeometry::BuildOriginLandingGeometry(
@@ -6113,8 +6125,8 @@ bool UVoxelStrateManager::AnyOriginLandingFloorNearLattice(
for (const FStrateSlot& Slot : StrateLayout) for (const FStrateSlot& Slot : StrateLayout)
{ {
if (Slot.Definition == nullptr) continue; if (Slot.Definition == nullptr) continue;
const float TopZ = (static_cast<float>(Slot.TopChunkZ) + 1.0f) * CHUNK_SIZE; const float TopZ = (static_cast<float>(Slot.TopChunkZ) + 1.0f) * StrateLayoutChunkWidthVoxels;
const float BottomZ = static_cast<float>(Slot.BottomChunkZ) * CHUNK_SIZE; const float BottomZ = static_cast<float>(Slot.BottomChunkZ) * StrateLayoutChunkWidthVoxels;
const float Seal = VF_BoundarySealThicknessForDefinition(*Slot.Definition); const float Seal = VF_BoundarySealThicknessForDefinition(*Slot.Definition);
if (VoxelPassageGeometry::OriginLandingFloorTouchesLattice( if (VoxelPassageGeometry::OriginLandingFloorTouchesLattice(
VoxelBox, LatticeOrigin, Step, TopZ, BottomZ, Seal, OriginSpineRadius)) VoxelBox, LatticeOrigin, Step, TopZ, BottomZ, Seal, OriginSpineRadius))
@@ -6148,7 +6160,7 @@ int32 UVoxelStrateManager::FindSlotIndexForChunkZ(int32 ChunkZ) const
UVoxelStrateDefinition* UVoxelStrateManager::GetStrateAt(float WorldZ) const UVoxelStrateDefinition* UVoxelStrateManager::GetStrateAt(float WorldZ) const
{ {
// Convert world Z to chunk Z coordinate // Convert world Z to chunk Z coordinate
int32 ChunkZ = FMath::FloorToInt((WorldZ / VOXEL_SIZE) / CHUNK_SIZE); int32 ChunkZ = FMath::FloorToInt((WorldZ / VOXEL_SIZE) / StrateLayoutChunkWidthVoxels);
int32 SlotIdx = FindSlotIndexForChunkZ(ChunkZ); int32 SlotIdx = FindSlotIndexForChunkZ(ChunkZ);
if (SlotIdx >= 0) if (SlotIdx >= 0)
{ {
@@ -6159,7 +6171,7 @@ UVoxelStrateDefinition* UVoxelStrateManager::GetStrateAt(float WorldZ) const
int32 UVoxelStrateManager::GetStrateIndex(float WorldZ) const int32 UVoxelStrateManager::GetStrateIndex(float WorldZ) const
{ {
int32 ChunkZ = FMath::FloorToInt((WorldZ / VOXEL_SIZE) / CHUNK_SIZE); int32 ChunkZ = FMath::FloorToInt((WorldZ / VOXEL_SIZE) / StrateLayoutChunkWidthVoxels);
int32 SlotIdx = FindSlotIndexForChunkZ(ChunkZ); int32 SlotIdx = FindSlotIndexForChunkZ(ChunkZ);
if (SlotIdx >= 0) if (SlotIdx >= 0)
{ {
@@ -6318,9 +6330,9 @@ FSlabGenerationParams UVoxelStrateManager::GetSlabParamsForChunk(const FIntVecto
// Fill in the runtime Z bounds (voxel coordinates, same convention as // Fill in the runtime Z bounds (voxel coordinates, same convention as
// FStrateGenerationParams::StrateTopWorldZ / StrateBottomWorldZ). // FStrateGenerationParams::StrateTopWorldZ / StrateBottomWorldZ).
// TopChunkZ+1 because the top chunk's CEILING is at (TopChunkZ+1)*CHUNK_SIZE. // TopChunkZ+1 because the top chunk's CEILING is at (TopChunkZ+1)*StrateLayoutChunkWidthVoxels.
Result.StrateTopWorldZ = (float)(Slot.TopChunkZ + 1) * CHUNK_SIZE; Result.StrateTopWorldZ = (float)(Slot.TopChunkZ + 1) * StrateLayoutChunkWidthVoxels;
Result.StrateBottomWorldZ = (float)(Slot.BottomChunkZ) * CHUNK_SIZE; Result.StrateBottomWorldZ = (float)(Slot.BottomChunkZ) * StrateLayoutChunkWidthVoxels;
return Result; return Result;
} }
@@ -6353,8 +6365,8 @@ FMazeGenerationParams UVoxelStrateManager::GetMazeParamsForChunk(const FIntVecto
} }
} }
#endif #endif
Result.StrateTopWorldZ = (float)(Slot.TopChunkZ + 1) * CHUNK_SIZE; Result.StrateTopWorldZ = (float)(Slot.TopChunkZ + 1) * StrateLayoutChunkWidthVoxels;
Result.StrateBottomWorldZ = (float)Slot.BottomChunkZ * CHUNK_SIZE; Result.StrateBottomWorldZ = (float)Slot.BottomChunkZ * StrateLayoutChunkWidthVoxels;
return Result; return Result;
} }
@@ -6380,8 +6392,8 @@ FSurfaceGenerationParams UVoxelStrateManager::GetSurfaceParamsForChunk(const FIn
} }
} }
#endif #endif
Result.StrateTopWorldZ = (float)(Slot.TopChunkZ + 1) * CHUNK_SIZE; Result.StrateTopWorldZ = (float)(Slot.TopChunkZ + 1) * StrateLayoutChunkWidthVoxels;
Result.StrateBottomWorldZ = (float)Slot.BottomChunkZ * CHUNK_SIZE; Result.StrateBottomWorldZ = (float)Slot.BottomChunkZ * StrateLayoutChunkWidthVoxels;
return Result; return Result;
} }
@@ -6407,8 +6419,8 @@ FVerticalShaftParams UVoxelStrateManager::GetVerticalShaftParamsForChunk(const F
} }
} }
#endif #endif
Result.StrateTopWorldZ = (float)(Slot.TopChunkZ + 1) * CHUNK_SIZE; Result.StrateTopWorldZ = (float)(Slot.TopChunkZ + 1) * StrateLayoutChunkWidthVoxels;
Result.StrateBottomWorldZ = (float)Slot.BottomChunkZ * CHUNK_SIZE; Result.StrateBottomWorldZ = (float)Slot.BottomChunkZ * StrateLayoutChunkWidthVoxels;
return Result; return Result;
} }
@@ -6434,8 +6446,8 @@ FFloatingIslandParams UVoxelStrateManager::GetFloatingIslandParamsForChunk(const
} }
} }
#endif #endif
Result.StrateTopWorldZ = (float)(Slot.TopChunkZ + 1) * CHUNK_SIZE; Result.StrateTopWorldZ = (float)(Slot.TopChunkZ + 1) * StrateLayoutChunkWidthVoxels;
Result.StrateBottomWorldZ = (float)Slot.BottomChunkZ * CHUNK_SIZE; Result.StrateBottomWorldZ = (float)Slot.BottomChunkZ * StrateLayoutChunkWidthVoxels;
return Result; return Result;
} }
@@ -6469,14 +6481,14 @@ FBiomeContext UVoxelStrateManager::GetBiomeContextForChunk(const FIntVector& Chu
bool UVoxelStrateManager::GetStrateUnrealZRange(float WorldZ, float& OutTopZ, float& OutBottomZ) const bool UVoxelStrateManager::GetStrateUnrealZRange(float WorldZ, float& OutTopZ, float& OutBottomZ) const
{ {
const int32 ChunkZ = FMath::FloorToInt((WorldZ / VOXEL_SIZE) / CHUNK_SIZE); const int32 ChunkZ = FMath::FloorToInt((WorldZ / VOXEL_SIZE) / StrateLayoutChunkWidthVoxels);
const int32 SlotIdx = FindSlotIndexForChunkZ(ChunkZ); const int32 SlotIdx = FindSlotIndexForChunkZ(ChunkZ);
if (SlotIdx < 0) return false; if (SlotIdx < 0) return false;
const FStrateSlot& Slot = StrateLayout[SlotIdx]; const FStrateSlot& Slot = StrateLayout[SlotIdx];
// Voxel-space Z bounds → Unreal units. Ceiling = top chunk's upper edge. // Voxel-space Z bounds → Unreal units. Ceiling = top chunk's upper edge.
OutTopZ = (float)(Slot.TopChunkZ + 1) * CHUNK_SIZE * VOXEL_SIZE; OutTopZ = (float)(Slot.TopChunkZ + 1) * StrateLayoutChunkWidthVoxels * VOXEL_SIZE;
OutBottomZ = (float)(Slot.BottomChunkZ) * CHUNK_SIZE * VOXEL_SIZE; OutBottomZ = (float)(Slot.BottomChunkZ) * StrateLayoutChunkWidthVoxels * VOXEL_SIZE;
return true; return true;
} }
@@ -6489,8 +6501,8 @@ FStrateDisturbanceParams UVoxelStrateManager::GetDisturbanceParamsForChunk(const
} }
const FStrateSlot& Slot = StrateLayout[SlotIdx]; const FStrateSlot& Slot = StrateLayout[SlotIdx];
FStrateDisturbanceParams Result = Slot.Definition->Disturbances; FStrateDisturbanceParams Result = Slot.Definition->Disturbances;
Result.StrateTopWorldZ = (float)(Slot.TopChunkZ + 1) * CHUNK_SIZE; Result.StrateTopWorldZ = (float)(Slot.TopChunkZ + 1) * StrateLayoutChunkWidthVoxels;
Result.StrateBottomWorldZ = (float)(Slot.BottomChunkZ) * CHUNK_SIZE; Result.StrateBottomWorldZ = (float)(Slot.BottomChunkZ) * StrateLayoutChunkWidthVoxels;
return Result; return Result;
} }
@@ -6522,8 +6534,8 @@ float UVoxelStrateManager::GetWaterLevelWorldZForChunk(const FIntVector& ChunkCo
} }
if (Rel <= 0.0f) return -FLT_MAX; if (Rel <= 0.0f) return -FLT_MAX;
const float BottomZ = (float)(Slot.BottomChunkZ) * CHUNK_SIZE; const float BottomZ = (float)(Slot.BottomChunkZ) * StrateLayoutChunkWidthVoxels;
const float TopZ = (float)(Slot.TopChunkZ + 1) * CHUNK_SIZE; const float TopZ = (float)(Slot.TopChunkZ + 1) * StrateLayoutChunkWidthVoxels;
return FMath::Lerp(BottomZ, TopZ, FMath::Clamp(Rel, 0.0f, 1.0f)); return FMath::Lerp(BottomZ, TopZ, FMath::Clamp(Rel, 0.0f, 1.0f));
} }
@@ -6567,8 +6579,8 @@ FStrateGenerationParams UVoxelStrateManager::GetGenerationParams(const FIntVecto
FindComposerOverride(Slot.StrateIndex)) FindComposerOverride(Slot.StrateIndex))
{ {
FStrateGenerationParams Result = Override->Params.TunnelNetworkParams; FStrateGenerationParams Result = Override->Params.TunnelNetworkParams;
Result.StrateTopWorldZ = (float)(Slot.TopChunkZ + 1) * CHUNK_SIZE; Result.StrateTopWorldZ = (float)(Slot.TopChunkZ + 1) * StrateLayoutChunkWidthVoxels;
Result.StrateBottomWorldZ = (float)Slot.BottomChunkZ * CHUNK_SIZE; Result.StrateBottomWorldZ = (float)Slot.BottomChunkZ * StrateLayoutChunkWidthVoxels;
// A candidate is a hard replacement of this slot. Do not blend its rolled vector with an // A candidate is a hard replacement of this slot. Do not blend its rolled vector with an
// authored neighbour at a boundary; this is also how the offline fixture measures it. // authored neighbour at a boundary; this is also how the offline fixture measures it.
return ResolveFinalParams(Result); return ResolveFinalParams(Result);
@@ -6578,8 +6590,8 @@ FStrateGenerationParams UVoxelStrateManager::GetGenerationParams(const FIntVecto
if (SeasonStrates.IsValidIndex(SlotIdx)) if (SeasonStrates.IsValidIndex(SlotIdx))
{ {
FStrateGenerationParams Result = SeasonStrates[SlotIdx].Params.TunnelNetworkParams; FStrateGenerationParams Result = SeasonStrates[SlotIdx].Params.TunnelNetworkParams;
Result.StrateTopWorldZ = (float)(Slot.TopChunkZ + 1) * CHUNK_SIZE; Result.StrateTopWorldZ = (float)(Slot.TopChunkZ + 1) * StrateLayoutChunkWidthVoxels;
Result.StrateBottomWorldZ = (float)Slot.BottomChunkZ * CHUNK_SIZE; Result.StrateBottomWorldZ = (float)Slot.BottomChunkZ * StrateLayoutChunkWidthVoxels;
// Season vectors are already final, measured slot records. Vertical structural posts own // Season vectors are already final, measured slot records. Vertical structural posts own
// their boundary; blending them with another selected recipe would describe neither one. // their boundary; blending them with another selected recipe would describe neither one.
return ResolveFinalParams(Result); return ResolveFinalParams(Result);
@@ -6596,8 +6608,17 @@ FStrateGenerationParams UVoxelStrateManager::GetGenerationParams(const FIntVecto
// //
// TopChunkZ=0, CHUNK_SIZE=32: top of the strate = chunk 0's top edge = voxel Z=32 // TopChunkZ=0, CHUNK_SIZE=32: top of the strate = chunk 0's top edge = voxel Z=32
// BottomChunkZ=-3: bottom of the strate = chunk -3's bottom edge = voxel Z=-3*32 = -96 // BottomChunkZ=-3: bottom of the strate = chunk -3's bottom edge = voxel Z=-3*32 = -96
BaseParams.StrateTopWorldZ = (float)(Slot.TopChunkZ + 1) * CHUNK_SIZE; BaseParams.StrateTopWorldZ = (float)(Slot.TopChunkZ + 1) * StrateLayoutChunkWidthVoxels;
BaseParams.StrateBottomWorldZ = (float)(Slot.BottomChunkZ) * CHUNK_SIZE; BaseParams.StrateBottomWorldZ = (float)(Slot.BottomChunkZ) * StrateLayoutChunkWidthVoxels;
// Core currently dispatches one generator field per resolved strate. Gradient and
// interleaved metadata therefore use the explicitly declared Hard fallback for every
// legacy parameter lookup as well; mixing parameter vectors here would disagree with the
// shared ceiling/content/bedrock composition layer.
if (bHardTransitionFallbackForAssembly)
{
return ResolveFinalParams(BaseParams);
}
//========================================================================= //=========================================================================
// BOUNDARY BLENDING (transition-type aware) // BOUNDARY BLENDING (transition-type aware)
@@ -6670,8 +6691,8 @@ FStrateGenerationParams UVoxelStrateManager::GetGenerationParams(const FIntVecto
if (EffectiveBlend > 0 && DistFromBottom < EffectiveBlend) if (EffectiveBlend > 0 && DistFromBottom < EffectiveBlend)
{ {
FStrateGenerationParams BelowParams = BuildParamsFromDefinition(BelowSlot.Definition); FStrateGenerationParams BelowParams = BuildParamsFromDefinition(BelowSlot.Definition);
BelowParams.StrateTopWorldZ = (float)(BelowSlot.TopChunkZ + 1) * CHUNK_SIZE; BelowParams.StrateTopWorldZ = (float)(BelowSlot.TopChunkZ + 1) * StrateLayoutChunkWidthVoxels;
BelowParams.StrateBottomWorldZ = (float)(BelowSlot.BottomChunkZ) * CHUNK_SIZE; BelowParams.StrateBottomWorldZ = (float)(BelowSlot.BottomChunkZ) * StrateLayoutChunkWidthVoxels;
// Linear alpha: 0 at EffectiveBlend chunks away, 1 at the boundary // Linear alpha: 0 at EffectiveBlend chunks away, 1 at the boundary
float Alpha = 1.0f - ((float)DistFromBottom / (float)EffectiveBlend); float Alpha = 1.0f - ((float)DistFromBottom / (float)EffectiveBlend);
@@ -6708,8 +6729,8 @@ FStrateGenerationParams UVoxelStrateManager::GetGenerationParams(const FIntVecto
if (DistFromBottom < CheckRange) if (DistFromBottom < CheckRange)
{ {
FStrateGenerationParams BelowParams = BuildParamsFromDefinition(BelowSlot.Definition); FStrateGenerationParams BelowParams = BuildParamsFromDefinition(BelowSlot.Definition);
BelowParams.StrateTopWorldZ = (float)(BelowSlot.TopChunkZ + 1) * CHUNK_SIZE; BelowParams.StrateTopWorldZ = (float)(BelowSlot.TopChunkZ + 1) * StrateLayoutChunkWidthVoxels;
BelowParams.StrateBottomWorldZ = (float)(BelowSlot.BottomChunkZ) * CHUNK_SIZE; BelowParams.StrateBottomWorldZ = (float)(BelowSlot.BottomChunkZ) * StrateLayoutChunkWidthVoxels;
// Sample 3D Perlin noise to warp the boundary position. // Sample 3D Perlin noise to warp the boundary position.
// XY frequency 0.15 gives medium-scale variation (~6-7 chunks per cycle). // XY frequency 0.15 gives medium-scale variation (~6-7 chunks per cycle).
@@ -6769,8 +6790,8 @@ FStrateGenerationParams UVoxelStrateManager::GetGenerationParams(const FIntVecto
if (EffectiveBlend > 0 && DistFromTop < EffectiveBlend) if (EffectiveBlend > 0 && DistFromTop < EffectiveBlend)
{ {
FStrateGenerationParams AboveParams = BuildParamsFromDefinition(AboveSlot.Definition); FStrateGenerationParams AboveParams = BuildParamsFromDefinition(AboveSlot.Definition);
AboveParams.StrateTopWorldZ = (float)(AboveSlot.TopChunkZ + 1) * CHUNK_SIZE; AboveParams.StrateTopWorldZ = (float)(AboveSlot.TopChunkZ + 1) * StrateLayoutChunkWidthVoxels;
AboveParams.StrateBottomWorldZ = (float)(AboveSlot.BottomChunkZ) * CHUNK_SIZE; AboveParams.StrateBottomWorldZ = (float)(AboveSlot.BottomChunkZ) * StrateLayoutChunkWidthVoxels;
float Alpha = 1.0f - ((float)DistFromTop / (float)EffectiveBlend); float Alpha = 1.0f - ((float)DistFromTop / (float)EffectiveBlend);
Alpha = FMath::Clamp(Alpha, 0.0f, 1.0f); Alpha = FMath::Clamp(Alpha, 0.0f, 1.0f);
@@ -6791,8 +6812,8 @@ FStrateGenerationParams UVoxelStrateManager::GetGenerationParams(const FIntVecto
if (DistFromTop < CheckRange) if (DistFromTop < CheckRange)
{ {
FStrateGenerationParams AboveParams = BuildParamsFromDefinition(AboveSlot.Definition); FStrateGenerationParams AboveParams = BuildParamsFromDefinition(AboveSlot.Definition);
AboveParams.StrateTopWorldZ = (float)(AboveSlot.TopChunkZ + 1) * CHUNK_SIZE; AboveParams.StrateTopWorldZ = (float)(AboveSlot.TopChunkZ + 1) * StrateLayoutChunkWidthVoxels;
AboveParams.StrateBottomWorldZ = (float)(AboveSlot.BottomChunkZ) * CHUNK_SIZE; AboveParams.StrateBottomWorldZ = (float)(AboveSlot.BottomChunkZ) * StrateLayoutChunkWidthVoxels;
// Same noise function but with a different seed offset to avoid // Same noise function but with a different seed offset to avoid
// symmetry between top and bottom boundaries of adjacent strates // symmetry between top and bottom boundaries of adjacent strates
+40 -4
View File
@@ -146,6 +146,10 @@ public:
FVoxelForgeCoreTaskScheduler Scheduler; FVoxelForgeCoreTaskScheduler Scheduler;
std::unordered_set<VoxelForgeCore::TileKey, VoxelForgeCore::TileKeyHash> RetainedTiles; std::unordered_set<VoxelForgeCore::TileKey, VoxelForgeCore::TileKeyHash> RetainedTiles;
FCriticalSection RetainedTilesLock; FCriticalSection RetainedTilesLock;
FCriticalSection ShapeReadinessLock;
std::unordered_set<VoxelForgeCore::TileKey, VoxelForgeCore::TileKeyHash> ShapeFreeTiles;
std::unordered_set<VoxelForgeCore::TileKey, VoxelForgeCore::TileKeyHash> ShapeDependentTiles;
std::atomic<bool> bSnapshotReady{false};
std::atomic<bool> bReady{false}; std::atomic<bool> bReady{false};
std::atomic<bool> bInitialFailed{false}; std::atomic<bool> bInitialFailed{false};
std::atomic<bool> bRegionCompileInFlight{false}; std::atomic<bool> bRegionCompileInFlight{false};
@@ -7689,6 +7693,7 @@ bool AVoxelWorld::InitializeVoxelForgeCoreWorld(FString& OutFailureReason)
Request.includeFarWorld = true; Request.includeFarWorld = true;
VoxelForgeCoreState = State; VoxelForgeCoreState = State;
State->bSnapshotReady.store(true, std::memory_order_release);
ActiveTaskCount.fetch_add(1, std::memory_order_relaxed); ActiveTaskCount.fetch_add(1, std::memory_order_relaxed);
UE::Tasks::Launch(TEXT("VoxelForgeCoreCompile"), UE::Tasks::Launch(TEXT("VoxelForgeCoreCompile"),
[this, State, Request, InitialDesired, ActiveCoreClipRadius, ActiveCoreMaxClipLevel, [this, State, Request, InitialDesired, ActiveCoreClipRadius, ActiveCoreMaxClipLevel,
@@ -7708,10 +7713,17 @@ bool AVoxelWorld::InitializeVoxelForgeCoreWorld(FString& OutFailureReason)
std::string Error; std::string Error;
bool bCompiled = false; bool bCompiled = false;
bCompiled = State->World->compile(Request, State->Scheduler, Error);
if (bCompiled)
{ {
// The initial compile builds into local state and atomically publishes an immutable
// shape. Proven native-only tiles may hold shared WorldLock readers during this work;
// take the writer only for region retention after publication.
// La compilation initiale construit un etat local puis publie une forme immuable.
// Les tuiles natives validees gardent le verrou lecteur partage; le verrou ecrivain
// ne sert qu'a retenir les regions apres publication.
FWriteScopeLock Lock(State->WorldLock); FWriteScopeLock Lock(State->WorldLock);
bCompiled = State->World->compile(Request, State->Scheduler, Error); if (State->World)
if (bCompiled)
{ {
State->World->retainTileRegions(InitialDesired); State->World->retainTileRegions(InitialDesired);
FScopeLock RetainedLock(&State->RetainedTilesLock); FScopeLock RetainedLock(&State->RetainedTilesLock);
@@ -13019,9 +13031,33 @@ void AVoxelWorld::LoadCoreTile(const FVoxelTileKey& Tile, EVoxelTileWorkPriority
return; return;
} }
} }
if (PendingTiles.Contains(Tile) || !IsVoxelForgeCoreReady()) return; if (PendingTiles.Contains(Tile)) return;
const TSharedPtr<FVoxelForgeCoreRuntimeState, ESPMode::ThreadSafe> State = VoxelForgeCoreState; const TSharedPtr<FVoxelForgeCoreRuntimeState, ESPMode::ThreadSafe> State = VoxelForgeCoreState;
if (!State.IsValid() || State->bRegionCompileFailed.load(std::memory_order_acquire)) return; if (!State.IsValid()||State->bInitialFailed.load(std::memory_order_acquire)
||State->bRegionCompileFailed.load(std::memory_order_acquire)
||State->bShuttingDown.load(std::memory_order_acquire))return;
const bool bShapeReady=State->bReady.load(std::memory_order_acquire);
if(!bShapeReady)
{
if(!State->bSnapshotReady.load(std::memory_order_acquire))return;
const VoxelForgeCore::TileKey CoreKey{
{Tile.Coord.X,Tile.Coord.Y,Tile.Coord.Z},Tile.Level};
bool bShapeFree=false;
{
FScopeLock ReadinessLock(&State->ShapeReadinessLock);
if(State->ShapeFreeTiles.contains(CoreKey))bShapeFree=true;
else if(State->ShapeDependentTiles.contains(CoreKey))return;
else
{
FReadScopeLock WorldReadLock(State->WorldLock);
if(!State->World)return;
bShapeFree=State->World->isTileShapeFree(CoreKey);
if(bShapeFree)State->ShapeFreeTiles.insert(CoreKey);
else State->ShapeDependentTiles.insert(CoreKey);
}
}
if(!bShapeFree)return;
}
if (IsStreamingResultBacklogCapped()) if (IsStreamingResultBacklogCapped())
{ {
StreamingResultBacklogCapStops.fetch_add(1, std::memory_order_relaxed); StreamingResultBacklogCapStops.fetch_add(1, std::memory_order_relaxed);
@@ -41,21 +41,27 @@
// SealFactor > 0 et BaseDensity > 0, le résultat est solide GARANTI quelle qu'ait été l'entrée. // SealFactor > 0 et BaseDensity > 0, le résultat est solide GARANTI quelle qu'ait été l'entrée.
// C'est exactement ce qu'encode `IVoxelDensityOp::ClassifyBox` (voir VoxelDensityOp.h), et la // C'est exactement ce qu'encode `IVoxelDensityOp::ClassifyBox` (voir VoxelDensityOp.h), et la
// raison pour laquelle cette méthode existe. // raison pour laquelle cette méthode existe.
FORCEINLINE void VF_ApplyBoundarySeal(float& Density, float WorldZ, FORCEINLINE void VF_ApplyUpperBoundarySealValue(float& Density, float WorldZ,
float StrateTopZ, float StrateBottomZ, float StrateTopZ, float Thickness, float BaseDensity)
float Thickness, float BaseDensity)
{ {
if (VoxelDensityAblation::IsBoundarySealOff() || Thickness <= 0.0f) return; const float DistTop = StrateTopZ - WorldZ;
const float DistTop = StrateTopZ - WorldZ; // + si on est sous le plafond
const float DistBot = WorldZ - StrateBottomZ; // + si on est au-dessus du sol
if (DistTop >= 0.0f && DistTop < Thickness) if (DistTop >= 0.0f && DistTop < Thickness)
{ {
float SealFactor = 1.0f - (DistTop / Thickness); float SealFactor = 1.0f - (DistTop / Thickness);
SealFactor = SmoothStep01(SealFactor); SealFactor = SmoothStep01(SealFactor);
Density = FMath::Max(Density, SealFactor * BaseDensity); Density = FMath::Max(Density, SealFactor * BaseDensity);
} }
}
FORCEINLINE void VF_ApplyBoundarySeal(float& Density, float WorldZ,
float StrateTopZ, float StrateBottomZ,
float Thickness, float BaseDensity)
{
if (VoxelDensityAblation::IsBoundarySealOff() || Thickness <= 0.0f) return;
const float DistBot = WorldZ - StrateBottomZ; // + si on est au-dessus du sol
VF_ApplyUpperBoundarySealValue(Density, WorldZ, StrateTopZ, Thickness, BaseDensity);
if (DistBot >= 0.0f && DistBot < Thickness) if (DistBot >= 0.0f && DistBot < Thickness)
{ {
float SealFactor = 1.0f - (DistBot / Thickness); float SealFactor = 1.0f - (DistBot / Thickness);
@@ -64,6 +70,16 @@ FORCEINLINE void VF_ApplyBoundarySeal(float& Density, float WorldZ,
} }
} }
// The same structural seal, limited to a strate's upper boundary. Native finite fields use this
// when their lower boundary intentionally has no seal; keeping the math here makes that ceiling
// use the same shared density primitive as every two-sided strate seal.
FORCEINLINE void VF_ApplyUpperBoundarySeal(float& Density, float WorldZ,
float StrateTopZ, float Thickness, float BaseDensity)
{
if (VoxelDensityAblation::IsBoundarySealOff() || Thickness <= 0.0f) return;
VF_ApplyUpperBoundarySealValue(Density, WorldZ, StrateTopZ, Thickness, BaseDensity);
}
//============================================================================= //=============================================================================
// CARVE DE PASSAGE / PASSAGE CARVING // CARVE DE PASSAGE / PASSAGE CARVING
//============================================================================= //=============================================================================
+7
View File
@@ -419,6 +419,13 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Voxel|Strates", meta = (ClampMin = "0", ClampMax = "16")) UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Voxel|Strates", meta = (ClampMin = "0", ClampMax = "16"))
int32 InterStrateGapChunks = 0; int32 InterStrateGapChunks = 0;
// Physical width of one vertical strate-layout chunk. This is independent of the
// Core tile width (32^3 voxels) and of the source generator's voxel resolution.
// 8 m preserves the owner's current SurfaceWorld extent at 25 cm Core voxels.
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Voxel|Strates|World Assembly",
meta = (ClampMin = "0.25", ClampMax = "64.0", Units = "m"))
float StrateLayoutChunkSizeMeters = 8.0f;
//========================================================================= //=========================================================================
// SPINE & INTER-STRATE CONNECTIONS (the (0,0) descent axis) // SPINE & INTER-STRATE CONNECTIONS (the (0,0) descent axis)
//========================================================================= //=========================================================================
@@ -244,6 +244,13 @@ public:
UFUNCTION(BlueprintCallable, Category = "Strate") UFUNCTION(BlueprintCallable, Category = "Strate")
int32 GetStrateIndex(float WorldZ) const; int32 GetStrateIndex(float WorldZ) const;
// Director-resolved physical strate chunk width expressed in owner voxel units.
// This is independent of Core's 32^3 tile width.
float GetStrateLayoutChunkWidthVoxels() const { return StrateLayoutChunkWidthVoxels; }
uint32 GetStrateLayoutChunkSizeMicrometres() const { return StrateLayoutChunkSizeMicrometres; }
void SetHardTransitionFallbackForAssembly(bool bEnabled)
{ bHardTransitionFallbackForAssembly = bEnabled; }
/** Layout/passage generation counter (bumped by every Initialize → GeneratePassages). /** Layout/passage generation counter (bumped by every Initialize → GeneratePassages).
* Hot-path callers key thread_local memos on this so an editor rebuild (RebuildStrates / * Hot-path callers key thread_local memos on this so an editor rebuild (RebuildStrates /
* live edit) can never serve a stale strate index or passage shortlist. */ * live edit) can never serve a stale strate index or passage shortlist. */
@@ -525,6 +532,11 @@ protected:
// VoxelSettings::InterStrateGapChunks during Initialize(). // VoxelSettings::InterStrateGapChunks during Initialize().
int32 InterStrateGapChunks = 0; int32 InterStrateGapChunks = 0;
// Resolved once from VoxelSettings::StrateLayoutChunkSizeMeters during Initialize().
float StrateLayoutChunkWidthVoxels = 32.0f;
uint32 StrateLayoutChunkSizeMicrometres = 8000000;
bool bHardTransitionFallbackForAssembly = false;
// Production keeps the legacy writer available only as a fail-closed fallback for a // Production keeps the legacy writer available only as a fail-closed fallback for a
// non-native/malformed passage; native D-floors bypass it. This switch never changes the // non-native/malformed passage; native D-floors bypass it. This switch never changes the
// passage carve or air contract. // passage carve or air contract.
+7 -11
View File
@@ -1852,8 +1852,6 @@ struct VOXELFORGE_API FStrateDisturbanceParams
UENUM(BlueprintType) UENUM(BlueprintType)
enum class EVoxelPassageStyle : uint8 enum class EVoxelPassageStyle : uint8
{ {
// “Straight” is retained as the authored style name for the base connection, but its runtime
// geometry is a gentle two-leg switchback rather than a vertical shaft.
Straight UMETA(DisplayName = "Straight (walkable sloped tunnel)"), Straight UMETA(DisplayName = "Straight (walkable sloped tunnel)"),
Worm UMETA(DisplayName = "Worm (organic meander around the axis)"), Worm UMETA(DisplayName = "Worm (organic meander around the axis)"),
Spiral UMETA(DisplayName = "Spiral (corkscrew descent)"), Spiral UMETA(DisplayName = "Spiral (corkscrew descent)"),
@@ -1878,14 +1876,12 @@ struct VOXELFORGE_API FStratePassageConfig
// Tunnel shape. // Tunnel shape.
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Passage") UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Passage")
EVoxelPassageStyle Style = EVoxelPassageStyle::Straight; EVoxelPassageStyle Style = EVoxelPassageStyle::Worm;
// ----- WIDTH (tapers along the length) ----- // ----- WIDTH (tapers along the length) -----
// Radius at the two mouths (entry/exit) and at the middle. Equal = uniform tube; // Radius at the two mouths (entry/exit) and at the middle. Equal = uniform tube;
// The walkable default is 1.5x the original comfortable profile: 2.25 m diameter at mouths // Core raises both radii to at least 12 owner voxels (1.5 m) for capsule clearance.
// and 1.875 m at the waist when the stored radii remain 9/7.5 voxels at 12.5 cm per voxel. // The passage landing remains wider for turning.
// Double these asset values to retain the previous 4.5/3.75 m dimensions. The §6.5 landing
// room remains wider for turning.
// Mouth > Mid = chambers at the ends with a squeeze between; Mid > Mouth = a bulge. // Mouth > Mid = chambers at the ends with a squeeze between; Mid > Mouth = a bulge.
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Passage|Width", meta = (ClampMin = "1.0")) UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Passage|Width", meta = (ClampMin = "1.0"))
float MouthRadius = 9.0f; float MouthRadius = 9.0f;
@@ -1912,8 +1908,8 @@ struct VOXELFORGE_API FStratePassageConfig
float DistanceMax = 192.0f; float DistanceMax = 192.0f;
// ----- SHAPE detail ----- // ----- SHAPE detail -----
// Exotic styles only: max sideways excursion from the axis (voxels). 24 = 6 m; 0 = straight // Max sideways variation from the winding path's axis (voxels). Core keeps the route inside
// even in Worm style. The default walkable switchback does not use this wander value. // DistanceMax and adds enough distance to meet the walkable grade.
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Passage|Shape", meta = (ClampMin = "0.0")) UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Passage|Shape", meta = (ClampMin = "0.0"))
float Wander = 24.0f; float Wander = 24.0f;
@@ -1926,8 +1922,8 @@ struct VOXELFORGE_API FStratePassageConfig
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Passage|Shape", meta = (ClampMin = "0.0")) UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Passage|Shape", meta = (ClampMin = "0.0"))
float VerticalWobble = 0.0f; float VerticalWobble = 0.0f;
// Spiral style: helix radius (voxels) and number of full turns over the descent. The default // Spiral style: helix radius (voxels) and minimum number of turns. Core adds turns when
// radius is 6 m. // needed to meet the walkable grade. The default stored radius is 3 m at the legacy scale.
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Passage|Spiral", meta = (ClampMin = "1.0")) UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Passage|Spiral", meta = (ClampMin = "1.0"))
float SpiralRadius = 24.0f; float SpiralRadius = 24.0f;
+10 -2
View File
@@ -33,9 +33,12 @@ if [[ "$FP_CONTRACT" != "default" && "$FP_CONTRACT" != "off" && "$FP_CONTRACT" !
fi fi
command -v "$COMPILER" >/dev/null || { printf 'Compiler not found: %s\n' "$COMPILER" >&2; exit 2; } command -v "$COMPILER" >/dev/null || { printf 'Compiler not found: %s\n' "$COMPILER" >&2; exit 2; }
command -v ar >/dev/null || { printf 'ar not found\n' >&2; exit 2; } command -v ar >/dev/null || { printf 'ar not found\n' >&2; exit 2; }
command -v pkg-config >/dev/null || { printf 'pkg-config not found\n' >&2; exit 2; }
pkg-config --exists egl glesv2 libpng || { printf 'EGL, GLESv2, and libpng development files are required\n' >&2; exit 2; }
BUILD_DIR="$ROOT/Build/linux-$VARIANT" BUILD_ROOT="${VOXELFORGE_BUILD_ROOT:-$ROOT/Build}"
BIN_DIR="$ROOT/bin/linux" BIN_DIR="${VOXELFORGE_BIN_DIR:-$ROOT/bin/linux}"
BUILD_DIR="$BUILD_ROOT/linux-$VARIANT"
mkdir -p "$BUILD_DIR/wrappers" "$BUILD_DIR/objects" "$BIN_DIR" mkdir -p "$BUILD_DIR/wrappers" "$BUILD_DIR/objects" "$BIN_DIR"
INCLUDES=( INCLUDES=(
@@ -117,5 +120,10 @@ CORE_LIBRARY="$BUILD_DIR/libVoxelForgeCore.a"
"$(command -v ar)" rcs "$CORE_LIBRARY" "${CORE_OBJECTS[@]}" "$(command -v ar)" rcs "$CORE_LIBRARY" "${CORE_OBJECTS[@]}"
OUTPUT="$BIN_DIR/VoxelForgeCoreHeadless-$VARIANT" OUTPUT="$BIN_DIR/VoxelForgeCoreHeadless-$VARIANT"
"$COMPILER" -pthread "${LEGACY_OBJECTS[@]}" "$CORE_LIBRARY" -o "$OUTPUT" "$COMPILER" -pthread "${LEGACY_OBJECTS[@]}" "$CORE_LIBRARY" -o "$OUTPUT"
CAPTURE_OUTPUT="$BIN_DIR/VoxelForgeOffscreenCapture-$VARIANT"
"$COMPILER" -std=c++20 -O2 -fno-fast-math -pthread \
"$ROOT/Source/LinuxOffscreenCapture.cpp" -o "$CAPTURE_OUTPUT" \
$(pkg-config --cflags --libs egl glesv2 libpng)
printf 'Built Core library: %s\nBuilt headless benchmark: %s\n' "$CORE_LIBRARY" "$OUTPUT" printf 'Built Core library: %s\nBuilt headless benchmark: %s\n' "$CORE_LIBRARY" "$OUTPUT"
printf 'Built EGL offscreen capture: %s\n' "$CAPTURE_OUTPUT"
printf 'Compiler: %s | variant: %s | fp-contract: %s | jobs: %s\n' "$COMPILER" "$VARIANT" "$FP_CONTRACT" "$JOBS" printf 'Compiler: %s | variant: %s | fp-contract: %s | jobs: %s\n' "$COMPILER" "$VARIANT" "$FP_CONTRACT" "$JOBS"
+7 -2
View File
@@ -153,8 +153,13 @@ radius range, top flattening, taper, bounded contour warp, roughness, blend, con
route constraints. `PlanFloatingIslandCluster` emits stable island and connector IDs, a connected route constraints. `PlanFloatingIslandCluster` emits stable island and connector IDs, a connected
cluster graph, conservative influence AABBs, and a centerline route. At least the primary chain is cluster graph, conservative influence AABBs, and a centerline route. At least the primary chain is
always planned; `islandDensityQ16` controls up to two optional side sites. Connectors carry a sharp-tag always planned; `islandDensityQ16` controls up to two optional side sites. Connectors carry a sharp-tag
ready bit for a later hybrid-mesher adapter. The schema accepts geometry version 1 and 2. Manifests ready bit for a later hybrid-mesher adapter. The schema accepts geometry versions 1 through 3.
without a geometry version retain version-1 evaluation and canonical hashes. Version 3 keeps the version-2 island form, removes the all-XY lower seal, and obtains its ceiling from
the shared upper-strate boundary seal. The resolved upper bound comes from the strate's own chunk
range; `boundarySealSubvoxels` sets the shared seal thickness and remains a planning margin for island
features. It does not define a FloatingIslands-specific ceiling height. Versions 1 and 2 retain their
recorded two-sided boundary seals. Manifests without a geometry version retain version-1 evaluation
and canonical hashes.
`FloatingIslandFieldV1::densitySubvoxels` evaluates the canonical island and connector field. `FloatingIslandFieldV1::densitySubvoxels` evaluates the canonical island and connector field.
`interval` returns unknown for boxes overlapping any influence AABB and a certified all-air range `interval` returns unknown for boxes overlapping any influence AABB and a certified all-air range
@@ -0,0 +1,183 @@
#pragma once
#include <array>
#include <atomic>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <memory>
#include <thread>
#include <type_traits>
#include <utility>
namespace VoxelForgeCoreShared
{
// Exact input identity for a pure XY column value. LOD is deliberately not part of this key:
// the same recipe/plan column has the same bits at every sampling step.
struct FColumnCacheKey
{
std::uint64_t recipeIdentity = 0;
std::uint64_t recipeContentHash = 0;
std::uint64_t planIdentity = 0;
std::uint64_t planContentHash = 0;
std::int64_t xSubvoxels = 0;
std::int64_t ySubvoxels = 0;
// Optional exact sub-domain identity for recipes with several independent columns
// at the same XY (for example, a floating-island anchor).
std::uint64_t contextIdentity = 0;
std::array<std::uint64_t, 7> words() const noexcept
{
return {recipeIdentity, recipeContentHash, planIdentity, planContentHash,
static_cast<std::uint64_t>(xSubvoxels), static_cast<std::uint64_t>(ySubvoxels),
contextIdentity};
}
};
// A bounded, world-owned second-level cache. Existing thread-local caches stay first, so
// their ordinary hit path remains private and lock-free. Shared hits read atomic words; only
// a shared miss takes the set spin lock. Entries are four-way set associative, evict on
// collision, and carry pointer identities plus content hashes to reject stale reuse.
// Les caches TLS restent le premier niveau; seul un defaut partage prend le verrou du groupe.
template <typename TValue, std::size_t SetCount, std::size_t Ways = 4>
class TSharedColumnValueCache
{
static_assert(SetCount > 0 && (SetCount & (SetCount - 1)) == 0,
"column cache set count must be a power of two");
static_assert(Ways > 0 && Ways <= 16, "unsupported column cache associativity");
static_assert(std::is_trivially_copyable_v<TValue>,
"shared column values must be trivially copyable");
static constexpr std::size_t ValueWordCount = (sizeof(TValue) + 7) / 8;
using FKeyWords = std::array<std::uint64_t, 7>;
using FValueWords = std::array<std::uint64_t, ValueWordCount>;
struct FEntry
{
std::atomic<std::uint64_t> Version{0};
std::atomic<std::uint64_t> Tag{0};
std::array<std::atomic<std::uint64_t>, 7> Key{};
std::array<std::atomic<std::uint64_t>, ValueWordCount> Value{};
};
struct FSet
{
std::atomic_flag Writer = ATOMIC_FLAG_INIT;
std::uint8_t NextWay = 0;
std::array<FEntry, Ways> Entries{};
};
struct FSpinGuard
{
explicit FSpinGuard(std::atomic_flag& value) : Flag(value)
{
while (Flag.test_and_set(std::memory_order_acquire))
std::this_thread::yield();
}
~FSpinGuard() { Flag.clear(std::memory_order_release); }
std::atomic_flag& Flag;
};
public:
TSharedColumnValueCache() : Sets(std::make_unique<FSet[]>(SetCount)) {}
TSharedColumnValueCache(const TSharedColumnValueCache&) = delete;
TSharedColumnValueCache& operator=(const TSharedColumnValueCache&) = delete;
static TSharedColumnValueCache* setThreadActive(TSharedColumnValueCache* value) noexcept
{
TSharedColumnValueCache* previous = Active;
Active = value;
return previous;
}
static TSharedColumnValueCache* threadActive() noexcept { return Active; }
template <typename TFactory>
TValue getOrCompute(const FColumnCacheKey& key, TFactory&& factory,
bool& computed)
{
computed = false;
const FKeyWords keyWords = key.words();
const std::uint64_t tag = Hash(keyWords);
const std::size_t setIndex = static_cast<std::size_t>(tag) & (SetCount - 1);
FSet& set = Sets[setIndex];
TValue value{};
if (TryReadSet(set, keyWords, tag, value)) return value;
FSpinGuard lock(set.Writer);
if (TryReadSet(set, keyWords, tag, value)) return value;
value = std::forward<TFactory>(factory)();
computed = true;
FValueWords valueWords{};
std::memcpy(valueWords.data(), &value, sizeof(TValue));
std::size_t replacement = Ways;
for (std::size_t way = 0; way < Ways; ++way)
if (set.Entries[way].Version.load(std::memory_order_seq_cst) == 0)
{ replacement = way; break; }
if (replacement == Ways)
{
replacement = set.NextWay;
set.NextWay = static_cast<std::uint8_t>((set.NextWay + 1) % Ways);
}
FEntry& entry = set.Entries[replacement];
std::uint64_t version = entry.Version.load(std::memory_order_seq_cst);
if (version & 1u) ++version;
entry.Version.store(version + 1, std::memory_order_seq_cst);
for (std::size_t word = 0; word < keyWords.size(); ++word)
entry.Key[word].store(keyWords[word], std::memory_order_seq_cst);
for (std::size_t word = 0; word < valueWords.size(); ++word)
entry.Value[word].store(valueWords[word], std::memory_order_seq_cst);
entry.Tag.store(tag, std::memory_order_seq_cst);
entry.Version.store(version + 2, std::memory_order_seq_cst);
return value;
}
private:
static std::uint64_t Hash(const FKeyWords& words) noexcept
{
std::uint64_t hash = 0x9E3779B185EBCA87ull;
for (const std::uint64_t word : words)
{
hash ^= word + 0x9E3779B97F4A7C15ull + (hash << 6) + (hash >> 2);
hash ^= hash >> 30;
hash *= 0xBF58476D1CE4E5B9ull;
hash ^= hash >> 27;
hash *= 0x94D049BB133111EBull;
hash ^= hash >> 31;
}
return hash == 0 ? 1 : hash;
}
static bool TryRead(const FEntry& entry, const FKeyWords& keyWords,
std::uint64_t tag, TValue& out)
{
const std::uint64_t before = entry.Version.load(std::memory_order_seq_cst);
if (before == 0 || (before & 1u)
|| entry.Tag.load(std::memory_order_seq_cst) != tag) return false;
FKeyWords foundKey{};
for (std::size_t word = 0; word < foundKey.size(); ++word)
foundKey[word] = entry.Key[word].load(std::memory_order_seq_cst);
if (foundKey != keyWords) return false;
FValueWords foundValue{};
for (std::size_t word = 0; word < foundValue.size(); ++word)
foundValue[word] = entry.Value[word].load(std::memory_order_seq_cst);
const std::uint64_t after = entry.Version.load(std::memory_order_seq_cst);
if (before != after || (after & 1u)) return false;
std::memcpy(&out, foundValue.data(), sizeof(TValue));
return true;
}
static bool TryReadSet(const FSet& set, const FKeyWords& keyWords,
std::uint64_t tag, TValue& out)
{
for (const FEntry& entry : set.Entries)
if (TryRead(entry, keyWords, tag, out)) return true;
return false;
}
std::unique_ptr<FSet[]> Sets;
inline static thread_local TSharedColumnValueCache* Active = nullptr;
};
}
@@ -110,9 +110,19 @@ namespace VoxelForgeCore
enum class TileClass : std::uint8_t { allSolid, allAir, mixed, unknown }; enum class TileClass : std::uint8_t { allSolid, allAir, mixed, unknown };
struct HeightfieldColumnEvaluation
{
std::int64_t x = 0, y = 0;
std::uint64_t sequence = 0;
bool outsideTileFootprint = false;
};
struct TileGenerationStats struct TileGenerationStats
{ {
TileClass tileClass = TileClass::unknown; TileClass tileClass = TileClass::unknown;
bool nativeOnlyRoute = false;
bool analyticRegionPageRoute = false;
bool nativeSurfaceTile = false;
std::uint64_t solidBoxes = 0; std::uint64_t solidBoxes = 0;
std::uint64_t airBoxes = 0; std::uint64_t airBoxes = 0;
std::uint64_t mixedBoxes = 0; std::uint64_t mixedBoxes = 0;
@@ -124,6 +134,13 @@ namespace VoxelForgeCore
std::uint64_t columnCacheHits = 0; std::uint64_t columnCacheHits = 0;
std::uint64_t columnCacheMisses = 0; std::uint64_t columnCacheMisses = 0;
std::uint64_t columnCacheConflictMisses = 0; std::uint64_t columnCacheConflictMisses = 0;
std::uint64_t sharedColumnCacheHits = 0;
std::uint64_t columnEvaluations = 0;
std::uint64_t uniformBlockProofsChecked = 0;
std::uint64_t uniformBlockProofSamplesChecked = 0;
std::uint64_t uniformBlockProofFallbackBlocks = 0;
std::uint64_t uniformBlockProofUnknownBlocks = 0;
std::uint64_t uniformBlockProofViolations = 0;
double classificationMilliseconds = 0.0; double classificationMilliseconds = 0.0;
double columnComputeMilliseconds = 0.0; double columnComputeMilliseconds = 0.0;
double columnEvaluationExclusiveMilliseconds = 0.0; double columnEvaluationExclusiveMilliseconds = 0.0;
@@ -137,6 +154,7 @@ namespace VoxelForgeCore
double marchingCubesGradientNormalsMilliseconds = 0.0; double marchingCubesGradientNormalsMilliseconds = 0.0;
double marchingCubesEdgeInterpolationMilliseconds = 0.0; double marchingCubesEdgeInterpolationMilliseconds = 0.0;
double marchingCubesVertexDedupStreamMilliseconds = 0.0; double marchingCubesVertexDedupStreamMilliseconds = 0.0;
double marchingCubesSkirtMilliseconds = 0.0;
double marchingCubesOtherMilliseconds = 0.0; double marchingCubesOtherMilliseconds = 0.0;
std::uint64_t marchingCubesGradientFallbackDensityCalls = 0; std::uint64_t marchingCubesGradientFallbackDensityCalls = 0;
std::uint64_t marchingCubesEdgeMidpointDensityCalls = 0; std::uint64_t marchingCubesEdgeMidpointDensityCalls = 0;
@@ -152,6 +170,20 @@ namespace VoxelForgeCore
double farHorizonMilliseconds = 0.0; double farHorizonMilliseconds = 0.0;
std::uint64_t farStratumFieldCalls = 0; std::uint64_t farStratumFieldCalls = 0;
std::uint64_t farConnectorFieldCalls = 0; std::uint64_t farConnectorFieldCalls = 0;
std::uint64_t farStratumColumnPointCalls = 0;
std::uint64_t farStratumColumnCacheHits = 0;
std::uint64_t farStratumColumnCacheMisses = 0;
std::uint64_t farStratumColumnConflictMisses = 0;
std::uint64_t farStratumSharedColumnCacheHits = 0;
std::uint64_t farStratumColumnEvaluations = 0;
std::uint64_t farConnectorColumnPointCalls = 0;
std::uint64_t farConnectorColumnCacheHits = 0;
std::uint64_t farConnectorColumnCacheMisses = 0;
std::uint64_t farConnectorColumnConflictMisses = 0;
std::uint64_t farConnectorSharedColumnCacheHits = 0;
std::uint64_t farConnectorColumnEvaluations = 0;
double farStratumColumnComputeMilliseconds = 0.0;
double farConnectorColumnComputeMilliseconds = 0.0;
std::uint64_t farShellTrianglesAdded = 0; std::uint64_t farShellTrianglesAdded = 0;
std::uint64_t horizonGroundTriangles = 0; std::uint64_t horizonGroundTriangles = 0;
std::uint64_t horizonGroundTrianglesRemoved = 0; std::uint64_t horizonGroundTrianglesRemoved = 0;
@@ -167,7 +199,7 @@ namespace VoxelForgeCore
bool capRefined = false; bool capRefined = false;
std::uint64_t columnEvaluationWorkerHash = 0; std::uint64_t columnEvaluationWorkerHash = 0;
bool columnCoordinateCaptureComplete = true; bool columnCoordinateCaptureComplete = true;
std::vector<std::array<std::int64_t, 2>> evaluatedColumnCoordinates; std::vector<HeightfieldColumnEvaluation> evaluatedColumnCoordinates;
}; };
struct TileMesh struct TileMesh
@@ -216,8 +248,9 @@ namespace VoxelForgeCore
// This is independent of tile size and is the fixed input scale for Core field blocks. // This is independent of tile size and is the fixed input scale for Core field blocks.
// L'assembleur v1 encode coordonnees et scalaires en 1/256 de voxel, independamment des tuiles. // L'assembleur v1 encode coordonnees et scalaires en 1/256 de voxel, independamment des tuiles.
inline constexpr std::int64_t WorldAssemblySubvoxelsPerVoxel = 256; inline constexpr std::int64_t WorldAssemblySubvoxelsPerVoxel = 256;
inline constexpr std::uint32_t WorldAssemblySchemaVersion = 1; inline constexpr std::uint32_t WorldAssemblySchemaVersion = 2;
inline constexpr std::uint32_t WorldAssemblyEvaluatorVersion = 5; // Version 14 adds shared passage columns for long native open-air crossings.
inline constexpr std::uint32_t WorldAssemblyEvaluatorVersion = 14;
enum class FieldChannel : std::uint32_t enum class FieldChannel : std::uint32_t
{ {
@@ -269,6 +302,8 @@ namespace VoxelForgeCore
std::uint32_t schemaVersion = WorldAssemblySchemaVersion; std::uint32_t schemaVersion = WorldAssemblySchemaVersion;
std::uint32_t evaluatorVersion = WorldAssemblyEvaluatorVersion; std::uint32_t evaluatorVersion = WorldAssemblyEvaluatorVersion;
std::uint32_t unitsPerVoxel = static_cast<std::uint32_t>(WorldAssemblySubvoxelsPerVoxel); std::uint32_t unitsPerVoxel = static_cast<std::uint32_t>(WorldAssemblySubvoxelsPerVoxel);
// Resolved physical strate chunk width in 1/256 Core voxel units; tileVoxelCount remains 32.
std::int64_t layoutChunkWidthSubvoxels = 8192;
std::uint32_t seed = 0; std::uint32_t seed = 0;
std::int64_t biomeCellSizeSubvoxels = 256 * 800; std::int64_t biomeCellSizeSubvoxels = 256 * 800;
std::int64_t biomeWarpSubvoxels = 256 * 250; std::int64_t biomeWarpSubvoxels = 256 * 250;
@@ -359,7 +394,12 @@ namespace VoxelForgeCore
std::uint32_t schemaVersion = 1; std::uint32_t schemaVersion = 1;
// Profile 1 preserves the original shallow pads. Profile 2 adds a thick crust, // Profile 1 preserves the original shallow pads. Profile 2 adds a thick crust,
// bounded lobed roots and arched spans without changing the feature-family schema. // bounded lobed roots and arched spans without changing the feature-family schema.
std::uint32_t geometryVersion = 2; // Version 3 keeps the version-2 island shapes, removes the all-XY lower boundary seal,
// and routes its upper seal through the shared strate-boundary primitive. Version 4
// records the director-resolved strate layout width. Version 5 adds one passage-rooted
// island whose root reaches the owned bedrock and whose surface route ends at its mouth.
// New production adapters opt in explicitly; the compatibility default remains version 4.
std::uint32_t geometryVersion = 4;
std::uint32_t unitsPerVoxel = static_cast<std::uint32_t>(WorldAssemblySubvoxelsPerVoxel); std::uint32_t unitsPerVoxel = static_cast<std::uint32_t>(WorldAssemblySubvoxelsPerVoxel);
// Import scale is explicit in microns; the reduced ratio maps owner-authored lengths to Core voxels. // Import scale is explicit in microns; the reduced ratio maps owner-authored lengths to Core voxels.
// L'echelle d'import est explicite en microns; le rapport reduit convertit les longueurs owner. // L'echelle d'import est explicite en microns; le rapport reduit convertit les longueurs owner.
@@ -373,6 +413,9 @@ namespace VoxelForgeCore
std::int64_t layoutCenterTopZSubvoxels = -64 * WorldAssemblySubvoxelsPerVoxel; std::int64_t layoutCenterTopZSubvoxels = -64 * WorldAssemblySubvoxelsPerVoxel;
std::int64_t layoutMinimumZSubvoxels = -128 * WorldAssemblySubvoxelsPerVoxel; std::int64_t layoutMinimumZSubvoxels = -128 * WorldAssemblySubvoxelsPerVoxel;
std::int64_t layoutMaximumZSubvoxels = 0; std::int64_t layoutMaximumZSubvoxels = 0;
// Director-resolved physical strate layout chunk in 1/256 Core voxel units.
// This is independent of the internal 32-voxel Core tile.
std::int64_t layoutChunkWidthSubvoxels = 8192;
std::uint32_t primaryIslandCount = 3; std::uint32_t primaryIslandCount = 3;
std::int64_t islandDensityQ16 = 1ll << 15; std::int64_t islandDensityQ16 = 1ll << 15;
// Legacy owner lengths use ownerVoxelSizeMicrons; the scale ratio converts them to Core voxels. // Legacy owner lengths use ownerVoxelSizeMicrons; the scale ratio converts them to Core voxels.
@@ -393,6 +436,14 @@ namespace VoxelForgeCore
std::int64_t boundarySealSubvoxels = 2 * WorldAssemblySubvoxelsPerVoxel; std::int64_t boundarySealSubvoxels = 2 * WorldAssemblySubvoxelsPerVoxel;
std::int64_t bridgeHalfWidthSubvoxels = 3 * WorldAssemblySubvoxelsPerVoxel; std::int64_t bridgeHalfWidthSubvoxels = 3 * WorldAssemblySubvoxelsPerVoxel;
std::int64_t bridgeThicknessSubvoxels = 4 * WorldAssemblySubvoxelsPerVoxel; std::int64_t bridgeThicknessSubvoxels = 4 * WorldAssemblySubvoxelsPerVoxel;
// Version 5 anchor-island inputs are resolved from that strate's passage config.
// The anchor is the last primary route island and must stay inside the passage disk.
std::uint32_t anchorIslandOrdinal = 2;
std::int64_t anchorPlacementRadiusSubvoxels = 0;
std::int64_t anchorRootRadiusSubvoxels = 0;
std::int64_t anchorIslandMinimumRadiusSubvoxels = 0;
std::int64_t anchorRootBottomZSubvoxels = 0;
std::int64_t anchorMouthOffsetSubvoxels = 0;
WorldAssemblyRouteConstraintsV1 routeConstraints; WorldAssemblyRouteConstraintsV1 routeConstraints;
std::uint64_t contentHash = 0; std::uint64_t contentHash = 0;
}; };
@@ -496,7 +547,8 @@ namespace VoxelForgeCore
std::uint64_t contentHash = 0; std::uint64_t contentHash = 0;
static std::optional<FloatingIslandManifestV1> FromJson( static std::optional<FloatingIslandManifestV1> FromJson(
std::string_view json, std::string& error); std::string_view json, std::string& error,
std::int64_t resolvedLayoutChunkWidthSubvoxels = 0);
bool finalize(std::string& error); bool finalize(std::string& error);
bool validate(std::string& error) const; bool validate(std::string& error) const;
std::string ToJson() const; std::string ToJson() const;
@@ -528,6 +580,169 @@ namespace VoxelForgeCore
std::string ToJson() const; std::string ToJson() const;
}; };
// Read-only, versioned account of the physical layout resolved by the director and the
// Core adapter. Coordinates are half-open micrometre intervals; recipe anchors retain their
// source fixed-point units so this record never rounds the recipe itself.
inline constexpr std::uint32_t ResolvedLayoutSchemaVersionV3 = 3;
enum class ResolvedLayoutValidationModeV3 : std::uint8_t { compatibility, strict };
struct ResolvedLayoutAnchorV2
{
std::string kind;
std::string stableId;
std::string units;
std::vector<std::int64_t> values;
};
struct ResolvedLayoutBandV2
{
std::string kind; // ceiling, content, bedrock
std::int64_t bottomMicrometres = 0;
std::int64_t topMicrometres = 0;
bool presentInCurrentField = false;
bool diggable = true;
bool protectedBand = false;
std::string behaviour;
std::string densitySide;
std::string capPath;
std::int64_t solidDensityQ16 = 1ll << 16;
};
struct ResolvedLayoutStratumV2
{
std::string stableId;
std::int32_t order = 0;
std::int32_t strateIndex = -1;
std::string generatorKind;
std::string recipeId;
std::uint32_t recipeVersion = 0;
std::int64_t interiorBottomMicrometres = 0;
std::int64_t interiorTopMicrometres = 0;
std::uint32_t voxelSizeMicrometres = 0;
std::array<std::int64_t, 3> latticeOriginMicrometres{};
ResolvedLayoutBandV2 ceiling;
ResolvedLayoutBandV2 content;
ResolvedLayoutBandV2 bedrock;
std::string transitionMode; // mode at this strate's lower interface
std::int32_t transitionBlendChunks = 0;
std::int64_t transitionWidthMicrometres = 0;
std::int64_t transitionWarpAmplitudeMicrometres = 0;
std::int64_t transitionInterpenetrationMicrometres = 0;
bool transitionHonouredInCore = false;
bool transitionFallsBackToHard = false;
std::string transitionDispatchPath;
std::string boundDispatchPath;
std::string queryDispatchPath;
std::string managerLookup;
std::int64_t managerChunkWidthMicrometres = 0;
std::int64_t dispatchChunkWidthMicrometres = 0;
std::vector<ResolvedLayoutAnchorV2> anchors;
};
struct ResolvedLayoutIssueV2
{
std::string code;
std::string detail;
};
struct ResolvedLayoutPassagePointV1
{
std::array<std::int64_t, 3> positionSubvoxels{};
std::int64_t radiusSubvoxels = 0;
};
struct ResolvedLayoutPassageV1
{
std::string stableId;
std::int32_t upperStrateIndex = -1;
std::int32_t lowerStrateIndex = -1;
std::int64_t placementRadiusSubvoxels = 0;
std::array<std::int64_t, 3> upperMouthSubvoxels{};
std::array<std::int64_t, 3> lowerMouthSubvoxels{};
std::int64_t mouthRadiusSubvoxels = 0;
std::int64_t midRadiusSubvoxels = 0;
// Derived from the mouth binding; the main descent is monotone through this point.
std::size_t lowerMouthControlIndex = 0;
std::vector<ResolvedLayoutPassagePointV1> controlPoints;
};
struct PassageVoidCrossingAuditV1
{
std::size_t passageIndex = 0;
std::size_t firstSegment = 0;
std::size_t lastSegment = 0;
std::uint64_t unsupportedSamples = 0;
double unsupportedLengthMetres = 0.0;
std::array<double, 4> startPointSubvoxels{};
std::array<double, 4> endPointSubvoxels{};
bool needsColumn = false;
bool connectedAtStart = false;
bool connectedAtEnd = false;
std::array<std::int64_t, 2> columnAxisSubvoxels{};
std::int64_t columnTopZSubvoxels = 0;
std::int64_t columnBottomZSubvoxels = 0;
std::int64_t columnMinimumRadiusSubvoxels = 0;
std::int64_t columnNominalRadiusSubvoxels = 0;
std::int64_t columnMaximumRadiusSubvoxels = 0;
double maximumRouteOffsetMetres = 0.0;
double maximumBoreRadiusMetres = 0.0;
};
struct ResolvedLayoutPassageConfigV1
{
std::int32_t upperStrateIndex = -1;
std::int32_t connections = 1;
// EVoxelPassageStyle numeric values: Straight=0, Worm=1, Spiral=2, Cascading=3.
std::uint32_t style = 1;
std::int64_t mouthRadiusSubvoxels = 0;
std::int64_t midRadiusSubvoxels = 0;
std::int64_t reachMinimumSubvoxels = 0;
std::int64_t reachMaximumSubvoxels = 0;
std::int64_t distanceMinimumSubvoxels = 0;
std::int64_t distanceMaximumSubvoxels = 0;
std::int64_t wanderSubvoxels = 0;
std::uint32_t segments = 20;
std::int64_t verticalWobbleSubvoxels = 0;
std::int64_t spiralRadiusSubvoxels = 0;
std::int64_t spiralTurnsQ16 = 2ll << 16;
std::uint32_t cascadeSteps = 4;
std::int64_t cascadeLedgeSubvoxels = 0;
};
struct VFCORE_API ResolvedLayoutSnapshotV3
{
std::uint32_t schemaVersion = ResolvedLayoutSchemaVersionV3;
std::string worldIdentity;
std::uint32_t ownerVoxelSizeMicrometres = 0;
std::uint32_t coreVoxelSizeMicrometres = 0;
std::uint32_t strateLayoutChunkSizeMicrometres = 8000000;
std::int64_t strateLayoutChunkWidthSubvoxels = 8192;
std::vector<ResolvedLayoutStratumV2> strates;
std::vector<ResolvedLayoutPassageV1> passages;
std::string stableIdentity;
bool finalize(std::string& error);
bool validate(ResolvedLayoutValidationModeV3 mode,
std::vector<ResolvedLayoutIssueV2>& issues,
std::string& error) const;
std::string ToJson() const;
static std::optional<ResolvedLayoutSnapshotV3> FromJson(
std::string_view json, std::string& error);
};
struct ResolvedLayoutValidatorAuditV3
{
std::uint32_t controlsRun = 0;
std::uint32_t controlsRejectedAsExpected = 0;
bool passed = false;
std::vector<ResolvedLayoutIssueV2> failures;
};
VFCORE_API ResolvedLayoutValidatorAuditV3 AuditResolvedLayoutValidatorV3();
VFCORE_API bool PlanResolvedLayoutPassagesV1(
ResolvedLayoutSnapshotV3& layout, std::int32_t seed,
const std::vector<ResolvedLayoutPassageConfigV1>& configs,
std::string& error);
struct FloatingIslandBoundsAuditResult struct FloatingIslandBoundsAuditResult
{ {
std::uint64_t boxesTested = 0; std::uint64_t boxesTested = 0;
@@ -650,10 +865,12 @@ namespace VoxelForgeCore
std::uint64_t columnHits = 0; std::uint64_t columnHits = 0;
std::uint64_t columnMisses = 0; std::uint64_t columnMisses = 0;
std::uint64_t columnConflictMisses = 0; std::uint64_t columnConflictMisses = 0;
std::uint64_t sharedColumnHits = 0;
std::uint64_t columnEvaluations = 0;
double columnComputeMilliseconds = 0.0; double columnComputeMilliseconds = 0.0;
bool captureCoordinates = false; bool captureCoordinates = false;
bool coordinateCaptureComplete = true; bool coordinateCaptureComplete = true;
std::vector<std::array<std::int64_t, 2>> evaluatedCoordinates; std::vector<HeightfieldColumnEvaluation> evaluatedCoordinates;
}; };
struct FieldInfluenceBounds struct FieldInfluenceBounds
@@ -704,6 +921,13 @@ namespace VoxelForgeCore
std::int64_t maximumZSubvoxels, std::int32_t stepVoxels) const noexcept; std::int64_t maximumZSubvoxels, std::int32_t stepVoxels) const noexcept;
static void resetThreadColumnCacheStats(bool captureCoordinates = false, static void resetThreadColumnCacheStats(bool captureCoordinates = false,
bool clearCache = false, std::uint32_t octaveDrop = 0) noexcept; bool clearCache = false, std::uint32_t octaveDrop = 0) noexcept;
static void setThreadColumnCaptureBounds(std::int64_t minimumXSubvoxels,
std::int64_t minimumYSubvoxels, std::int64_t maximumXSubvoxels,
std::int64_t maximumYSubvoxels) noexcept;
static void setThreadColumnOctaveDrop(std::uint32_t octaveDrop) noexcept;
static std::uint32_t threadColumnOctaveDrop() noexcept;
static void setThreadColumnInterpolationStrideSubvoxels(std::int64_t stride) noexcept;
static std::int64_t threadColumnInterpolationStrideSubvoxels() noexcept;
static void setThreadColumnCacheLegacyDirectMapped(bool enabled) noexcept; static void setThreadColumnCacheLegacyDirectMapped(bool enabled) noexcept;
static const HeightfieldColumnCacheStats& threadColumnCacheStats() noexcept; static const HeightfieldColumnCacheStats& threadColumnCacheStats() noexcept;
FieldInterval interval(std::int64_t minimumXSubvoxels, FieldInterval interval(std::int64_t minimumXSubvoxels,
@@ -796,6 +1020,8 @@ namespace VoxelForgeCore
explicit operator bool() const noexcept { return static_cast<bool>(data_); } explicit operator bool() const noexcept { return static_cast<bool>(data_); }
const WorldConfiguration& configuration() const; const WorldConfiguration& configuration() const;
const WorldAssemblyManifest* worldAssembly() const noexcept; const WorldAssemblyManifest* worldAssembly() const noexcept;
const ResolvedLayoutSnapshotV3* resolvedLayout() const noexcept;
ResolvedWorldSnapshot withoutResolvedLayoutPassages() const;
private: private:
struct Data; struct Data;
@@ -1023,6 +1249,9 @@ namespace VoxelForgeCore
std::int32_t bandMaxZVoxel = 2147483647; std::int32_t bandMaxZVoxel = 2147483647;
bool hashDensity = false; bool hashDensity = false;
bool captureDensitySamples = false; bool captureDensitySamples = false;
// Diagnostic only; materialize the full density lattice even when block proofs
// establish that the tile has no surface.
bool forceFullDensityCapture = false;
bool skipUvAndColors = false; bool skipUvAndColors = false;
bool skipUv = false; bool skipUv = false;
bool skipColors = false; bool skipColors = false;
@@ -1033,9 +1262,13 @@ namespace VoxelForgeCore
// Opt-in diagnostic only; records XY columns evaluated by this LOD8 tile. // Opt-in diagnostic only; records XY columns evaluated by this LOD8 tile.
// Diagnostic seulement; enregistre les colonnes XY evaluees par cette tuile LOD8. // Diagnostic seulement; enregistre les colonnes XY evaluees par cette tuile LOD8.
bool captureColumnCoordinates = false; bool captureColumnCoordinates = false;
bool useSharedColumnCache = true;
// Separate cold pass only; samples the MC inner stages without changing output. // Separate cold pass only; samples the MC inner stages without changing output.
// Passe froide separee seulement; mesure les etapes internes MC sans changer la sortie. // Passe froide separee seulement; mesure les etapes internes MC sans changer la sortie.
bool profileMesherStages = false; bool profileMesherStages = false;
// Diagnostic only; fills and checks every lattice sample in blocks certified uniform.
// Diagnostic seulement; evalue et verifie tous les echantillons des blocs uniformes.
bool auditUniformBlockProofs = false;
// Negative control for the shared XY-column cache; 1 restores the old direct-map indexing. // Negative control for the shared XY-column cache; 1 restores the old direct-map indexing.
// Controle negatif du cache XY partage; 1 restaure l'ancien indexage direct. // Controle negatif du cache XY partage; 1 restaure l'ancien indexage direct.
bool legacyDirectMappedColumnCache = false; bool legacyDirectMappedColumnCache = false;
@@ -1045,11 +1278,20 @@ namespace VoxelForgeCore
// LOD8-only planar horizon interior grid; zero follows the MC step, 128 restores S9. // LOD8-only planar horizon interior grid; zero follows the MC step, 128 restores S9.
// Grille interieure LOD8 seulement; zero suit la maille MC, 128 restaure S9. // Grille interieure LOD8 seulement; zero suit la maille MC, 128 restaure S9.
std::int32_t lod8HorizonInteriorStepVoxels = 0; std::int32_t lod8HorizonInteriorStepVoxels = 0;
// Bump when the distant cap representation changes. LOD4-8 mesh hashes are salted; // Bump when shared stratum-boundary caps or the distant horizon representation changes.
// density and LOD0-3 hashes remain unchanged. // LOD4-8 mesh hashes are salted; density and LOD0-3 keep their direct identities.
// Incremente quand le plafond lointain change. Les hashes LOD4-8 incluent cette version; // Incremente quand les plafonds partages ou l'horizon lointain changent.
// densite et hashes LOD0-3 restent inchanges. // Les hashes de maillage LOD4-8 incluent cette version; LOD0-3 gardent leur identite directe.
std::uint32_t farHorizonVersion = 3; std::uint32_t farHorizonVersion = 4;
// Linux research controls for reproducing L5 negative controls. Defaults preserve output.
std::uint32_t diagnosticGlobalOctaveDrop = 0;
std::uint32_t diagnosticCellStride = 1;
std::uint32_t diagnosticColumnInterpolationStride = 1;
// Diagnostic negative control only: deliberately bypass the native-only readiness
// proof and require the sampling guard to reject any shape-dependent tile.
// Controle negatif diagnostique: contourne volontairement la preuve native seule
// et exige que la garde rejette toute tuile dependante de la forme.
bool diagnosticForceNativeOnly = false;
}; };
class VFCORE_API World class VFCORE_API World
@@ -1067,16 +1309,26 @@ namespace VoxelForgeCore
// True only when a fine tile needs a separately compiled region before generation. // True only when a fine tile needs a separately compiled region before generation.
// Vrai seulement si une tuile fine doit attendre la compilation d'une region dediee. // Vrai seulement si une tuile fine doit attendre la compilation d'une region dediee.
bool needsTileRegion(const TileKey& tile) const; bool needsTileRegion(const TileKey& tile) const;
// Conservative precompile proof: true only for a tile that can sample the native
// SurfaceWorld heightfield throughout its padded mesh domain without compiled shape data.
// Preuve prudente avant compilation: vrai seulement si toute la zone maillee avec marge
// utilise le champ SurfaceWorld natif, sans lire la forme compilee.
bool isTileShapeFree(const TileKey& tile) const;
// Compile missing detail regions for entering fine tiles. Generated tile keys map to // Compile missing detail regions for entering fine tiles. Generated tile keys map to
// shared world-coordinate regions. The default analyticOnly path coalesces each entering // bounded, world-aligned pages. The default analyticOnly path builds each page's
// LOD slab, builds its primitives/bins, and evaluates density on demand without // primitives/bins and evaluates density on demand without rasterizing unused lattice
// rasterizing unused lattice volumes. Set false to use fixed absolute packed pages. The // volumes. Set false to use fixed absolute packed pages. The optional count is newly
// optional count is newly covered tile keys; regions stay resident until retainTileRegions. // covered tile keys; regions stay resident until retainTileRegions.
// Compile les regions de detail manquantes. Les tuiles entrantes sont regroupees en pages
// bornees alignees au monde; analyticOnly construit les primitives et bins sans rasteriser
// de volume inutilise. Sinon, utilise les pages compactes fixes; le compteur indique les
// nouvelles tuiles couvertes et retainTileRegions libere les anciennes regions.
bool compileTileRegion(std::span<const TileKey> tiles, std::uint32_t workerLimit, bool compileTileRegion(std::span<const TileKey> tiles, std::uint32_t workerLimit,
const JobScheduler& scheduler, std::string& error, const JobScheduler& scheduler, std::string& error,
std::size_t* outCompiledTiles = nullptr, std::size_t* outCompiledTiles = nullptr,
TileRegionCompileStats* outStats = nullptr, TileRegionCompileStats* outStats = nullptr,
bool analyticOnly = true); bool analyticOnly = true,
bool diagnosticIncludeBaseCoveredTiles = false);
void retainTileRegions(std::span<const TileKey> desiredTiles); void retainTileRegions(std::span<const TileKey> desiredTiles);
void buildFarWorld(); void buildFarWorld();
bool isCompiled() const noexcept; bool isCompiled() const noexcept;
@@ -1084,6 +1336,14 @@ namespace VoxelForgeCore
ShapeBuildStats buildStats() const; ShapeBuildStats buildStats() const;
float densityAt(Vec3d voxelPosition) const; float densityAt(Vec3d voxelPosition) const;
// Audit-only view of density-field columns and short spans supporting passage voids.
std::vector<PassageVoidCrossingAuditV1> passageVoidCrossings() const;
bool isPassageColumnSample(std::size_t passageIndex, std::size_t segmentIndex,
Vec3d voxelPosition) const;
bool isPassageShortSpanSample(std::size_t passageIndex, std::size_t segmentIndex,
Vec3d voxelPosition) const;
// Audit-only selector provenance for the same point evaluator; never used by meshing.
std::string densityDispatchPathAt(Vec3d voxelPosition) const;
// Analytic source distance without the occupancy-preserving near-zero clamp or packed proxy. // Analytic source distance without the occupancy-preserving near-zero clamp or packed proxy.
float unclampedDensityAt(Vec3d voxelPosition) const; float unclampedDensityAt(Vec3d voxelPosition) const;
DetailFieldSample detailSampleAt(Vec3d voxelPosition) const; DetailFieldSample detailSampleAt(Vec3d voxelPosition) const;
@@ -55,6 +55,7 @@
#include "Json.h" #include "Json.h"
#include "VoxelForgeCore/VoxelForgeCore.h" #include "VoxelForgeCore/VoxelForgeCore.h"
#include "VoxelForgeCore/ThreadLocalStorage.h" #include "VoxelForgeCore/ThreadLocalStorage.h"
#include "VoxelForgeCore/SharedColumnCache.h"
// Keep Core's expression-level FMA behavior fixed regardless of the toolchain setting. // Keep Core's expression-level FMA behavior fixed regardless of the toolchain setting.
// Clang's "fast" mode ignores the pragma, so Core's runtime self-test rejects that build. // Clang's "fast" mode ignores the pragma, so Core's runtime self-test rejects that build.
+340 -8
View File
@@ -817,8 +817,9 @@ inline void AppendFarConnectorShells(const FStandaloneShapeWorld& Shape,const FV
struct FFarMeshColumnIndex struct FFarMeshColumnIndex
{ {
FFarMeshColumnIndex(const FVoxelMeshData& InMesh,const FIntVector& InOrigin,int32 InExtent, FFarMeshColumnIndex(const FVoxelMeshData& InMesh,const FIntVector& InOrigin,int32 InExtent,
int32 InCells,double InStep) int32 InCells,double InStep,double InVoxelSizeCm)
:Mesh(InMesh),Origin(InOrigin),Extent(InExtent),Cells(InCells),Step(InStep), :Mesh(InMesh),Origin(InOrigin),Extent(InExtent),Cells(InCells),Step(InStep),
VoxelSizeCm(InVoxelSizeCm),
ByColumn(static_cast<size_t>(InCells)*InCells) ByColumn(static_cast<size_t>(InCells)*InCells)
{ {
for(int32 Triangle=0;Triangle+2<Mesh.Triangles.Num();Triangle+=3) for(int32 Triangle=0;Triangle+2<Mesh.Triangles.Num();Triangle+=3)
@@ -864,16 +865,98 @@ struct FFarMeshColumnIndex
return Hits; return Hits;
} }
bool HasDownwardHit(double X,double Y,double Z,double Tolerance) const
{
const int32 CX=std::clamp(static_cast<int32>(std::floor((X-Origin.X)/Step)),0,Cells-1);
const int32 CY=std::clamp(static_cast<int32>(std::floor((Y-Origin.Y)/Step)),0,Cells-1);
const auto& Candidates=ByColumn[static_cast<size_t>(CY)*Cells+CX];
for(const int32 Triangle:Candidates)
{
const int32 IA=Mesh.Triangles[Triangle*3],IB=Mesh.Triangles[Triangle*3+1],
IC=Mesh.Triangles[Triangle*3+2];
if(IA<0||IB<0||IC<0||IA>=Mesh.Normals.Num()||IB>=Mesh.Normals.Num()
||IC>=Mesh.Normals.Num())continue;
if(Mesh.Normals[IA].Z+Mesh.Normals[IB].Z+Mesh.Normals[IC].Z>=-1.5)continue;
const double AX=PositionAxis(IA,0),AY=PositionAxis(IA,1),AZ=PositionAxis(IA,2);
const double BX=PositionAxis(IB,0),BY=PositionAxis(IB,1),BZ=PositionAxis(IB,2);
const double CXv=PositionAxis(IC,0),CYv=PositionAxis(IC,1),CZ=PositionAxis(IC,2);
const double Den=(BX-AX)*(CYv-AY)-(BY-AY)*(CXv-AX);
if(std::abs(Den)<1.0e-10)continue;
const double U=((X-AX)*(CYv-AY)-(Y-AY)*(CXv-AX))/Den;
const double V=((BX-AX)*(Y-AY)-(BY-AY)*(X-AX))/Den;
const double W=1.0-U-V;
if(U<-1.0e-7||V<-1.0e-7||W<-1.0e-7)continue;
const double Hit=AZ+U*(BZ-AZ)+V*(CZ-AZ);
if(std::abs(Hit-Z)<=Tolerance)return true;
}
return false;
}
bool HasDownwardCellCoverage(double X0,double Y0,double X1,double Y1,
double Z,double Tolerance) const
{
// Probe the perimeter as well as the interior: sparse interior-only probes can
// incorrectly hide a missing ceiling quad at an MC grid vertex.
// Sonder le perimetre et l'interieur: des sondes seulement interieures peuvent
// masquer un carre de plafond manquant sur un sommet de la grille MC.
constexpr double Samples[5]={0.0,0.25,0.5,0.75,1.0};
for(const double V:Samples)for(const double U:Samples)
{
const double X=X0+(X1-X0)*U;
const double Y=Y0+(Y1-Y0)*V;
if(!HasDownwardHit(X,Y,Z,Tolerance))return false;
}
return true;
}
bool HasUpwardHit(double X,double Y,double Z,double Tolerance) const
{
const int32 CX=std::clamp(static_cast<int32>(std::floor((X-Origin.X)/Step)),0,Cells-1);
const int32 CY=std::clamp(static_cast<int32>(std::floor((Y-Origin.Y)/Step)),0,Cells-1);
const auto& Candidates=ByColumn[static_cast<size_t>(CY)*Cells+CX];
for(const int32 Triangle:Candidates)
{
const int32 IA=Mesh.Triangles[Triangle*3],IB=Mesh.Triangles[Triangle*3+1],
IC=Mesh.Triangles[Triangle*3+2];
if(IA<0||IB<0||IC<0||IA>=Mesh.Normals.Num()||IB>=Mesh.Normals.Num()
||IC>=Mesh.Normals.Num())continue;
if(Mesh.Normals[IA].Z+Mesh.Normals[IB].Z+Mesh.Normals[IC].Z<=1.5)continue;
const double AX=PositionAxis(IA,0),AY=PositionAxis(IA,1),AZ=PositionAxis(IA,2);
const double BX=PositionAxis(IB,0),BY=PositionAxis(IB,1),BZ=PositionAxis(IB,2);
const double CXv=PositionAxis(IC,0),CYv=PositionAxis(IC,1),CZ=PositionAxis(IC,2);
const double Den=(BX-AX)*(CYv-AY)-(BY-AY)*(CXv-AX);
if(std::abs(Den)<1.0e-10)continue;
const double U=((X-AX)*(CYv-AY)-(Y-AY)*(CXv-AX))/Den;
const double V=((BX-AX)*(Y-AY)-(BY-AY)*(X-AX))/Den;
const double W=1.0-U-V;
if(U<-1.0e-7||V<-1.0e-7||W<-1.0e-7)continue;
const double Hit=AZ+U*(BZ-AZ)+V*(CZ-AZ);
if(std::abs(Hit-Z)<=Tolerance)return true;
}
return false;
}
bool HasUpwardCellCoverage(double X0,double Y0,double X1,double Y1,
double Z,double Tolerance) const
{
constexpr double Samples[5]={0.0,0.25,0.5,0.75,1.0};
for(const double V:Samples)for(const double U:Samples)
if(!HasUpwardHit(X0+(X1-X0)*U,Y0+(Y1-Y0)*V,Z,Tolerance))return false;
return true;
}
private: private:
double PositionAxis(int32 Index,int32 Axis) const double PositionAxis(int32 Index,int32 Axis) const
{ {
const FVector& P=Mesh.Vertices[Index]; const FVector& P=Mesh.Vertices[Index];
return (Axis==0?P.X:(Axis==1?P.Y:P.Z))*0.04; const double WorldCentimetres=Axis==0?P.X:(Axis==1?P.Y:P.Z);
return WorldCentimetres/VoxelSizeCm;
} }
const FVoxelMeshData& Mesh; const FVoxelMeshData& Mesh;
FIntVector Origin; FIntVector Origin;
int32 Extent=0,Cells=0; int32 Extent=0,Cells=0;
double Step=1.0; double Step=1.0;
double VoxelSizeCm=25.0;
std::vector<std::vector<int32>> ByColumn; std::vector<std::vector<int32>> ByColumn;
}; };
@@ -974,11 +1057,11 @@ inline void AppendFarStratumShells(const FStandaloneOwnerWorld& World,const FSta
std::vector<FBoundary> Boundaries; std::vector<FBoundary> Boundaries;
for(const FStrateSlot& Slot:Layout) for(const FStrateSlot& Slot:Layout)
{ {
const FStrateGenerationParams Params=World.Manager->GetGenerationParams( FStandaloneShapeWorld::FResolvedStratumBounds Resolved;
FIntVector(0,0,(Slot.TopChunkZ+Slot.BottomChunkZ)/2)); if(!Shape.GetResolvedStratumBounds(Slot,Resolved))continue;
const double HalfWidth=std::max(8.0,static_cast<double>(Params.BoundarySealThickness)+8.0); const double HalfWidth=std::max(8.0,Resolved.SealThickness+8.0);
Boundaries.push_back({static_cast<double>(Slot.BottomChunkZ)*CHUNK_SIZE,HalfWidth}); Boundaries.push_back({Resolved.BottomZ,HalfWidth});
Boundaries.push_back({static_cast<double>(Slot.TopChunkZ+1)*CHUNK_SIZE,HalfWidth}); Boundaries.push_back({Resolved.TopZ,HalfWidth});
} }
std::sort(Boundaries.begin(),Boundaries.end(),[](const FBoundary& A,const FBoundary& B){return A.Z<B.Z;}); std::sort(Boundaries.begin(),Boundaries.end(),[](const FBoundary& A,const FBoundary& B){return A.Z<B.Z;});
Boundaries.erase(std::unique(Boundaries.begin(),Boundaries.end(),[](const FBoundary& A,const FBoundary& B) Boundaries.erase(std::unique(Boundaries.begin(),Boundaries.end(),[](const FBoundary& A,const FBoundary& B)
@@ -996,7 +1079,8 @@ inline void AppendFarStratumShells(const FStandaloneOwnerWorld& World,const FSta
const bool bHasColors=Mesh.Colors.Num()==OldVertexCount; const bool bHasColors=Mesh.Colors.Num()==OldVertexCount;
const FColor Color=bHasColors&&OldVertexCount>0?Mesh.Colors[0]:FColor(160,160,160,255); const FColor Color=bHasColors&&OldVertexCount>0?Mesh.Colors[0]:FColor(160,160,160,255);
const int32 Cells=std::max(1,World.CoarseTileCells); const int32 Cells=std::max(1,World.CoarseTileCells);
FFarMeshColumnIndex MeshIndex(Mesh,Origin,Extent,Cells,Step); FFarMeshColumnIndex MeshIndex(Mesh,Origin,Extent,Cells,Step,
static_cast<double>(World.CoreVoxelSizeMicrons)/10000.0);
std::vector<FVector> NewVertices,NewNormals; std::vector<FVector> NewVertices,NewNormals;
std::vector<FVector2f> NewUVs;std::vector<FColor> NewColors; std::vector<FVector2f> NewUVs;std::vector<FColor> NewColors;
std::vector<int32> NewTriangles; std::vector<int32> NewTriangles;
@@ -1132,3 +1216,251 @@ inline void AppendFarStratumShells(const FStandaloneOwnerWorld& World,const FSta
Mesh.TriangleSkirtFaceMasks=std::move(CombinedFaceMasks); Mesh.TriangleSkirtFaceMasks=std::move(CombinedFaceMasks);
Mesh.NumSurfaceVertices=OldSurfaceVertices+AddedVertices; Mesh.NumSurfaceVertices=OldSurfaceVertices+AddedVertices;
} }
inline void AppendStratumBoundaryCeilings(const FStandaloneOwnerWorld& World,
const FStandaloneShapeWorld& Shape,const FVoxelTileKey& Key,int32 Step,FVoxelMeshData& Mesh)
{
if(Key.Level<0||Step<=0||!World.Manager)return;
const FIntVector Origin=Key.OriginVoxels();
const int32 Extent=Key.ExtentVoxels();
const int32 GridStep=Step;
if(Extent<=0||GridStep<=0||Extent%GridStep!=0)return;
const int32 GridSide=Extent/GridStep+1;
struct FCandidate
{
double FaceZ=0.0;
double Thickness=0.0;
std::vector<uint8> SolidAbove;
};
std::vector<FCandidate> Candidates;
const double CoreMicrons=std::max<std::uint32_t>(1,World.CoreVoxelSizeMicrons);
for(const FStrateSlot& Slot:World.Manager->GetLayout())
{
const auto* Stratum=Shape.FindResolvedLayoutStratum(Slot.StrateIndex);
if(!Stratum||!Stratum->ceiling.presentInCurrentField
||Stratum->ceiling.topMicrometres<=Stratum->ceiling.bottomMicrometres)continue;
FCandidate Candidate;
Candidate.FaceZ=static_cast<double>(Stratum->ceiling.bottomMicrometres)/CoreMicrons;
Candidate.Thickness=static_cast<double>(Stratum->ceiling.topMicrometres
-Stratum->ceiling.bottomMicrometres)/CoreMicrons;
if(Candidate.FaceZ<Origin.Z-1.0e-6||Candidate.FaceZ>Origin.Z+Extent+1.0e-6)continue;
const double Epsilon=std::min(0.5,Candidate.Thickness*0.25);
if(Epsilon<=0.0)continue;
Candidate.SolidAbove.resize(static_cast<std::size_t>(GridSide)*GridSide,0);
bool AnySolidAbove=false;
for(int32 Y=0;Y<GridSide;++Y)for(int32 X=0;X<GridSide;++X)
{
const double WorldX=Origin.X+X*GridStep;
const double WorldY=Origin.Y+Y*GridStep;
const float Above=Shape.DensityAt(static_cast<float>(WorldX),static_cast<float>(WorldY),
static_cast<float>(Candidate.FaceZ+Epsilon));
const bool bSolidAbove=std::isfinite(Above)&&Above<0.0f;
Candidate.SolidAbove[static_cast<std::size_t>(Y*GridSide+X)]=bSolidAbove?1:0;
AnySolidAbove=AnySolidAbove||bSolidAbove;
}
if(AnySolidAbove)Candidates.push_back(std::move(Candidate));
}
if(Candidates.empty())return;
const int32 Cells=std::max(1,World.CoarseTileCells);
FFarMeshColumnIndex MeshIndex(Mesh,Origin,Extent,Cells,Step,
static_cast<double>(World.CoreVoxelSizeMicrons)/10000.0);
const int32 OldVertexCount=Mesh.Vertices.Num();
const int32 OldSurfaceVertices=std::clamp(Mesh.NumSurfaceVertices,0,OldVertexCount);
const bool bHasUVs=Mesh.UVs.Num()==OldVertexCount;
const bool bHasColors=Mesh.Colors.Num()==OldVertexCount;
const FColor Color=bHasColors&&OldVertexCount>0?Mesh.Colors[0]:FColor(160,160,160,255);
const double VoxelSizeCm=static_cast<double>(World.CoreVoxelSizeMicrons)/10000.0;
std::vector<FVector> NewVertices,NewNormals;
std::vector<FVector2f> NewUVs;
std::vector<FColor> NewColors;
std::vector<int32> NewTriangles;
for(const FCandidate& Candidate:Candidates)
{
std::vector<int32> VertexMap(static_cast<std::size_t>(GridSide)*GridSide,INDEX_NONE);
const double CeilingZ=Candidate.FaceZ;
const auto AddVertex=[&](int32 X,int32 Y)
{
const std::size_t GridIndex=static_cast<std::size_t>(Y*GridSide+X);
int32& Mapped=VertexMap[GridIndex];
if(Mapped!=INDEX_NONE)return Mapped;
Mapped=static_cast<int32>(NewVertices.size());
const double WorldX=Origin.X+X*GridStep,WorldY=Origin.Y+Y*GridStep;
NewVertices.emplace_back(WorldX*VoxelSizeCm,WorldY*VoxelSizeCm,CeilingZ*VoxelSizeCm);
NewNormals.emplace_back(0.0,0.0,-1.0);
if(bHasUVs)NewUVs.emplace_back(static_cast<float>(WorldX),static_cast<float>(WorldY));
if(bHasColors)NewColors.push_back(Color);
return Mapped;
};
for(int32 Y=0;Y+1<GridSide;++Y)for(int32 X=0;X+1<GridSide;++X)
{
const std::size_t I00=static_cast<std::size_t>(Y*GridSide+X);
const std::size_t I10=I00+1,I01=I00+GridSide,I11=I01+1;
if(!Candidate.SolidAbove[I00]||!Candidate.SolidAbove[I10]
||!Candidate.SolidAbove[I01]||!Candidate.SolidAbove[I11])continue;
const double CellX0=Origin.X+X*GridStep,CellY0=Origin.Y+Y*GridStep;
const double CellX1=CellX0+GridStep,CellY1=CellY0+GridStep;
// Suppress a coincident plane only when it covers the full cell. A hit at just the
// center of a curved shell triangle is not enough to leave the rest of this cap cell open.
if(MeshIndex.HasDownwardCellCoverage(CellX0,CellY0,CellX1,CellY1,CeilingZ,0.001))continue;
const int32 A=AddVertex(X,Y),B=AddVertex(X+1,Y);
const int32 C=AddVertex(X+1,Y+1),D=AddVertex(X,Y+1);
NewTriangles.insert(NewTriangles.end(),{A,C,B,A,D,C});
}
}
if(NewTriangles.empty())return;
const int32 AddedVertices=static_cast<int32>(NewVertices.size());
auto InsertVertices=[&](auto& Existing,const auto& Added)
{
using TArrayType=std::remove_reference_t<decltype(Existing)>;
TArrayType Combined;Combined.Reserve(Existing.Num()+static_cast<int32>(Added.size()));
for(int32 I=0;I<OldSurfaceVertices;++I)Combined.Add(Existing[I]);
for(const auto& Value:Added)Combined.Add(Value);
for(int32 I=OldSurfaceVertices;I<Existing.Num();++I)Combined.Add(Existing[I]);
Existing=std::move(Combined);
};
InsertVertices(Mesh.Vertices,NewVertices);InsertVertices(Mesh.Normals,NewNormals);
if(bHasUVs)InsertVertices(Mesh.UVs,NewUVs);
if(bHasColors)InsertVertices(Mesh.Colors,NewColors);
for(int32& Index:Mesh.Triangles)if(Index>=OldSurfaceVertices)Index+=AddedVertices;
const int32 CeilingStart=std::max(0,Mesh.Triangles.Num()-Mesh.NumCeilingTriangles*3);
TArray<int32> CombinedTriangles;CombinedTriangles.Reserve(
Mesh.Triangles.Num()+static_cast<int32>(NewTriangles.size()));
for(int32 I=0;I<CeilingStart;++I)CombinedTriangles.Add(Mesh.Triangles[I]);
for(const int32 Index:NewTriangles)CombinedTriangles.Add(OldSurfaceVertices+Index);
for(int32 I=CeilingStart;I<Mesh.Triangles.Num();++I)CombinedTriangles.Add(Mesh.Triangles[I]);
const int32 OldTriangleCount=Mesh.Triangles.Num()/3;
TArray<uint8> ExistingFaceMasks=Mesh.TriangleSkirtFaceMasks;
ExistingFaceMasks.SetNum(OldTriangleCount);
TArray<uint8> CombinedFaceMasks;CombinedFaceMasks.Reserve(
OldTriangleCount+static_cast<int32>(NewTriangles.size()/3));
for(int32 Triangle=0;Triangle<CeilingStart/3;++Triangle)
CombinedFaceMasks.Add(ExistingFaceMasks[Triangle]);
for(std::size_t Triangle=0;Triangle<NewTriangles.size()/3;++Triangle)
CombinedFaceMasks.Add(0);
for(int32 Triangle=CeilingStart/3;Triangle<OldTriangleCount;++Triangle)
CombinedFaceMasks.Add(ExistingFaceMasks[Triangle]);
Mesh.Triangles=std::move(CombinedTriangles);
Mesh.TriangleSkirtFaceMasks=std::move(CombinedFaceMasks);
Mesh.NumSurfaceVertices=OldSurfaceVertices+AddedVertices;
Mesh.NumCeilingTriangles+=static_cast<int32>(NewTriangles.size()/3);
}
// Add the interior-facing top of each bedrock band. The density composition already
// makes this band solid and editable; this planar closure keeps its visible floor
// continuous when a coarse marching-cubes step would otherwise skip a sub-voxel band.
inline void AppendStratumBoundaryFloors(const FStandaloneOwnerWorld& World,
const FStandaloneShapeWorld& Shape,const FVoxelTileKey& Key,int32 Step,FVoxelMeshData& Mesh)
{
if(Key.Level<0||Step<=0||!World.Manager||!Shape.ResolvedLayout)return;
const FIntVector Origin=Key.OriginVoxels();
const int32 Extent=Key.ExtentVoxels();
if(Extent<=0||Extent%Step!=0)return;
const int32 GridSide=Extent/Step+1;
struct FCandidate { double FloorZ=0.0; double Thickness=0.0; };
std::vector<FCandidate> Candidates;
const double CoreMicrons=std::max<std::uint32_t>(1,World.CoreVoxelSizeMicrons);
for(const FStrateSlot& Slot:World.Manager->GetLayout())
{
const auto* Stratum=Shape.FindResolvedLayoutStratum(Slot.StrateIndex);
if(!Stratum||!Stratum->bedrock.presentInCurrentField
||Stratum->bedrock.topMicrometres<=Stratum->bedrock.bottomMicrometres)continue;
const double FloorZ=static_cast<double>(Stratum->bedrock.topMicrometres)/CoreMicrons;
if(FloorZ<Origin.Z-1.0e-6||FloorZ>Origin.Z+Extent+1.0e-6)continue;
Candidates.push_back({FloorZ,static_cast<double>(Stratum->bedrock.topMicrometres
-Stratum->bedrock.bottomMicrometres)/CoreMicrons});
}
if(Candidates.empty())return;
const int32 Cells=std::max(1,World.CoarseTileCells);
FFarMeshColumnIndex MeshIndex(Mesh,Origin,Extent,Cells,Step,
static_cast<double>(World.CoreVoxelSizeMicrons)/10000.0);
const int32 OldVertexCount=Mesh.Vertices.Num();
const int32 OldSurfaceVertices=std::clamp(Mesh.NumSurfaceVertices,0,OldVertexCount);
const bool bHasUVs=Mesh.UVs.Num()==OldVertexCount;
const bool bHasColors=Mesh.Colors.Num()==OldVertexCount;
const FColor Color=bHasColors&&OldVertexCount>0?Mesh.Colors[0]:FColor(160,160,160,255);
const double VoxelSizeCm=static_cast<double>(World.CoreVoxelSizeMicrons)/10000.0;
std::vector<FVector> NewVertices,NewNormals;
std::vector<FVector2f> NewUVs;
std::vector<FColor> NewColors;
std::vector<int32> NewTriangles;
for(const FCandidate& Candidate:Candidates)
{
const double Epsilon=std::min(0.5,Candidate.Thickness*0.25);
if(Epsilon<=0.0)continue;
std::vector<uint8> SolidBelow(static_cast<std::size_t>(GridSide)*GridSide,0);
for(int32 Y=0;Y<GridSide;++Y)for(int32 X=0;X<GridSide;++X)
{
const double WorldX=Origin.X+X*Step,WorldY=Origin.Y+Y*Step;
const float Density=Shape.DensityAt(static_cast<float>(WorldX),static_cast<float>(WorldY),
static_cast<float>(Candidate.FloorZ-Epsilon));
SolidBelow[static_cast<std::size_t>(Y*GridSide+X)]=
std::isfinite(Density)&&Density<0.0f?1:0;
}
std::vector<int32> VertexMap(static_cast<std::size_t>(GridSide)*GridSide,INDEX_NONE);
const auto AddVertex=[&](int32 X,int32 Y)
{
const std::size_t GridIndex=static_cast<std::size_t>(Y*GridSide+X);
int32& Mapped=VertexMap[GridIndex];
if(Mapped!=INDEX_NONE)return Mapped;
Mapped=static_cast<int32>(NewVertices.size());
const double WorldX=Origin.X+X*Step,WorldY=Origin.Y+Y*Step;
NewVertices.emplace_back(WorldX*VoxelSizeCm,WorldY*VoxelSizeCm,
Candidate.FloorZ*VoxelSizeCm);
NewNormals.emplace_back(0.0,0.0,1.0);
if(bHasUVs)NewUVs.emplace_back(static_cast<float>(WorldX),static_cast<float>(WorldY));
if(bHasColors)NewColors.push_back(Color);
return Mapped;
};
for(int32 Y=0;Y+1<GridSide;++Y)for(int32 X=0;X+1<GridSide;++X)
{
const std::size_t I00=static_cast<std::size_t>(Y*GridSide+X);
const std::size_t I10=I00+1,I01=I00+GridSide,I11=I01+1;
if(!SolidBelow[I00]||!SolidBelow[I10]||!SolidBelow[I01]||!SolidBelow[I11])continue;
const double X0=Origin.X+X*Step,Y0=Origin.Y+Y*Step;
const double X1=X0+Step,Y1=Y0+Step;
if(MeshIndex.HasUpwardCellCoverage(X0,Y0,X1,Y1,Candidate.FloorZ,0.001))continue;
const int32 A=AddVertex(X,Y),B=AddVertex(X+1,Y);
const int32 C=AddVertex(X+1,Y+1),D=AddVertex(X,Y+1);
NewTriangles.insert(NewTriangles.end(),{A,B,C,A,C,D});
}
}
if(NewTriangles.empty())return;
const int32 AddedVertices=static_cast<int32>(NewVertices.size());
auto InsertVertices=[&](auto& Existing,const auto& Added)
{
using TArrayType=std::remove_reference_t<decltype(Existing)>;
TArrayType Combined;Combined.Reserve(Existing.Num()+static_cast<int32>(Added.size()));
for(int32 I=0;I<OldSurfaceVertices;++I)Combined.Add(Existing[I]);
for(const auto& Value:Added)Combined.Add(Value);
for(int32 I=OldSurfaceVertices;I<Existing.Num();++I)Combined.Add(Existing[I]);
Existing=std::move(Combined);
};
InsertVertices(Mesh.Vertices,NewVertices);InsertVertices(Mesh.Normals,NewNormals);
if(bHasUVs)InsertVertices(Mesh.UVs,NewUVs);
if(bHasColors)InsertVertices(Mesh.Colors,NewColors);
for(int32& Index:Mesh.Triangles)if(Index>=OldSurfaceVertices)Index+=AddedVertices;
const int32 CeilingStart=std::max(0,Mesh.Triangles.Num()-Mesh.NumCeilingTriangles*3);
TArray<int32> CombinedTriangles;CombinedTriangles.Reserve(
Mesh.Triangles.Num()+static_cast<int32>(NewTriangles.size()));
for(int32 I=0;I<CeilingStart;++I)CombinedTriangles.Add(Mesh.Triangles[I]);
for(const int32 Index:NewTriangles)CombinedTriangles.Add(OldSurfaceVertices+Index);
for(int32 I=CeilingStart;I<Mesh.Triangles.Num();++I)CombinedTriangles.Add(Mesh.Triangles[I]);
const int32 OldTriangleCount=Mesh.Triangles.Num()/3;
TArray<uint8> ExistingFaceMasks=Mesh.TriangleSkirtFaceMasks;
ExistingFaceMasks.SetNum(OldTriangleCount);
TArray<uint8> CombinedFaceMasks;CombinedFaceMasks.Reserve(
OldTriangleCount+static_cast<int32>(NewTriangles.size()/3));
for(int32 Triangle=0;Triangle<CeilingStart/3;++Triangle)
CombinedFaceMasks.Add(ExistingFaceMasks[Triangle]);
for(std::size_t Triangle=0;Triangle<NewTriangles.size()/3;++Triangle)
CombinedFaceMasks.Add(0);
for(int32 Triangle=CeilingStart/3;Triangle<OldTriangleCount;++Triangle)
CombinedFaceMasks.Add(ExistingFaceMasks[Triangle]);
Mesh.Triangles=std::move(CombinedTriangles);
Mesh.TriangleSkirtFaceMasks=std::move(CombinedFaceMasks);
Mesh.NumSurfaceVertices=OldSurfaceVertices+AddedVertices;
}
+226 -46
View File
@@ -170,6 +170,8 @@ namespace floating_island_detail
HashWord(hash, static_cast<std::uint64_t>(recipe.layoutCenterTopZSubvoxels), 8); HashWord(hash, static_cast<std::uint64_t>(recipe.layoutCenterTopZSubvoxels), 8);
HashWord(hash, static_cast<std::uint64_t>(recipe.layoutMinimumZSubvoxels), 8); HashWord(hash, static_cast<std::uint64_t>(recipe.layoutMinimumZSubvoxels), 8);
HashWord(hash, static_cast<std::uint64_t>(recipe.layoutMaximumZSubvoxels), 8); HashWord(hash, static_cast<std::uint64_t>(recipe.layoutMaximumZSubvoxels), 8);
if(recipe.geometryVersion>=4)
HashWord(hash,static_cast<std::uint64_t>(recipe.layoutChunkWidthSubvoxels),8);
HashWord(hash, recipe.primaryIslandCount, 4); HashWord(hash, recipe.primaryIslandCount, 4);
HashWord(hash, static_cast<std::uint64_t>(recipe.islandDensityQ16), 8); HashWord(hash, static_cast<std::uint64_t>(recipe.islandDensityQ16), 8);
HashWord(hash, static_cast<std::uint64_t>(recipe.spacingSubvoxels), 8); HashWord(hash, static_cast<std::uint64_t>(recipe.spacingSubvoxels), 8);
@@ -186,6 +188,15 @@ namespace floating_island_detail
HashWord(hash, static_cast<std::uint64_t>(recipe.crustDepthBonusQ16), 8); HashWord(hash, static_cast<std::uint64_t>(recipe.crustDepthBonusQ16), 8);
HashWord(hash, static_cast<std::uint64_t>(recipe.rootDepthRatioQ16), 8); HashWord(hash, static_cast<std::uint64_t>(recipe.rootDepthRatioQ16), 8);
} }
if (recipe.geometryVersion >= 5)
{
HashWord(hash, recipe.anchorIslandOrdinal, 4);
HashWord(hash, static_cast<std::uint64_t>(recipe.anchorPlacementRadiusSubvoxels), 8);
HashWord(hash, static_cast<std::uint64_t>(recipe.anchorRootRadiusSubvoxels), 8);
HashWord(hash, static_cast<std::uint64_t>(recipe.anchorIslandMinimumRadiusSubvoxels), 8);
HashWord(hash, static_cast<std::uint64_t>(recipe.anchorRootBottomZSubvoxels), 8);
HashWord(hash, static_cast<std::uint64_t>(recipe.anchorMouthOffsetSubvoxels), 8);
}
HashWord(hash, static_cast<std::uint64_t>(recipe.blendRadiusSubvoxels), 8); HashWord(hash, static_cast<std::uint64_t>(recipe.blendRadiusSubvoxels), 8);
HashWord(hash, static_cast<std::uint64_t>(recipe.contourWarpSubvoxels), 8); HashWord(hash, static_cast<std::uint64_t>(recipe.contourWarpSubvoxels), 8);
HashWord(hash, static_cast<std::uint64_t>(recipe.roughnessSubvoxels), 8); HashWord(hash, static_cast<std::uint64_t>(recipe.roughnessSubvoxels), 8);
@@ -245,10 +256,10 @@ namespace floating_island_detail
inline bool ValidateRecipe(const FloatingIslandRecipeV1& recipe, std::string& error) inline bool ValidateRecipe(const FloatingIslandRecipeV1& recipe, std::string& error)
{ {
const std::array<std::int64_t, 25> values = { const std::array<std::int64_t, 32> values = {
recipe.layoutOriginXSubvoxels, recipe.layoutOriginYSubvoxels, recipe.layoutOriginXSubvoxels, recipe.layoutOriginYSubvoxels,
recipe.layoutCenterTopZSubvoxels, recipe.layoutMinimumZSubvoxels, recipe.layoutCenterTopZSubvoxels, recipe.layoutMinimumZSubvoxels,
recipe.layoutMaximumZSubvoxels, recipe.islandDensityQ16, recipe.layoutMaximumZSubvoxels, recipe.layoutChunkWidthSubvoxels, recipe.islandDensityQ16,
recipe.spacingSubvoxels, recipe.minimumRadiusSubvoxels, recipe.spacingSubvoxels, recipe.minimumRadiusSubvoxels,
recipe.maximumRadiusSubvoxels, recipe.thicknessRatioQ16, recipe.maximumRadiusSubvoxels, recipe.thicknessRatioQ16,
recipe.verticalJitterQ16, recipe.topFlattenQ16, recipe.verticalJitterQ16, recipe.topFlattenQ16,
@@ -257,6 +268,10 @@ namespace floating_island_detail
recipe.blendRadiusSubvoxels, recipe.contourWarpSubvoxels, recipe.blendRadiusSubvoxels, recipe.contourWarpSubvoxels,
recipe.roughnessSubvoxels, recipe.boundarySealSubvoxels, recipe.roughnessSubvoxels, recipe.boundarySealSubvoxels,
recipe.bridgeHalfWidthSubvoxels, recipe.bridgeThicknessSubvoxels, recipe.bridgeHalfWidthSubvoxels, recipe.bridgeThicknessSubvoxels,
static_cast<std::int64_t>(recipe.anchorIslandOrdinal),
recipe.anchorPlacementRadiusSubvoxels, recipe.anchorRootRadiusSubvoxels,
recipe.anchorIslandMinimumRadiusSubvoxels, recipe.anchorRootBottomZSubvoxels,
recipe.anchorMouthOffsetSubvoxels,
recipe.routeConstraints.capsuleRadiusSubvoxels, recipe.routeConstraints.capsuleRadiusSubvoxels,
recipe.routeConstraints.capsuleHeightSubvoxels, recipe.routeConstraints.capsuleHeightSubvoxels,
recipe.routeConstraints.maximumGradeQ16}; recipe.routeConstraints.maximumGradeQ16};
@@ -266,7 +281,7 @@ namespace floating_island_detail
? recipe.ownerVoxelSizeMicrons / ScaleGcd : 0; ? recipe.ownerVoxelSizeMicrons / ScaleGcd : 0;
const std::uint32_t ExpectedDenominator = ScaleGcd > 0 const std::uint32_t ExpectedDenominator = ScaleGcd > 0
? recipe.coreVoxelSizeMicrons / ScaleGcd : 0; ? recipe.coreVoxelSizeMicrons / ScaleGcd : 0;
if (recipe.schemaVersion != 1 || (recipe.geometryVersion != 1 && recipe.geometryVersion != 2) if (recipe.schemaVersion != 1 || recipe.geometryVersion < 1 || recipe.geometryVersion > 8
|| (recipe.geometryVersion == 1 || (recipe.geometryVersion == 1
&& (recipe.crustDepthBonusQ16 != 0 || recipe.rootDepthRatioQ16 != 0)) && (recipe.crustDepthBonusQ16 != 0 || recipe.rootDepthRatioQ16 != 0))
|| recipe.unitsPerVoxel != Q || recipe.unitsPerVoxel != Q
@@ -275,6 +290,11 @@ namespace floating_island_detail
|| recipe.ownerToCoreScaleNumerator != ExpectedNumerator || recipe.ownerToCoreScaleNumerator != ExpectedNumerator
|| recipe.ownerToCoreScaleDenominator != ExpectedDenominator || recipe.ownerToCoreScaleDenominator != ExpectedDenominator
|| recipe.primaryIslandCount < 3 || recipe.primaryIslandCount > 9 || recipe.primaryIslandCount < 3 || recipe.primaryIslandCount > 9
|| recipe.layoutChunkWidthSubvoxels <= 0
|| static_cast<long double>(recipe.layoutChunkWidthSubvoxels)*recipe.coreVoxelSizeMicrons
< 250000.0L*Q
|| static_cast<long double>(recipe.layoutChunkWidthSubvoxels)*recipe.coreVoxelSizeMicrons
> 64000000.0L*Q
|| recipe.layoutMaximumZSubvoxels <= recipe.layoutMinimumZSubvoxels || recipe.layoutMaximumZSubvoxels <= recipe.layoutMinimumZSubvoxels
|| recipe.layoutMaximumZSubvoxels - recipe.layoutMinimumZSubvoxels > 2048 * Q || recipe.layoutMaximumZSubvoxels - recipe.layoutMinimumZSubvoxels > 2048 * Q
|| std::any_of(values.begin(), values.end(), [](auto value) { return !ValidScalar(value); })) || std::any_of(values.begin(), values.end(), [](auto value) { return !ValidScalar(value); }))
@@ -316,6 +336,21 @@ namespace floating_island_detail
|| constraints.minimumClearanceSubvoxels < 0 || constraints.minimumClearanceSubvoxels < 0
|| constraints.minimumSupportProbes == 0 || constraints.minimumSupportProbes > 5) || constraints.minimumSupportProbes == 0 || constraints.minimumSupportProbes > 5)
{ error = "floating-island shape or route parameters are outside the supported range"; return false; } { error = "floating-island shape or route parameters are outside the supported range"; return false; }
if (recipe.geometryVersion >= 5
&& (recipe.anchorIslandOrdinal != recipe.primaryIslandCount - 1
|| recipe.anchorPlacementRadiusSubvoxels <= 0
|| recipe.anchorRootRadiusSubvoxels < recipe.anchorMouthOffsetSubvoxels
+ recipe.routeConstraints.capsuleRadiusSubvoxels + Q
|| recipe.anchorIslandMinimumRadiusSubvoxels
< recipe.anchorMouthOffsetSubvoxels
+ recipe.routeConstraints.capsuleRadiusSubvoxels + Q
|| recipe.anchorIslandMinimumRadiusSubvoxels > 64 * Q
|| recipe.anchorRootBottomZSubvoxels < recipe.layoutMinimumZSubvoxels
+ recipe.boundarySealSubvoxels
|| recipe.anchorRootBottomZSubvoxels >= recipe.layoutCenterTopZSubvoxels
|| recipe.anchorMouthOffsetSubvoxels <= 0
|| recipe.anchorMouthOffsetSubvoxels > 64 * Q))
{ error = "floating-island bedrock anchor is outside its passage or rock-thickness bounds"; return false; }
return true; return true;
} }
@@ -425,6 +460,9 @@ namespace floating_island_detail
struct FIslandColumnCacheEntry struct FIslandColumnCacheEntry
{ {
bool bValid=false; bool bValid=false;
const FloatingIslandRecipeV1* RecipeIdentity=nullptr;
const FloatingIslandPlanV1* PlanIdentity=nullptr;
std::uint64_t RecipeContentHash=0,PlanContentHash=0;
std::uint32_t Seed=0; std::uint32_t Seed=0;
std::uint64_t StableId=0; std::uint64_t StableId=0;
std::int64_t SampleX=0,SampleY=0,CenterX=0,CenterY=0,TopZ=0,Radius=0,TopHalf=0; std::int64_t SampleX=0,SampleY=0,CenterX=0,CenterY=0,TopZ=0,Radius=0,TopHalf=0;
@@ -432,9 +470,12 @@ namespace floating_island_detail
double DeltaX=0.0,DeltaY=0.0,Radial=0.0,Angle=0.0,LobePhase=0.0,TopSurface=0.0; double DeltaX=0.0,DeltaY=0.0,Radial=0.0,Angle=0.0,LobePhase=0.0,TopSurface=0.0;
}; };
using FSharedIslandColumnCache =
VoxelForgeCoreShared::TSharedColumnValueCache<FIslandColumnCacheEntry,16384,4>;
inline const FIslandColumnCacheEntry& IslandColumnCache( inline const FIslandColumnCacheEntry& IslandColumnCache(
const FloatingIslandRecipeV1& recipe,const FloatingIslandAnchorV1& island, const FloatingIslandRecipeV1& recipe,const FloatingIslandPlanV1& plan,
double x,double y) const FloatingIslandAnchorV1& island,double x,double y)
{ {
// Density samples arrive on integer Core lattice columns; reuse the exact column metrics // Density samples arrive on integer Core lattice columns; reuse the exact column metrics
// across Z samples without changing the field value or touching shared world state. // across Z samples without changing the field value or touching shared world state.
@@ -450,7 +491,10 @@ namespace floating_island_detail
std::uint64_t IndexKey=island.stableId std::uint64_t IndexKey=island.stableId
^(static_cast<std::uint64_t>(SampleX)*0x9e3779b97f4a7c15ull) ^(static_cast<std::uint64_t>(SampleX)*0x9e3779b97f4a7c15ull)
^(static_cast<std::uint64_t>(SampleY)*0xc2b2ae3d27d4eb4full) ^(static_cast<std::uint64_t>(SampleY)*0xc2b2ae3d27d4eb4full)
^(static_cast<std::uint64_t>(recipe.seed)<<23); ^(static_cast<std::uint64_t>(recipe.seed)<<23)
^recipe.contentHash^std::rotl(plan.contentHash,17)
^static_cast<std::uint64_t>(reinterpret_cast<std::uintptr_t>(&recipe))
^std::rotl(static_cast<std::uint64_t>(reinterpret_cast<std::uintptr_t>(&plan)),31);
IndexKey^=IndexKey>>33; IndexKey^=IndexKey>>33;
IndexKey*=0xff51afd7ed558ccdull; IndexKey*=0xff51afd7ed558ccdull;
IndexKey^=IndexKey>>33; IndexKey^=IndexKey>>33;
@@ -459,7 +503,9 @@ namespace floating_island_detail
for(std::size_t Way=0;Way<Ways;++Way) for(std::size_t Way=0;Way<Ways;++Way)
{ {
FIslandColumnCacheEntry& Entry=cache[Base+Way]; FIslandColumnCacheEntry& Entry=cache[Base+Way];
const bool bKeyMatches=Entry.bValid&&Entry.Seed==recipe.seed const bool bKeyMatches=Entry.bValid&&Entry.RecipeIdentity==&recipe
&&Entry.PlanIdentity==&plan&&Entry.RecipeContentHash==recipe.contentHash
&&Entry.PlanContentHash==plan.contentHash&&Entry.Seed==recipe.seed
&&Entry.StableId==island.stableId &&Entry.StableId==island.stableId
&&Entry.SampleX==SampleX&&Entry.SampleY==SampleY &&Entry.SampleX==SampleX&&Entry.SampleY==SampleY
&&Entry.CenterX==island.centerSubvoxels[0] &&Entry.CenterX==island.centerSubvoxels[0]
@@ -473,32 +519,53 @@ namespace floating_island_detail
if(!Entry.bValid)Replacement=&Entry; if(!Entry.bValid)Replacement=&Entry;
} }
FIslandColumnCacheEntry& Entry=*Replacement; const auto build=[&]()
Entry.bValid=true; {
Entry.Seed=recipe.seed; FIslandColumnCacheEntry Entry;
Entry.StableId=island.stableId; Entry.bValid=true;
Entry.SampleX=SampleX; Entry.RecipeIdentity=&recipe;
Entry.SampleY=SampleY; Entry.PlanIdentity=&plan;
Entry.CenterX=island.centerSubvoxels[0]; Entry.RecipeContentHash=recipe.contentHash;
Entry.CenterY=island.centerSubvoxels[1]; Entry.PlanContentHash=plan.contentHash;
Entry.TopZ=island.topZSubvoxels; Entry.Seed=recipe.seed;
Entry.Radius=island.radiusSubvoxels; Entry.StableId=island.stableId;
Entry.TopHalf=island.topHalfSubvoxels; Entry.SampleX=SampleX;
Entry.TopFlattenQ16=recipe.topFlattenQ16; Entry.SampleY=SampleY;
Entry.ContourWarp=recipe.contourWarpSubvoxels; Entry.CenterX=island.centerSubvoxels[0];
Entry.DeltaX=x-static_cast<double>(island.centerSubvoxels[0]); Entry.CenterY=island.centerSubvoxels[1];
Entry.DeltaY=y-static_cast<double>(island.centerSubvoxels[1]); Entry.TopZ=island.topZSubvoxels;
Entry.Radial=std::hypot(Entry.DeltaX,Entry.DeltaY); Entry.Radius=island.radiusSubvoxels;
Entry.Angle=std::atan2(Entry.DeltaY,Entry.DeltaX); Entry.TopHalf=island.topHalfSubvoxels;
Entry.LobePhase=LobePhase(recipe,island); Entry.TopFlattenQ16=recipe.topFlattenQ16;
const double EffectiveRadius=std::max(1.0,static_cast<double>(island.radiusSubvoxels) Entry.ContourWarp=recipe.contourWarpSubvoxels;
+LobeOffsetWithPhase(recipe,Entry.Angle,static_cast<double>(island.topZSubvoxels), Entry.DeltaX=x-static_cast<double>(island.centerSubvoxels[0]);
Entry.LobePhase)); Entry.DeltaY=y-static_cast<double>(island.centerSubvoxels[1]);
const double Edge=std::clamp(Entry.Radial/EffectiveRadius,0.0,1.0); Entry.Radial=std::hypot(Entry.DeltaX,Entry.DeltaY);
const double Drop=(1.0-Q16ToDouble(recipe.topFlattenQ16)) Entry.Angle=std::atan2(Entry.DeltaY,Entry.DeltaX);
*static_cast<double>(island.topHalfSubvoxels)*2.0*Edge*Edge; Entry.LobePhase=LobePhase(recipe,island);
Entry.TopSurface=static_cast<double>(island.topZSubvoxels)-Drop; const double EffectiveRadius=std::max(1.0,static_cast<double>(island.radiusSubvoxels)
return Entry; +LobeOffsetWithPhase(recipe,Entry.Angle,static_cast<double>(island.topZSubvoxels),
Entry.LobePhase));
const double Edge=std::clamp(Entry.Radial/EffectiveRadius,0.0,1.0);
const double Drop=(1.0-Q16ToDouble(recipe.topFlattenQ16))
*static_cast<double>(island.topHalfSubvoxels)*2.0*Edge*Edge;
Entry.TopSurface=static_cast<double>(island.topZSubvoxels)-Drop;
return Entry;
};
FIslandColumnCacheEntry Entry{};
if(auto* shared=FSharedIslandColumnCache::threadActive())
{
const VoxelForgeCoreShared::FColumnCacheKey key{
static_cast<std::uint64_t>(reinterpret_cast<std::uintptr_t>(&recipe)),
recipe.contentHash,
static_cast<std::uint64_t>(reinterpret_cast<std::uintptr_t>(&plan)),
plan.contentHash,SampleX,SampleY,island.stableId};
bool computed=false;
Entry=shared->getOrCompute(key,build,computed);
}
else Entry=build();
*Replacement=Entry;
return *Replacement;
} }
inline std::int64_t ScaledQ16(std::int64_t value, std::int64_t scaleQ16) inline std::int64_t ScaledQ16(std::int64_t value, std::int64_t scaleQ16)
@@ -641,6 +708,7 @@ namespace floating_island_detail
} }
inline double IslandDensity(const FloatingIslandRecipeV1& recipe, inline double IslandDensity(const FloatingIslandRecipeV1& recipe,
const FloatingIslandPlanV1& plan,
const FloatingIslandAnchorV1& island, const FloatingIslandAnchorV1& island,
double x, double y, double z) double x, double y, double z)
{ {
@@ -665,7 +733,7 @@ namespace floating_island_detail
std::max({z - top, radial - envelope, bottomZ - z}), x, y, z); std::max({z - top, radial - envelope, bottomZ - z}), x, y, z);
} }
const FIslandColumnCacheEntry& Column=IslandColumnCache(recipe,island,x,y); const FIslandColumnCacheEntry& Column=IslandColumnCache(recipe,plan,island,x,y);
const double dx=Column.DeltaX; const double dx=Column.DeltaX;
const double dy=Column.DeltaY; const double dy=Column.DeltaY;
const double radial=Column.Radial; const double radial=Column.Radial;
@@ -685,6 +753,28 @@ namespace floating_island_detail
const double rootBlend = std::clamp(radius * 0.12, 2.0 * Q, 5.0 * Q); const double rootBlend = std::clamp(radius * 0.12, 2.0 * Q, 5.0 * Q);
for (std::int32_t root = 0; root < rootCount; ++root) for (std::int32_t root = 0; root < rootCount; ++root)
sdf = SmoothMin(sdf, RootLobeDensity(recipe, island, root, x, y, z), rootBlend); sdf = SmoothMin(sdf, RootLobeDensity(recipe, island, root, x, y, z), rootBlend);
if (recipe.geometryVersion >= 5 && recipe.geometryVersion < 8
&& island.ordinal == recipe.anchorIslandOrdinal
&& recipe.anchorRootBottomZSubvoxels < island.bottomZSubvoxels)
{
// The central buttress must meet the island crust underside. IslandBottom
// also includes the four shorter root lobes and sits below that surface.
const double rootTop = static_cast<double>(IslandCrustBottom(recipe, island));
const double rootBottom = static_cast<double>(recipe.anchorRootBottomZSubvoxels);
const double depth = std::max(1.0, rootTop - rootBottom);
const double blend = std::clamp(static_cast<double>(recipe.anchorRootRadiusSubvoxels)
* 0.12, 3.0 * Q, 6.0 * Q);
// A slightly flared lower buttress joins the island's own root lobes to bedrock.
// Une base legerement evasee relie les racines de l'ile a la roche de fond.
const double t = std::clamp((rootTop - z) / depth, 0.0, 1.0);
const double rootRadius = static_cast<double>(recipe.anchorRootRadiusSubvoxels)
* (0.92 + 0.08 * SmoothStep(t));
double rootSdf = std::max({Column.Radial - rootRadius,
rootBottom - z, z - rootTop});
rootSdf = ApplySurfaceDetail(recipe, island.stableId ^ 0x414e43484f52524full,
rootSdf, x, y, z, 0.75);
sdf = SmoothMin(sdf, rootSdf, blend);
}
const double topDetailScale = topDistance >= std::max(sideDistance, undersideDistance) const double topDetailScale = topDistance >= std::max(sideDistance, undersideDistance)
|| z >= static_cast<double>(IslandCrustBottom(recipe, island)) + radius * 0.45 || z >= static_cast<double>(IslandCrustBottom(recipe, island)) + radius * 0.45
? 0.25 : 1.0; ? 0.25 : 1.0;
@@ -733,7 +823,7 @@ namespace floating_island_detail
double result = static_cast<double>(MaxDensity); double result = static_cast<double>(MaxDensity);
for (const auto& island : plan.islands) for (const auto& island : plan.islands)
{ {
double group = IslandDensity(recipe, island, double group = IslandDensity(recipe, plan, island,
static_cast<double>(x), static_cast<double>(y), static_cast<double>(z)); static_cast<double>(x), static_cast<double>(y), static_cast<double>(z));
for (const auto& edge : plan.clusterEdges) for (const auto& edge : plan.clusterEdges)
{ {
@@ -769,7 +859,7 @@ namespace floating_island_detail
const auto evaluateLocalGroup = [&](std::size_t islandIndex) const auto evaluateLocalGroup = [&](std::size_t islandIndex)
{ {
const auto& island = plan.islands[islandIndex]; const auto& island = plan.islands[islandIndex];
double group = IslandDensity(recipe, island, double group = IslandDensity(recipe, plan, island,
static_cast<double>(x), static_cast<double>(y), static_cast<double>(z)); static_cast<double>(x), static_cast<double>(y), static_cast<double>(z));
for (const std::uint32_t edgeIndex : featureIndices) for (const std::uint32_t edgeIndex : featureIndices)
{ {
@@ -795,7 +885,7 @@ namespace floating_island_detail
const auto evaluateDistantGroup = [&](std::size_t islandIndex) const auto evaluateDistantGroup = [&](std::size_t islandIndex)
{ {
const auto& island = plan.islands[islandIndex]; const auto& island = plan.islands[islandIndex];
double group = IslandDensity(recipe, island, double group = IslandDensity(recipe, plan, island,
static_cast<double>(x), static_cast<double>(y), static_cast<double>(z)); static_cast<double>(x), static_cast<double>(y), static_cast<double>(z));
for (const auto& edge : plan.clusterEdges) for (const auto& edge : plan.clusterEdges)
{ {
@@ -855,9 +945,15 @@ namespace floating_island_detail
FloatingIslandAnchorV1& island) FloatingIslandAnchorV1& island)
{ {
const std::int64_t pad = IslandBlendMargin(recipe) + recipe.roughnessSubvoxels; const std::int64_t pad = IslandBlendMargin(recipe) + recipe.roughnessSubvoxels;
const std::int64_t reach = island.radiusSubvoxels + recipe.contourWarpSubvoxels + pad; const bool isAnchorRoot=recipe.geometryVersion>=5&&recipe.geometryVersion<8
&&island.ordinal==recipe.anchorIslandOrdinal;
const std::int64_t reach = std::max(island.radiusSubvoxels,
isAnchorRoot?recipe.anchorRootRadiusSubvoxels:std::int64_t{0})
+ recipe.contourWarpSubvoxels + pad;
island.influenceMinimumSubvoxels = {island.centerSubvoxels[0] - reach, island.influenceMinimumSubvoxels = {island.centerSubvoxels[0] - reach,
island.centerSubvoxels[1] - reach, island.bottomZSubvoxels - pad}; island.centerSubvoxels[1] - reach,
(isAnchorRoot?std::min(island.bottomZSubvoxels,recipe.anchorRootBottomZSubvoxels)
:island.bottomZSubvoxels)-pad};
island.influenceMaximumSubvoxels = {island.centerSubvoxels[0] + reach, island.influenceMaximumSubvoxels = {island.centerSubvoxels[0] + reach,
island.centerSubvoxels[1] + reach, island.topZSubvoxels + pad}; island.centerSubvoxels[1] + reach, island.topZSubvoxels + pad};
} }
@@ -902,12 +998,19 @@ namespace floating_island_detail
std::unordered_set<std::uint64_t> islandIds; std::unordered_set<std::uint64_t> islandIds;
std::unordered_set<std::uint32_t> ordinals; std::unordered_set<std::uint32_t> ordinals;
const FloatingIslandAnchorV1* anchorIsland = nullptr;
for (const auto& island : plan.islands) for (const auto& island : plan.islands)
{ {
const bool isAnchor=recipe.geometryVersion>=5
&&island.ordinal==recipe.anchorIslandOrdinal;
if(isAnchor)anchorIsland=&island;
if (island.stableId == 0 || !islandIds.insert(island.stableId).second if (island.stableId == 0 || !islandIds.insert(island.stableId).second
|| !ordinals.insert(island.ordinal).second || !ordinals.insert(island.ordinal).second
|| island.radiusSubvoxels < recipe.minimumRadiusSubvoxels || island.radiusSubvoxels < (isAnchor?recipe.anchorIslandMinimumRadiusSubvoxels
|| island.radiusSubvoxels > recipe.maximumRadiusSubvoxels :recipe.minimumRadiusSubvoxels)
|| island.radiusSubvoxels > (isAnchor
?std::max(recipe.anchorIslandMinimumRadiusSubvoxels,recipe.maximumRadiusSubvoxels)
:recipe.maximumRadiusSubvoxels)
|| island.topHalfSubvoxels <= 0 || island.topZSubvoxels <= island.bottomZSubvoxels || island.topHalfSubvoxels <= 0 || island.topZSubvoxels <= island.bottomZSubvoxels
|| island.taperEndQ16 < recipe.taperEndMinimumQ16 || island.taperEndQ16 < recipe.taperEndMinimumQ16
|| island.taperEndQ16 > recipe.taperEndMaximumQ16 || island.taperEndQ16 > recipe.taperEndMaximumQ16
@@ -924,12 +1027,17 @@ namespace floating_island_detail
{ error = "floating-island anchor has invalid coordinates or an inverted bound"; return false; } { error = "floating-island anchor has invalid coordinates or an inverted bound"; return false; }
} }
const std::int64_t pad = IslandBlendMargin(recipe) + recipe.roughnessSubvoxels; const std::int64_t pad = IslandBlendMargin(recipe) + recipe.roughnessSubvoxels;
const std::int64_t reach = island.radiusSubvoxels + recipe.contourWarpSubvoxels + pad; const bool hasAnchorRoot=recipe.geometryVersion>=5&&recipe.geometryVersion<8&&isAnchor;
const std::int64_t reach = std::max(island.radiusSubvoxels,
hasAnchorRoot?recipe.anchorRootRadiusSubvoxels:std::int64_t{0})
+ recipe.contourWarpSubvoxels + pad;
if (island.influenceMinimumSubvoxels[0] > island.centerSubvoxels[0] - reach if (island.influenceMinimumSubvoxels[0] > island.centerSubvoxels[0] - reach
|| island.influenceMaximumSubvoxels[0] < island.centerSubvoxels[0] + reach || island.influenceMaximumSubvoxels[0] < island.centerSubvoxels[0] + reach
|| island.influenceMinimumSubvoxels[1] > island.centerSubvoxels[1] - reach || island.influenceMinimumSubvoxels[1] > island.centerSubvoxels[1] - reach
|| island.influenceMaximumSubvoxels[1] < island.centerSubvoxels[1] + reach || island.influenceMaximumSubvoxels[1] < island.centerSubvoxels[1] + reach
|| island.influenceMinimumSubvoxels[2] > island.bottomZSubvoxels - pad || island.influenceMinimumSubvoxels[2] > (hasAnchorRoot
?std::min(island.bottomZSubvoxels,recipe.anchorRootBottomZSubvoxels)
:island.bottomZSubvoxels) - pad
|| island.influenceMaximumSubvoxels[2] < island.topZSubvoxels + pad || island.influenceMaximumSubvoxels[2] < island.topZSubvoxels + pad
|| island.bottomZSubvoxels < recipe.layoutMinimumZSubvoxels + recipe.boundarySealSubvoxels || island.bottomZSubvoxels < recipe.layoutMinimumZSubvoxels + recipe.boundarySealSubvoxels
|| island.topZSubvoxels > recipe.layoutMaximumZSubvoxels - recipe.boundarySealSubvoxels) || island.topZSubvoxels > recipe.layoutMaximumZSubvoxels - recipe.boundarySealSubvoxels)
@@ -938,6 +1046,19 @@ namespace floating_island_detail
for (std::uint32_t ordinal = 0; ordinal < recipe.primaryIslandCount; ++ordinal) for (std::uint32_t ordinal = 0; ordinal < recipe.primaryIslandCount; ++ordinal)
if (!ordinals.contains(ordinal)) if (!ordinals.contains(ordinal))
{ error = "floating-island route chain is missing a primary seeded anchor"; return false; } { error = "floating-island route chain is missing a primary seeded anchor"; return false; }
if(recipe.geometryVersion>=5)
{
if(!anchorIsland)
{error="floating-island plan is missing its unique passage anchor island";return false;}
const double anchorDistance=std::hypot(
static_cast<double>(anchorIsland->centerSubvoxels[0]),
static_cast<double>(anchorIsland->centerSubvoxels[1]));
if(anchorDistance>recipe.anchorPlacementRadiusSubvoxels
||recipe.anchorRootBottomZSubvoxels>=anchorIsland->bottomZSubvoxels
||recipe.anchorMouthOffsetSubvoxels+recipe.routeConstraints.capsuleRadiusSubvoxels
>=anchorIsland->radiusSubvoxels)
{error="floating-island anchor island or its mouth leaves the passage radius or rock envelope";return false;}
}
std::unordered_set<std::uint64_t> edgeIds; std::unordered_set<std::uint64_t> edgeIds;
std::unordered_map<std::uint64_t, std::vector<std::uint64_t>> adjacency; std::unordered_map<std::uint64_t, std::vector<std::uint64_t>> adjacency;
@@ -1163,7 +1284,8 @@ namespace floating_island_detail
} }
std::optional<FloatingIslandManifestV1> FloatingIslandManifestV1::FromJson( std::optional<FloatingIslandManifestV1> FloatingIslandManifestV1::FromJson(
std::string_view json, std::string& error) std::string_view json, std::string& error,
std::int64_t resolvedLayoutChunkWidthSubvoxels)
{ {
VFJson::Value root; VFJson::Value root;
if (!VFJson::Parser(std::string(json)).Parse(root, error)) return std::nullopt; if (!VFJson::Parser(std::string(json)).Parse(root, error)) return std::nullopt;
@@ -1189,6 +1311,31 @@ std::optional<FloatingIslandManifestV1> FloatingIslandManifestV1::FromJson(
manifest.recipe.crustDepthBonusQ16 = 0; manifest.recipe.crustDepthBonusQ16 = 0;
manifest.recipe.rootDepthRatioQ16 = 0; manifest.recipe.rootDepthRatioQ16 = 0;
} }
if(manifest.recipe.geometryVersion>=4)
{
if(!floating_island_detail::ReadInteger(recipeValue.Get("layout_chunk_width_q"),
manifest.recipe.layoutChunkWidthSubvoxels))
{error="floating-island recipe is missing its resolved layout chunk width";return std::nullopt;}
if(resolvedLayoutChunkWidthSubvoxels>0
&& manifest.recipe.layoutChunkWidthSubvoxels!=resolvedLayoutChunkWidthSubvoxels)
{error="floating-island recipe layout width disagrees with the resolved world layout";return std::nullopt;}
}
if(manifest.recipe.geometryVersion>=5)
{
if(!floating_island_detail::ReadU32(recipeValue.Get("anchor_island_ordinal"),
manifest.recipe.anchorIslandOrdinal)
||!floating_island_detail::ReadInteger(recipeValue.Get("anchor_placement_radius_q"),
manifest.recipe.anchorPlacementRadiusSubvoxels)
||!floating_island_detail::ReadInteger(recipeValue.Get("anchor_root_radius_q"),
manifest.recipe.anchorRootRadiusSubvoxels)
||!floating_island_detail::ReadInteger(recipeValue.Get("anchor_island_minimum_radius_q"),
manifest.recipe.anchorIslandMinimumRadiusSubvoxels)
||!floating_island_detail::ReadInteger(recipeValue.Get("anchor_root_bottom_z_q"),
manifest.recipe.anchorRootBottomZSubvoxels)
||!floating_island_detail::ReadInteger(recipeValue.Get("anchor_mouth_offset_q"),
manifest.recipe.anchorMouthOffsetSubvoxels))
{error="floating-island geometry version 7 is missing a passage-rooted anchor field";return std::nullopt;}
}
if (!floating_island_detail::ReadU32(root.Get("schema_version"), schema) if (!floating_island_detail::ReadU32(root.Get("schema_version"), schema)
|| !floating_island_detail::ReadHash(root.Get("content_hash"), manifestHash) || !floating_island_detail::ReadHash(root.Get("content_hash"), manifestHash)
|| !floating_island_detail::ReadU32(recipeValue.Get("schema_version"), manifest.recipe.schemaVersion) || !floating_island_detail::ReadU32(recipeValue.Get("schema_version"), manifest.recipe.schemaVersion)
@@ -1224,6 +1371,10 @@ std::optional<FloatingIslandManifestV1> FloatingIslandManifestV1::FromJson(
|| !floating_island_detail::ReadHash(planValue.Get("content_hash"), planHash) || !floating_island_detail::ReadHash(planValue.Get("content_hash"), planHash)
|| schema != 1) || schema != 1)
{ error = "floating-island manifest is missing a required versioned recipe or plan field"; return std::nullopt; } { error = "floating-island manifest is missing a required versioned recipe or plan field"; return std::nullopt; }
if(manifest.recipe.geometryVersion<4 && resolvedLayoutChunkWidthSubvoxels>0)
manifest.recipe.layoutChunkWidthSubvoxels=resolvedLayoutChunkWidthSubvoxels;
else if(manifest.recipe.geometryVersion<4)
{ error="legacy floating-island manifest requires the world's resolved layout chunk width"; return std::nullopt; }
manifest.recipe.contentHash = recipeHash; manifest.recipe.contentHash = recipeHash;
manifest.contentHash = manifestHash; manifest.contentHash = manifestHash;
manifest.plan.contentHash = planHash; manifest.plan.contentHash = planHash;
@@ -1335,6 +1486,15 @@ std::string FloatingIslandManifestV1::ToJson() const
out << ",\"geometry_version\":" << recipe.geometryVersion out << ",\"geometry_version\":" << recipe.geometryVersion
<< ",\"crust_depth_bonus_q16\":" << recipe.crustDepthBonusQ16 << ",\"crust_depth_bonus_q16\":" << recipe.crustDepthBonusQ16
<< ",\"root_depth_ratio_q16\":" << recipe.rootDepthRatioQ16; << ",\"root_depth_ratio_q16\":" << recipe.rootDepthRatioQ16;
if(recipe.geometryVersion>=4)
out << ",\"layout_chunk_width_q\":" << recipe.layoutChunkWidthSubvoxels;
if(recipe.geometryVersion>=5)
out << ",\"anchor_island_ordinal\":" << recipe.anchorIslandOrdinal
<< ",\"anchor_placement_radius_q\":" << recipe.anchorPlacementRadiusSubvoxels
<< ",\"anchor_root_radius_q\":" << recipe.anchorRootRadiusSubvoxels
<< ",\"anchor_island_minimum_radius_q\":" << recipe.anchorIslandMinimumRadiusSubvoxels
<< ",\"anchor_root_bottom_z_q\":" << recipe.anchorRootBottomZSubvoxels
<< ",\"anchor_mouth_offset_q\":" << recipe.anchorMouthOffsetSubvoxels;
out << ",\"blend_radius_q\":" << recipe.blendRadiusSubvoxels out << ",\"blend_radius_q\":" << recipe.blendRadiusSubvoxels
<< ",\"contour_warp_q\":" << recipe.contourWarpSubvoxels << ",\"contour_warp_q\":" << recipe.contourWarpSubvoxels
<< ",\"roughness_q\":" << recipe.roughnessSubvoxels << ",\"roughness_q\":" << recipe.roughnessSubvoxels
@@ -1496,6 +1656,9 @@ std::optional<FloatingIslandManifestV1> PlanFloatingIslandCluster(
auto island = floating_island_detail::MakeIsland(recipe, i, auto island = floating_island_detail::MakeIsland(recipe, i,
primaryXY[i][0], primaryXY[i][1], tops[i], site); primaryXY[i][0], primaryXY[i][1], tops[i], site);
island.radiusSubvoxels = radii[i]; island.radiusSubvoxels = radii[i];
if(recipe.geometryVersion>=5&&i==recipe.anchorIslandOrdinal)
island.radiusSubvoxels=std::max(island.radiusSubvoxels,
recipe.anchorIslandMinimumRadiusSubvoxels);
island.topHalfSubvoxels = std::max<std::int64_t>(1, island.radiusSubvoxels / 5); island.topHalfSubvoxels = std::max<std::int64_t>(1, island.radiusSubvoxels / 5);
island.centerSubvoxels[2] = island.topZSubvoxels - island.topHalfSubvoxels; island.centerSubvoxels[2] = island.topZSubvoxels - island.topHalfSubvoxels;
island.bottomZSubvoxels = floating_island_detail::IslandBottom(recipe, island.bottomZSubvoxels = floating_island_detail::IslandBottom(recipe,
@@ -1582,14 +1745,31 @@ std::optional<FloatingIslandManifestV1> PlanFloatingIslandCluster(
static_cast<double>(a.centerSubvoxels[0]) + dx * t); static_cast<double>(a.centerSubvoxels[0]) + dx * t);
const std::int64_t y = floating_island_detail::RoundQ( const std::int64_t y = floating_island_detail::RoundQ(
static_cast<double>(a.centerSubvoxels[1]) + dy * t); static_cast<double>(a.centerSubvoxels[1]) + dy * t);
std::int64_t routeX=x,routeY=y;
if(recipe.geometryVersion>=5&&segment+2==count&&piece==pieces)
{
const auto& anchor=islands[recipe.anchorIslandOrdinal];
const std::uint32_t side=static_cast<std::uint32_t>(
floating_island_detail::UnitQ16(recipe.seed,anchor.stableId,
0x414e43484f524d50ull)&1u);
const double routeAngle=std::atan2(dy,dx);
const double angle=routeAngle+(side?1.0:-1.0)
*floating_island_detail::Pi/2.0;
const double mouthX=static_cast<double>(anchor.centerSubvoxels[0])
+static_cast<double>(recipe.anchorMouthOffsetSubvoxels)*std::cos(angle);
const double mouthY=static_cast<double>(anchor.centerSubvoxels[1])
+static_cast<double>(recipe.anchorMouthOffsetSubvoxels)*std::sin(angle);
routeX=floating_island_detail::RoundQ(mouthX);
routeY=floating_island_detail::RoundQ(mouthY);
}
const auto surface = floating_island_detail::FindCapsuleFootingTopZ( const auto surface = floating_island_detail::FindCapsuleFootingTopZ(
recipe, manifest.plan, x, y); recipe, manifest.plan, routeX, routeY);
if (!surface) if (!surface)
{ error = "island planner could not find a full capsule-width support surface along its connector chain"; return std::nullopt; } { error = "island planner could not find a full capsule-width support surface along its connector chain"; return std::nullopt; }
WorldAssemblyRoutePointV1 point; WorldAssemblyRoutePointV1 point;
point.stableFeatureId = floating_island_detail::StableId(recipe.seed, point.stableFeatureId = floating_island_detail::StableId(recipe.seed,
0x500000000ull + routeOrdinal, 0x524f555445ull); 0x500000000ull + routeOrdinal, 0x524f555445ull);
point.positionSubvoxels = {x, y, *surface + capsuleHalf point.positionSubvoxels = {routeX, routeY, *surface + capsuleHalf
+ recipe.routeConstraints.minimumClearanceSubvoxels + recipe.routeConstraints.minimumClearanceSubvoxels
+ (recipe.geometryVersion >= 2 ? floating_island_detail::Q / 8 : 0)}; + (recipe.geometryVersion >= 2 ? floating_island_detail::Q / 8 : 0)};
point.radiusSubvoxels = routeRadius; point.radiusSubvoxels = routeRadius;
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+618 -50
View File
@@ -2,6 +2,7 @@
#include "StandaloneSnapshotAdapter.h" #include "StandaloneSnapshotAdapter.h"
#include "VoxelForgeCore/VoxelForgeCore.h" #include "VoxelForgeCore/VoxelForgeCore.h"
#include "WorldAssemblerInternal.h" #include "WorldAssemblerInternal.h"
#include "ResolvedLayoutInternal.h"
#include "FloatingIslandsInternal.h" #include "FloatingIslandsInternal.h"
#include <shared_mutex> #include <shared_mutex>
@@ -13,6 +14,8 @@
#include <set> #include <set>
#include <functional> #include <functional>
#include <thread> #include <thread>
#include <new>
#include <stdexcept>
namespace vfcore::detail namespace vfcore::detail
{ {
@@ -31,6 +34,7 @@ namespace VoxelForgeCore
{ {
std::shared_ptr<FStandaloneOwnerWorld> owner; std::shared_ptr<FStandaloneOwnerWorld> owner;
std::shared_ptr<const WorldAssemblyManifest> worldAssembly; std::shared_ptr<const WorldAssemblyManifest> worldAssembly;
std::shared_ptr<const ResolvedLayoutSnapshotV3> resolvedLayout;
WorldConfiguration configuration; WorldConfiguration configuration;
}; };
@@ -387,8 +391,8 @@ namespace VoxelForgeCore
{ {
const VoxelForgeCore::Heightfield2D Block(Manifest.recipe,Plan); const VoxelForgeCore::Heightfield2D Block(Manifest.recipe,Plan);
if(!Block.isValid())continue; if(!Block.isValid())continue;
const int64 StratumMinZ=static_cast<int64>(Plan.bottomChunkZ)*CHUNK_SIZE*Scale; const int64 StratumMinZ=static_cast<int64>(Plan.bottomChunkZ)*Manifest.recipe.layoutChunkWidthSubvoxels*Scale;
const int64 StratumMaxZ=(static_cast<int64>(Plan.topChunkZ)+1)*CHUNK_SIZE*Scale; const int64 StratumMaxZ=(static_cast<int64>(Plan.topChunkZ)+1)*Manifest.recipe.layoutChunkWidthSubvoxels*Scale;
if(TileMaxZ<StratumMinZ||TileMinZ>StratumMaxZ)continue; if(TileMaxZ<StratumMinZ||TileMinZ>StratumMaxZ)continue;
struct FGridSample struct FGridSample
{ {
@@ -436,8 +440,10 @@ namespace VoxelForgeCore
FGroundProfile Profile; FGroundProfile Profile;
Profile.GridStep=GridStepVoxels;Profile.Coordinates=GridCoordinates; Profile.GridStep=GridStepVoxels;Profile.Coordinates=GridCoordinates;
Profile.MinimumZ=static_cast<double>(std::min(Plan.bottomChunkZ,Plan.topChunkZ))*CHUNK_SIZE; Profile.MinimumZ=static_cast<double>(std::min(Plan.bottomChunkZ,Plan.topChunkZ))
Profile.MaximumZ=static_cast<double>(std::max(Plan.bottomChunkZ,Plan.topChunkZ)+1)*CHUNK_SIZE; *Manifest.recipe.layoutChunkWidthSubvoxels/Scale;
Profile.MaximumZ=static_cast<double>(std::max(Plan.bottomChunkZ,Plan.topChunkZ)+1)
*Manifest.recipe.layoutChunkWidthSubvoxels/Scale;
Profile.Ground.reserve(Grid.size());Profile.Cap.reserve(Grid.size()); Profile.Ground.reserve(Grid.size());Profile.Cap.reserve(Grid.size());
for(const auto& Sample:Grid) for(const auto& Sample:Grid)
{Profile.Ground.push_back(Sample.Ground/Scale);Profile.Cap.push_back(Sample.Cap/Scale);} {Profile.Ground.push_back(Sample.Ground/Scale);Profile.Cap.push_back(Sample.Cap/Scale);}
@@ -862,13 +868,15 @@ namespace VoxelForgeCore
struct detail_StandaloneSnapshotAdapter struct detail_StandaloneSnapshotAdapter
{ {
static ResolvedWorldSnapshot FromOwner(std::shared_ptr<FStandaloneOwnerWorld> owner, static ResolvedWorldSnapshot FromOwner(std::shared_ptr<FStandaloneOwnerWorld> owner,
std::shared_ptr<const WorldAssemblyManifest> worldAssembly = {}) std::shared_ptr<const WorldAssemblyManifest> worldAssembly = {},
std::shared_ptr<const ResolvedLayoutSnapshotV3> resolvedLayout = {})
{ {
if(!owner||!owner->Settings||!owner->Manager||!owner->Generator)return {}; if(!owner||!owner->Settings||!owner->Manager||!owner->Generator)return {};
auto data=std::make_shared<ResolvedWorldSnapshot::Data>(); auto data=std::make_shared<ResolvedWorldSnapshot::Data>();
data->configuration=MakeConfiguration(*owner); data->configuration=MakeConfiguration(*owner);
data->owner=std::move(owner); data->owner=std::move(owner);
data->worldAssembly=std::move(worldAssembly); data->worldAssembly=std::move(worldAssembly);
data->resolvedLayout=std::move(resolvedLayout);
return ResolvedWorldSnapshot(std::move(data)); return ResolvedWorldSnapshot(std::move(data));
} }
}; };
@@ -886,6 +894,16 @@ namespace VoxelForgeCore
if(!parsed)return {}; if(!parsed)return {};
worldAssembly=std::make_shared<WorldAssemblyManifest>(std::move(*parsed)); worldAssembly=std::make_shared<WorldAssemblyManifest>(std::move(*parsed));
} }
std::shared_ptr<const ResolvedLayoutSnapshotV3> resolvedLayout;
if(jsonRoot.Get("resolved_layout_json").IsString())
{
auto parsed=ResolvedLayoutSnapshotV3::FromJson(jsonRoot.Get("resolved_layout_json").String(),error);
if(!parsed)return {};
std::vector<ResolvedLayoutIssueV2> issues;std::string strictError;
if(!parsed->validate(ResolvedLayoutValidationModeV3::strict,issues,strictError))
{error="strict resolved-layout validation failed: "+strictError;return {};}
resolvedLayout=std::make_shared<ResolvedLayoutSnapshotV3>(std::move(*parsed));
}
const bool seedChanged=owner->Seed!=seed; const bool seedChanged=owner->Seed!=seed;
owner->Settings->Seed=seed; owner->Settings->Seed=seed;
@@ -908,7 +926,7 @@ namespace VoxelForgeCore
owner->MaxClipLevel=maxLodOverride; owner->MaxClipLevel=maxLodOverride;
owner->Settings->MaxClipLevel=maxLodOverride; owner->Settings->MaxClipLevel=maxLodOverride;
} }
return detail_StandaloneSnapshotAdapter::FromOwner(std::move(owner),std::move(worldAssembly)); return detail_StandaloneSnapshotAdapter::FromOwner(std::move(owner),std::move(worldAssembly),std::move(resolvedLayout));
} }
std::optional<ResolvedWorldSnapshot> ResolvedWorldSnapshot::FromJson( std::optional<ResolvedWorldSnapshot> ResolvedWorldSnapshot::FromJson(
@@ -925,11 +943,35 @@ namespace VoxelForgeCore
if(!parsed)return std::nullopt; if(!parsed)return std::nullopt;
worldAssembly=std::make_shared<WorldAssemblyManifest>(std::move(*parsed)); worldAssembly=std::make_shared<WorldAssemblyManifest>(std::move(*parsed));
} }
return detail_StandaloneSnapshotAdapter::FromOwner(std::move(owner),std::move(worldAssembly)); std::shared_ptr<const ResolvedLayoutSnapshotV3> resolvedLayout;
if(root.Get("resolved_layout_json").IsString())
{
auto parsed=ResolvedLayoutSnapshotV3::FromJson(root.Get("resolved_layout_json").String(),error);
if(!parsed)return std::nullopt;
std::vector<ResolvedLayoutIssueV2> issues;std::string strictError;
if(!parsed->validate(ResolvedLayoutValidationModeV3::strict,issues,strictError))
{error="strict resolved-layout validation failed: "+strictError;return std::nullopt;}
resolvedLayout=std::make_shared<ResolvedLayoutSnapshotV3>(std::move(*parsed));
}
return detail_StandaloneSnapshotAdapter::FromOwner(std::move(owner),std::move(worldAssembly),std::move(resolvedLayout));
} }
const WorldAssemblyManifest* ResolvedWorldSnapshot::worldAssembly() const noexcept const WorldAssemblyManifest* ResolvedWorldSnapshot::worldAssembly() const noexcept
{ return data_?data_->worldAssembly.get():nullptr; } { return data_?data_->worldAssembly.get():nullptr; }
const ResolvedLayoutSnapshotV3* ResolvedWorldSnapshot::resolvedLayout() const noexcept
{ return data_?data_->resolvedLayout.get():nullptr; }
ResolvedWorldSnapshot ResolvedWorldSnapshot::withoutResolvedLayoutPassages() const
{
if(!data_||!data_->resolvedLayout)return {};
auto copy=std::make_shared<Data>(*data_);
auto layout=std::make_shared<ResolvedLayoutSnapshotV3>(*data_->resolvedLayout);
layout->passages.clear();
std::string error;
if(!layout->finalize(error))return {};
copy->resolvedLayout=std::move(layout);
return ResolvedWorldSnapshot(std::move(copy));
}
const WorldConfiguration& ResolvedWorldSnapshot::configuration() const const WorldConfiguration& ResolvedWorldSnapshot::configuration() const
{ {
@@ -941,8 +983,14 @@ namespace VoxelForgeCore
{ {
std::shared_ptr<FStandaloneOwnerWorld> owner; std::shared_ptr<FStandaloneOwnerWorld> owner;
std::shared_ptr<const WorldAssemblyManifest> worldAssembly; std::shared_ptr<const WorldAssemblyManifest> worldAssembly;
std::shared_ptr<const ResolvedLayoutSnapshotV3> resolvedLayout;
WorldConfiguration configuration; WorldConfiguration configuration;
std::unique_ptr<FStandaloneShapeWorld> shape; std::unique_ptr<FStandaloneShapeWorld> shape;
std::atomic<bool> shapeReady{false};
std::unique_ptr<world_assembly_detail::FSharedHeightfieldColumnCache>
sharedHeightfieldColumns;
std::unique_ptr<floating_island_detail::FSharedIslandColumnCache>
sharedIslandColumns;
ShapeBuildRequest buildRequest; ShapeBuildRequest buildRequest;
mutable std::shared_mutex tileRegionMutex; mutable std::shared_mutex tileRegionMutex;
std::unordered_map<TileKey,std::shared_ptr<FStandaloneShapeWorld>,TileKeyHash> tileRegions; std::unordered_map<TileKey,std::shared_ptr<FStandaloneShapeWorld>,TileKeyHash> tileRegions;
@@ -953,22 +1001,214 @@ namespace VoxelForgeCore
std::uint64_t lastSequence=0; std::uint64_t lastSequence=0;
}; };
struct FScopedSharedColumnCaches
{
using FHeightfieldCache=world_assembly_detail::FSharedHeightfieldColumnCache;
using FIslandCache=floating_island_detail::FSharedIslandColumnCache;
FHeightfieldCache* PreviousHeightfield=nullptr;
FIslandCache* PreviousIslands=nullptr;
FScopedSharedColumnCaches(FHeightfieldCache* Heightfield,FIslandCache* Islands)
: PreviousHeightfield(FHeightfieldCache::setThreadActive(Heightfield)),
PreviousIslands(FIslandCache::setThreadActive(Islands)) {}
~FScopedSharedColumnCaches()
{
FHeightfieldCache::setThreadActive(PreviousHeightfield);
FIslandCache::setThreadActive(PreviousIslands);
}
};
World::World(ResolvedWorldSnapshot snapshot):impl_(std::make_unique<Impl>()) World::World(ResolvedWorldSnapshot snapshot):impl_(std::make_unique<Impl>())
{ {
if(snapshot.data_) if(snapshot.data_)
{ {
impl_->owner=snapshot.data_->owner; impl_->owner=snapshot.data_->owner;
impl_->worldAssembly=snapshot.data_->worldAssembly; impl_->worldAssembly=snapshot.data_->worldAssembly;
impl_->resolvedLayout=snapshot.data_->resolvedLayout;
impl_->configuration=snapshot.data_->configuration; impl_->configuration=snapshot.data_->configuration;
if(impl_->worldAssembly)
{
if(!impl_->worldAssembly->plan.strates.empty())
impl_->sharedHeightfieldColumns=
std::make_unique<world_assembly_detail::FSharedHeightfieldColumnCache>();
if(!impl_->worldAssembly->floatingIslands.empty())
impl_->sharedIslandColumns=
std::make_unique<floating_island_detail::FSharedIslandColumnCache>();
}
} }
} }
World::~World()=default; World::~World()=default;
World::World(World&&) noexcept=default; World::World(World&&) noexcept=default;
World& World::operator=(World&&) noexcept=default; World& World::operator=(World&&) noexcept=default;
namespace
{
template<class TImpl>
bool NativeOnlyBoundsForTile(const TImpl& impl,const TileKey& key,
FIntVector& minimum,FIntVector& maximum)
{
if(!impl.owner||key.lod!=0||key.lod>=impl.configuration.fullResolutionLodCount)
return false;
constexpr std::int64_t TileExtent=CHUNK_SIZE;
const std::int64_t skirt=impl.owner->CoreVoxelSizeMicrons>0
?static_cast<std::int64_t>(std::ceil(std::abs(
static_cast<double>(impl.owner->SkirtCells)
*static_cast<double>(impl.owner->OwnerVoxelSizeMicrons)
/static_cast<double>(impl.owner->CoreVoxelSizeMicrons)))):0;
const std::int64_t pad=std::max<std::int64_t>(8,skirt+4);
const std::int64_t coordinates[3]={key.coordinate.x,key.coordinate.y,key.coordinate.z};
std::int64_t low[3]{},high[3]{};
for(int axis=0;axis<3;++axis)
{
const std::int64_t origin=coordinates[axis]*TileExtent;
low[axis]=origin-pad;
high[axis]=origin+TileExtent+pad;
if(low[axis]<std::numeric_limits<std::int32_t>::min()+4ll
||high[axis]>std::numeric_limits<std::int32_t>::max()-4ll)return false;
}
minimum=FIntVector(static_cast<int32>(low[0]),static_cast<int32>(low[1]),
static_cast<int32>(low[2]));
maximum=FIntVector(static_cast<int32>(high[0]),static_cast<int32>(high[1]),
static_cast<int32>(high[2]));
return true;
}
bool IntersectsBox(const std::array<std::int64_t,3>& minimum,
const std::array<std::int64_t,3>& maximum,
const std::int64_t tileMinimum[3],const std::int64_t tileMaximum[3])
{
for(int axis=0;axis<3;++axis)
if(maximum[axis]<tileMinimum[axis]||minimum[axis]>tileMaximum[axis])
return false;
return true;
}
bool RouteTouchesBox(const WorldAssemblyStratumPlanV1& plan,
const std::int64_t tileMinimum[3],const std::int64_t tileMaximum[3])
{
if(plan.route.empty())return false;
const std::int64_t constraintRadius=std::max<std::int64_t>(0,
plan.routeConstraints.capsuleRadiusSubvoxels)
+std::max<std::int64_t>(0,plan.routeConstraints.capsuleHeightSubvoxels)/2;
for(std::size_t index=0;index<plan.route.size();++index)
{
const auto& point=plan.route[index];
const std::int64_t radius=std::max(constraintRadius,
std::max<std::int64_t>(0,point.radiusSubvoxels));
std::array<std::int64_t,3> low{},high{};
for(int axis=0;axis<3;++axis)
{
low[axis]=point.positionSubvoxels[axis]-radius;
high[axis]=point.positionSubvoxels[axis]+radius;
}
if(IntersectsBox(low,high,tileMinimum,tileMaximum))return true;
if(index+1>=plan.route.size())continue;
const auto& next=plan.route[index+1];
const std::int64_t segmentRadius=std::max(radius,
std::max(constraintRadius,std::max<std::int64_t>(0,next.radiusSubvoxels)));
for(int axis=0;axis<3;++axis)
{
low[axis]=std::min(point.positionSubvoxels[axis],next.positionSubvoxels[axis])
-segmentRadius;
high[axis]=std::max(point.positionSubvoxels[axis],next.positionSubvoxels[axis])
+segmentRadius;
}
if(IntersectsBox(low,high,tileMinimum,tileMaximum))return true;
}
return false;
}
bool OwnerPassageTouchesBox(const FStandaloneOwnerWorld& owner,
const FIntVector& minimum,const FIntVector& maximum)
{
const double ownerToCore=owner.OwnerVoxelSizeMicrons>0
&&owner.CoreVoxelSizeMicrons>0
?static_cast<double>(owner.OwnerVoxelSizeMicrons)
/static_cast<double>(owner.CoreVoxelSizeMicrons):1.0;
const double padding=(std::max(8.0,static_cast<double>(owner.SkirtCells)+4.0)
/ownerToCore)+64.0;
const double tileMinimum[3]={static_cast<double>(minimum.X),
static_cast<double>(minimum.Y),static_cast<double>(minimum.Z)};
const double tileMaximum[3]={static_cast<double>(maximum.X),
static_cast<double>(maximum.Y),static_cast<double>(maximum.Z)};
const auto SegmentTouches=[&](const FVector& a,const FVector& b,double radius)
{
for(int axis=0;axis<3;++axis)
{
const double pointA=(&a.X)[axis]*ownerToCore;
const double pointB=(&b.X)[axis]*ownerToCore;
const double expansion=(radius+padding)*ownerToCore;
if(std::max(pointA,pointB)+expansion<tileMinimum[axis]
||std::min(pointA,pointB)-expansion>tileMaximum[axis])return false;
}
return true;
};
for(const FVoxelPassage& passage:owner.Manager->GetPassages())
{
const auto& points=passage.ControlPoints;
if(points.Num()<2)
{
if(SegmentTouches(passage.UpperPoint,passage.LowerPoint,passage.Radius))
return true;
continue;
}
for(int32 index=0;index+1<points.Num();++index)
{
const double radius=std::max({static_cast<double>(passage.Radius),
passage.ControlRadii.IsValidIndex(index)
?static_cast<double>(passage.ControlRadii[index]):0.0,
passage.ControlRadii.IsValidIndex(index+1)
?static_cast<double>(passage.ControlRadii[index+1]):0.0});
if(SegmentTouches(points[index],points[index+1],radius))return true;
}
}
return false;
}
bool ResolvedPassageTouchesBox(const ResolvedLayoutSnapshotV3& layout,
const FIntVector& minimum,const FIntVector& maximum,std::uint32_t coreVoxelSizeMicrons)
{
if(layout.passages.empty())return false;
constexpr double Q=static_cast<double>(WorldAssemblySubvoxelsPerVoxel);
const double voxelsPerMetre=coreVoxelSizeMicrons>0
?1000000.0/coreVoxelSizeMicrons:4.0;
const double bridgeHalfWidthVoxels=3.5*voxelsPerMetre;
const double bridgeFootDepthVoxels=(5.0-0.13)*voxelsPerMetre;
const double tileMinimum[3]={static_cast<double>(minimum.X),
static_cast<double>(minimum.Y),static_cast<double>(minimum.Z)};
const double tileMaximum[3]={static_cast<double>(maximum.X),
static_cast<double>(maximum.Y),static_cast<double>(maximum.Z)};
for(const auto& passage:layout.passages)
for(std::size_t segment=1;segment<passage.controlPoints.size();++segment)
{
const auto& a=passage.controlPoints[segment-1];
const auto& b=passage.controlPoints[segment];
const double radius=static_cast<double>(std::max(
a.radiusSubvoxels,b.radiusSubvoxels))/Q;
const double horizontalExtent=std::max(radius,bridgeHalfWidthVoxels);
const double low[3]={
std::min(a.positionSubvoxels[0],b.positionSubvoxels[0])/Q-horizontalExtent,
std::min(a.positionSubvoxels[1],b.positionSubvoxels[1])/Q-horizontalExtent,
std::min(a.positionSubvoxels[2],b.positionSubvoxels[2])/Q-radius
-bridgeFootDepthVoxels};
const double high[3]={
std::max(a.positionSubvoxels[0],b.positionSubvoxels[0])/Q+horizontalExtent,
std::max(a.positionSubvoxels[1],b.positionSubvoxels[1])/Q+horizontalExtent,
std::max(a.positionSubvoxels[2],b.positionSubvoxels[2])/Q+radius};
bool overlap=true;
for(int axis=0;axis<3;++axis)
overlap&=high[axis]>=tileMinimum[axis]&&low[axis]<=tileMaximum[axis];
if(overlap)return true;
}
return false;
}
}
bool World::compile(const ShapeBuildRequest& request,const JobScheduler& scheduler,std::string& error) bool World::compile(const ShapeBuildRequest& request,const JobScheduler& scheduler,std::string& error)
{ {
if(!impl_->owner){error="resolved world snapshot is empty";return false;} if(!impl_->owner){error="resolved world snapshot is empty";return false;}
if(impl_->shapeReady.load(std::memory_order_acquire))
{error="world shape is already compiled";return false;}
if(!::vfcore::fp_contract::selfTest()) if(!::vfcore::fp_contract::selfTest())
{ {
error="Core startup refused: floating-point contraction self-test detected a fused multiply-add; this compiler/flag combination is unsupported for world generation"; error="Core startup refused: floating-point contraction self-test detected a fused multiply-add; this compiler/flag combination is unsupported for world generation";
@@ -980,7 +1220,7 @@ namespace VoxelForgeCore
static_cast<int32>(std::clamp<std::uint32_t>(request.workerLimit,1,16)),ToNative(request.detail), static_cast<int32>(std::clamp<std::uint32_t>(request.workerLimit,1,16)),ToNative(request.detail),
request.includeFarWorld,error,&scheduler,request.roundTunnels,request.profileDetailBand, request.includeFarWorld,error,&scheduler,request.roundTunnels,request.profileDetailBand,
request.validatePassageRoutes,request.gpuVisualDetailTiles, request.validatePassageRoutes,request.gpuVisualDetailTiles,
request.cpuVisualDetailTiles,impl_->worldAssembly.get()); request.cpuVisualDetailTiles,impl_->worldAssembly.get(),impl_->resolvedLayout.get());
if(ok) if(ok)
{ {
impl_->shape=std::move(shape); impl_->shape=std::move(shape);
@@ -988,13 +1228,77 @@ namespace VoxelForgeCore
std::unique_lock lock(impl_->tileRegionMutex); std::unique_lock lock(impl_->tileRegionMutex);
impl_->tileRegions.clear(); impl_->tileRegions.clear();
impl_->tileRegionCount.store(0,std::memory_order_release); impl_->tileRegionCount.store(0,std::memory_order_release);
impl_->shapeReady.store(true,std::memory_order_release);
} }
return ok; return ok;
} }
bool World::isTileShapeFree(const TileKey& key) const
{
if(!impl_||!impl_->owner||!impl_->worldAssembly||!impl_->resolvedLayout||!impl_->owner->Manager
||!impl_->owner->Generator||!impl_->editLog.empty())return false;
FIntVector boundsMin,boundsMax;
if(!NativeOnlyBoundsForTile(*impl_,key,boundsMin,boundsMax))return false;
const std::int64_t tileMinimum[3]={boundsMin.X,boundsMin.Y,boundsMin.Z};
const std::int64_t tileMaximum[3]={boundsMax.X,boundsMax.Y,boundsMax.Z};
const int32 LayoutChunkWidth=static_cast<int32>(std::max<std::int64_t>(1,
impl_->resolvedLayout->strateLayoutChunkWidthSubvoxels/WorldAssemblySubvoxelsPerVoxel));
const int32 firstSurfaceChunk=FloorDiv(boundsMin.Z,LayoutChunkWidth);
const int32 lastSurfaceChunk=FloorDiv(boundsMax.Z,LayoutChunkWidth);
const WorldAssemblyStratumPlanV1* selectedPlan=nullptr;
for(int32 chunkZ=firstSurfaceChunk;chunkZ<=lastSurfaceChunk;++chunkZ)
{
if(impl_->owner->Manager->GetGeneratorTypeForChunk(FIntVector(0,0,chunkZ))
!=ECaveGeneratorType::SurfaceWorld)return false;
const int32 strateIndex=impl_->owner->Manager->GetStrateIndex(
static_cast<float>((static_cast<double>(chunkZ)+0.5)
*impl_->resolvedLayout->strateLayoutChunkSizeMicrometres/10000.0));
const auto found=std::find_if(impl_->worldAssembly->plan.strates.begin(),
impl_->worldAssembly->plan.strates.end(),[strateIndex,chunkZ](const auto& plan)
{return plan.strateIndex==strateIndex&&chunkZ<=plan.topChunkZ
&&chunkZ>=plan.bottomChunkZ;});
if(found==impl_->worldAssembly->plan.strates.end()
||(selectedPlan&&selectedPlan!=&*found))return false;
selectedPlan=&*found;
}
if(!selectedPlan||!Heightfield2D(impl_->worldAssembly->recipe,*selectedPlan).isValid())
return false;
const double coreVoxelsPerOwnerChunk=static_cast<double>(
impl_->resolvedLayout->strateLayoutChunkWidthSubvoxels)/WorldAssemblySubvoxelsPerVoxel;
const int32 firstIslandChunk=FMath::FloorToInt(
static_cast<double>(boundsMin.Z)/coreVoxelsPerOwnerChunk);
const int32 lastIslandChunk=FMath::FloorToInt(
static_cast<double>(boundsMax.Z)/coreVoxelsPerOwnerChunk);
for(int32 chunkZ=firstIslandChunk;chunkZ<=lastIslandChunk;++chunkZ)
if(impl_->owner->Manager->GetGeneratorTypeForChunk(FIntVector(0,0,chunkZ))
==ECaveGeneratorType::FloatingIslands)return false;
constexpr std::int64_t scale=WorldAssemblySubvoxelsPerVoxel;
const std::int64_t subMinimum[3]={tileMinimum[0]*scale,tileMinimum[1]*scale,
tileMinimum[2]*scale};
const std::int64_t subMaximum[3]={tileMaximum[0]*scale,tileMaximum[1]*scale,
tileMaximum[2]*scale};
for(const WorldAssemblyFeatureV1& feature:selectedPlan->features)
if(IntersectsBox(feature.minimumSubvoxels,feature.maximumSubvoxels,
subMinimum,subMaximum))return false;
if(RouteTouchesBox(*selectedPlan,subMinimum,subMaximum))return false;
if(ResolvedPassageTouchesBox(*impl_->resolvedLayout,boundsMin,boundsMax,
impl_->owner->CoreVoxelSizeMicrons))return false;
if(OwnerPassageTouchesBox(*impl_->owner,boundsMin,boundsMax))return false;
FStandaloneShapeWorld proofGeometry;
if(!proofGeometry.BuildShapeDependencyProof(*impl_->owner,boundsMin,boundsMax,
impl_->owner->Generator->bStandaloneResearchRoundTunnels,impl_->resolvedLayout.get()))return false;
const FIntVector tileOrigin=ToNative(key).OriginVoxels();
if(proofGeometry.HasShapeDependencyInBox(tileOrigin,1,CHUNK_SIZE))return false;
return true;
}
bool World::needsTileRegion(const TileKey& key) const bool World::needsTileRegion(const TileKey& key) const
{ {
if(!impl_||!impl_->owner||!impl_->shape||!impl_->shape->IsBuilt() if(!impl_||!impl_->owner||!impl_->shapeReady.load(std::memory_order_acquire)
||!impl_->shape||!impl_->shape->IsBuilt()
||key.lod<0||key.lod>=impl_->configuration.fullResolutionLodCount) ||key.lod<0||key.lod>=impl_->configuration.fullResolutionLodCount)
return false; return false;
if(CoveredByBaseShape(impl_->buildRequest,impl_->configuration,key))return false; if(CoveredByBaseShape(impl_->buildRequest,impl_->configuration,key))return false;
@@ -1005,14 +1309,20 @@ namespace VoxelForgeCore
bool World::compileTileRegion(std::span<const TileKey> tiles,std::uint32_t workerLimit, bool World::compileTileRegion(std::span<const TileKey> tiles,std::uint32_t workerLimit,
const JobScheduler& scheduler,std::string& error, const JobScheduler& scheduler,std::string& error,
std::size_t* outCompiledTiles, std::size_t* outCompiledTiles,
TileRegionCompileStats* outStats,bool analyticOnly) TileRegionCompileStats* outStats,bool analyticOnly,
bool diagnosticIncludeBaseCoveredTiles)
{ {
if(outCompiledTiles)*outCompiledTiles=0; if(outCompiledTiles)*outCompiledTiles=0;
if(outStats)*outStats={}; if(outStats)*outStats={};
if(!impl_||!impl_->owner||!impl_->shape||!impl_->shape->IsBuilt()) try
{
if(!impl_||!impl_->owner||!impl_->shapeReady.load(std::memory_order_acquire)
||!impl_->shape||!impl_->shape->IsBuilt())
{error="the base world must be compiled before adding tile regions";return false;} {error="the base world must be compiled before adding tile regions";return false;}
if(tiles.empty())return true; if(tiles.empty())return true;
constexpr std::int64_t RegionPadding=10;
struct FPendingRegion struct FPendingRegion
{ {
TileKey pageKey; TileKey pageKey;
@@ -1031,15 +1341,31 @@ namespace VoxelForgeCore
const TileKey& key=tiles[inputIndex]; const TileKey& key=tiles[inputIndex];
if(key.lod<0||key.lod>8) if(key.lod<0||key.lod>8)
{error="tile region contains an invalid LOD";return false;} {error="tile region contains an invalid LOD";return false;}
if(key.lod>=impl_->configuration.fullResolutionLodCount if(key.lod>=impl_->configuration.fullResolutionLodCount)continue;
||CoveredByBaseShape(impl_->buildRequest,impl_->configuration,key))continue; const std::int64_t extent=static_cast<std::int64_t>(CHUNK_SIZE)
*(std::int64_t{1}<<key.lod);
const std::int32_t coordinates[3]={key.coordinate.x,key.coordinate.y,
key.coordinate.z};
for(int axis=0;axis<3;++axis)
{
const std::int64_t origin=static_cast<std::int64_t>(coordinates[axis])*extent;
if(origin<std::numeric_limits<std::int32_t>::min()+RegionPadding
||origin+extent>std::numeric_limits<std::int32_t>::max()-RegionPadding)
{error="tile region coordinate is out of range";return false;}
}
if(!diagnosticIncludeBaseCoveredTiles
&&CoveredByBaseShape(impl_->buildRequest,impl_->configuration,key))continue;
if(impl_->tileRegions.contains(key)||!seenTiles.insert(key).second)continue; if(impl_->tileRegions.contains(key)||!seenTiles.insert(key).second)continue;
// Analytic regions evaluate only requested fine tiles and can safely coalesce a // Keep every region's bounds spatially finite. A large camera step can bring in
// whole entering LOD slab. Packed pages retain their fixed absolute parent cells. // disjoint tiles across the whole view; coalescing an entire LOD slab makes the
const TileKey pageKey=analyticOnly?TileKey{{0,0,0},key.lod}:ShapePageKey(key); // dense axis-bin grid grow with the bounding rectangle of all of them at once.
auto [found,inserted]=regionByPage.try_emplace(pageKey,pendingRegions.size()); // Garder chaque region spatialement bornee: un grand deplacement peut amener des
if(inserted)pendingRegions.push_back({pageKey,{}}); // tuiles disjointes; fusionner tout un niveau ferait croitre les bins avec son
pendingRegions[found->second].tiles.push_back(key); // grand rectangle englobant.
const TileKey pageKey=ShapePageKey(key);
auto [found,inserted]=regionByPage.try_emplace(pageKey,pendingRegions.size());
if(inserted)pendingRegions.push_back({pageKey,{}});
pendingRegions[found->second].tiles.push_back(key);
} }
} }
if(pendingRegions.empty())return true; if(pendingRegions.empty())return true;
@@ -1076,7 +1402,9 @@ namespace VoxelForgeCore
const FIntVector fineMax(regionMax.X+PagePad,regionMax.Y+PagePad,regionMax.Z+PagePad); const FIntVector fineMax(regionMax.X+PagePad,regionMax.Y+PagePad,regionMax.Z+PagePad);
auto region=std::make_shared<FStandaloneShapeWorld>(); auto region=std::make_shared<FStandaloneShapeWorld>();
if(!region->BuildAnalyticRegion(*impl_->owner,fineMin,fineMax,regionMin,regionMax, if(!region->BuildAnalyticRegion(*impl_->owner,fineMin,fineMax,regionMin,regionMax,
ToNative(base.detail),base.roundTunnels,regionErrors[index]))return; ToNative(base.detail),base.roundTunnels,impl_->worldAssembly.get(),
impl_->resolvedLayout.get(),
regionErrors[index]))return;
compiledRegions[index]=std::move(region); compiledRegions[index]=std::move(region);
}; };
struct FAnalyticBuildContext struct FAnalyticBuildContext
@@ -1126,7 +1454,8 @@ namespace VoxelForgeCore
auto region=std::make_shared<FStandaloneShapeWorld>(); auto region=std::make_shared<FStandaloneShapeWorld>();
if(!region->Build(*impl_->owner,fineMin,fineMax,regionMin,regionMax, if(!region->Build(*impl_->owner,fineMin,fineMax,regionMin,regionMax,
static_cast<int32>(clampedWorkers),ToNative(base.detail),false,error,&scheduler, static_cast<int32>(clampedWorkers),ToNative(base.detail),false,error,&scheduler,
base.roundTunnels,base.profileDetailBand,false,{}, {},impl_->worldAssembly.get()))return false; base.roundTunnels,base.profileDetailBand,false,{}, {},impl_->worldAssembly.get(),
impl_->resolvedLayout.get()))return false;
if(!impl_->editLog.empty())region->SetEditTransaction(impl_->editLog); if(!impl_->editLog.empty())region->SetEditTransaction(impl_->editLog);
const auto& build=region->GetStats(); const auto& build=region->GetStats();
++stats.regionsBuilt; ++stats.regionsBuilt;
@@ -1142,19 +1471,40 @@ namespace VoxelForgeCore
compiledRegions[i]=std::move(region); compiledRegions[i]=std::move(region);
} }
} }
for(const auto& region:compiledRegions)
if(region)region->SetSharedDensitySource(impl_->shape.get());
{ {
std::unique_lock lock(impl_->tileRegionMutex); std::unordered_map<TileKey,std::shared_ptr<FStandaloneShapeWorld>,TileKeyHash> publish;
publish.reserve(stats.tileKeysCovered);
for(std::size_t i=0;i<pendingRegions.size();++i) for(std::size_t i=0;i<pendingRegions.size();++i)
{
for(const TileKey& key:pendingRegions[i].tiles) for(const TileKey& key:pendingRegions[i].tiles)
if(impl_->tileRegions.try_emplace(key,compiledRegions[i]).second)++compiledTileCount; publish.try_emplace(key,compiledRegions[i]);
} const std::size_t candidates=publish.size();
std::unique_lock lock(impl_->tileRegionMutex);
impl_->tileRegions.reserve(impl_->tileRegions.size()+candidates);
impl_->tileRegions.merge(publish);
compiledTileCount=candidates-publish.size();
impl_->tileRegionCount.store(impl_->tileRegions.size(),std::memory_order_release); impl_->tileRegionCount.store(impl_->tileRegions.size(),std::memory_order_release);
} }
stats.wallSeconds=std::chrono::duration<double>(Clock::now()-compileStart).count(); stats.wallSeconds=std::chrono::duration<double>(Clock::now()-compileStart).count();
if(outCompiledTiles)*outCompiledTiles=compiledTileCount; if(outCompiledTiles)*outCompiledTiles=compiledTileCount;
if(outStats)*outStats=stats; if(outStats)*outStats=stats;
return true; return true;
}
catch(const std::bad_alloc&)
{
if(outCompiledTiles)*outCompiledTiles=0;
if(outStats)*outStats={};
error="region OOM";
return false;
}
catch(const std::length_error&)
{
if(outCompiledTiles)*outCompiledTiles=0;
if(outStats)*outStats={};
error="region size";
return false;
}
} }
void World::retainTileRegions(std::span<const TileKey> desiredTiles) void World::retainTileRegions(std::span<const TileKey> desiredTiles)
@@ -1171,14 +1521,17 @@ namespace VoxelForgeCore
} }
void World::buildFarWorld() void World::buildFarWorld()
{ if(impl_->shape)impl_->shape->BuildFarWorld(); } { if(impl_&&impl_->shapeReady.load(std::memory_order_acquire)&&impl_->shape)impl_->shape->BuildFarWorld(); }
bool World::isCompiled() const noexcept { return impl_&&impl_->shape&&impl_->shape->IsBuilt(); } bool World::isCompiled() const noexcept
bool World::hasFarWorld() const noexcept { return impl_&&impl_->shape&&impl_->shape->HasFarWorld(); } { return impl_&&impl_->shapeReady.load(std::memory_order_acquire); }
bool World::hasFarWorld() const noexcept
{ return impl_&&impl_->shapeReady.load(std::memory_order_acquire)
&&impl_->shape&&impl_->shape->HasFarWorld(); }
ShapeBuildStats World::buildStats() const ShapeBuildStats World::buildStats() const
{ {
ShapeBuildStats out; ShapeBuildStats out;
if(!impl_||!impl_->shape)return out; if(!impl_||!impl_->shapeReady.load(std::memory_order_acquire)||!impl_->shape)return out;
const auto& stats=impl_->shape->GetStats(); const auto& stats=impl_->shape->GetStats();
out.shapeSeconds=stats.ShapeSeconds;out.intervalSeconds=stats.IntervalSeconds; out.shapeSeconds=stats.ShapeSeconds;out.intervalSeconds=stats.IntervalSeconds;
out.surfaceSeconds=stats.SurfaceSeconds;out.farShapeSeconds=stats.FarShapeSeconds; out.surfaceSeconds=stats.SurfaceSeconds;out.farShapeSeconds=stats.FarShapeSeconds;
@@ -1188,18 +1541,61 @@ namespace VoxelForgeCore
} }
float World::densityAt(Vec3d position) const float World::densityAt(Vec3d position) const
{ return impl_&&impl_->shape?impl_->shape->DensityAt(static_cast<float>(position.x),static_cast<float>(position.y),static_cast<float>(position.z)):0.0f; } { return impl_&&impl_->shapeReady.load(std::memory_order_acquire)&&impl_->shape?impl_->shape->DensityAt(static_cast<float>(position.x),static_cast<float>(position.y),static_cast<float>(position.z)):0.0f; }
std::vector<PassageVoidCrossingAuditV1> World::passageVoidCrossings() const
{
std::vector<PassageVoidCrossingAuditV1> result;
if(!impl_||!impl_->shapeReady.load(std::memory_order_acquire)||!impl_->shape)return result;
const auto& crossings=impl_->shape->GetPassageVoidCrossings();
result.reserve(crossings.size());
for(const auto& crossing:crossings)
{
PassageVoidCrossingAuditV1 value;
value.passageIndex=crossing.passageIndex;value.firstSegment=crossing.firstSegment;
value.lastSegment=crossing.lastSegment;value.unsupportedSamples=crossing.unsupportedSamples;
value.unsupportedLengthMetres=crossing.unsupportedLengthMetres;
value.startPointSubvoxels=crossing.startPoint;value.endPointSubvoxels=crossing.endPoint;
value.needsColumn=crossing.needsColumn;
value.connectedAtStart=crossing.connectedAtStart;
value.connectedAtEnd=crossing.connectedAtEnd;
value.columnAxisSubvoxels={crossing.centerXSubvoxels,crossing.centerYSubvoxels};
value.columnTopZSubvoxels=crossing.topZSubvoxels;
value.columnBottomZSubvoxels=crossing.bottomZSubvoxels;
value.columnMinimumRadiusSubvoxels=crossing.minimumRadiusSubvoxels;
value.columnNominalRadiusSubvoxels=crossing.nominalRadiusSubvoxels;
value.columnMaximumRadiusSubvoxels=crossing.maximumRadiusSubvoxels;
value.maximumRouteOffsetMetres=crossing.maximumRouteOffsetMetres;
value.maximumBoreRadiusMetres=crossing.maximumBoreRadiusMetres;
result.push_back(value);
}
return result;
}
bool World::isPassageColumnSample(std::size_t passageIndex,std::size_t segmentIndex,
Vec3d position) const
{return impl_&&impl_->shapeReady.load(std::memory_order_acquire)&&impl_->shape
&&impl_->shape->IsResolvedPassageColumnSample(passageIndex,segmentIndex,
{position.x,position.y,position.z});}
bool World::isPassageShortSpanSample(std::size_t passageIndex,std::size_t segmentIndex,
Vec3d position) const
{return impl_&&impl_->shapeReady.load(std::memory_order_acquire)&&impl_->shape
&&impl_->shape->IsResolvedPassageShortSpanSample(passageIndex,segmentIndex,
{position.x,position.y,position.z});}
std::string World::densityDispatchPathAt(Vec3d position) const
{ return impl_&&impl_->shapeReady.load(std::memory_order_acquire)&&impl_->shape
?impl_->shape->DensityDispatchPathAt(static_cast<float>(position.x),static_cast<float>(position.y),static_cast<float>(position.z))
:"uncompiled"; }
float World::unclampedDensityAt(Vec3d position) const float World::unclampedDensityAt(Vec3d position) const
{ return impl_&&impl_->shape?impl_->shape->DensityAtUnclamped(static_cast<float>(position.x),static_cast<float>(position.y),static_cast<float>(position.z)):0.0f; } { return impl_&&impl_->shapeReady.load(std::memory_order_acquire)&&impl_->shape?impl_->shape->DensityAtUnclamped(static_cast<float>(position.x),static_cast<float>(position.y),static_cast<float>(position.z)):0.0f; }
DetailFieldSample World::detailSampleAt(Vec3d position) const DetailFieldSample World::detailSampleAt(Vec3d position) const
{ return impl_&&impl_->shape?impl_->shape->DetailSampleAt(static_cast<float>(position.x),static_cast<float>(position.y),static_cast<float>(position.z)):DetailFieldSample{}; } { return impl_&&impl_->shapeReady.load(std::memory_order_acquire)&&impl_->shape?impl_->shape->DetailSampleAt(static_cast<float>(position.x),static_cast<float>(position.y),static_cast<float>(position.z)):DetailFieldSample{}; }
float World::densityAtLattice(Vec3i position) const float World::densityAtLattice(Vec3i position) const
{ return impl_&&impl_->shape?impl_->shape->DensityAtLattice(position.x,position.y,position.z):0.0f; } { return impl_&&impl_->shapeReady.load(std::memory_order_acquire)&&impl_->shape?impl_->shape->DensityAtLattice(position.x,position.y,position.z):0.0f; }
bool World::isSolidAt(Vec3d position) const { return densityAt(position)<0.0f; } bool World::isSolidAt(Vec3d position) const { return densityAt(position)<0.0f; }
bool World::isSolidAlongSegment(Vec3d start,Vec3d end,double spacing) const bool World::isSolidAlongSegment(Vec3d start,Vec3d end,double spacing) const
{ {
if(!impl_||!impl_->shape||!std::isfinite(spacing)||spacing<=0.0)return false; if(!impl_||!impl_->shapeReady.load(std::memory_order_acquire)||!impl_->shape
||!std::isfinite(spacing)||spacing<=0.0)return false;
const double dx=end.x-start.x,dy=end.y-start.y,dz=end.z-start.z; const double dx=end.x-start.x,dy=end.y-start.y,dz=end.z-start.z;
const double length=std::sqrt(dx*dx+dy*dy+dz*dz); const double length=std::sqrt(dx*dx+dy*dy+dz*dz);
const std::size_t intervals=std::max<std::size_t>(1,static_cast<std::size_t>(std::ceil(length/spacing))); const std::size_t intervals=std::max<std::size_t>(1,static_cast<std::size_t>(std::ceil(length/spacing)));
@@ -1213,7 +1609,7 @@ namespace VoxelForgeCore
TileClass World::classifyBox(Vec3i origin,std::int32_t step,std::int32_t cells) const TileClass World::classifyBox(Vec3i origin,std::int32_t step,std::int32_t cells) const
{ {
if(!impl_||!impl_->shape)return TileClass::mixed; if(!impl_||!impl_->shapeReady.load(std::memory_order_acquire)||!impl_->shape)return TileClass::mixed;
const EVoxelTileClass result=impl_->shape->ClassifyBox(ToNative(origin),step,cells); const EVoxelTileClass result=impl_->shape->ClassifyBox(ToNative(origin),step,cells);
return result==EVoxelTileClass::AllSolid?TileClass::allSolid: return result==EVoxelTileClass::AllSolid?TileClass::allSolid:
result==EVoxelTileClass::AllAir?TileClass::allAir:TileClass::mixed; result==EVoxelTileClass::AllAir?TileClass::allAir:TileClass::mixed;
@@ -1335,17 +1731,39 @@ namespace VoxelForgeCore
// Les tuiles proches n'avaient aucun conflit; garder leur acces simple et associer les LOD grossiers. // Les tuiles proches n'avaient aucun conflit; garder leur acces simple et associer les LOD grossiers.
Heightfield2D::setThreadColumnCacheLegacyDirectMapped( Heightfield2D::setThreadColumnCacheLegacyDirectMapped(
options.legacyDirectMappedColumnCache||key.lod<=2); options.legacyDirectMappedColumnCache||key.lod<=2);
if(!impl_||!impl_->owner||!impl_->shape||!impl_->shape->IsBuilt()) if(!impl_||!impl_->owner)
{ error="world must be compiled before generating tiles";return std::nullopt; } { error="resolved world snapshot is empty";return std::nullopt; }
const bool bShapeReady=impl_->shapeReady.load(std::memory_order_acquire);
const bool bNativeOnly=!bShapeReady||options.diagnosticForceNativeOnly;
if(!bShapeReady&&!options.diagnosticForceNativeOnly&&!isTileShapeFree(key))
{error="tile is shape-dependent and must wait for shape compilation";return std::nullopt;}
if(!bNativeOnly&&(!impl_->shape||!impl_->shape->IsBuilt()))
{error="world shape publication is incomplete";return std::nullopt;}
FScopedSharedColumnCaches sharedColumnCaches(options.useSharedColumnCache
?impl_->sharedHeightfieldColumns.get():nullptr,
options.useSharedColumnCache?impl_->sharedIslandColumns.get():nullptr);
const auto& world=*impl_->owner; const auto& world=*impl_->owner;
FStandaloneShapeWorld nativeOnlyShape;
FIntVector nativeOnlyMinimum,nativeOnlyMaximum;
std::shared_ptr<FStandaloneShapeWorld> page; std::shared_ptr<FStandaloneShapeWorld> page;
if(impl_->tileRegionCount.load(std::memory_order_acquire)!=0) if(bNativeOnly)
{
if(!NativeOnlyBoundsForTile(*impl_,key,nativeOnlyMinimum,nativeOnlyMaximum))
{error="shape-free guard: tile has no bounded native-only domain";return std::nullopt;}
if(!options.diagnosticForceNativeOnly&&!isTileShapeFree(key))
{error="shape-free guard: tile failed the native-only readiness proof";return std::nullopt;}
nativeOnlyShape.InitializeNativeSurfaceOnly(*impl_->owner,impl_->worldAssembly.get(),
impl_->resolvedLayout.get(),
nativeOnlyMinimum,nativeOnlyMaximum);
}
else if(impl_->tileRegionCount.load(std::memory_order_acquire)!=0)
{ {
std::shared_lock lock(impl_->tileRegionMutex); std::shared_lock lock(impl_->tileRegionMutex);
if(const auto found=impl_->tileRegions.find(key);found!=impl_->tileRegions.end()) if(const auto found=impl_->tileRegions.find(key);found!=impl_->tileRegions.end())
page=found->second; page=found->second;
} }
const FStandaloneShapeWorld* tileShapeContext=page?page.get():impl_->shape.get(); const FStandaloneShapeWorld* tileShapeContext=bNativeOnly?&nativeOnlyShape:
(page?page.get():impl_->shape.get());
UVoxelMarchingCubesMesher mesher; UVoxelMarchingCubesMesher mesher;
mesher.SetGenerator(world.Generator.get()); mesher.SetGenerator(world.Generator.get());
mesher.SetGeometryVoxelSizeCm(static_cast<float>(world.CoreVoxelSizeMicrons)/10000.0f); mesher.SetGeometryVoxelSizeCm(static_cast<float>(world.CoreVoxelSizeMicrons)/10000.0f);
@@ -1402,6 +1820,12 @@ namespace VoxelForgeCore
} }
if(!sharpFeatures.IsEmpty()) if(!sharpFeatures.IsEmpty())
{ {
if(bNativeOnly)
{
nativeOnlyShape.RecordNativeOnlyViolation();
error="shape-free guard: tile intersects a shape feature";
return std::nullopt;
}
// Streamed analytic pages omit the native assembly plan. Use the immutable base // Streamed analytic pages omit the native assembly plan. Use the immutable base
// shape only for tagged tiles so their mesher samples the same field as the tags. // shape only for tagged tiles so their mesher samples the same field as the tags.
// Les pages analytiques omettent le plan natif ; utiliser la base uniquement pour // Les pages analytiques omettent le plan natif ; utiliser la base uniquement pour
@@ -1446,13 +1870,26 @@ namespace VoxelForgeCore
} }
} }
} }
int32 MeshCells=cells,MeshStep=step;
if(options.diagnosticCellStride>1&&level>=3)
{
const int32 Stride=static_cast<int32>(std::min<std::uint32_t>(
options.diagnosticCellStride,static_cast<std::uint32_t>(std::max(1,cells))));
MeshCells=FMath::Max(1,cells/Stride);
MeshStep=FMath::Max(1,extent/MeshCells);
}
int64 sampleCount=0;std::vector<float> densityValues; int64 sampleCount=0;std::vector<float> densityValues;
FVoxelMarchingCubesStageTimings McStageTimings; FVoxelMarchingCubesStageTimings McStageTimings;
TileMesh out;out.key=key; TileMesh out;out.key=key;
out.diagnostics.featureRefinedResolution=bFeatureRefinedResolution; out.diagnostics.featureRefinedResolution=bFeatureRefinedResolution;
if(options.profileMesherStages)
{
out.diagnostics.nativeOnlyRoute=bNativeOnly;
out.diagnostics.analyticRegionPageRoute=page&&page->IsAnalyticOnly();
}
const bool bHasWorldAssembly=impl_->worldAssembly!=nullptr; const bool bHasWorldAssembly=impl_->worldAssembly!=nullptr;
const bool bNeedsFarShell=bHasWorldAssembly&&key.lod>=7 const bool bNeedsFarShell=bHasWorldAssembly&&key.lod>=7
&&(tileShape.HasFarWorld()||impl_->shape->HasFarWorld()); &&(tileShape.HasFarWorld()||(bShapeReady&&impl_->shape->HasFarWorld()));
bool bOverlapsPlayerEdit=false; bool bOverlapsPlayerEdit=false;
if(tileShape.HasEditTransaction()) if(tileShape.HasEditTransaction())
{ {
@@ -1473,15 +1910,19 @@ namespace VoxelForgeCore
const int64 TileMaximumZ=static_cast<int64>(origin.Z)+extent; const int64 TileMaximumZ=static_cast<int64>(origin.Z)+extent;
for(const auto& Plan:impl_->worldAssembly->plan.strates) for(const auto& Plan:impl_->worldAssembly->plan.strates)
{ {
const int64 PlanMinimumZ=static_cast<int64>(std::min(Plan.bottomChunkZ,Plan.topChunkZ))*CHUNK_SIZE; const int64 PlanMinimumZ=static_cast<int64>(std::min(Plan.bottomChunkZ,Plan.topChunkZ))
const int64 PlanMaximumZ=(static_cast<int64>(std::max(Plan.bottomChunkZ,Plan.topChunkZ))+1)*CHUNK_SIZE; *impl_->resolvedLayout->strateLayoutChunkWidthSubvoxels/WorldAssemblySubvoxelsPerVoxel;
const int64 PlanMaximumZ=(static_cast<int64>(std::max(Plan.bottomChunkZ,Plan.topChunkZ)+1))
*impl_->resolvedLayout->strateLayoutChunkWidthSubvoxels/WorldAssemblySubvoxelsPerVoxel;
bHasNativeSurfaceHorizonPlan=bHasNativeSurfaceHorizonPlan bHasNativeSurfaceHorizonPlan=bHasNativeSurfaceHorizonPlan
||(TileMinimumZ<=PlanMaximumZ&&TileMaximumZ>=PlanMinimumZ); ||(TileMinimumZ<=PlanMaximumZ&&TileMaximumZ>=PlanMinimumZ);
} }
for(const auto& Entry:impl_->worldAssembly->floatingIslands) for(const auto& Entry:impl_->worldAssembly->floatingIslands)
{ {
const int64 PlanMinimumZ=static_cast<int64>(std::min(Entry.bottomChunkZ,Entry.topChunkZ))*CHUNK_SIZE; const int64 PlanMinimumZ=static_cast<int64>(std::min(Entry.bottomChunkZ,Entry.topChunkZ))
const int64 PlanMaximumZ=(static_cast<int64>(std::max(Entry.bottomChunkZ,Entry.topChunkZ))+1)*CHUNK_SIZE; *impl_->resolvedLayout->strateLayoutChunkWidthSubvoxels/WorldAssemblySubvoxelsPerVoxel;
const int64 PlanMaximumZ=(static_cast<int64>(std::max(Entry.bottomChunkZ,Entry.topChunkZ)+1))
*impl_->resolvedLayout->strateLayoutChunkWidthSubvoxels/WorldAssemblySubvoxelsPerVoxel;
bHasIslandPlanInTile=bHasIslandPlanInTile bHasIslandPlanInTile=bHasIslandPlanInTile
||(TileMinimumZ<=PlanMaximumZ&&TileMaximumZ>=PlanMinimumZ); ||(TileMinimumZ<=PlanMaximumZ&&TileMaximumZ>=PlanMinimumZ);
} }
@@ -1492,6 +1933,15 @@ namespace VoxelForgeCore
FStandaloneShapeWorld::ResetThreadClassificationStats(); FStandaloneShapeWorld::ResetThreadClassificationStats();
VoxelForgeCore::Heightfield2D::resetThreadColumnCacheStats( VoxelForgeCore::Heightfield2D::resetThreadColumnCacheStats(
options.captureColumnCoordinates); options.captureColumnCoordinates);
if(options.captureColumnCoordinates)
{
constexpr std::int64_t SubvoxelsPerVoxel=WorldAssemblySubvoxelsPerVoxel;
VoxelForgeCore::Heightfield2D::setThreadColumnCaptureBounds(
static_cast<std::int64_t>(origin.X)*SubvoxelsPerVoxel,
static_cast<std::int64_t>(origin.Y)*SubvoxelsPerVoxel,
static_cast<std::int64_t>(origin.X+extent)*SubvoxelsPerVoxel,
static_cast<std::int64_t>(origin.Y+extent)*SubvoxelsPerVoxel);
}
bool bNativeSurfaceTile=false; bool bNativeSurfaceTile=false;
bool bNativeSurfaceBandSafe=false; bool bNativeSurfaceBandSafe=false;
double classificationColumnComputeMilliseconds=0.0; double classificationColumnComputeMilliseconds=0.0;
@@ -1504,6 +1954,8 @@ namespace VoxelForgeCore
VoxelForgeCore::Heightfield2D::threadColumnCacheStats().columnComputeMilliseconds VoxelForgeCore::Heightfield2D::threadColumnCacheStats().columnComputeMilliseconds
-columnMillisecondsBeforeClassification); -columnMillisecondsBeforeClassification);
bNativeSurfaceTile=Classification.bNativeSurface; bNativeSurfaceTile=Classification.bNativeSurface;
if(options.profileMesherStages)
out.diagnostics.nativeSurfaceTile=bNativeSurfaceTile;
// NativeSurfaceDensityAt consumes only the bounded manifest heightfield and its // NativeSurfaceDensityAt consumes only the bounded manifest heightfield and its
// bounded type-2/type-4 features. Unknown tile occupancy does not make that Z support // bounded type-2/type-4 features. Unknown tile occupancy does not make that Z support
// unknown; edits and cross-strate tiles are still excluded below. // unknown; edits and cross-strate tiles are still excluded below.
@@ -1520,7 +1972,8 @@ namespace VoxelForgeCore
} }
if((out.diagnostics.tileClass==TileClass::allSolid if((out.diagnostics.tileClass==TileClass::allSolid
||out.diagnostics.tileClass==TileClass::allAir) ||out.diagnostics.tileClass==TileClass::allAir)
&&!options.hashDensity&&!options.captureDensitySamples&&!bNeedsFarShell) &&!options.hashDensity&&!options.captureDensitySamples&&!bNeedsFarShell
&&!options.auditUniformBlockProofs)
{ {
out.diagnostics.meshingSkipped=true; out.diagnostics.meshingSkipped=true;
const auto Counts=FStandaloneShapeWorld::GetThreadClassificationStats(); const auto Counts=FStandaloneShapeWorld::GetThreadClassificationStats();
@@ -1536,6 +1989,8 @@ namespace VoxelForgeCore
out.diagnostics.columnCacheHits=Columns.columnHits; out.diagnostics.columnCacheHits=Columns.columnHits;
out.diagnostics.columnCacheMisses=Columns.columnMisses; out.diagnostics.columnCacheMisses=Columns.columnMisses;
out.diagnostics.columnCacheConflictMisses=Columns.columnConflictMisses; out.diagnostics.columnCacheConflictMisses=Columns.columnConflictMisses;
out.diagnostics.sharedColumnCacheHits=Columns.sharedColumnHits;
out.diagnostics.columnEvaluations=Columns.columnEvaluations;
out.diagnostics.classificationMilliseconds=Counts.Milliseconds; out.diagnostics.classificationMilliseconds=Counts.Milliseconds;
out.diagnostics.classificationExclusiveMilliseconds=std::max(0.0, out.diagnostics.classificationExclusiveMilliseconds=std::max(0.0,
Counts.Milliseconds-classificationColumnComputeMilliseconds); Counts.Milliseconds-classificationColumnComputeMilliseconds);
@@ -1559,7 +2014,7 @@ namespace VoxelForgeCore
int32 MeshBandMinZVoxel=options.bandMinZVoxel; int32 MeshBandMinZVoxel=options.bandMinZVoxel;
int32 MeshBandMaxZVoxel=options.bandMaxZVoxel; int32 MeshBandMaxZVoxel=options.bandMaxZVoxel;
bool bNativeHeightfieldBandLimited=false; bool bNativeHeightfieldBandLimited=false;
if(bHasWorldAssembly&&bNativeSurfaceBandSafe if(bHasWorldAssembly&&bNativeSurfaceBandSafe&&!(page&&page->IsAnalyticOnly())
&&!options.hashDensity&&!options.captureDensitySamples&&world.Manager!=nullptr) &&!options.hashDensity&&!options.captureDensitySamples&&world.Manager!=nullptr)
{ {
// La surface 2D et les bornes de volume du manifeste definissent tout le support Z. // La surface 2D et les bornes de volume du manifeste definissent tout le support Z.
@@ -1568,7 +2023,11 @@ namespace VoxelForgeCore
const double CoreVoxelSizeCm=static_cast<double>(impl_->configuration.voxelSizeMicrons)/10000.0; const double CoreVoxelSizeCm=static_cast<double>(impl_->configuration.voxelSizeMicrons)/10000.0;
const double OwnerVoxelSizeCm=impl_->owner!=nullptr&&impl_->owner->OwnerVoxelSizeMicrons>0 const double OwnerVoxelSizeCm=impl_->owner!=nullptr&&impl_->owner->OwnerVoxelSizeMicrons>0
?static_cast<double>(impl_->owner->OwnerVoxelSizeMicrons)/10000.0:0.5*static_cast<double>(VOXEL_SIZE); ?static_cast<double>(impl_->owner->OwnerVoxelSizeMicrons)/10000.0:0.5*static_cast<double>(VOXEL_SIZE);
const double CoreVoxelsPerOwnerChunk=static_cast<double>(CHUNK_SIZE)*OwnerVoxelSizeCm/CoreVoxelSizeCm; const double CoreVoxelsPerOwnerChunk=impl_->resolvedLayout
?static_cast<double>(impl_->resolvedLayout->strateLayoutChunkWidthSubvoxels)
/WorldAssemblySubvoxelsPerVoxel
:static_cast<double>(impl_->owner->StrateLayoutChunkWidthSubvoxels)
/WorldAssemblySubvoxelsPerVoxel;
const int32 CenterChunkZ=FMath::FloorToInt(TileCenterZ/CoreVoxelsPerOwnerChunk); const int32 CenterChunkZ=FMath::FloorToInt(TileCenterZ/CoreVoxelsPerOwnerChunk);
const int32 StrateIndex=world.Manager->GetStrateIndex( const int32 StrateIndex=world.Manager->GetStrateIndex(
static_cast<float>(TileCenterZ*CoreVoxelSizeCm)); static_cast<float>(TileCenterZ*CoreVoxelSizeCm));
@@ -1678,13 +2137,54 @@ namespace VoxelForgeCore
out.diagnostics.featureListMilliseconds=std::chrono::duration<double,std::milli>( out.diagnostics.featureListMilliseconds=std::chrono::duration<double,std::milli>(
std::chrono::steady_clock::now()-FeatureListStart).count(); std::chrono::steady_clock::now()-FeatureListStart).count();
const ScopedWorldAssemblyFeatureQueriesV1 featureScope(featureQueries); const ScopedWorldAssemblyFeatureQueriesV1 featureScope(featureQueries);
// GenerateMesh samples only origin..origin+extent plus the one-step normal halo;
// queryMinimum/queryMaximum above are exactly that inclusive domain.
// GenerateMesh n'échantillonne que origin..origin+extent et la marge de normale d'un pas ;
// queryMinimum/queryMaximum ci-dessus couvrent exactement ce domaine inclusif.
const FStandaloneShapeWorld::FScopedPassageTileQueries passageFeatureScope(
tileShape,queryMinimum,queryMaximum);
const bool bDiagnosticColumnSampling=options.diagnosticGlobalOctaveDrop!=0
||options.diagnosticColumnInterpolationStride>1;
const std::uint32_t PreviousOctaveDrop=bDiagnosticColumnSampling
?Heightfield2D::threadColumnOctaveDrop():0;
const std::int64_t PreviousInterpolationStride=bDiagnosticColumnSampling
?Heightfield2D::threadColumnInterpolationStrideSubvoxels():0;
if(bDiagnosticColumnSampling)
{
Heightfield2D::setThreadColumnOctaveDrop(options.diagnosticGlobalOctaveDrop);
Heightfield2D::setThreadColumnInterpolationStrideSubvoxels(
options.diagnosticColumnInterpolationStride>1&&level>=3
?static_cast<std::int64_t>(MeshStep)*WorldAssemblySubvoxelsPerVoxel
*options.diagnosticColumnInterpolationStride:0);
}
const double ColumnMillisecondsBeforeMeshing= const double ColumnMillisecondsBeforeMeshing=
VoxelForgeCore::Heightfield2D::threadColumnCacheStats().columnComputeMilliseconds; VoxelForgeCore::Heightfield2D::threadColumnCacheStats().columnComputeMilliseconds;
const auto MarchingCubesStart=std::chrono::steady_clock::now(); const auto MarchingCubesStart=std::chrono::steady_clock::now();
FVoxelMeshData mesh=mesher.GenerateMesh(origin,step,cells,nullptr, FVoxelUniformBlockProofAuditStats BlockProofAudit;
FVoxelMeshData mesh=mesher.GenerateMesh(origin,MeshStep,MeshCells,nullptr,
MeshBandMinZVoxel,MeshBandMaxZVoxel,&sampleCount,nullptr,nullptr, MeshBandMinZVoxel,MeshBandMaxZVoxel,&sampleCount,nullptr,nullptr,
(options.hashDensity||options.captureDensitySamples)?&densityValues:nullptr, (options.hashDensity||options.captureDensitySamples)?&densityValues:nullptr,
options.profileMesherStages?&McStageTimings:nullptr); options.profileMesherStages?&McStageTimings:nullptr,
options.auditUniformBlockProofs?&BlockProofAudit:nullptr,
options.forceFullDensityCapture);
if(options.auditUniformBlockProofs)
{
out.diagnostics.uniformBlockProofsChecked=BlockProofAudit.CheckedBlocks;
out.diagnostics.uniformBlockProofSamplesChecked=BlockProofAudit.CheckedSamples;
out.diagnostics.uniformBlockProofFallbackBlocks=BlockProofAudit.FallbackBlocks;
out.diagnostics.uniformBlockProofUnknownBlocks=BlockProofAudit.UnknownBlocks;
out.diagnostics.uniformBlockProofViolations=BlockProofAudit.Violations;
}
if(bDiagnosticColumnSampling)
{
Heightfield2D::setThreadColumnOctaveDrop(PreviousOctaveDrop);
Heightfield2D::setThreadColumnInterpolationStrideSubvoxels(PreviousInterpolationStride);
}
if(bNativeOnly&&tileShape.GetNativeOnlyViolationCount()!=0)
{
error="shape-free guard caught a mesher read outside the native SurfaceWorld field";
return std::nullopt;
}
const double MarchingCubesWallMilliseconds=std::chrono::duration<double,std::milli>( const double MarchingCubesWallMilliseconds=std::chrono::duration<double,std::milli>(
std::chrono::steady_clock::now()-MarchingCubesStart).count(); std::chrono::steady_clock::now()-MarchingCubesStart).count();
const double ColumnMillisecondsAfterMeshing= const double ColumnMillisecondsAfterMeshing=
@@ -1695,6 +2195,10 @@ namespace VoxelForgeCore
ColumnMillisecondsAfterMeshing-ColumnMillisecondsBeforeMeshing); ColumnMillisecondsAfterMeshing-ColumnMillisecondsBeforeMeshing);
if(options.profileMesherStages) if(options.profileMesherStages)
{ {
out.diagnostics.marchingCubesSkirtMilliseconds=McStageTimings.SkirtMilliseconds;
out.diagnostics.marchingCubesExclusiveMilliseconds=std::max(0.0,
out.diagnostics.marchingCubesExclusiveMilliseconds
-out.diagnostics.marchingCubesSkirtMilliseconds);
out.diagnostics.marchingCubesDensityGridMilliseconds=McStageTimings.DensityGridMilliseconds; out.diagnostics.marchingCubesDensityGridMilliseconds=McStageTimings.DensityGridMilliseconds;
out.diagnostics.marchingCubesCellClassificationMilliseconds= out.diagnostics.marchingCubesCellClassificationMilliseconds=
McStageTimings.CellClassificationMilliseconds; McStageTimings.CellClassificationMilliseconds;
@@ -1715,12 +2219,23 @@ namespace VoxelForgeCore
std::chrono::steady_clock::now()-MeshingStart).count(); std::chrono::steady_clock::now()-MeshingStart).count();
out.diagnostics.farHorizonVersion=key.lod>=4?options.farHorizonVersion:0; out.diagnostics.farHorizonVersion=key.lod>=4?options.farHorizonVersion:0;
const auto FarShellStart=std::chrono::steady_clock::now(); const auto FarShellStart=std::chrono::steady_clock::now();
const FStandaloneShapeWorld& farShape=tileShape.HasFarWorld()?tileShape:*impl_->shape; const FStandaloneShapeWorld& farShape=tileShape.HasFarWorld()?tileShape:
(bShapeReady?*impl_->shape:tileShape);
out.diagnostics.farShellRepairSkipped=bSkipFarShellRepair; out.diagnostics.farShellRepairSkipped=bSkipFarShellRepair;
if(farShape.HasFarWorld()&&!bSkipFarShellRepair) if(farShape.HasFarWorld()&&!bSkipFarShellRepair)
{ {
const auto BeforeStratum=FStandaloneShapeWorld::GetThreadClassificationStats(); const auto BeforeStratum=FStandaloneShapeWorld::GetThreadClassificationStats();
const int32 BeforeStratumTriangles=mesh.Triangles.Num()/3; const int32 BeforeStratumTriangles=mesh.Triangles.Num()/3;
std::array<std::uint64_t,6> BeforeStratumColumnCacheStats;
double BeforeStratumColumnComputeMilliseconds;
if(options.profileMesherStages)
{
const auto& Columns=VoxelForgeCore::Heightfield2D::threadColumnCacheStats();
BeforeStratumColumnCacheStats={Columns.pointCalls,Columns.columnHits,
Columns.columnMisses,Columns.columnConflictMisses,
Columns.sharedColumnHits,Columns.columnEvaluations};
BeforeStratumColumnComputeMilliseconds=Columns.columnComputeMilliseconds;
}
const auto StratumStart=std::chrono::steady_clock::now(); const auto StratumStart=std::chrono::steady_clock::now();
AppendFarStratumShells(world,farShape,nativeKey,step,mesh); AppendFarStratumShells(world,farShape,nativeKey,step,mesh);
const auto AfterStratum=FStandaloneShapeWorld::GetThreadClassificationStats(); const auto AfterStratum=FStandaloneShapeWorld::GetThreadClassificationStats();
@@ -1728,11 +2243,39 @@ namespace VoxelForgeCore
std::chrono::steady_clock::now()-StratumStart).count(); std::chrono::steady_clock::now()-StratumStart).count();
out.diagnostics.farStratumFieldCalls= out.diagnostics.farStratumFieldCalls=
AfterStratum.NativeFloatFieldCalls-BeforeStratum.NativeFloatFieldCalls; AfterStratum.NativeFloatFieldCalls-BeforeStratum.NativeFloatFieldCalls;
if(options.profileMesherStages)
{
const auto& Columns=VoxelForgeCore::Heightfield2D::threadColumnCacheStats();
out.diagnostics.farStratumColumnPointCalls=
Columns.pointCalls-BeforeStratumColumnCacheStats[0];
out.diagnostics.farStratumColumnCacheHits=
Columns.columnHits-BeforeStratumColumnCacheStats[1];
out.diagnostics.farStratumColumnCacheMisses=
Columns.columnMisses-BeforeStratumColumnCacheStats[2];
out.diagnostics.farStratumColumnConflictMisses=
Columns.columnConflictMisses-BeforeStratumColumnCacheStats[3];
out.diagnostics.farStratumSharedColumnCacheHits=
Columns.sharedColumnHits-BeforeStratumColumnCacheStats[4];
out.diagnostics.farStratumColumnEvaluations=
Columns.columnEvaluations-BeforeStratumColumnCacheStats[5];
out.diagnostics.farStratumColumnComputeMilliseconds=
Columns.columnComputeMilliseconds-BeforeStratumColumnComputeMilliseconds;
}
out.diagnostics.farShellTrianglesAdded=static_cast<std::uint64_t>( out.diagnostics.farShellTrianglesAdded=static_cast<std::uint64_t>(
std::max(0,mesh.Triangles.Num()/3-BeforeStratumTriangles)); std::max(0,mesh.Triangles.Num()/3-BeforeStratumTriangles));
const auto BeforeConnector=AfterStratum; const auto BeforeConnector=AfterStratum;
const int32 BeforeConnectorTriangles=mesh.Triangles.Num()/3; const int32 BeforeConnectorTriangles=mesh.Triangles.Num()/3;
std::array<std::uint64_t,6> BeforeConnectorColumnCacheStats;
double BeforeConnectorColumnComputeMilliseconds;
if(options.profileMesherStages)
{
const auto& Columns=VoxelForgeCore::Heightfield2D::threadColumnCacheStats();
BeforeConnectorColumnCacheStats={Columns.pointCalls,Columns.columnHits,
Columns.columnMisses,Columns.columnConflictMisses,
Columns.sharedColumnHits,Columns.columnEvaluations};
BeforeConnectorColumnComputeMilliseconds=Columns.columnComputeMilliseconds;
}
const auto ConnectorStart=std::chrono::steady_clock::now(); const auto ConnectorStart=std::chrono::steady_clock::now();
AppendFarConnectorShells(farShape,nativeKey,step,world.CoarseTileCells,mesh); AppendFarConnectorShells(farShape,nativeKey,step,world.CoarseTileCells,mesh);
const auto AfterConnector=FStandaloneShapeWorld::GetThreadClassificationStats(); const auto AfterConnector=FStandaloneShapeWorld::GetThreadClassificationStats();
@@ -1740,6 +2283,24 @@ namespace VoxelForgeCore
std::chrono::steady_clock::now()-ConnectorStart).count(); std::chrono::steady_clock::now()-ConnectorStart).count();
out.diagnostics.farConnectorFieldCalls= out.diagnostics.farConnectorFieldCalls=
AfterConnector.NativeFloatFieldCalls-BeforeConnector.NativeFloatFieldCalls; AfterConnector.NativeFloatFieldCalls-BeforeConnector.NativeFloatFieldCalls;
if(options.profileMesherStages)
{
const auto& Columns=VoxelForgeCore::Heightfield2D::threadColumnCacheStats();
out.diagnostics.farConnectorColumnPointCalls=
Columns.pointCalls-BeforeConnectorColumnCacheStats[0];
out.diagnostics.farConnectorColumnCacheHits=
Columns.columnHits-BeforeConnectorColumnCacheStats[1];
out.diagnostics.farConnectorColumnCacheMisses=
Columns.columnMisses-BeforeConnectorColumnCacheStats[2];
out.diagnostics.farConnectorColumnConflictMisses=
Columns.columnConflictMisses-BeforeConnectorColumnCacheStats[3];
out.diagnostics.farConnectorSharedColumnCacheHits=
Columns.sharedColumnHits-BeforeConnectorColumnCacheStats[4];
out.diagnostics.farConnectorColumnEvaluations=
Columns.columnEvaluations-BeforeConnectorColumnCacheStats[5];
out.diagnostics.farConnectorColumnComputeMilliseconds=
Columns.columnComputeMilliseconds-BeforeConnectorColumnComputeMilliseconds;
}
out.diagnostics.farShellTrianglesAdded+=static_cast<std::uint64_t>( out.diagnostics.farShellTrianglesAdded+=static_cast<std::uint64_t>(
std::max(0,mesh.Triangles.Num()/3-BeforeConnectorTriangles)); std::max(0,mesh.Triangles.Num()/3-BeforeConnectorTriangles));
} }
@@ -1785,6 +2346,11 @@ namespace VoxelForgeCore
out.diagnostics.horizonGroundTrianglesRemoved=GroundStats.RemovedTriangles; out.diagnostics.horizonGroundTrianglesRemoved=GroundStats.RemovedTriangles;
out.diagnostics.horizonCapTriangles=CapStats.Triangles; out.diagnostics.horizonCapTriangles=CapStats.Triangles;
} }
if(impl_->worldAssembly&&!bOverlapsPlayerEdit)
{
AppendStratumBoundaryFloors(world,farShape,nativeKey,step,mesh);
AppendStratumBoundaryCeilings(world,farShape,nativeKey,step,mesh);
}
out.densitySampleCount=static_cast<std::uint64_t>(std::max<int64>(0,sampleCount)); out.densitySampleCount=static_cast<std::uint64_t>(std::max<int64>(0,sampleCount));
if(bHasWorldAssembly) if(bHasWorldAssembly)
@@ -1798,6 +2364,8 @@ namespace VoxelForgeCore
out.diagnostics.columnCacheHits=Columns.columnHits; out.diagnostics.columnCacheHits=Columns.columnHits;
out.diagnostics.columnCacheMisses=Columns.columnMisses; out.diagnostics.columnCacheMisses=Columns.columnMisses;
out.diagnostics.columnCacheConflictMisses=Columns.columnConflictMisses; out.diagnostics.columnCacheConflictMisses=Columns.columnConflictMisses;
out.diagnostics.sharedColumnCacheHits=Columns.sharedColumnHits;
out.diagnostics.columnEvaluations=Columns.columnEvaluations;
out.diagnostics.columnComputeMilliseconds=Columns.columnComputeMilliseconds; out.diagnostics.columnComputeMilliseconds=Columns.columnComputeMilliseconds;
out.diagnostics.columnEvaluationExclusiveMilliseconds=Columns.columnComputeMilliseconds; out.diagnostics.columnEvaluationExclusiveMilliseconds=Columns.columnComputeMilliseconds;
out.diagnostics.classificationMilliseconds=Counts.Milliseconds; out.diagnostics.classificationMilliseconds=Counts.Milliseconds;
+130 -30
View File
@@ -5,6 +5,7 @@
#include "VoxelForgeCore/VoxelForgeCore.h" #include "VoxelForgeCore/VoxelForgeCore.h"
#include <algorithm> #include <algorithm>
#include <atomic>
#include <bit> #include <bit>
#include <charconv> #include <charconv>
#include <chrono> #include <chrono>
@@ -121,6 +122,9 @@ WorldAssemblyFeatureColumnRangeV1 BuildWorldAssemblyFeatureColumnRangeV1(
namespace world_assembly_detail namespace world_assembly_detail
{ {
using FSharedHeightfieldColumnCache =
VoxelForgeCoreShared::TSharedColumnValueCache<HeightfieldPointSample,131072,4>;
// Preserve recipe order without allocating or looking up metadata in the point loop. // Preserve recipe order without allocating or looking up metadata in the point loop.
// Garder l'ordre de recette sans allocation ni recherche de metadonnees par point. // Garder l'ordre de recette sans allocation ni recherche de metadonnees par point.
struct FeatureRange struct FeatureRange
@@ -231,6 +235,9 @@ namespace world_assembly_detail
|| recipe.evaluatorVersion > WorldAssemblyEvaluatorVersion || recipe.evaluatorVersion > WorldAssemblyEvaluatorVersion
|| recipe.unitsPerVoxel != WorldAssemblySubvoxelsPerVoxel) || recipe.unitsPerVoxel != WorldAssemblySubvoxelsPerVoxel)
{ error = "world assembly recipe version, evaluator or fixed scale is unsupported"; return false; } { error = "world assembly recipe version, evaluator or fixed scale is unsupported"; return false; }
if (recipe.layoutChunkWidthSubvoxels <= 0
|| recipe.layoutChunkWidthSubvoxels > 256ll * 512ll)
{ error = "resolved strate-layout chunk width is outside the supported physical range"; return false; }
if (recipe.biomes.empty() || recipe.biomes.size() > MaxBiomeCount) if (recipe.biomes.empty() || recipe.biomes.size() > MaxBiomeCount)
{ error = "world assembly recipe must contain one to eight biome profiles"; return false; } { error = "world assembly recipe must contain one to eight biome profiles"; return false; }
if (recipe.biomeCellSizeSubvoxels <= 0 || recipe.biomeCellSizeSubvoxels > 100000000ll if (recipe.biomeCellSizeSubvoxels <= 0 || recipe.biomeCellSizeSubvoxels > 100000000ll
@@ -292,7 +299,8 @@ namespace world_assembly_detail
return true; return true;
} }
inline bool ValidateStratum(const WorldAssemblyStratumPlanV1& stratum, std::string& error) inline bool ValidateStratum(const WorldAssemblyStratumPlanV1& stratum,
std::int64_t layoutChunkWidthSubvoxels, std::string& error)
{ {
if (stratum.strateIndex < 0 || stratum.topChunkZ < stratum.bottomChunkZ if (stratum.strateIndex < 0 || stratum.topChunkZ < stratum.bottomChunkZ
|| stratum.capWavelengthSubvoxels <= 0 || stratum.capUndulationSubvoxels < 0 || stratum.capWavelengthSubvoxels <= 0 || stratum.capUndulationSubvoxels < 0
@@ -326,9 +334,9 @@ namespace world_assembly_detail
if (feature.type == 2 || feature.type == 4) if (feature.type == 2 || feature.type == 4)
{ {
const std::int64_t stratumMinZ = static_cast<std::int64_t>(stratum.bottomChunkZ) const std::int64_t stratumMinZ = static_cast<std::int64_t>(stratum.bottomChunkZ)
* 32 * WorldAssemblySubvoxelsPerVoxel; * layoutChunkWidthSubvoxels;
const std::int64_t stratumMaxZ = (static_cast<std::int64_t>(stratum.topChunkZ) + 1) const std::int64_t stratumMaxZ = (static_cast<std::int64_t>(stratum.topChunkZ) + 1)
* 32 * WorldAssemblySubvoxelsPerVoxel; * layoutChunkWidthSubvoxels;
constexpr std::int64_t maximumExceptionExtent = 1024 constexpr std::int64_t maximumExceptionExtent = 1024
* WorldAssemblySubvoxelsPerVoxel; * WorldAssemblySubvoxelsPerVoxel;
for (std::size_t axis = 0; axis < 3; ++axis) for (std::size_t axis = 0; axis < 3; ++axis)
@@ -416,6 +424,7 @@ namespace world_assembly_detail
std::uint64_t hash = StartHash(); std::uint64_t hash = StartHash();
HashWord(hash, recipe.schemaVersion, 4); HashWord(hash, recipe.evaluatorVersion, 4); HashWord(hash, recipe.schemaVersion, 4); HashWord(hash, recipe.evaluatorVersion, 4);
HashWord(hash, recipe.unitsPerVoxel, 4); HashWord(hash, recipe.seed, 4); HashWord(hash, recipe.unitsPerVoxel, 4); HashWord(hash, recipe.seed, 4);
HashWord(hash, static_cast<std::uint64_t>(recipe.layoutChunkWidthSubvoxels), 8);
HashWord(hash, static_cast<std::uint64_t>(recipe.biomeCellSizeSubvoxels), 8); HashWord(hash, static_cast<std::uint64_t>(recipe.biomeCellSizeSubvoxels), 8);
HashWord(hash, static_cast<std::uint64_t>(recipe.biomeWarpSubvoxels), 8); HashWord(hash, static_cast<std::uint64_t>(recipe.biomeWarpSubvoxels), 8);
HashWord(hash, static_cast<std::uint64_t>(recipe.biomeWarpWavelengthSubvoxels), 8); HashWord(hash, static_cast<std::uint64_t>(recipe.biomeWarpWavelengthSubvoxels), 8);
@@ -624,6 +633,7 @@ namespace world_assembly_detail
if (!value.IsObject() || !ReadU32(value.Get("schema_version"), recipe.schemaVersion) if (!value.IsObject() || !ReadU32(value.Get("schema_version"), recipe.schemaVersion)
|| !ReadU32(value.Get("evaluator_version"), recipe.evaluatorVersion) || !ReadU32(value.Get("evaluator_version"), recipe.evaluatorVersion)
|| !ReadU32(value.Get("units_per_voxel"), recipe.unitsPerVoxel) || !ReadU32(value.Get("units_per_voxel"), recipe.unitsPerVoxel)
|| !ReadInteger(value.Get("layout_chunk_width_q"), recipe.layoutChunkWidthSubvoxels)
|| !ReadU32(value.Get("seed"), recipe.seed) || !ReadU32(value.Get("seed"), recipe.seed)
|| !ReadInteger(value.Get("biome_cell_size_q"), recipe.biomeCellSizeSubvoxels) || !ReadInteger(value.Get("biome_cell_size_q"), recipe.biomeCellSizeSubvoxels)
|| !ReadInteger(value.Get("biome_warp_q"), recipe.biomeWarpSubvoxels) || !ReadInteger(value.Get("biome_warp_q"), recipe.biomeWarpSubvoxels)
@@ -689,6 +699,7 @@ namespace world_assembly_detail
out << "{\"schema_version\":" << recipe.schemaVersion out << "{\"schema_version\":" << recipe.schemaVersion
<< ",\"evaluator_version\":" << recipe.evaluatorVersion << ",\"evaluator_version\":" << recipe.evaluatorVersion
<< ",\"units_per_voxel\":" << recipe.unitsPerVoxel << ",\"units_per_voxel\":" << recipe.unitsPerVoxel
<< ",\"layout_chunk_width_q\":" << recipe.layoutChunkWidthSubvoxels
<< ",\"seed\":" << recipe.seed << ",\"seed\":" << recipe.seed
<< ",\"biome_cell_size_q\":" << recipe.biomeCellSizeSubvoxels << ",\"biome_cell_size_q\":" << recipe.biomeCellSizeSubvoxels
<< ",\"biome_warp_q\":" << recipe.biomeWarpSubvoxels << ",\"biome_warp_q\":" << recipe.biomeWarpSubvoxels
@@ -857,7 +868,8 @@ namespace world_assembly_detail
|| !ReadI32(islandValue.Get("bottom_chunk_z"), entry.bottomChunkZ)) || !ReadI32(islandValue.Get("bottom_chunk_z"), entry.bottomChunkZ))
{ error = "world assembly floating-island slot is missing its resolved strate bounds"; return std::nullopt; } { error = "world assembly floating-island slot is missing its resolved strate bounds"; return std::nullopt; }
const std::string nestedJson = JsonText(islandValue.Get("manifest")); const std::string nestedJson = JsonText(islandValue.Get("manifest"));
auto parsedIsland = FloatingIslandManifestV1::FromJson(nestedJson, error); auto parsedIsland = FloatingIslandManifestV1::FromJson(
nestedJson, error, manifest.recipe.layoutChunkWidthSubvoxels);
if (!parsedIsland) return std::nullopt; if (!parsedIsland) return std::nullopt;
entry.manifest = std::move(*parsedIsland); entry.manifest = std::move(*parsedIsland);
manifest.floatingIslands.push_back(std::move(entry)); manifest.floatingIslands.push_back(std::move(entry));
@@ -1031,6 +1043,7 @@ namespace world_assembly_detail
// Audit-only override; normal tile generation resets this to zero before evaluating a recipe. // Audit-only override; normal tile generation resets this to zero before evaluating a recipe.
// Surcharge reservee aux mesures; la generation remet zero avant d'evaluer une recette. // Surcharge reservee aux mesures; la generation remet zero avant d'evaluer une recette.
inline thread_local std::uint32_t HeightfieldColumnOctaveDrop = 0; inline thread_local std::uint32_t HeightfieldColumnOctaveDrop = 0;
inline thread_local std::int64_t HeightfieldColumnInterpolationStrideSubvoxels = 0;
inline std::int32_t FractalNoiseQ16(std::int64_t xQ16, std::int64_t yQ16, inline std::int32_t FractalNoiseQ16(std::int64_t xQ16, std::int64_t yQ16,
std::int64_t zQ16, std::uint32_t octaves, bool ridged = false) std::int64_t zQ16, std::uint32_t octaves, bool ridged = false)
@@ -1374,6 +1387,9 @@ namespace world_assembly_detail
std::array<std::uint8_t, HeightfieldColumnCacheSetCount>> HeightfieldColumnCacheNextWay; std::array<std::uint8_t, HeightfieldColumnCacheSetCount>> HeightfieldColumnCacheNextWay;
inline thread_local HeightfieldColumnCacheStats HeightfieldColumnStats{}; inline thread_local HeightfieldColumnCacheStats HeightfieldColumnStats{};
inline thread_local bool HeightfieldColumnCacheLegacyDirectMapped=false; inline thread_local bool HeightfieldColumnCacheLegacyDirectMapped=false;
inline thread_local std::array<std::int64_t,4> HeightfieldColumnCaptureBounds{};
inline thread_local bool HeightfieldColumnCaptureBoundsValid=false;
inline std::atomic<std::uint64_t> HeightfieldColumnCaptureSequence{0};
inline std::size_t HeightfieldColumnCacheSet(const WorldAssemblyRecipeV1& recipe, inline std::size_t HeightfieldColumnCacheSet(const WorldAssemblyRecipeV1& recipe,
const WorldAssemblyStratumPlanV1& plan,std::int64_t x,std::int64_t y) noexcept const WorldAssemblyStratumPlanV1& plan,std::int64_t x,std::int64_t y) noexcept
@@ -1506,6 +1522,43 @@ namespace world_assembly_detail
inline HeightfieldPointSample CachedColumn(const WorldAssemblyRecipeV1& recipe, inline HeightfieldPointSample CachedColumn(const WorldAssemblyRecipeV1& recipe,
const WorldAssemblyStratumPlanV1& plan,std::int64_t x,std::int64_t y) const WorldAssemblyStratumPlanV1& plan,std::int64_t x,std::int64_t y)
{ {
const std::int64_t InterpolationStride=HeightfieldColumnInterpolationStrideSubvoxels;
if(InterpolationStride>0)
{
const std::int64_t X0=FloorDiv(x,InterpolationStride)*InterpolationStride;
const std::int64_t Y0=FloorDiv(y,InterpolationStride)*InterpolationStride;
const std::int64_t X1=X0+InterpolationStride,Y1=Y0+InterpolationStride;
const std::int64_t Fx=x-X0,Fy=y-Y0;
struct FScopedInterpolationSampling
{
std::int64_t Previous=HeightfieldColumnInterpolationStrideSubvoxels;
~FScopedInterpolationSampling()
{HeightfieldColumnInterpolationStrideSubvoxels=Previous;}
} SamplingScope;
HeightfieldColumnInterpolationStrideSubvoxels=0;
const HeightfieldPointSample C00=CachedColumn(recipe,plan,X0,Y0);
const HeightfieldPointSample C10=CachedColumn(recipe,plan,X1,Y0);
const HeightfieldPointSample C01=CachedColumn(recipe,plan,X0,Y1);
const HeightfieldPointSample C11=CachedColumn(recipe,plan,X1,Y1);
const auto Lerp=[&](std::int64_t A,std::int64_t B,std::int64_t T)
{return A+((B-A)*T)/InterpolationStride;};
const auto Bilinear=[&](std::int64_t A,std::int64_t B,
std::int64_t C,std::int64_t D)
{
const std::int64_t Top=Lerp(A,B,Fx),Bottom=Lerp(C,D,Fx);
return Lerp(Top,Bottom,Fy);
};
HeightfieldPointSample Out=C00;
Out.groundHeightSubvoxels=Bilinear(C00.groundHeightSubvoxels,
C10.groundHeightSubvoxels,C01.groundHeightSubvoxels,
C11.groundHeightSubvoxels);
Out.capHeightSubvoxels=Bilinear(C00.capHeightSubvoxels,
C10.capHeightSubvoxels,C01.capHeightSubvoxels,
C11.capHeightSubvoxels);
return Out;
}
if(HeightfieldColumnOctaveDrop!=0)
return EvaluateColumn(recipe,plan,x,y);
auto& cache=HeightfieldColumnCache.Get(); auto& cache=HeightfieldColumnCache.Get();
auto& nextWay=HeightfieldColumnCacheNextWay.Get(); auto& nextWay=HeightfieldColumnCacheNextWay.Get();
HeightfieldColumnCacheEntry* replacement=nullptr; HeightfieldColumnCacheEntry* replacement=nullptr;
@@ -1549,22 +1602,46 @@ namespace world_assembly_detail
replacement=&cache[first+replacementWay]; replacement=&cache[first+replacementWay];
} }
auto& entry=*replacement; auto& entry=*replacement;
const auto start=std::chrono::steady_clock::now();
HeightfieldPointSample column=EvaluateColumn(recipe,plan,x,y);
HeightfieldColumnStats.columnComputeMilliseconds+=std::chrono::duration<double,std::milli>(
std::chrono::steady_clock::now()-start).count();
++HeightfieldColumnStats.columnMisses; ++HeightfieldColumnStats.columnMisses;
if(HeightfieldColumnStats.captureCoordinates&&HeightfieldColumnStats.coordinateCaptureComplete) const auto compute=[&]()
{ {
try const std::uint64_t sequence=HeightfieldColumnStats.captureCoordinates
?HeightfieldColumnCaptureSequence.fetch_add(1,std::memory_order_relaxed):0;
const auto start=std::chrono::steady_clock::now();
HeightfieldPointSample result=EvaluateColumn(recipe,plan,x,y);
HeightfieldColumnStats.columnComputeMilliseconds+=std::chrono::duration<double,std::milli>(
std::chrono::steady_clock::now()-start).count();
++HeightfieldColumnStats.columnEvaluations;
if(HeightfieldColumnStats.captureCoordinates
&&HeightfieldColumnStats.coordinateCaptureComplete)
{ {
HeightfieldColumnStats.evaluatedCoordinates.push_back({x,y}); try
} {
catch(...) const bool outside=HeightfieldColumnCaptureBoundsValid
{ &&(x<HeightfieldColumnCaptureBounds[0]||x>HeightfieldColumnCaptureBounds[2]
HeightfieldColumnStats.coordinateCaptureComplete=false; ||y<HeightfieldColumnCaptureBounds[1]||y>HeightfieldColumnCaptureBounds[3]);
HeightfieldColumnStats.evaluatedCoordinates.push_back({x,y,sequence,outside});
}
catch(...)
{
HeightfieldColumnStats.coordinateCaptureComplete=false;
}
} }
return result;
};
HeightfieldPointSample column{};
if(auto* shared=FSharedHeightfieldColumnCache::threadActive())
{
const VoxelForgeCoreShared::FColumnCacheKey key{
static_cast<std::uint64_t>(reinterpret_cast<std::uintptr_t>(&recipe)),
recipe.contentHash,
static_cast<std::uint64_t>(reinterpret_cast<std::uintptr_t>(&plan)),
plan.contentHash,x,y};
bool computed=false;
column=shared->getOrCompute(key,compute,computed);
if(!computed)++HeightfieldColumnStats.sharedColumnHits;
} }
else column=compute();
entry={&recipe,&plan,recipe.contentHash,plan.contentHash,x,y,column}; entry={&recipe,&plan,recipe.contentHash,plan.contentHash,x,y,column};
return column; return column;
} }
@@ -1682,15 +1759,15 @@ bool WorldAssemblyManifest::finalize(std::string& error)
{ error = "SurfaceWorld stratum recipe seed does not match the world assembly season seed"; return false; } { error = "SurfaceWorld stratum recipe seed does not match the world assembly season seed"; return false; }
stratum.recipeOverride.contentHash = world_assembly_detail::HashRecipe(stratum.recipeOverride); stratum.recipeOverride.contentHash = world_assembly_detail::HashRecipe(stratum.recipeOverride);
} }
if (!world_assembly_detail::ValidateStratum(stratum, error)) return false; if (!world_assembly_detail::ValidateStratum(stratum, recipe.layoutChunkWidthSubvoxels, error)) return false;
if (recipe.evaluatorVersion >= 4) if (recipe.evaluatorVersion >= 4)
{ {
if (stratum.routeConstraints.version != 1 || stratum.route.size() < 2) if (stratum.routeConstraints.version != 1 || stratum.route.size() < 2)
{ error = "world assembly evaluator 4 requires a versioned entrance-to-exit route"; return false; } { error = "world assembly evaluator 4 requires a versioned entrance-to-exit route"; return false; }
const std::int64_t bottomZ = static_cast<std::int64_t>(stratum.bottomChunkZ) const std::int64_t bottomZ = static_cast<std::int64_t>(stratum.bottomChunkZ)
* 32 * WorldAssemblySubvoxelsPerVoxel; * recipe.layoutChunkWidthSubvoxels;
const std::int64_t topZ = (static_cast<std::int64_t>(stratum.topChunkZ) + 1) const std::int64_t topZ = (static_cast<std::int64_t>(stratum.topChunkZ) + 1)
* 32 * WorldAssemblySubvoxelsPerVoxel; * recipe.layoutChunkWidthSubvoxels;
const std::int64_t halfHeight = stratum.routeConstraints.capsuleHeightSubvoxels / 2; const std::int64_t halfHeight = stratum.routeConstraints.capsuleHeightSubvoxels / 2;
for (const auto& point : stratum.route) for (const auto& point : stratum.route)
{ {
@@ -1720,14 +1797,12 @@ bool WorldAssemblyManifest::finalize(std::string& error)
const auto& Scale = islands.manifest.recipe; const auto& Scale = islands.manifest.recipe;
if (Scale.ownerToCoreScaleNumerator == 0 || Scale.ownerToCoreScaleDenominator == 0) if (Scale.ownerToCoreScaleNumerator == 0 || Scale.ownerToCoreScaleDenominator == 0)
{ error = "floating-island owner-to-Core scale is invalid"; return false; } { error = "floating-island owner-to-Core scale is invalid"; return false; }
const double CoreVoxelsPerOwnerChunk = static_cast<double>(CoreTileVoxelCount) if(Scale.layoutChunkWidthSubvoxels<=0)
* Scale.ownerToCoreScaleNumerator / Scale.ownerToCoreScaleDenominator; {error="floating-island strate has no resolved layout chunk width";return false;}
const std::int64_t bottomQ = static_cast<std::int64_t>(std::llround( const std::int64_t bottomQ = static_cast<std::int64_t>(islands.bottomChunkZ)
static_cast<double>(islands.bottomChunkZ) * CoreVoxelsPerOwnerChunk *Scale.layoutChunkWidthSubvoxels;
* WorldAssemblySubvoxelsPerVoxel)); const std::int64_t topQ = (static_cast<std::int64_t>(islands.topChunkZ)+1)
const std::int64_t topQ = static_cast<std::int64_t>(std::llround( *Scale.layoutChunkWidthSubvoxels;
static_cast<double>(static_cast<std::int64_t>(islands.topChunkZ) + 1)
* CoreVoxelsPerOwnerChunk * WorldAssemblySubvoxelsPerVoxel));
if (islands.manifest.recipe.layoutMinimumZSubvoxels < bottomQ if (islands.manifest.recipe.layoutMinimumZSubvoxels < bottomQ
|| islands.manifest.recipe.layoutMaximumZSubvoxels > topQ) || islands.manifest.recipe.layoutMaximumZSubvoxels > topQ)
{ error = "floating-island recipe layout escapes the resolved owner strate bounds"; return false; } { error = "floating-island recipe layout escapes the resolved owner strate bounds"; return false; }
@@ -1931,7 +2006,7 @@ std::array<std::int64_t,2> Heightfield2D::capHeightBounds() const noexcept
if(recipe_->evaluatorVersion>=5) if(recipe_->evaluatorVersion>=5)
{ {
const long double TopSubvoxels=(static_cast<long double>(plan_->topChunkZ)+1.0L) const long double TopSubvoxels=(static_cast<long double>(plan_->topChunkZ)+1.0L)
*CoreTileVoxelCount*WorldAssemblySubvoxelsPerVoxel; *recipe_->layoutChunkWidthSubvoxels;
Minimum=std::min(Minimum,TopSubvoxels); Minimum=std::min(Minimum,TopSubvoxels);
Maximum=std::min(Maximum,TopSubvoxels); Maximum=std::min(Maximum,TopSubvoxels);
} }
@@ -1950,7 +2025,7 @@ std::int64_t Heightfield2D::farSurfaceCapHeightSubvoxels(std::int64_t x,
// Clip only the far render surface. Keep the near density evaluator bit-identical. // Clip only the far render surface. Keep the near density evaluator bit-identical.
// Borner uniquement le plafond lointain. L'evaluateur de densite proche reste identique. // Borner uniquement le plafond lointain. L'evaluateur de densite proche reste identique.
const std::int64_t ownedUpperBoundary=(static_cast<std::int64_t>(plan_->topChunkZ)+1) const std::int64_t ownedUpperBoundary=(static_cast<std::int64_t>(plan_->topChunkZ)+1)
*CoreTileVoxelCount*WorldAssemblySubvoxelsPerVoxel; *recipe_->layoutChunkWidthSubvoxels;
return std::min(column.capHeightSubvoxels,ownedUpperBoundary); return std::min(column.capHeightSubvoxels,ownedUpperBoundary);
} }
@@ -2049,15 +2124,40 @@ void Heightfield2D::resetThreadColumnCacheStats(bool captureCoordinates, bool cl
Stats.columnHits=0; Stats.columnHits=0;
Stats.columnMisses=0; Stats.columnMisses=0;
Stats.columnConflictMisses=0; Stats.columnConflictMisses=0;
Stats.sharedColumnHits=0;
Stats.columnEvaluations=0;
Stats.columnComputeMilliseconds=0.0; Stats.columnComputeMilliseconds=0.0;
Stats.captureCoordinates=captureCoordinates; Stats.captureCoordinates=captureCoordinates;
Stats.coordinateCaptureComplete=true; Stats.coordinateCaptureComplete=true;
Stats.evaluatedCoordinates.clear(); Stats.evaluatedCoordinates.clear();
world_assembly_detail::HeightfieldColumnCaptureBoundsValid=false;
}
void Heightfield2D::setThreadColumnCaptureBounds(std::int64_t minimumXSubvoxels,
std::int64_t minimumYSubvoxels,std::int64_t maximumXSubvoxels,
std::int64_t maximumYSubvoxels) noexcept
{
world_assembly_detail::HeightfieldColumnCaptureBounds={minimumXSubvoxels,
minimumYSubvoxels,maximumXSubvoxels,maximumYSubvoxels};
world_assembly_detail::HeightfieldColumnCaptureBoundsValid=true;
} }
void Heightfield2D::setThreadColumnCacheLegacyDirectMapped(bool enabled) noexcept void Heightfield2D::setThreadColumnCacheLegacyDirectMapped(bool enabled) noexcept
{ world_assembly_detail::HeightfieldColumnCacheLegacyDirectMapped=enabled; } { world_assembly_detail::HeightfieldColumnCacheLegacyDirectMapped=enabled; }
void Heightfield2D::setThreadColumnOctaveDrop(std::uint32_t octaveDrop) noexcept
{ world_assembly_detail::HeightfieldColumnOctaveDrop=octaveDrop; }
std::uint32_t Heightfield2D::threadColumnOctaveDrop() noexcept
{ return world_assembly_detail::HeightfieldColumnOctaveDrop; }
void Heightfield2D::setThreadColumnInterpolationStrideSubvoxels(std::int64_t stride) noexcept
{ world_assembly_detail::HeightfieldColumnInterpolationStrideSubvoxels=std::max<std::int64_t>(0,stride); }
std::int64_t Heightfield2D::threadColumnInterpolationStrideSubvoxels() noexcept
{ return world_assembly_detail::HeightfieldColumnInterpolationStrideSubvoxels; }
const HeightfieldColumnCacheStats& Heightfield2D::threadColumnCacheStats() noexcept const HeightfieldColumnCacheStats& Heightfield2D::threadColumnCacheStats() noexcept
{ return world_assembly_detail::HeightfieldColumnStats; } { return world_assembly_detail::HeightfieldColumnStats; }
@@ -2204,8 +2304,8 @@ FieldInfluenceBounds Heightfield2D::influenceBounds() const noexcept
{ {
FieldInfluenceBounds out; FieldInfluenceBounds out;
if (!isValid()) return out; if (!isValid()) return out;
out.minimumZSubvoxels = static_cast<std::int64_t>(plan_->bottomChunkZ) * 32 * WorldAssemblySubvoxelsPerVoxel; out.minimumZSubvoxels = static_cast<std::int64_t>(plan_->bottomChunkZ) * recipe_->layoutChunkWidthSubvoxels;
out.maximumZSubvoxels = (static_cast<std::int64_t>(plan_->topChunkZ) + 1) * 32 * WorldAssemblySubvoxelsPerVoxel; out.maximumZSubvoxels = (static_cast<std::int64_t>(plan_->topChunkZ) + 1) * recipe_->layoutChunkWidthSubvoxels;
return out; return out;
} }
@@ -0,0 +1,263 @@
# VoxelForge strata, units, and generation layers
**Design round L20 — 2026-10-20**
## Summary
Author strate layout in metres and give each strate a voxel size. Keep Core's internal tile at 32³
voxels; its physical width follows that strate's voxel size and the tile's LOD. Use one director to
resolve the season, layout, seed, generator recipe, resolution, and interfaces before workers start.
Generators then evaluate an immutable, common field contract. A shared composition layer applies
strata boundaries, gaps, seals, edits, caches, and proofs. The mesher consumes that composed field
and generic surface hints; it should not branch on SurfaceWorld, FloatingIslands, or feature type IDs.
The code already has parts of this shape, but not the boundaries between them. In particular,
`FStandaloneShapeWorld` is both a dispatch layer and a collection of field adapters, while
`World::generateTile` contains generator-aware far-surface and feature refinement. The Unreal
adapter currently translates two different meanings of “chunk” into Core coordinates.
The L19 ledges are not explained by a different density recipe per LOD. The ring audit found
upward-facing terrain from the same lower SurfaceWorld field at different extracted heights on
adjacent LODs. At the default 25 cm Core voxel size, LOD1, LOD2, and LOD3 sample at 0.5 m, 1 m,
and 2 m. The maximum LOD1→2 ring difference is 1.49862 m; LOD2→3 reaches 7.73318 m, with 8
no-hit samples among 308. An explicit shared surface contract can give all LODs common boundary
geometry and a controlled transition band. A planar ceiling alone will not fix these ground ledges.
One conversion issue needs an explicit preservation target. The current Core path maps one
SurfaceWorld slot chunk to 32 Core voxels (8 m at 25 cm), but one FloatingIslands slot chunk to
32 owner voxels at 12.5 cm (4 m). Converting each current interpretation independently into metres
can preserve each field's current positions, but it does not make shared chunk indices one common
physical boundary. The converter must record the actual per-strate bounds and any resulting gap or
overlap before choosing a unified interface. Do not promise a no-movement migration from a single
global “metres per chunk” constant.
Metres are not a runtime cost concern. Resolution is. Halving voxel spacing in all three axes means
about eight times as many density samples for the same physical volume, plus more tiles, queue work,
and cache entries because each internal tile remains 32³ voxels. With 25 cm as the default for all
strates, the proposed starting resolution matches today's Core sampling resolution.
## 1. Current code mapped to the three layers
There is no single class called “director” today. The director work is split between Unreal's
season/layout code, the Core adapter, and Core's tile scheduler.
| Intended layer | Current location and symbols | Current responsibility and boundary issue |
|---|---|---|
| **Director / orchestrator** | `VoxelStrateComposer.cpp`; `VoxelSeasonManifest.cpp`; `VoxelStrateManager.cpp` (`Initialize`, `GetGeneratorTypeForChunk`, `GetGenerationParams`); `VoxelWorld.cpp` (`BuildDesiredTiles`, tile scheduling, epochs); `VoxelForgeCoreAdapter.cpp` (`BuildSurfaceStratumPlan`, `BuildFloatingIslandStratumPlan`, `AttachValidatedWorldAssembly`) | Composes season params and stacked slots, resolves generator kind and seed, and serializes the Core snapshot. `WorldAssemblyManifest`, `WorldAssemblyPlanV1`, and their `FromJson`/`finalize`/`validate` functions in `WorldAssemblerInternal.h` are the current plan/manifest format. Resolution and bounds are not fully resolved here: Core re-derives them using generator-specific conversions. `TopWorldZ`, `BottomWorldZ`, `HeightInChunks`, and `InterStrateGapChunks` remain chunk/voxel-coordinate based in owner-facing data. |
| **Generators** | SurfaceWorld: `Heightfield2D` in `VoxelForgeCore.h` and `WorldAssemblerInternal.h`; plan construction in `VoxelForgeCoreAdapter.cpp`. FloatingIslands: `FloatingIslandFieldV1` in `VoxelForgeCore.h` and `FloatingIslandsInternal.h`; plan construction in the adapter. Legacy: `UVoxelGenerator::GetDensityAt` in `VoxelGenerator.cpp`, `VoxelDensityOpStack.cpp`, and `VoxelCaveMorphology.cpp`. | SurfaceWorld and FloatingIslands have distinct plan and evaluator APIs. Legacy generation still asks the manager for the current chunk's params and generator type. In Core, the “generator” boundary is obscured by `FStandaloneShapeWorld`, which selects native fields or falls back to the copied owner generator. |
| **Shared field / composition library** | Noise and fixed-point evaluation: `WorldAssemblerInternal.h`, `FloatingIslandsInternal.h`. CPU/HLSL far-field math: `VoxelForgeFieldShared.h`. FP contract: `CoreNamespacePreamble.h`. Feature culling and caches: `BuildWorldAssemblyFeatureTileListV1`, `ScopedWorldAssemblyFeatureQueriesV1`, `SharedColumnCache.h`, `ThreadLocalStorage.h`. Field bounds/proofs: `Heightfield2D::interval`, FloatingIslands bounds, `FStandaloneShapeWorld::ClassifyBoxDetailed` and `BuildShapeDependencyProof`. Density seals: `VoxelDensityPrimitives.h`. | Useful shared pieces exist, but only for subsets of recipes. Noise is not one library used by every legacy and native generator. Bounds, density, and output identity still use subvoxels of a Core voxel. The canonical stratum bounds descriptor `FResolvedStratumBounds` is private to `ShapeWorldInternal.h`, not part of the plan contract. `AppendStratumBoundaryCeilings` is under far-shell/meshing code, even though the boundary meaning is shared composition policy. |
| **Mesher** | `UVoxelMarchingCubesMesher::GenerateMesh` in `VoxelMarchingCubesMesher.cpp`; dispatch and mesh assembly in `World::generateTile` in `VoxelForgeCore.cpp`; `FarShellsInternal.h`; hybrid sharp support in `VoxelHybridSharpMesher.h` and `VoxelMarchingCubesMesher.cpp`. | MC, skirts, far shells, connector repair panels, LOD refinement, and cap repair are spread across the production mesher and Core tile builder. `World::generateTile` scans recipe feature type IDs, refines type-4 shelves only at LOD0–2, selects a native SurfaceWorld horizon, and invokes separate ground/cap repair. `FStandaloneShapeWorld::BuildFarFieldTileInput` constructs FloatingIslands connector panels. These are recipe-aware mesh paths. |
### What crosses a boundary today that should not
- `FStandaloneShapeWorld` reads `UVoxelStrateManager`, `FStrateSlot`, `WorldAssemblyManifest`, legacy
generator params, and generator type. It selects a recipe, evaluates a field, resolves its bounds,
applies a seal, and builds GPU far-field input. That combines director, generator adapter, shared
field, and renderer responsibilities.
- `World::generateTile` knows `WorldAssemblyPlanV1`, SurfaceWorld heightfields, feature numeric IDs,
and FloatingIslands presence. The generic mesher should receive capabilities and surface data,
not know those recipe identities.
- The adapter exports one layout but encodes physical positions in `WorldAssemblySubvoxelsPerVoxel`.
That makes a physical length's fixed integer depend on the selected Core voxel size.
- Core `WorldAssemblyStratumPlanV1` carries `topChunkZ`/`bottomChunkZ`; validation in
`WorldAssemblerInternal.h` multiplies those values by `32`. FloatingIslands additionally stores
its own owner-to-Core size ratio and metric-equivalent bounds in Core-voxel units.
- The Core boundary path calls `GetResolvedStratumBounds` differently for SurfaceWorld and
FloatingIslands. The director should resolve a single physical boundary record once.
- Legacy density still reaches into manager-owned params and operations. It must become a generator
adapter that consumes the same resolved request as a native recipe, or remain explicitly marked as
a compatibility route until it can be ported.
## 2. Violations, ranked by risk
Rank 1 is the highest risk to correct physical layout and cross-LOD output.
| Rank | Risk | Violation and evidence | Why it matters |
|---:|---|---|---|
| 1 | **Critical** | **No single physical bounds/interface contract.** `FResolvedStratumBounds` in `ShapeWorldInternal.h` derives SurfaceWorld bounds from `Slot.*ChunkZ × 32`, but derives native FloatingIslands bounds from `layout*ZSubvoxels` and an owner/Core scale ratio. `GetResolvedStratumBounds` is then reused by field classification, far-field protection, and far ceiling generation. | A shared logical slot boundary can map to different metre positions depending on generator. This can make an apparent seam a gap, overlap, or misplaced terrain surface before the mesher samples it. It also makes “preserve the old heights” ambiguous unless the old per-field physical bounds are recorded. |
| 2 | **Critical** | **LOD extraction has no required shared surface representation.** `World::generateTile` uses normal MC sampling for LOD1–3; native SurfaceWorld ground refinement is only invoked at LOD4+. L19's strict ring probe excludes skirts and masked triangles and measured 149.862 cm max at LOD1→2 and 773.318 cm max at LOD2→3. | A coordinate-stable density function does not guarantee equal extracted surfaces when sample grids differ. Thin seals can be skipped, and a heightfield root can shift with coarse XY/Z samples. This is the measured ledge failure. |
| 3 | **High** | **Chunk, owner-voxel, Core-voxel, and fixed-point units are mixed.** `WorldAssemblyFixed` in the Unreal adapter serializes lengths as 1/256 Core voxel. SurfaceWorld plan bounds use `Slot.BottomChunkZ * 32` and `(TopChunkZ-BottomChunkZ+1)*32`. FloatingIslands uses `32 × ownerToCoreScaleNumerator / denominator`. `ShapeWorldInternal.h` reverses Core Z to legacy chunk coordinates with `/ GetCoreVoxelsPerOwnerChunk()`. | A parameter's physical interpretation depends on generator and runtime Core size. `/32`, `*32`, and scale-ratio logic are reasonable only in a single boundary adapter or for the internal fixed tile; they are incorrect as the authored layout contract. |
| 4 | **High** | **The Unreal adapter and manager both resolve the same layout.** `VoxelStrateManager.cpp` creates chunk slots and per-generator runtime params; `VoxelForgeCoreAdapter.cpp` re-reads those params and builds distinct native plans; `ShapeWorldInternal.h` maps Core samples back through the manager again. `WorldAssemblyStratumPlanV1::topChunkZ/bottomChunkZ` are checked against the manager in `AttachValidatedWorldAssembly`. | The runtime can validate matching integer slots without validating that the resulting physical bounds mean the same thing for both generators. The future adapter should serialize already-resolved metres and per-strate resolution. |
| 5 | **High** | **Generators read director state.** Legacy `UVoxelGenerator::GetDensityAt` asks the manager for type/params and builds/refetches operator stacks. Core native lookup also asks the manager which generator applies at a Core sample. | The generator cannot be a pure evaluator of a resolved recipe. It is hard to cache, audit, or replay independently, and unit conversion is repeated in worker code. |
| 6 | **High** | **Boundary behavior is split between recipe and shared paths.** FloatingIslands geometry v3 special-cases top seal evaluation in `NativeFloatingIslandDensityAt`; older geometry versions retain two-sided seals. `VF_ApplyBoundarySeal`/`VF_ApplyUpperBoundarySeal` provide shared density math, while `AppendStratumBoundaryCeilings` separately patches missing mesh coverage. SurfaceWorld also owns a heightfield cap. | Density closure, boundary ownership, and visible cap geometry can disagree. A shared operator alone does not guarantee a shared, LOD-stable surface. Preserve versioned historical fields during migration, then route new plans through one contract. |
| 7 | **Medium-high** | **Mesher contains recipe policy.** `World::generateTile` has SurfaceWorld native-horizon selection, a SurfaceWorld-only far skip condition, type-2 sharp boxes, type-4 shelf refinement, separate native ground/cap refinement, and a `farHorizonVersion` identity. `ShapeWorldInternal.h` creates connector panel repairs from FloatingIslands. | A new recipe requires mesher edits and generator details leak into extraction. The mesher should consume explicit surfaces, generic feature constraints, and a requested error/refinement hint. |
| 8 | **Medium-high** | **Legacy paths do not share the new generator format.** `UVoxelGenerator`, operator stacks, morphology caches, Core's native `Heightfield2D`, and `FloatingIslandFieldV1` have separate recipe/parameter routes. | “One generator format” is not yet true. A migration wrapper is needed so behavior can be ported in small, hash-checked steps instead of reimplementing all legacy archetypes at once. |
| 9 | **Medium** | **Shared helpers and numeric policies are partial.** Core's FP preamble/self-test applies to Core translation units; fixed-point noise is implemented in assembler code, island noise is in a separate implementation, and far CPU/HLSL math has its own shared header. Feature bounds/caches are more reusable than the field interfaces. | Keep the tested Core determinism contract, but promote the shared numeric/noise primitives only where their exact semantics can be versioned. “Shared” code is not automatically cross-platform identical if separate float evaluators remain. |
### Unit measurements relevant to migration
`CHUNK_SIZE` is 32 and `VOXEL_SIZE` is 12.5 cm, so the owner's legacy chunk is 4 m
([`VoxelTypes.h`](../Source/VoxelForge/Public/VoxelTypes.h), [`Round5`](Research/WorldAssemblerM3/Round5/REPORT.md)). The current default Core voxel is 25 cm. In the current native Core routes:
| Route | Current conversion | Physical chunk width at default | Evidence |
|---|---|---:|---|
| SurfaceWorld | `32` Core voxels per slot chunk | 8 m | `BuildSurfaceStratumPlan` uses chunk bounds directly in Core voxel units; L18 records the preserved `topChunkZ × 32` mapping. |
| FloatingIslands | `32 × 125000/250000 = 16` Core voxels per owner chunk | 4 m | `BuildFloatingIslandStratumPlan` serializes the ratio and applies it to layout bounds; `GetCoreVoxelsPerOwnerChunk` uses the same ratio. |
This confirms the claimed factor of two. It does **not** prove that this conversion alone caused
the L19 ring delta. L19 isolated the observed step to coarse extraction of lower SurfaceWorld
terrain, and the reported LOD4+ horizon refiner cannot affect those LOD1→2 and LOD2→3 values.
## 3. Generator contract and one-time interface handling
### What the director resolves before generation
The director should publish an immutable `ResolvedWorld` (exact type/schema is an implementation
choice) containing:
- a stable world/season identity and seed;
- an ordered list of strates with a stable ID, generator kind and recipe version;
- each strate's physical minimum and maximum bounds in metres, including height as their difference;
- a voxel size in metres per strate (25 cm default for every strate);
- route points, island anchors/connectors, and all top/bottom/ceiling positions in the same physical
coordinate space;
- one resolved interface record per adjacent pair, including any explicit void, bedrock gap,
sealed contact, upper cap, passage, or open boundary;
- any season-level values that affect world output, such as routes, islands, water datum, or biome
selection, already attached to their owning strate or interface;
- a canonical identity over the sorted resolved layout, seed, resolution map, recipes, and interface
records.
Do not make generators ask the director for the active `FStrateSlot`, chunk number, season, or
neighbour generator while evaluating a point.
### Request to every generator
A worker request should give the generator:
1. The immutable resolved recipe and stable stratum ID.
2. Physical query/tile bounds in metres, including the exact halo requested by the mesher.
3. The canonical sample coordinates or a clearly defined lattice origin and step. Voxel coordinates
are useful as an internal derived lattice, but metres/physical fixed units are the identity space.
4. The resolved per-strate voxel size and seed. LOD can be included as a sampling hint; the canonical
field value itself must not change just because the caller chose another LOD.
5. Read-only interface descriptors that touch the request bounds. Pass boundary records, not a
pointer back to the neighbour's manager or mutable generator.
### Result from every generator
The common result should provide a deterministic field evaluator and its declared capabilities:
- signed density using one documented solid/air sign convention;
- optional material or surface-class data;
- conservative interval/classification proofs and conservative feature/influence bounds, or an
explicit “unknown, evaluate” result;
- optional semantic 2D surfaces such as a ground heightfield or a cap, in physical coordinates;
- a detail envelope / maximum safe sample spacing hint. It is a hint to generic LOD/refinement
policy, not permission for a recipe to choose its own mesh path;
- generator/schema/evaluator versions for stable plan and output identity.
Keep the established fail-open behavior: an unknown interval or influence bound causes evaluation,
not a solid/air skip. Existing feature candidate lists and worker caches fit this contract as
optimizations beneath the evaluator.
### Interfaces, seals, caps, and voids belong to shared composition
The director resolves the meaning and exact physical location of each interface once. The shared
composition layer then combines generator fields and applies boundary semantics in a fixed order:
1. Evaluate each generator only for its declared physical domain, retaining its ordinary
field/feature behavior.
2. Apply the interface contract once: for example, a physically measured seal band, a cap surface,
open void, bedrock gap, or permitted passage. The contract declares ownership, sidedness, material
class, collision/support policy, and whether player edits may cut it. A gap is data, not an
accidental “no generator found” branch.
3. Apply world edits through the canonical composed field, so both sides see the same edit in
physical space.
4. Give the resulting field, proofs, and any explicit surfaces to the mesher.
This centralizes the semantics currently spread across generator density wrappers,
`FResolvedStratumBounds`, and `AppendStratumBoundaryCeilings`. Existing versioned manifests still
need compatibility adapters: do not silently reinterpret old `boundarySealSubvoxels` values.
For two different generator kinds that meet at a plane, both should reference the same stable
interface ID and exact physical boundary. Their density fields can remain independent; shared
composition owns the boundary rule. If the plan intentionally has open space between them, the
resolved layout records that metre-valued interval explicitly.
## 4. Why LOD changes thin features, and the interface surface contract
MC samples density at lattice corners. A thin seal or cap can be narrower than one coarse cell, so
the coarse grid may see no sign change at all. If it does see a crossing, interpolation uses the
coarse cell's endpoint values; its root can differ from the finer grid's root. A shared analytic
density function guarantees the same values at the same physical coordinates, not the same triangles
from different sample grids.
For a physical strate boundary, use an explicit surface descriptor with exact height/shape in metres
and a globally stable sample phase. Every LOD must use common anchors along tile and LOD transition
edges. The mesher can fill the interior at its chosen rate, then build a deterministic transition
band from those common anchors into its coarser interior. A seal/cap should not rely on a sub-cell
thin density strip surviving arbitrary MC sampling.
For the L19 lower-ground ledge, the same rule needs a SurfaceWorld ground profile available to the
mesher as semantic surface data. A shared planar boundary cap would only close the strate ceiling;
it would not align these upward-facing ground triangles. The surface can be band-limited by LOD, but
the adjacent LODs must share their transition samples and be checked against a physical error
tolerance. If that cannot be met with a transition band, refine only the affected boundary tiles.
The costs are extra boundary vertices/triangles and some CPU work to construct common transition
strips. Collision/support must consume the same interface representation where that surface is
collision-relevant. The owner would see caps and ledges hold one physical height as the camera moves
between LODs, instead of steps or holes appearing at the ring. Authoring remains in metres; internal
tile and transition details stay hidden.
This is not free geometry, but it is bounded to boundaries and LOD transition bands. L19 has already
shown why “add a thin density seal and sample it normally” is not a sufficient all-LOD guarantee.
## 5. Keep the per-strate resolution door open
Yes. A 25 cm per-strate default preserves the current Core sample spacing, and the common physical
field coordinate contract leaves room for later different sizes. Do not enable mixed resolutions
until the Round5 boundary contract is met:
1. Canonical physical-space field queries and explicit ownership at a shared boundary.
2. Deterministic transition meshes with common LOD ancestry on both resolutions.
3. Physical-space edit rasterization/replay that reaches both grids exactly once, with no holes or
double application.
4. A stable, canonically sorted strate-ID-to-size map included in plan/season identity and border
hashes.
5. Streaming and collision rules for tiles that touch or span two resolutions.
At today's one-size setting, the size map has one value (250,000 microns) for every strate. It adds
no mixed-resolution mesh, edit, or streaming cost. Tile width remains `32 × voxel size × 2^LOD`;
different future sizes change physical tile width and workload, but never change the 32³ internal
tile format.
## 6. Migration plan with “worlds don't move” checks
The checkpoints distinguish expected equality from a deliberately changed interface mesh. A plan
or schema identity can change even when field output remains equal; record both identities and mesh
hashes separately.
| Step | Work | Expected equality / check | Changes output? / Unreal PC? |
|---:|---|---|---|
| 0 | Freeze the L19 evidence as the baseline: W12, Clang with FP contraction off; retain the whole-view hashes, full-detail hashes, strict ceiling audit, captures, and FI/SW ring tables. | Baseline hashes recorded below; pin the protected SW LOD0–2 hashes too. Capture byte/pixel comparisons and ring samples must retain location, LOD, and skirt exclusion. | No. No new build needed for this design round. |
| 1 | Add a versioned resolved-metre layout representation and a read-only conversion/audit path. The audit reports, per strate, old input units, resolved old physical bounds, new metre bounds, voxel size, interfaces, and identity. Keep the old evaluator active. | Exact old-vs-new resolved positions at all authored top, bottom, height, route, island, and cap anchors. Old Core density/mesh/payload/topology hashes remain equal where the conversion is exactly representable; otherwise list the precise quantization delta before accepting a new baseline. | No. Core parser/audit can be Linux-only; adapter export needs Unreal BuildHost on the owner's PC. |
| 2 | Change owner-facing layout authoring and season serialization to metres. Convert each old slot using its **current resolved physical bounds**, not one global chunk multiplier. Represent any historical gap/overlap explicitly. Default each strate's voxel size to 25 cm. | Same physical top/bottom/height values and field anchors before/after. Run default W12 hashes and matched captures. The report must call out any interface whose two old generator bounds disagree instead of silently forcing them together. | Intended no. Touches `VoxelForgeCoreAdapter.cpp`, `VoxelStrateManager`, season manifest/composer and likely `VoxelWorld`; compile and actor validation require the owner's Unreal PC. |
| 3 | Add the common generator request/result contract and adapt `Heightfield2D` and `FloatingIslandFieldV1`; wrap the legacy `UVoxelGenerator` route without moving it yet. Move manager lookups out of evaluator calls in stages. | Per-strate exact density queries, proof classifications, full-detail hashes, whole-view hashes, W1/W8/W12 determinism, and generator-to-legacy route parity. Existing current output hashes remain equal for adapters that preserve their exact physical recipe. | No intended visual change. Unreal adapter/legacy wrappers need owner-PC UHT/build and actor validation; native Core pieces can be audited on Linux. |
| 4 | Resolve interface records once in the director; route new seal, cap, void, bedrock-gap, and passage behavior through shared composition. Keep old manifest versions on compatibility adapters. | Preserve density hashes where only a mesh closure was missing. Run the strict LOD0–8 ceiling interior/perimeter audit, edge pairing, same-LOD border hashes, matched captures, and field proofs. Any newly closed boundary is a named expected mesh/payload/topology delta. | Affected boundary mesh may change. Adapter serialization needs owner-PC validation; Core audit can run here. This step fixes thin seals/caps, not the L19 ground ledges. |
| 5 | Add the generic explicit-surface and LOD-transition contract. Feed SurfaceWorld ground-profile data into common transition bands; prototype on the measured FI/SW interface. | Produce before/after matched readable captures and full ring tables. Require zero no-hit interface samples and a chosen physical seam-error limit; retain L19 hash equality for unaffected tiles/LODs. For intended changes, list changed mesh/payload/topology hashes and keep density unchanged if the field itself is unchanged. | **This is the step that fixes the L19 ledges.** It changes protected SurfaceWorld LOD2 output, so implement only after the owner approves that specific output change. Unreal capture/collision review is on the owner's PC. |
| 6 | Enable a per-strate size map behind the already-resolved contract, initially set to 25 cm on all strates. Add one non-default diagnostic size case only after the default remains green. | At all-25-cm map, reproduce the approved default hashes and captures. Include sorted size-map identity in a negative control; boundary/transition hashes must change when one size changes. Re-run edit-across-boundary, collision, streaming, and W1/W8/W12 checks. | No default change; non-default diagnostic intentionally changes sampling. Touches Unreal reflected settings, snapshot adapter, and world identity; full compile/run requires the owner's PC. |
### L19 reference hashes
Representative W12 Clang `-ffp-contract=off`, density / mesh / payload / topology:
| Whole view | L19 hash |
|---|---|
| SurfaceWorld | `c10697a8f48380c7 / 4197fc1072f0ff58 / 7b3e616ec9459851 / c879e35592bf33e5` |
| FloatingIslands | `00bc3607a7839854 / 4baa66127c2b0892 / e11ef05e851a1517 / 1278bc4b1fffb869` |
Protected SurfaceWorld LOD0–2 hashes are in the L19 report and should be retained through steps
1–4 except for explicitly approved boundary geometry. The whole-view hash gate alone cannot prove
that a ring improved; step 5 needs the strict ring table and readable captures as well.
### Owner decisions this design needs
1. **Preservation target:** confirm that migration snapshots each current generator's resolved
physical bounds (including any current overlap or gap) before later tuning them into a single
authored metre layout. If instead the initial migration should force currently different bounds
to meet, that is a deliberate world change and needs its own baseline/capture review.
2. **Ledge output:** approve the specific SurfaceWorld LOD2/transition change before step 5
implementation, as required by the existing protected-output rule.
@@ -0,0 +1,115 @@
# Linux10 — startup and region crossing
**Result:** no world-generation optimization was shipped. The dominant spawn gate is full shape compilation; the current Core API does not let tiles consume a partially built shape safely. L10 adds opt-in phase and crossing telemetry to the headless research path.
Runs used CPUs 0–11, normal priority, at most `-j12`, a 6 GiB address-space cap, and the unchanged `powersave` governor. Peak monitored RSS was 624,996 KiB (610.3 MiB). Final builds: Clang 19 with FP contraction off, SHA-256 `7d5360e2baa637f8b2b4679df9616580bffe689afd101470e311260f0ecd4975`; GCC 14 default, `5041cf15019766f453eb59fe8ff7fc4cd98ca6a904208b645e3d7ca4584e1195`. The L9 Clang timing/hash baseline is `Standalone/bin/linux/VoxelForgeCoreHeadless-linux9-clang`, SHA-256 `0cd3f0ef993ced2c615418c6e2b37b83f57eff6d024d7d1568c30ea51490384a`.
## 1. Startup phases
SurfaceWorld seed 0, W12, no hash; five runs on the optimized Clang build. Wall and process CPU are medians. Process CPU sums work across threads. First-tile time is from cold start; its CPU column is CPU since pool start.
| Phase | Wall ms | Process CPU ms | Threads used |
|---|---:|---:|---|
| Owner data load and resolve | 5.05 | 5.05 | 1 |
| Assembly plan build | 51.04 | 51.03 | 1 |
| Core snapshot | 0.53 | 0.54 | 1 |
| First desired-set build, 2,553 tiles | 0.74 | 0.74 | 1 |
| Shape request setup | 0.03 | 0.03 | 1 |
| Shape compile | 222.59 | 856.79 | caller + up to 8 scheduler workers |
| Streamer setup | 0.01 | 0.01 | 1 |
| Worker-pool start | 0.41 | 1.27 | 12 requested; 8–11 had entered at print |
| First tile starts at 299.62 ms | — | 1.59 since pool start | 12/12 entered |
Shape-compile wall ranged 215.89–324.88 ms; first tile started at 286.56–409.76 ms. Owner load, plan, local shape setup, and far-parent construction are serial. Before the pool starts, there are no sleeping stream workers, but most of the 12 allowed CPUs are unused. During the interval and detail-band phases the scheduler uses at most 8 workers, leaving up to 4 CPUs unused.
The phase-trace mode’s whole-view median was 1.436 s, versus 1.372 s with tracing off. The phase runs are for decomposition only; the performance ranking and A/B below use the optimized build with tracing disabled and hashing off. In that flag-off path, shape wall time was 0.222 s median, consistent with the phase trace.
## 2. Shape contents and first-tile dependencies
| Shape phase | Wall ms | Process CPU ms | Work / concurrency |
|---|---:|---:|---|
| Local owner shapes and spatial bins | 40.46 | 40.44 | Extracts owner primitives; 1 thread |
| Rock intervals, signs, candidate bands | 40.20 | 187.14 | Packed column signs and candidate masks; up to 8 workers |
| Detail band and sign-edge distances | 81.00 | 568.78 | Applies coherent detail to candidate nodes and builds distance proxies; up to 8 workers |
| Route validation and shared-field setup | 1.12 | 1.13 | 5,642 passage samples; then shared primitive form |
| Far parents and bins | 55.56 | 55.57 | 6,050 far rooms / 18,348 links; 1 thread |
The compile extracts 18,348 owner primitives (71 rooms, 74 tunnels, 2 passages), covers 138,188,413 sign nodes, allocates 36.71 MiB of packed words and 263.57 MiB of proxy address capacity, and visits 214,538 detail candidates (6,098 flips).
For this SurfaceWorld fixture, the first LOD0 tile’s density queries take the native `Heightfield2D` path before packed-shape lookup. Far-parent shapes are not needed by that first tile. However, `World::generateTile` rejects requests until the full base shape is marked built, and `compileTileRegion` also requires that base shape. So the current API gates the near tile on the interval, detail, validation, and far-parent work even when that tile does not sample those arrays. Other recipes and fallback/query paths do use the analytic primitives and packed signs/proxies.
There is no seed-independent owner shape payload to cache at build time. The assembly plan is built from owner data; region pages also re-run owner primitive extraction, spatial-bin construction, and shared-field packing. Those immutable owner-derived structures are a possible per-world reuse target, but the measured short crossings below built no pages, so this run does not price that work.
## 3. Moving crossing
Hashing off, W12, same camera and already-streamed initial view. Region compile was called, but all entering fine keys were covered by the initial shape bounds; it built zero regions.
| Camera step | New tiles | LOD breakdown | Region compile | Tile work wall | Crossing total |
|---|---:|---|---:|---:|---:|
| 8 m | 144 | LOD2: 128, LOD3: 16 | 0.010 ms | 12.61 ms | 12.81 ms |
| 16 m | 288 | LOD0: 128, LOD1: 16, LOD2: 128, LOD3: 16 | 0.010 ms | 60.49 ms | 60.68 ms |
The 16 m crossing’s worker-time sum was 633 ms; its wall time was 60.5 ms. No plan or full shape compile repeated. A 24 m attempt terminated with `std::bad_alloc` after base shape compilation and before crossing metrics; the failing allocation site is unknown.
## 4. Ranked levers
| Rank | Lever | Upper bound from these measurements | Assessment |
|---:|---|---|---|
| 1 | Overlap near-tile work with shape compilation | 222.6 ms, 16.2% of 1.372 s whole-view-ready; first tile could start earlier by up to the compile time | Largest opportunity. Not built: tiles and region compilation currently require a fully built base shape. A safe version needs immutable partial-page publication and a wait before any tile reads an unfinished sign, proxy, primitive bin, or far field. |
| 2 | Defer far-parent construction until far tiles need it | 55.6 ms, at most 4.1% of whole-view-ready and 18.6% of the first-tile delay | Could improve spawn, but far and near paths share mutable spatial-bin state today. Needs separate immutable bins and a synchronized readiness state; no crossing benefit was measured. |
| 3 | Parallelize assembly-plan construction | 51.0 ms, at most 3.7% of whole-view-ready | Serial and seed/owner-specific. No safe deterministic parallel split was established. |
| 4 | Raise shape scheduler cap from 8 to 12 | About 121 ms currently lies in the two worker phases; ideal linear scaling saves about 40 ms (2.9% of whole-view-ready) | Below the 3% bar before overhead, and no crossing benefit. Not built. |
For any future partial or deferred build, hashes can fail if a tile observes a partially written sign/proxy array, if region publication races with tile lookup, or if shared bins change while a tile is sampling. The page must be immutable before publication; worker-count and timing tests must compare W1 with W12 and repeat W12. Any asynchronous result must also follow the Epoch/MPSC shutdown-drain rules.
## 5. Final-build timing and hashes
Five interleaved W12 runs, no hash. Pair values are `whole_view_ready / stream_wall` in seconds.
| Pair | L9 `7650abb` Clang | L10 Clang | Delta, ms |
|---:|---:|---:|---:|
| 1 | 1.336 / 1.050 | 1.346 / 1.060 | +10 / +10 |
| 2 | 1.351 / 1.062 | 1.365 / 1.073 | +14 / +11 |
| 3 | 1.359 / 1.073 | 1.374 / 1.083 | +15 / +10 |
| 4 | 1.363 / 1.077 | 1.375 / 1.081 | +12 / +4 |
| 5 | 1.387 / 1.089 | 1.372 / 1.092 | −15 / +3 |
| **Median** | **1.359 / 1.073** | **1.372 / 1.081** | **+13 / +8** |
The measurement-only candidate is +1.0% whole-view-ready and +0.7% stream median; this is no demonstrated speedup. Hashing was off for these timings.
Final rebuilt binaries passed SurfaceWorld and FloatingIslands seed-0 hash checks at W1, W8, and five W12 runs per compiler: Clang FP contraction off and GCC default. Every full-detail, whole-view, LOD0–8, and exact-query row matches the compiler-matched L9 baseline. Audit files: `Saved/Linux/l10_final_surface_hash_audit.txt` and `Saved/Linux/l10_islands_hash_audit.txt`.
| Recipe / scope | Density | Mesh | Payload | Topology |
|---|---|---|---|---|
| SurfaceWorld full detail | `0x0ee0579bd15cbbe4` | `0x32e5d4964d610fee` | `0x1932b96ee4b1d910` | `0x69743c6bad3447dc` |
| SurfaceWorld whole view | `0xc10697a8f48380c7` | `0xe75c9119a1498cd5` | `0x49a9a8d1835a6c8c` | `0xedcb23288b5e8724` |
| FloatingIslands full detail | `0x6d842d2878b08ef6` | `0x4b868a3184f08035` | `0x2cedf2236788752d` | `0xeac17d5e0cb5044a` |
| FloatingIslands whole view | `0x5be4d8cde79b2a76` | `0x96f75041f6861b3a` | `0x3700a516cc89d50c` | `0x6b99948d6eab4f21` |
Exact-query hashes also match: SurfaceWorld density `0xe4d4a8eb95b35933`, detail `0xefcba20c0c70c415`, collision `0xe604823a249029bf`; FloatingIslands density `0x61daded9c303becb`, detail `0xefcba20c0c70c415`, collision `0x84d37463be9b0573`.
## 6. Failed or retried runs
- One phase smoke omitted the explicit owner-data path and resolved it under `Standalone/bin/data`; reran with `Standalone/data/owner_world.json`.
- A no-camera phase smoke produced 2,370 tiles instead of the 2,553-tile fixture; discarded it and reran with the fixed camera.
- A malformed `--workers=w8` command exited during argument parsing; reran with numeric `--workers=8`.
- The first FloatingIslands matrix invocation omitted the three required streaming-mode switches. All 14 attempts exited before generation; corrected the command and all 14 final runs passed.
- The 24 m crossing attempt failed with `std::bad_alloc` as described above.
- The first hash-audit parser expected 13 rows; the actual audit contains 12 scopes. Corrected the parser and all final comparisons passed.
At spawn, the first tile starts about 300 ms after cold start, with roughly 223 ms in full shape compilation and 51 ms in the single-threaded plan; this round did not make that wait shorter. While moving, the 16 m crossing completed 288 entering tiles in about 61 ms and repeated no shape compile, so the measured delay was tile work rather than region setup.
## Orchestrator review (Claude)
- **Not committed:** the L10 telemetry code. It is +1.0% whole-view median with tracing off (4 of 5
pairs slower), and the rule is zero cost when off. Saved as `Saved/Linux/claude/l10-telemetry.patch`
(gitignored) for reuse; the tree is reset to `7650abb`.
- **Key finding, for L11:** the first SurfaceWorld tiles take the native `Heightfield2D` path and don't
read the cave shape, yet `World::generateTile` waits for the full base shape (~223 ms). A per-tile
readiness check (start tiles whose recipe path provably never touches shape arrays) is lever #1 in
safe form.
- **Open bug, for L11:** the 24 m crossing died with `std::bad_alloc` under the 6 GiB **address-space**
cap (`RLIMIT_AS`). That cap counts reservations, not resident memory; L10 also reports 263.57 MiB
of proxy address *capacity*. It is not yet known whether this is a real memory blow-up on larger
crossings or the cap counting reserved address space. L7's 32 m step also hit the 160M-node
interval bound.
@@ -0,0 +1,74 @@
# VoxelForge L11 — Linux report
## 24 m crossing crash
The crash is real. The original binary threw `std::bad_alloc` after base shape compilation with both 6 GiB and 16 GiB `RLIMIT_AS`; the 16 GiB run peaked at 476,128 KiB RSS and 1,542,284 KiB virtual size. The allocation trace identifies a 432,345,551,342,665,824-byte resize in `BuildSpatialBins`, reached from `BuildAnalyticRegion` during `World::compileTileRegion`. The crossing code had coalesced disjoint entering tiles into a large LOD rectangle and tried to allocate dense per-axis bins that the analytic fallback never reads. L10's 263.57 MiB figure is the proxies' reserved virtual capacity; RSS samples record resident usage separately.
Analytic regions now skip those dense bins and compile in world-aligned 128-voxel pages. Pages are built privately and published together; coordinate, `bad_alloc`, and size failures return errors before partial pages are published. On the final L11 binary, 24 m and 32 m both passed (16 pages each); 1,000 m passed with 2,260 entering keys, 72 pages, 63 ms region-build wall time, 700,232 KiB peak RSS, and 2,578,588 KiB peak virtual size. The fixed 24 m run peaked at 533,420 KiB RSS and 2,578,588 KiB virtual size. Crossing pages build no packed interval nodes (`lattice_nodes=0`) and do not expand the immutable base sign/proxy arrays; they add analytic primitive/bin data. `retainTileRegions` prunes pages outside the desired set. The largest empirically verified step is 1,000 m. Work follows the destination's entering tile set; once the old and new views are disjoint, its page count stays bounded by the active view as travel distance increases. Keys outside Core's signed 32-bit voxel range are rejected with `tile region coordinate is out of range` before page construction. The earlier L7 32 m / 160-million-node failure was the same unbounded region geometry.
| Step | Entering keys | Pages | Added interval nodes | Base proxy nodes / virtual capacity |
|---:|---:|---:|---:|---:|
| 24 m | 432 | 16 | 0 | 185,024 / 263.57 MiB |
| 1,000 m | 2,260 | 72 | 0 | 185,024 / 263.57 MiB |
## Shape readiness
`isTileShapeFree` accepts only LOD0 tiles whose padded mesh box maps to one valid SurfaceWorld plan, excludes FloatingIslands, plan features, routes, passages, edits, and overlaps with owner shape primitives or detail bounds. This covers the MC skirt and sample margin. Higher LODs are conservatively shape-dependent; the accepted path cannot use far parents. The native-only context is initialized without building sign arrays, proxies, owner primitive vectors, or spatial bins. Native sampling and classification paths check the padded bounds, reject unsupported fallbacks, and count any attempted shape-dependent read; tile generation then fails instead of returning a partial mesh.
The SurfaceWorld spawn view proved 27/27 near-ring tiles shape-free. A deliberately mis-marked distant tile `(0,0,100000,lod0)` reached the sampler and was rejected by the guard. After shape publication, native-only and full-shape generation matched all four hashes for all 27 tiles. Shape-dependent tiles waited for the release-published shape; tile jobs continue through the existing Epoch and MPSC result path, and published shape/page data is immutable. The FloatingIslands spawn proof accepted 0/27 tiles, so all waited for its shape. Slow-shape delay defaults to zero; audit and negative-control work is opt-in.
## No-hash timing pairs
Five interleaved W12 pairs, camera `0,-35,-487.94`, seed 0, Clang `-ffp-contract=off`, hashing off. Times are from process start. The L9 executable does not emit a first-tile completion event and starts tile workers only after shape compilation; its first-tile cell is therefore unavailable.
| Pair | First tile L9 / L11 | Near ring L9 / L11 | Whole view L9 / L11 |
|---:|---:|---:|---:|
| 1 | — / 153 ms | 343 / 166 ms | 1,439 / 1,429 ms |
| 2 | — / 160 ms | 424 / 173 ms | 1,526 / 1,447 ms |
| 3 | — / 145 ms | 347 / 163 ms | 1,447 / 1,443 ms |
| 4 | — / 146 ms | 353 / 170 ms | 1,457 / 1,449 ms |
| 5 | — / 153 ms | 376 / 173 ms | 1,478 / 1,464 ms |
| Median | — / 153 ms | 353 / 170 ms | 1,457 / 1,447 ms |
The delayed maximum-overlap W12 run held shape compilation for 1.5 s: first tile 133 ms, near ring 166 ms, shape ready 1.696 s. Shape-free and full-shape near-ring hashes matched, and whole-view, full-detail, per-LOD, and exact-query hashes matched the baseline.
## Hashes
All 28 configurations passed against L10's committed `b370908` baseline: SurfaceWorld and FloatingIslands, seed 0, W1/W8/W12, Clang `-ffp-contract=off` and GCC default, with five W12 repeats per compiler and recipe. Each run matched all 12 rows: full-detail, whole-view, nine LODs, and exact queries. The delayed-overlap run also matched.
| Recipe | Full-detail density / mesh / payload / topology | Whole-view density / mesh / payload / topology | Exact-query density & unclamped / detail / collision |
|---|---|---|---|
| SurfaceWorld | `0x0ee0579bd15cbbe4` / `0x32e5d4964d610fee` / `0x1932b96ee4b1d910` / `0x69743c6bad3447dc` | `0xc10697a8f48380c7` / `0xe75c9119a1498cd5` / `0x49a9a8d1835a6c8c` / `0xedcb23288b5e8724` | `0xe4d4a8eb95b35933` / `0xefcba20c0c70c415` / `0xe604823a249029bf` |
| FloatingIslands | `0x6d842d2878b08ef6` / `0x4b868a3184f08035` / `0x2cedf2236788752d` / `0xeac17d5e0cb5044a` | `0x5be4d8cde79b2a76` / `0x96f75041f6861b3a` / `0x3700a516cc89d50c` / `0x6b99948d6eab4f21` | `0x61daded9c303becb` / `0xefcba20c0c70c415` / `0x84d37463be9b0573` |
The per-LOD D/M/P/T rows match exactly in every configuration; the complete comparison is recorded in `Saved/Linux/l11_hash_audit.txt`.
## Failed and retried runs
- The 24 m reproduction failed with `std::bad_alloc` under both address-space caps (`l11-cross24-as6g.log`, `l11-cross24-as16g.log`); the allocation trace above isolated the oversized bin resize. Final-binary 24 m, 32 m, and 1,000 m reruns passed (`l11-final-cross-24m.log`, `l11-final-cross-32m.log`, `l11-final-cross-1000m.log`).
- The first readiness proof admitted 512 LOD0 keys (`l11-readiness-audit.log`, `l11-readiness-audit2.log`). Although the 27 near-ring equivalence check passed, distant owner-shape tiles changed the whole-view density hash. Tightening the proof to test owner primitive bounds reduced early admission to the 27 safe near-ring tiles and restored every hash (`l11-readiness-audit-final.log`).
- One rebuilt audit invocation omitted the owner JSON path and exited 2 before generation (`l11-readiness-audit-path-error.log`; `Standalone/bin/data/owner_world.json` was missing). It was rerun with `Standalone/data/owner_world.json` and passed.
- The required hash matrix and five timing pairs had no failed runs. All monitored run processes stayed below the 6,000,000,000-byte RSS ceiling; governor remained `powersave`.
The standalone Core/headless builds passed with Clang and GCC. The Unreal adapter change was source-reviewed but could not be built here because UnrealBuildTool/UnrealEditor are not installed on this Linux machine.
At spawn on SurfaceWorld, the near ring is ready at a 170 ms median versus 353 ms on L9, and the first L11 tile is ready at 153 ms median before shape publication; L9 gates tile work on shape compilation and does not report that milestone. For fast movement, destination-page work stays bounded through the tested 1 km crossing, while invalid Core coordinates return an error before allocation.
## Orchestrator review (Claude)
- **Re-run by me, 5 interleaved W12 pairs, no hashing.** Near ring (`neighborhood_ready`) L9
0.338/0.338/0.337/0.326/0.334 s vs L11 0.159/0.159/0.167/0.169/0.159 s (median 0.337 → 0.159 s,
−53%). Whole view 1.337 → 1.365 s median (+2.1%, 4 of 5 pairs slower): a small cost, accepted for a
2× faster spawn ring. W12 hash runs give density `c10697a8f48380c7`.
- **Crossings re-run by me on L11** (`--region-crossing --camera-step=S,0,0`): 24 m gives 432 tiles,
0.867 s wall, 10.05 worker-s, rc 0; 1,000 m gives 2,260 tiles, 5.90 s wall, 70.4 worker-s, rc 0. The L9
binary lacks the option, so the original crash rests on Luna's reproduction and allocation trace.
- **New finding, for L12:** the 24 m crossing costs ~23 ms of work per tile, against ~2 ms for L10's 16 m
crossing (288 tiles, 0.633 worker-s). Tiles outside the base shape bounds, served from analytic
region pages, look about 10× more expensive. That is a moving-player cost.
- **Concurrency read:** `World::compile` builds the shape privately, then sets `impl_->shape` and
`buildRequest` before a release store of `shapeReady`. Every shape reader acquire-checks
`shapeReady` first (short-circuit), and shape-free tiles use a private native-only context. Sound.
- **Unreal:** `Source/VoxelForge/Private/VoxelWorld.cpp` changed (compile outside the writer lock;
proven shape-free tiles start before `bReady`). It is NOT compiled here, so it must be built on the
owner's PC before it is trusted in game.
@@ -0,0 +1,62 @@
# VoxelForge L12 — Linux report
Governor stayed `powersave`. Builds and runs used CPUs 0–11, at most 12 jobs, a 6 GiB address-space cap, and RSS monitors. Clang and GCC builds passed; peak sampled RSS was 881 MiB for one GCC compiler process and 679 MiB for the 1 km crossing. The GCC build process group peaked at 4.35 GiB. No Unreal adapter files changed.
## LOD cost and change
The 24 m profile is like-for-like at LOD1 in the same SurfaceWorld crossing. L11 generated 160 LOD1 tiles: 32 base-shape tiles averaged 2.73 ms each, while 128 analytic-page tiles averaged 71.72 ms. Of the LOD1 worker time, 9.06 of 9.27 seconds went to the marching-cubes density grid; the page compiler added 15 ms and built no packed lattice nodes. The page route lacked the manifest input needed for the exact LOD1 block proofs. Across all 160 LOD1 tiles, the sample counter reported 5.64 million density samples, or 35,271 per tile.
Analytic pages now retain the immutable shared manifest for block classification while continuing to sample the legacy density field. The proof audit checked 27,479 blocks and 36,574,549 samples, with zero violations. On the plain 24 m profile, page-backed LOD1 fell to 5.60 ms per tile; all 160 LOD1 tiles reported 432,000 samples (2,700 per tile) and 435 ms in density-grid work. Base LOD1 tiles averaged 2.51 ms, so page tiles are now about 2.2× their base cost. No base-shape bounds changed; pages remain privately built, immutably published, and bounded, with 16 pages at 24/32 m and 72 at 1 km.
## Plain W12 crossings
Worker time is the sum across tile workers; per-tile values use that sum. L11 values are from the L11 executable and logs. L12 values include region compilation in wall time.
| Step | Tiles | L11 wall / worker-s / ms per tile | L12 wall / worker-s / ms per tile |
|---:|---:|---:|---:|
| 8 m | 144 | 0.038 s / 0.381 / 2.65 | 0.035 s / 0.360 / 2.50 |
| 16 m | 288 | 0.831 s / 9.476 / 32.90 | 0.125 s / 1.096 / 3.80 |
| 24 m | 432 | 0.869 s / 9.912 / 22.95 | 0.164 s / 1.596 / 3.69 |
| 32 m | 576 | 0.898 s / 10.261 / 17.81 | 0.172 s / 1.691 / 2.94 |
| 1 km | 2,260 | 5.892 s / 69.534 / 30.77 | 1.247 s / 14.003 / 6.20 |
All five L12 steps passed; peak crossing RSS was 679 MiB. The 8 m L11 comparison is `l12-baseline-8m-page.log`; 16 m is `l12-baseline-16m-page.log`; 24 m, 32 m, and 1 km are the L11 final crossing logs.
## Spawn and hashes
Three plain W12 spawn runs had medians of 146 ms first tile, 161 ms near ring, and 1.361 s whole view. L11 medians were 153 ms, 170 ms, and 1.447 s.
All 28 requested L1 hash configurations matched L11: SurfaceWorld and FloatingIslands seed 0, Clang `-ffp-contract=off` and GCC default, W1/W8/W12, with five W12 repeats. Every run matched all 12 rows: full detail, whole view, nine LODs, and exact queries. Clang/GCC full-detail and whole-view D/M/P/T plus exact-query values are unchanged from the L11 report. The L3 FP-contract preamble/self-test remains in place.
| Recipe | Full-detail density / mesh / payload / topology | Whole-view density / mesh / payload / topology | Exact density+unclamped / detail / collision |
|---|---|---|---|
| SurfaceWorld | `0x0ee0579bd15cbbe4` / `0x32e5d4964d610fee` / `0x1932b96ee4b1d910` / `0x69743c6bad3447dc` | `0xc10697a8f48380c7` / `0xe75c9119a1498cd5` / `0x49a9a8d1835a6c8c` / `0xedcb23288b5e8724` | `0xe4d4a8eb95b35933` / `0xefcba20c0c70c415` / `0xe604823a249029bf` |
| FloatingIslands | `0x6d842d2878b08ef6` / `0x4b868a3184f08035` / `0x2cedf2236788752d` / `0xeac17d5e0cb5044a` | `0x5be4d8cde79b2a76` / `0x96f75041f6861b3a` / `0x3700a516cc89d50c` / `0x6b99948d6eab4f21` | `0x61daded9c303becb` / `0xefcba20c0c70c415` / `0x84d37463be9b0573` |
The 24 m crossing hash also matches L11 at W1 and W12 (432 rows each): density `0x174588abdc8c0d2c`, mesh `0x4c401e27d9d05dea`, payload `0xeb10d9801c5ef125`, topology `0xf59d12304d0dcb4a`.
The route-verified base/page audit does **not** pass the requested exact-tile invariant. For `(0,-5,-31,lod1)`, the base density hash is `0xe0672dae7528f8d7` and page density hash is `0x882280f67bfddd77`; mesh, payload, and topology match. All 48 base-covered LOD1 candidates had density mismatches; 10 also differed in mesh/payload/topology. Across eight route-verified LOD0/LOD1 pairs, all eight density hashes differed. The base SurfaceWorld route uses manifest density while L11 pages use the legacy density evaluator; switching page samples to the base field would change the L11 crossing hashes. I kept the legacy page field to preserve the required crossing output, so this pre-existing parity conflict remains unresolved.
## Failed and retried runs
- An attempted 24 m base-shape expansion exited 2 at the 160-million-node bound (`l12-baseline-24m-base.log`). A separate per-tile native-only proof promotion failed with `region OOM` and was reverted (`l12-probe-cross24-profile-w12.log`).
- The first plain step command passed `32` as the camera distance while labeling it 8 m; output identified it as 32 m. It was retained as the 32 m result, and 8 m was rerun with the correct distance.
- The first FloatingIslands matrix omitted `--auto-surface-camera`, so it hashed the wrong 2,553-tile view. It was rerun with the L11 seed-0 island placement; all 28 corrected matrix configurations passed. The comparison helper also needed two small script fixes before it reported the final 28/28 result.
- One base/page audit initially treated a LOD2 base-route fallback (`page_keys=0`) as a match. The audit now verifies the generated route; that apparent pass was rejected and the route-verified parity failure above is the final result.
Walking into new ground should feel much better: the plain 24 m crossing fell from 0.869 s to 0.164 s, and the 1 km crossing from 5.892 s to 1.247 s. Page-backed LOD1 tiles are down from 71.7 to 5.6 ms each while the L11 crossing hashes stay exact; base/page density-hash parity remains a separate unresolved constraint.
## Orchestrator review (Claude)
- Re-run by me (W12, no hashing, 3 interleaved pairs): 24 m crossing L11 0.874/0.914/0.898 s vs L12
0.154/0.166/0.166 s (median 0.898 → 0.166 s, 5.4×). Spawn is unchanged (near ring 0.160–0.184 s).
The 24 m crossing hash (density `0x174588abdc8c0d2c`, mesh `0x4c401e27d9d05dea`) matches L11 at W1
and W12. Hash runs refill skipped samples, so time crossings with hashing off.
- **Soundness of page-tile skipping:** the proof audit figures (27,479 blocks / 36,574,549 samples)
are the base-shape audit from L9, not page tiles. The evidence for pages is the crossing hash
equalling L11 (which filled every sample). That is necessary but narrow: one crossing, one seed.
- ⚠️ **Route-dependent output (a pre-existing multiplayer bug, now measured):** the same tile key
gives different density from the base shape (manifest field) than from an analytic page (legacy
field). All 48 base-covered LOD1 candidates differed in density, 10 also in mesh/payload/topology.
A tile's geometry then depends on streaming history (spawned near it vs walked to it), which
breaks peer determinism. Top priority for L13.
@@ -0,0 +1,140 @@
# VoxelForge M3 Linux13 — route-invariant density
## Field decision and fix
The approved reference is the Core base shape built from the reviewed owner manifest: `Heightfield2D`
for SurfaceWorld and `FloatingIslandFieldV1` for FloatingIslands. L12's base route sampled that
field. Its analytic pages instead fell through to the copied legacy owner `GetDensityAt` evaluator,
so the same key could sample different values after the player crossed into a page. In the L12
SurfaceWorld audit, all 48 base-covered LOD1 candidates had different density; 10 also differed in
mesh, payload, and topology. A 214,375-sample L12 negative-control run measured max/mean density
delta `0.076171875 / 0.0133467594`, 29 sign changes, 170 edge-crossing changes, and up to 1.7778
voxels of surface displacement. The manifest field is the approved Core world and is the reference
kept here.
Changing the page manifest flag alone did not fix FloatingIslands: 8/8 page pairs still failed,
with max density delta `433.925781`, 262,676 sign changes, and 17,188 edge-crossing changes across
343,000 samples. The source fix binds each compiled page to its world's base `FStandaloneShapeWorld`
before publication. Page density, lattice, detail, classification, and solid queries now delegate
to that one evaluator; the legacy page-local evaluator is no longer an independent output route.
`WorldAssemblyEvaluatorVersion` is bumped from 5 to 6.
## Route parity
The L12 evaluator-v5 negative control fails as required: 5/5 selected base/page pairs mismatch. After the fix,
four audits passed: SurfaceWorld seeds 0, 1, and 17, plus FloatingIslands seed 0.
| Compared routes | Pairs | Mismatches |
|---|---:|---:|
| Base vs page (28 clipmap-requested pages; 26 base-covered page controls) | 54 | 0 |
| Base vs native-only shape-free route (SurfaceWorld LOD0) | 27 | 0 |
| Edited base vs edited page | 4 | 0 |
| Same key built in initial and moved-world history | 2 | 0 |
| Tile samples vs exact Core queries at LOD2–8 | 56 | 0 |
All 87 tile-generation pairs match density, mesh, payload, and topology hashes. The 56 higher-LOD
pairs compare the sampled tile lattice to direct `densityAt` / `densityAtLattice` queries; these
also match all sampled densities and solid/air signs. The owner fixture has
`full_res_clip_levels=2`, so analytic page routes exist only at LOD0–1. In total, page comparisons
covered 2,315,250 density samples with zero delta, sign, edge-crossing, or surface-root differences;
6,172,229 exact-query samples had zero mismatches. The audit exits nonzero on any output-hash,
sample, route-verification, exact-query, or proof-violation mismatch.
The history probe builds the same LOD0 key in a second Core world after a 96 m camera move. Both
SurfaceWorld and FloatingIslands match all four hashes across those two build histories. The edit
probe applies a sequence-1 density offset centered on a sampled sign crossing; it changes the field,
and edited base/page results still match.
### Page proof audit
The fill-and-check audit generated page tiles with full density capture and uniform-block proof
verification, so it checked the field those pages actually sample. Across the four audits it checked
1,274 blocks / 1,695,694 samples: 518 blocks used the exact fallback, 6 were unknown, and there were
zero false proofs or violations. SurfaceWorld walkability passed 5,642/5,642, 6,080/6,080, and
4,785/4,785 samples for seeds 0, 1, and 17; FloatingIslands passed 4,000/4,000. Shape readiness
passed 27/27 near-ring tiles where eligible. FloatingIslands has no eligible native-only tiles.
## Cost, hashing off
W12, seed 0, `--force-generate`, camera `0,-35,-487.94`, with the same crossing setup as L12:
| Move | Entering tiles | L12 crossing | L13 crossing | L13 peak RSS |
|---|---:|---:|---:|---:|
| 8 m | 144 | 0.0347 s | 0.0399 s | 468 MiB |
| 16 m | 288 | 0.1249 s | 0.0856 s | 513 MiB |
| 24 m | 432 | 0.1635 s | 0.1242 s | 512 MiB |
| 32 m | 576 | 0.1717 s | 0.1692 s | 511 MiB |
| 1 km | 2,260 | 1.2474 s | 0.7696 s | 673 MiB |
Three W12 spawn runs had medians of 157 ms first tile, 180 ms near ring, and 1.499 s whole view;
L12 medians were 146 ms, 161 ms, and 1.361 s. Each spawn run generated the same 2,553-tile
benchmark view. The final timings are in `Saved/Linux/l13-crossing-final-*.log` and
`Saved/Linux/l13-spawn-final-*.log`.
## Determinism and invariants
All 28 required configurations passed: SurfaceWorld and FloatingIslands seed 0; Clang
`-ffp-contract=off` and GCC default; W1/W8/W12, with five W12 repeats per compiler and recipe. Each
run matched all 12 rows (full detail, whole view, LOD0–8, exact queries) against L12/L11.
| Recipe | Full detail D/M/P/T | Whole view D/M/P/T | Exact density / unclamped / detail / collision |
|---|---|---|---|
| SurfaceWorld | `0x0ee0579bd15cbbe4 / 0x32e5d4964d610fee / 0x1932b96ee4b1d910 / 0x69743c6bad3447dc` | `0xc10697a8f48380c7 / 0xe75c9119a1498cd5 / 0x49a9a8d1835a6c8c / 0xedcb23288b5e8724` | `0xe4d4a8eb95b35933 / 0xe4d4a8eb95b35933 / 0xefcba20c0c70c415 / 0xe604823a249029bf` |
| FloatingIslands | `0x6d842d2878b08ef6 / 0x4b868a3184f08035 / 0x2cedf2236788752d / 0xeac17d5e0cb5044a` | `0x5be4d8cde79b2a76 / 0x96f75041f6861b3a / 0x3700a516cc89d50c / 0x6b99948d6eab4f21` | `0x61daded9c303becb / 0x61daded9c303becb / 0xefcba20c0c70c415 / 0x84d37463be9b0573` |
The crossing output changes as intended. The 24 m W1 and W12 moved-tile hashes match each other:
`0x337ca62131576728 / 0x7612f48e2ddbbaab / 0x69a67ed4add83b87 / 0xf11ac1ebd0f7ddb8` (D/M/P/T),
replacing L12's `0x174588abdc8c0d2c / 0x4c401e27d9d05dea / 0xeb10d9801c5ef125 / 0xf59d12304d0dcb4a`.
The L3 FP-contract preamble and runtime self-test, L4 `FLazy`, L7 shared column cache, L9/L12
proofs, and L11 native-only readiness/crash fixes were preserved. The L6 screen-space controls
still pass their six same-LOD checks and reject the missing/floating-surface, global-octave, and
stride-2 negative controls as required. Its whole gate still rejects the known far-field error over
the 1 px bound (exit 6); the route binding does not affect those LOD3–8 base-field comparisons.
The asynchronous MPSC/Epoch path and `ARCHITECTURE.md` §8.10 invariants are unchanged. No Unreal
adapter files were touched; the Core exact-query and collision-sign routes were checked, but Unreal
collision cooking was not built here. `ARCHITECTURE.md` §8.36 and `CODEMAP.md` §3.22 document the new
route law.
Builds and runs used CPUs 0–11, at most 12 workers, a 6 GiB address-space cap, and a 6,000,000,000
byte RSS monitor. The governor remained `powersave`. Peak sampled RSS was 904 MiB across runs
(673 MiB in the no-hash cost table); the GCC build process group peaked at 4.27 GiB. Clang and GCC
builds passed. No system changes or Unreal builds were made.
## Failed and retried runs
- `l13-route-baseline-s0-w12.log` exited 2 because the inferred binary-relative owner JSON path did
not exist; reruns used the explicit repository JSON. The first baseline capture used the wrong
camera, then an audit pass had empty proof-skipped density captures; the final L12 negative
control is `l13-route-baseline-s0-w12-r4.log`.
- `l13-route-fi-diagnostic.log` and `l13-route-fi-diagnostic-r2.log` intentionally exposed the
remaining FloatingIslands split before the shared-source binding; both exit 9 on 8/8 mismatches.
- `l13-route-edit-s0.log` exited 9 because its brush did not change the selected tile. Centering the
brush on a sampled sign crossing fixed the audit in `l13-route-edit-s0-r2.log`.
- `l13-route-history-sw-s0.log` exited 9 because the second-world probe exceeded the 4,096-node
region compiler envelope. The retry compiles one matching LOD0 anchor tile and passes.
- The first `l13-cost-*` measurements omitted `--force-generate` and used the owner JSON start;
those are not used above. The final crossing and spawn runs use L12's camera and force-generation
setting. The screen-space run's exit 6 is its expected far-field rejection, not a retried run.
- All final builds, the 28 hash runs, eight no-hash cost runs, and two crossing-hash runs completed
within their limits. No commit, push, or stash was made.
## Multiplayer note for the owner
Peers with the same manifest, seed, evaluator version 6, and tile key now reconstruct the same Core
density and tile output through each available base, page, or native-only route, regardless of
arrival history; terrain geometry still does not need to cross the network. Player edits remain an
explicit versioned diff that must be ordered and synchronized between peers.
## Orchestrator review (Claude)
- **Spawn cost re-run by me, 5 interleaved W12 pairs, no hashing:** whole view L12
1.385/1.405/1.419/1.443/1.460 s vs L13 1.401/1.448/1.430/1.435/1.451 s (median 1.419 → 1.435 s,
+1.1%, within noise); near ring 0.168 → 0.171 s. The +10% in the cost table above compares L13 runs
with L12 numbers from another session; interleaved, there is no measurable spawn regression.
- The fix is structural: pages are bound to their world's single base `FStandaloneShapeWorld`
evaluator before publication, so routes can't diverge by construction. The negative control fails
on L12 (5/5), and the 87 tile pairs, 56 exact-query pairs and 2.3M page samples show 0 mismatches
after. The page lifetime is safe because the base shape is owned by the `World` and outlives its pages.
- Crossing output changed, as intended (evaluator version 5 → 6); the spawn and island worlds are
unchanged.
@@ -0,0 +1,157 @@
# Linux14 — far spawn work
No mesh or density code changed. The source changes add opt-in profiling for far-shell column
lookups; counter snapshots are behind the existing profile guard, with no added timing or counter
increments when profiling is off. The final plain build has the same output as L13.
## Far LOD cost and ranking
The first table is from five interleaved, W12, hashing-off pairs: L13 binary before and L14 binary
after. Values are median worker-sums across that LOD; per-tile time is the L14 median divided by
tile count. The ranking is L6, L8, L4, L5, L7 on both binaries.
| LOD | Tiles | L13 → L14 median worker-s (s) | L14 worker-ms/tile |
|---:|---:|---:|---:|
| 4 | 320 | 1.600 → 1.572 | 4.91 |
| 5 | 144 | 1.421 → 1.411 | 9.80 |
| 6 | 96 | 2.624 → 2.585 | 26.93 |
| 7 | 48 | 1.152 → 1.158 | 24.13 |
| 8 | 153 | 2.044 → 2.046 | 13.37 |
Phase detail below is one W12 `--profile-lod-work` run on the final Clang binary. Cache counters
include all column work for that LOD, not just refinement. A “shared hit” is a hit from the
world-shared cache; formula evaluations equal local misses minus shared hits.
| LOD | Calls | Local hits / misses | Shared hits | Formula evaluations (per tile) | Column compute (ms) | MC non-column (ms) | Ground/cap non-column (ms) | Connector shell non-column (ms) | Skirt (ms) | Assembly (ms) |
|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:|
| 4 | 1,845,787 | 1,579,868 / 265,919 | 175,805 | 90,114 (282) | 521 | 472 | 385 | 0 | 186 | 3 |
| 5 | 877,542 | 701,124 / 176,418 | 105,477 | 70,941 (493) | 408 | 135 | 705 | 0 | 159 | 2 |
| 6 | 760,952 | 418,443 / 342,509 | 63,209 | 279,300 (2,909) | 1,594 | 90 | 474 | 210 | 158 | 2 |
| 7 | 337,328 | 257,969 / 79,359 | 8,878 | 70,481 (1,468) | 395 | 59 | 514 | 0 | 145 | 4 |
| 8 | 644,565 | 508,799 / 135,766 | 29,545 | 106,221 (694) | 608 | 374 | 783 | 0 | 278 | 6 |
MC and refinement column-compute / non-column times (ms) were L4 `221/472` MC and `281/385`
ground/cap; L5 `199/135` MC and `209/705` ground/cap; L6 `196/90` MC and `205/474` ground/cap;
L7 `184/59` MC and `211/514` ground/cap; L8 `413/374` MC and `195/783` ground/cap. The column
compute column overlaps those column portions. Timers are worker sums and may differ by a few ms
from their subphase sums.
Stratum shells made zero field calls at LOD4–8 and took under 0.03 ms total. The profiler run
measured about 1.408 s whole-view-ready; the unprofiled interleaved runs below are the timing result.
## Connector-shell repair
`AppendFarConnectorShells` is guarded to LOD6 and above. Coarse marching cubes can leave gaps in a
route connector wall, so the repair checks four axial rays at connector stations and adds only the
panels where the nearest coarse-mesh hit misses the source-field radius tolerance. LOD6 checks at
128-voxel stations; LOD7–8 use 256-voxel stations. Only LOD6 had repair candidates in this spawn
view: 5,066 triangles were added. The shell took 1.403 worker-s, including 1.193 s of column
evaluation (about 0.210 s shell work outside those evaluations).
The LOD6 repair made 251,475 source/column calls: 44,596 worker-local hits, 206,879 local misses,
30 shared-cache hits, and 206,849 formula evaluations. Thus 82.3% of calls evaluated a formula;
the work is mostly uncached. A cache miss can include a point evicted by the four-way worker cache,
so these counters do not prove every evaluated XY is unique. The L13-bound base evaluator already
feeds the shared exact-XY cache; neighboring LOD samples mostly use different XY coordinates, and
only 30 repair samples hit the shared cache. Reducing stations or rays would change the repair
geometry, and no bit-identical reduction was proved.
## Ground and cap refinement
Ground refinement starts at LOD5 (32-voxel grid there, 64 at LOD6, then 128 at LOD7–8). Cap
refinement starts at LOD4 (16-voxel grid there, then 128 at LOD5–7; LOD8 may use its configured
interior override). Both query exact `Heightfield2D` columns and use those values for heights,
normals, materials, clipping, and replacing nearby coarse faces. The existing shared cache is keyed
by recipe/plan and exact XY, so aligned samples can already be reused across tiles and levels. The
LOD-wide shared-hit counts are in the table above; they are not refinement-only counts.
Current safe skips are the plan Z-range check for ground and the cap-height-bound check for caps.
No additional tile/cell skip was shown to preserve every sample that affects output; a grid point
can also supply a neighboring normal or clipped cell. No new refinement sharing or skip was built.
## Ranked exact-output work
No exact-output change with a measured saving above 3% was proved, so no geometry optimization was
built. The ranked work buckets are:
1. Ground/cap refinement across LOD4–8: about 3.95 worker-s including its column work. Removing all
of it would be an unrealistic idealized 23% of 1.419 s at 12-way division; the sampled values
currently affect geometry/materials/normals.
2. LOD6 connector repair: 1.403 worker-s inclusive, an idealized upper bound near 8.2% at 12-way
division. Most calls are uncached, and the missing panels are required for the current mesh.
3. Far-LOD column formula work: 3.53 worker-s across LOD4–8, overlapping the two buckets above.
Exact-XY sharing is already active; no redundant set large enough to remove was demonstrated.
4. Marching-cubes non-column work is 1.13 worker-s and skirts 0.93 worker-s. Assembly is only
0.017 worker-s; stratum shells are negligible. No exact reduction was established.
These idealized conversions divide worker-s by 12 and are not predicted wall-time gains. The L6
screen-space gate was not used because this round made no geometry change.
## Interleaved cost, builds, and hashes
Five hashing-off W12 pairs ran in one session, alternating
`Standalone/bin/linux/VoxelForgeCoreHeadless-linux13-clang` and
`Standalone/bin/linux/VoxelForgeCoreHeadless-linux14-clang`. Every run generated 2,553 tiles at
seed 0 and camera `0,-35,-487.94,0,-22`.
| Pair | L13 whole-view-ready (s) | L14 whole-view-ready (s) |
|---:|---:|---:|
| 1 | 1.416 | 1.410 |
| 2 | 1.436 | 1.388 |
| 3 | 1.416 | 1.424 |
| 4 | 1.429 | 1.419 |
| 5 | 1.430 | 1.426 |
Median was 1.429 s before and 1.419 s after (−0.7%, within this run spread). The telemetry is
opt-in; the plain run shows no measurable cost when off.
Final binaries `Standalone/bin/linux/VoxelForgeCoreHeadless-linux14-clang` and
`Standalone/bin/linux/VoxelForgeCoreHeadless-linux14-gcc` were rebuilt with `Standalone/BuildLinux.sh`,
`-j12`, CPUs 0–11, and a 6 GiB address-space cap: Clang 19 with FP contraction off and GCC 14 with
default contraction. Builds passed. Runtime peak RSS was 926,520 KiB; largest individual
build-process RSS was 901,968 KiB (GCC), with a 4,557,196 KiB process-group peak. Governor remained
`powersave`.
The final hash matrix passed 28/28: SurfaceWorld seed 0 and FloatingIslands seed 0, Clang/GCC,
W1/W8/W12, with five W12 repeats per recipe/compiler. Full-detail, whole-view, all nine per-LOD,
and exact-query rows match L13 exactly. Route parity also passed for SurfaceWorld seeds 0,
1, and 17 and FloatingIslands seed 0: page/native-only routes, edits, history, higher-LOD exact
queries, and proof checks had zero mismatches. The final 24 m crossing hash matched at W1/W12 on
both compilers: `0x337ca62131576728 / 0x7612f48e2ddbbaab / 0x69a67ed4add83b87 / 0xf11ac1ebd0f7ddb8`
(density/mesh/payload/topology).
| Recipe | Full-detail D/M/P/T | Whole-view D/M/P/T | Exact density / unclamped / detail / collision |
|---|---|---|---|
| SurfaceWorld | `0x0ee0579bd15cbbe4 / 0x32e5d4964d610fee / 0x1932b96ee4b1d910 / 0x69743c6bad3447dc` | `0xc10697a8f48380c7 / 0xe75c9119a1498cd5 / 0x49a9a8d1835a6c8c / 0xedcb23288b5e8724` | `0xe4d4a8eb95b35933 / 0xe4d4a8eb95b35933 / 0xefcba20c0c70c415 / 0xe604823a249029bf` |
| FloatingIslands | `0x6d842d2878b08ef6 / 0x4b868a3184f08035 / 0x2cedf2236788752d / 0xeac17d5e0cb5044a` | `0x5be4d8cde79b2a76 / 0x96f75041f6861b3a / 0x3700a516cc89d50c / 0x6b99948d6eab4f21` | `0x61daded9c303becb / 0x61daded9c303becb / 0xefcba20c0c70c415 / 0x84d37463be9b0573` |
Hash logs and the 28-row comparator are in `Saved/Linux/l14-final-hash-*.log` and
`Saved/Linux/l14-final-hash-audit.txt`. Final route logs are `Saved/Linux/l14-final-route-*.log`;
crossing and pair logs use the `l14-final-crossing-*` and `l14-final-cost-*` names.
## Failed or retried runs
- The first SurfaceWorld hash matrix and first crossing checks omitted the spawn camera and used the
headless origin. Their comparisons differed from L13; all 14 SurfaceWorld configurations and all
four crossing configurations were rerun with the spawn camera and passed. FloatingIslands used
its auto-surface camera and matched on the first run.
- The first route probes also used the wrong camera selection. A later seed-1 probe used the fixed
seed-0 camera, exited 9 on two LOD2 exact-query checks, and was rerun with `--auto-surface-camera`;
the corrected seed-1 and seed-17 audits passed. The origin-camera route probes returned success
but were not used as reference results.
- Clang was rebuilt after the connector counters were added and again after folding aggregation
into the existing opt-in guard. Both Clang builds and the final GCC build succeeded. No run hit
the RSS, 15-minute stuck-step, or 30-minute limits.
Owner note: the highest measured far cost is still LOD6 connector repair, but its formula work is
mostly uncached and its panels preserve the coarse route wall. The final interleaved plain runs show
no measurable diagnostic overhead; no geometry change or L6 budget claim is made.
## Orchestrator review (Claude)
- Accepted as a counting round. Interleaved W12, no hashing: L13 1.429 s vs L14 1.419 s median, so the
opt-in counters cost nothing measurable when off; committed with the report.
- Conclusion: exact-output far work has no remaining lever above 3%. The big buckets
(ground/cap refinement ~3.95 worker-s, LOD6 connector repair ~1.40 worker-s) produce visible
geometry. Further far savings need geometry changes, judged against today's same-LOD mesh within
the owner's budget (1 px at 1440p, at the LOD's closest display distance, display only).
@@ -0,0 +1,195 @@
# Linux15 report
## Result
Null result. No far-mesh shortcut passed the full 1 px, shading, swap, and topology gates, so no
recipe enables one by default. Evaluator version 6→7 adds the optional `far_display_mesh` declaration;
omitting it keeps the L14 output path. The controls are in the shared Core layer and do not touch
LOD0–2, exact queries, collision, edits, or server state.
Candidates measured:
- Refinement grid scale ×2 at LOD4, 5, 6, 7, and 8. The all-tile LOD4 and LOD5 runs reject; the
remaining per-LOD probes exceed 1 px or change shading, and the LOD6–8 candidates worsen at
least one adjacent swap.
- Reusing connector station radii leaves geometry p99 at 1.07 px but reaches 15.23 px maximum;
shading delta reaches 0.667 and the normal changes by 73.3°.
- Coarsening refinement at LOD4–8 is the largest measured saving, but exceeds the display budget.
Halving connector station density also saves time but opens gaps. Removing
any one ray direction also opens gaps, and the removed-panel control finds 99 new holes.
## Screen-space gate
The gate samples 65×65 surface grids across all 1,145 displayed LOD3–8 tiles (5,208,134 samples;
skirts excluded). Geometry is projected normal displacement against today's same-LOD mesh at its
closest display distance, using 90° horizontal FOV and 2,560 px (0.000613592 rad/px). Shading delta
is the maximum of fixed-light normalized Lambert change and material selector/blend-channel change;
the limit is 1/255. Each number below is p50/p99/max. Exact-path baseline values are all zero.
The gate rejects geometry max above 1 px, shading max above 1/255, any worse per-sample swap,
missing surface, or new hole/crack/floater. Its own validation fails if S13, stride-2, missing
surface, floating surface, missing fine-ring, or removed-panel controls are not rejected; the
panel control must expose at least one new connector hole.
| LOD | Tiles | Geometry px: baseline → refine×2 all | Shading delta: baseline → refine×2 all | Refine×2 holes / cracks / floating |
|---:|---:|---:|---:|---:|
| 3 | 384 | 0/0/0 → 0/0/0 | 0/0/0 → 0/0/0 | 0 / 0 / 0 |
| 4 | 320 | 0/0/0 → 0/2.370/606.562 | 0/0/0 → 0/0.023529/1 | 254 / 400 / 254 |
| 5 | 144 | 0/0/0 → 0/12.728/95.453 | 0/0/0 → 0/1/1 | 1,183 / 76 / 138 |
| 6 | 96 | 0/0/0 → 0.023/13.408/799.596 | 0/0/0 → 0/1/1 | 476 / 0 / 201 |
| 7 | 48 | 0/0/0 → 0/13.242/248.905 | 0/0/0 → 0/1/1 | 30 / 0 / 1 |
| 8 | 153 | 0/0/0 → 0.158/19.250/187.465 | 0/0/0 → 0.003922/1/1 | 45 / 0 / 946 |
The selected-patch swap report compares each baseline with refine×2 all. Values are p50/p99/max px.
| Swap (distance) | Before | After refine×2 all |
|---|---:|---:|
| 3→2 (96 m) | 0.611/3.767/6.045 | 0.611/3.767/6.045 |
| 4→3 (192 m) | 0.752/4.630/7.513 | 0.752/4.630/7.513 |
| 5→4 (384 m) | 0/9.580/31.783 | 2.435/32.321/86.615 |
| 6→5 (768 m) | 0/9.754/70.340 | 0.343/19.142/78.077 |
| 7→6 (1,536 m) | 0/9.040/42.355 | 0.200/15.109/50.994 |
| 8→7 (3,072 m) | 0.826/18.030/47.182 | 1.528/24.547/64.449 |
The station×2 LOD6 screen scan measures 0/2/813.571 px, shading 0/0/1, with 1,349 holes and 1,690
floaters. Its connector audit counts missing ray stations by stable tile/ray/station ID: holes 8→221
(216 new), floating classifications 464→405 (111 new IDs). In the refine×2 all row above, the
screen scan reports those all-tile holes, cracks, and floaters. Station×2 leaves all six selected-patch
swap p50/p99/max rows at baseline values, including 6→5 at 0/9.754/70.340 px. All four ray directions are required:
the four one-ray-removed
controls create 1,008, 1,022, 1,171, and 1,158 new holes. The explicit panel-removal control creates
99 new holes. The exact-path audit has zero new holes, cracks, or floating pieces; its raw connector
audit counts remain 8 holes and 464 pre-existing floating classifications.
The LOD4×2 and LOD5×2 candidates also fail in isolation. Reusing station radii misses the LOD6
geometry and shading limits. The four one-ray-removed masks add 1,008, 1,022, 1,171, and 1,158
connector holes, respectively.
## Negative controls
- The S13 global-octave-drop and stride-2 column-interpolation controls are rejected at every LOD3–8.
- Missing displayed surface, a floating surface, and missing fine-ring surface controls are rejected.
- Removing connector panels is rejected with 99 new holes. The exact connector path has zero new
station IDs classified as holes, cracks, or floaters.
## Speed
Five interleaved W12 pairs per candidate, hashing off, same 2,553-tile L1 view.
`whole_view_ready` is the metric. Both candidates fail the quality gate.
Station×2 connector stations:
| Pair | L14 baseline | Station×2 | Change |
|---:|---:|---:|---:|
| 1 | 1.320 s | 1.304 s | −1.2% |
| 2 | 1.363 s | 1.330 s | −2.4% |
| 3 | 1.371 s | 1.332 s | −2.8% |
| 4 | 1.393 s | 1.341 s | −3.7% |
| 5 | 1.391 s | 1.345 s | −3.3% |
| Median | 1.371 s | 1.332 s | −2.8% (3.3% median paired gain) |
Refinement grid scale ×2 at LOD4–8:
| Pair | L14 baseline | Refine×2 all | Change |
|---:|---:|---:|---:|
| 1 | 1.305 s | 1.164 s | −10.8% |
| 2 | 1.336 s | 1.177 s | −11.9% |
| 3 | 1.362 s | 1.169 s | −14.2% |
| 4 | 1.378 s | 1.178 s | −14.5% |
| 5 | 1.384 s | 1.190 s | −14.0% |
| Median | 1.362 s | 1.177 s | −13.6% (14.0% median paired gain) |
## Hashes and invariants
The undeclared/default recipe path matches L14. LOD0–2 density/mesh/payload/topology hashes:
| LOD | Density | Mesh | Payload | Topology |
|---:|---|---|---|---|
| 0 | `769f2a706d585a72` | `33eeeb39fa443816` | `645621a1d968983f` | `c2457ed905036c9d` |
| 1 | `69cc5a5c0a2c60af` | `b48335f5410c57d5` | `d15c5480162ab8ba` | `feca1bd025823604` |
| 2 | `85deed5683a77202` | `53469895987aeea2` | `e55f8ae7e1532033` | `d5feb12a0e85c09b` |
Exact queries (density / unclamped / detail / collision) remain
`e4d4a8eb95b35933 / e4d4a8eb95b35933 / efcba20c0c70c415 / e604823a249029bf`. The 24 m crossing's
432 moved tiles match L14 at W1/W12 with Clang off and GCC default:
`337ca62131576728 / 7612f48e2ddbbaab / 69a67ed4add83b87 / f11ac1ebd0f7ddb8` (D/M/P/T).
Its LOD0–2 per-LOD hashes also match the three rows above.
Determinism passed 28/28 configurations: SurfaceWorld seed 0 and FloatingIslands seed 0, Clang 19
FP-contract off and GCC 14 default, W1/W8/W12 and five W12 repeats. All per-LOD and whole-view
hashes match L14. L13 route parity passed for SurfaceWorld seeds 0, 1, and 17 and FloatingIslands
seed 0; page, native-only, higher-LOD, edit, and history mismatch counts are zero.
The L3 FP-contract preamble/self-test, L4 `FLazy`, L7 shared cache, L9/L12 proofs, L11 readiness and
crash fix, L13 route binding, and CLAUDE.md async rules remain in place. The evaluator and optional
recipe declaration are shared by all recipes. Builds and runs used CPUs 0–11, up to W12, normal
priority, 6 GiB address-space limits, and the unchanged `powersave` governor. Peak RSS was 904,400 KB
(GCC build); peak runtime RSS was 736,432 KB. No run exceeded the time or memory limits.
## Capture pairs
JPEGs are 1280×720 and each is under 74 KB. Before is L14; after is the rejected refinement×2
candidate applied at LOD4–8.
The L1 view uses `(0,-35,-487.94) m`, yaw 0°, pitch −22°. Horizon uses the same location at pitch −2°.
The mesa frame aims from the L1 location at the L6 mesa band (`(-472,-1432,-463.151) m` in the
gate) with yaw −161° and pitch 0.9°.
| View | Before | After refine×2 all |
|---|---|---|
| L1 camera | [l1-camera-before.jpg](captures/l1-camera-before.jpg) (59 KB) | [l1-camera-after-refineall.jpg](captures/l1-camera-after-refineall.jpg) (57 KB) |
| Horizon | [horizon-before.jpg](captures/horizon-before.jpg) (63 KB) | [horizon-after-refineall.jpg](captures/horizon-after-refineall.jpg) (60 KB) |
| LOD6 mesa rim | [lod6-mesa-rim-before.jpg](captures/lod6-mesa-rim-before.jpg) (74 KB) | [lod6-mesa-rim-after-refineall.jpg](captures/lod6-mesa-rim-after-refineall.jpg) (67 KB) |
## Failed and retried runs
- The first Clang build wrapper exited 127 because `/usr/bin/time` is absent; the direct Clang
`-ffp-contract=off` build succeeded. GCC 14 default also built successfully.
- A later sequential-build monitor was interrupted after Clang completed and before its GCC step
launched. Clang and GCC were rebuilt separately with the same compiler settings and 6 GiB cap.
- The first hash matrix omitted `--seed=0` and was discarded. A second FloatingIslands matrix used
the SurfaceWorld spawn camera; it was rerun with the L14 auto-surface camera. The corrected matrix
passed all 28 configurations.
- Initial SurfaceWorld route probes used no camera for seed 0 (the 2,370-tile bound), omitted
`--region-crossing` for seed 0 (shape compiler safety bound), and used the fixed seed-0 camera for
seed 1 (LOD2/exact-query parity mismatch; seed 17 was not run with that setup). They were rerun
with L14's camera selection and region-crossing option; all four final route audits passed. The
first 24 m crossing also omitted `--region-crossing` and exceeded the shape-build safety bound;
all four corrected compiler/worker combinations passed.
- The first connector audit compared aggregate counts. It was replaced with stable per-ray station
ID comparison before the final gate. The initial L4 selected-tile gate missed a changed tile; the
all-desired-tile coverage gate found and rejected it. The full-view gate is used in the table above.
- The first JPEG encoding pass did not set CPU affinity or an address-space cap. All six files were
re-encoded under CPUs 0–11 and the 6 GiB cap; sizes and pixels stayed the same.
- The first five speed pairs included screen-gate color capture on ordinary streaming tiles. That
diagnostic copy is now enabled only for gate runs; all five cost pairs were rerun and the table
above uses only the final logs. The final exact gate passed and station×2 remained rejected.
- No builds, captures, final audits, or cost runs timed out or breached their memory limits. The
intentional candidate rejections are listed above, not treated as infrastructure failures.
Evidence logs are in `Saved/Linux`: the final baseline and station×2 all-tile gates are
`l15-final-gatecolors-exact.log` and `l15-final-gatecolors-station2.log`; the best-payoff
refinement×2 all-tile gate is `l15-final-gatecolors-refineall.log`. Single-LOD refinement coverage is in
`l15-gate-alltiles-refine-l4x2.log` and `l15-gate-alltiles-refine-l5x2.log`. Single-LOD refinement
and connector-ray probes are `l15-gate-refine-l{x}x2.log`, `l15-gate-reuse.log`, and
`l15-gate-rays{14,13,11,7}.log`. Hash, route, and crossing evidence is in
`l15-final-hash-audit.txt`, `l15-final-route-*.log`, and `l15-final-crossing-24m-*.log`; final
station×2 speed pairs are `l15-final-speed-pair{1..5}-{before,after}.log`; refinement×2 pairs are
`l15-final-speed-refineall-pair{1..5}-{before,after}.log`.
## Note for the owner
The default far terrain stays the same because every measured reduction exceeded the 1 px geometry
or shading limit, worsened a swap, or opened holes. Refinement×2 across LOD4–8 saves 13.6% by the
median whole-view ratio, but creates hundreds-pixel errors and visible gaps, so the captures show it
for review only and it is not enabled.
## Orchestrator review (Claude)
- I looked at the LOD6 mesa-rim pair. After refine×2, the jagged crests are visibly smoothed, black
holes appear in the cap/ceiling, and a dark sliver shows on the left horizon. That confirms the
gate's rejection: the instrument is right this time, not the world.
- **Not merged into `assembler/world`:** the candidate knobs and the evaluator 6→7 bump add no default
output and would invalidate version stamps for nothing. The full L15 code (the extended gate with
shading, swap and connector-ID audits, and the candidate controls) is kept on side branch
`wip/l15-far-budget`. `assembler/world` stays at L14 code plus this report.
- Conclusion of L14+L15: far terrain has no exact or within-budget saving left with today's design. The
remaining far cost is the price of the current refinement and connector-repair geometry.
Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

@@ -0,0 +1,232 @@
# Linux16 — terrain cache design and Core prototype
This is a persistence feature. The measurements judge exactness, storage, and worker responsiveness;
first-time terrain generation remains a separate cost. The prototype is headless and opt-in. Unreal
integration remains for the owner's PC.
## Design
- **Cache identity.** Production keys should include a stable world ID; season ID and canonical
season-content hash; seed and RNG contract; recipe, plan, biome/manifest and owner-content hashes;
schema and `WorldAssemblyEvaluatorVersion` (6 here); tile coordinate and LOD; voxel size and tile
dimensions; generation options; material/payload-section schema; mesher contract; and a generator
build/FP-contract identity. Include a platform or compiler identity unless cross-build output has
been proven equivalent. Clang and GCC matched this round's full hash matrix, but that alone does
not make every future build interchangeable. Use canonical content hashes so whitespace or JSON
key order does not change the world identity.
- **Prototype identity.** The header and file name include the raw owner-snapshot hash, Core
configuration, recipe/plan/manifest hashes, seed, schema, evaluator, voxel size, tile size,
mesher/FP contract, generation-options hash, tile key and LOD. The edited-tile probe also includes
edit sequence and tile edit digest. The prototype uses 64-bit FNV for identity inputs and CRC32
for accidental file corruption. Production should use a 256-bit content hash and a stable world
ID; the prototype hashes are evidence machinery, not a security boundary.
- **Edits.** Keep the reusable cache pristine. On load, apply the authoritative versioned diff layer
in sequence, then build the edited render/collision result. A derived edited-tile cache, if useful,
must key on the last applied sequence and a digest of edits intersecting that tile. A newer edit
invalidates only derived entries for touched tiles; it leaves pristine entries valid. The edit
probe wrote and reread sequence 1 with digest `3cd5603ebf707d0c` and matched every array and hash.
- **Server.** Never accept a client's cached mesh or collision as authoritative. The server may use
its own locally generated cache for pristine meshes, then apply its ordered edit layer and build
collision from that result. Client cache contents never cross the network; only validated edits
do. A server restart can reuse its own cache after identity and payload validation.
- **Invalidation and verification.** Season/content, seed/RNG, recipe, plan, evaluator, generator,
mesher, FP, voxel-grid, LOD, options, or payload-schema changes select a different key. Evaluator
bump and edit-sequence bump were rejected by the prototype. A canonical uncompressed-payload hash
should be stored and verified at load; corruption or a mismatch is a cache miss, followed by
regeneration on a worker. The prototype verifies CRCs and structure on every load, compares the
complete mesh arrays and Core D/M/P/T hashes after every generated write/read, and regenerates a
deliberately corrupted cached tile. This proves the sampled write/read route; a file's own hash
cannot independently prove generator semantics on every later hit, so complete identity and
version discipline remain essential.
- **Stored data.** The prototype stores the final Core mesh: exact double positions/normals, float
UVs, RGBA, section/group counts, indices, skirt masks, density sample count, and D/M/P/T hashes.
This avoids remeshing on a hit and maps directly to future RMC sections. The indices and section
ranges can feed server-side collision construction after edits. Density/sign tiles offer more
freedom for future meshers but require meshing, materials, and collision work on load; density
sizes were not benchmarked here. Keep collision ownership server-side in either design.
- **Worker/smoothness path.** Cache reads, zlib decode, integrity checks, serialization, and writes
run in the existing headless Core tile worker/result route. The Unreal game thread was not
present on this machine; its later integration should submit cache work through the same worker
queue and return the ordinary tile result. The prototype uses that route for all recipes and
changes no recipe implementation. It exercises SurfaceWorld for cache round trips; the cache-off
matrix and route audits cover SurfaceWorld and FloatingIslands.
- **Read versus regenerate.** Track per-LOD generation and load/decode EWMA. If a demanded tile's
estimated read/decode time exceeds generation time, schedule generation directly; if an attempted
load fails, discard it and regenerate without blocking the result queue. Keep the same tile
priority and permit the previous coarser LOD to remain visible while work finishes. On this L1
set, warm read/decode averaged about 0.11 ms per LOD0 tile and 0.91–1.61 ms per LOD8/7 tile,
compared with 3.97 ms LOD0 and 12.89–24.24 ms LOD8/6 mesh generation in the instrumented fill.
- **Layout, crash safety, and eviction.** One file per tile under a world-content directory keeps
reads and eviction independent; the prototype has 2,553 L1 records and 2,986 touched records after
the 24 m crossing. It writes a same-directory `.tmp`, flushes and `fsync`s it, atomically renames
to `.vftile`, then syncs the directory. Readers only open final `.vftile` names and reject bad
lengths, versions, identities, CRCs, counts, indices, and padding. A crash before rename leaves a
non-loadable temp file. Production startup should remove old temp files. Use a global 2 GB cap
with an LRU index by last use, protect entries currently in use, reserve space under one lock,
evict oldest unpinned records before writes, and skip the write if space still cannot be made.
The prototype enforces the cap and skips writes when full; it does not implement LRU eviction.
Its 4 KiB padding enabled `O_DIRECT` measurements and can be removed in production buffered I/O.
## Compression measurements
Available system zlib headers/library (zlib 1.3.1) were linked with `-lz`. The existing zstd 1.5.7
CLI had no development headers, so it was tested as a per-tile CLI codec in LOD batches; its times
include one process start per LOD. No installs or system changes were made. All totals below cover
all 2,553 L1 tiles except Q16, whose first run had five route-audit tiles prepopulated before codec
sampling. Sizes are payload bytes; the lossless cache also has headers and per-file 4 KiB padding.
| Encoding | Total bytes | Relative to raw | Exact Core arrays? | L1 gate |
|---|---:|---:|---|---|
| Raw canonical mesh | 107,342,349 | 100% | Yes | Pass |
| zlib level 6 | 47,388,401 | 44.15% | Yes | Pass |
| zstd level 1 (CLI, per tile) | 46,513,479 | 43.33% | Yes | Pass; 1.85% smaller than zlib payload |
| Q16 positions + oct16 normals + delta-varint indices | 38,672,768 (2,548 tiles sampled) | 36.17% | No | Fail: 11.4482 px at LOD0; 6 degeneracy changes (2 at LOD4, 4 at LOD6) |
| Q24 positions + oct16 normals + delta-varint indices | 42,862,996 | 39.94% | No | Pass: 0.0458 px max, 0.000060 Lambert delta max, 0.00361° normal error max, no winding/degeneracy changes |
Q24 is about 9.5% smaller than zlib's payload, but it changes floating-point positions/normals and
cannot satisfy exact loaded-versus-regenerated hashes. The selected cache path is lossless zlib.
The zstd CLI decoded every tile byte-for-byte, and was modestly smaller/faster in this test. There
are no zstd development headers here, so it was not linked into the worker prototype. The L1 zlib
records occupied 55,685,120 bytes on disk, including record framing and page padding.
Per-tile size averages by LOD:
| LOD | Tiles | Raw B | zlib B | zstd B | Q16 B* | Q24 B |
|---:|---:|---:|---:|---:|---:|---:|
| 0 | 512 | 19,232.6 | 7,901.7 | 8,009.4 | 7,115.2 | 7,797.3 |
| 1 | 448 | 15,437.8 | 6,715.2 | 6,715.6 | 5,394.2 | 6,244.9 |
| 2 | 448 | 11,152.2 | 4,452.4 | 4,516.8 | 4,129.9 | 4,548.7 |
| 3 | 384 | 11,750.3 | 4,813.1 | 4,885.5 | 4,361.7 | 4,801.7 |
| 4 | 320 | 49,186.9 | 18,865.3 | 18,352.3 | 17,858.1 | 19,738.2 |
| 5 | 144 | 83,106.3 | 37,693.0 | 37,004.3 | 30,247.6 | 33,494.7 |
| 6 | 96 | 128,102.3 | 59,624.7 | 56,521.2 | 46,390.6 | 51,437.7 |
| 7 | 48 | 308,206.8 | 141,387.7 | 139,348.3 | 110,361.7 | 121,997.0 |
| 8 | 153 | 171,712.3 | 81,805.0 | 79,662.9 | 60,755.8 | 67,046.4 |
*Q16 averages are over the 2,548 newly generated tiles; five prepopulated tiles did not enter its
codec sample. Raw, zlib, and Q24 averages are from the clean 2,553-tile fill.
Average codec encode/decode time per tile, microseconds:
| LOD | Raw E/D | zlib E/D | zstd CLI E/D | Q24 mesh E/D |
|---:|---:|---:|---:|---:|
| 0 | 38.60 / 12.31 | 736.63 / 79.49 | 72.14 / 47.97 | 16.28 / 18.78 |
| 1 | 30.13 / 9.47 | 608.30 / 68.07 | 62.71 / 40.53 | 14.26 / 16.04 |
| 2 | 18.94 / 4.64 | 286.44 / 37.86 | 48.50 / 34.65 | 8.20 / 7.55 |
| 3 | 20.21 / 5.18 | 313.54 / 41.77 | 50.73 / 35.90 | 8.81 / 8.07 |
| 4 | 90.46 / 27.53 | 1,508.23 / 189.40 | 134.50 / 78.66 | 41.58 / 41.93 |
| 5 | 163.48 / 55.53 | 2,935.24 / 370.92 | 220.23 / 140.52 | 76.90 / 79.86 |
| 6 | 254.98 / 96.01 | 4,900.50 / 611.07 | 361.50 / 184.35 | 127.39 / 136.19 |
| 7 | 621.57 / 211.84 | 11,944.70 / 1,475.82 | 861.84 / 442.64 | 327.72 / 391.27 |
| 8 | 325.34 / 109.80 | 6,478.56 / 784.32 | 486.54 / 289.96 | 167.25 / 186.01 |
## Smoothness, prototype, and budgets
- A clean write generated, losslessly stored, reloaded, and exactly compared all 2,553 L1 tiles.
The whole-view D/M/P/T hash matched L14. The warm run hit 2,553/2,553 tiles, returned the same
hash, and reached whole-view-ready in 0.450 s including 0.193 s of shape setup; tile streaming
took 0.243 s.
- The 24 m crossing covered 432 entering tiles. Its D/M/P/T hash was
`337ca62131576728 / 7612f48e2ddbbaab / 69a67ed4add83b87 / f11ac1ebd0f7ddb8`, equal to L14.
The cache route audit passed 9 pristine pairs, one edited pair, and one movement-history pair,
all with exact arrays and zero D/M/P/T mismatches. The crossing fill generated and round-tripped
428 tiles; four had already been created by the route audit.
- Safety controls passed: evaluator bump rejected, edit-sequence bump rejected, a flipped compressed
payload byte rejected by record CRC, and a truncated file rejected by size validation. A separate
L1 run with one real tile corrupted regenerated that tile, hit the other 2,552, and restored the
exact L14 whole-view hash.
- `O_DIRECT` bypassed the kernel page cache for the 55,685,120-byte L1 record set: 0.269 s
(197.6 MiB/s). Buffered first touch was 0.0191 s and the repeat was 0.0126 s, but those passes
followed file writes/verification and were page-cache warm. No page cache was dropped; device
firmware may also cache blocks, so `O_DIRECT` is page-cache-cold evidence rather than proof of a
physical cold-device read. The ordinary worker hit path includes buffered read, zlib decode,
validation, and tile construction.
- The instrumentation measures raw, zlib, and mesh candidates on a miss, so its clean-fill
whole-view-ready time was 2.674 s versus 1.718 s for the hash-on no-cache L1 run. This includes
benchmark-only extra codec work. Production should encode only its selected lossless format on a
miss. Warm disk work and decode stay on workers; the first tile was ready in 0.226 s on fill and
0.208 s warm. These headless timings show worker completion; an Unreal frame-time check is still
for the integration round.
- The cache root peaked at 60,835,840 bytes after L1, the 24 m crossing, edit probe, and corruption
controls; the enforced limit is 2,000,000,000 bytes. No eviction was needed. The actual cache
implementation is a headless Core-worker prototype, not the Unreal plugin integration.
## Default-path cost and compatibility
Five interleaved W12 L1 pairs, hash off, 2,553 tiles each:
| Pair | L14 seconds | L16 cache-disabled seconds |
|---:|---:|---:|
| 1 | 1.450 | 1.446 |
| 2 | 1.464 | 1.457 |
| 3 | 1.458 | 1.453 |
| 4 | 1.525 | 1.472 |
| 5 | 1.459 | 1.483 |
Median: 1.459 s L14, 1.457 s L16, −0.14%; no measurable cache-off cost in this run.
All 28 L14 hash configurations passed (SurfaceWorld and FloatingIslands; Clang 19 FP off and GCC
14 default FP; W1/W8/W12 with five W12 repeats). Every one matched all 12 full-detail, whole-view,
nine LOD, and exact-query rows. The four default 24 m crossing checks (W1/W12 on both compilers)
matched all 13 rows, including the 432-tile crossing hash. Default route parity passed for both
compilers across SurfaceWorld seeds 0, 1, and 17 and FloatingIslands seed 0, using the existing
96 m history probe. The cache route passed its separate L1 and 24 m crossing audits.
Representative SurfaceWorld seed-0 hashes (D/M/P/T):
| View | Density / mesh / payload / topology |
|---|---|
| Full detail, 960 tiles | `0ee0579bd15cbbe4 / 32e5d4964d610fee / 1932b96ee4b1d910 / 69743c6bad3447dc` |
| Whole L1, 2,553 tiles | `c10697a8f48380c7 / e75c9119a1498cd5 / 49a9a8d1835a6c8c / edcb23288b5e8724` |
| LOD0, 512 tiles | `769f2a706d585a72 / 33eeeb39fa443816 / 645621a1d968983f / c2457ed905036c9d` |
| LOD1, 448 tiles | `69cc5a5c0a2c60af / b48335f5410c57d5 / d15c5480162ab8ba / feca1bd025823604` |
| LOD2, 448 tiles | `85deed5683a77202 / 53469895987aeea2 / e55f8ae7e1532033 / d5feb12a0e85c09b` |
| LOD3, 384 tiles | `6518caefb3be7e7f / ec513c90b853a614 / f62fa1137ff17f82 / ccf1dcf681965816` |
| LOD4, 320 tiles | `62d4be96021992f4 / f1e4c6efcc2615a9 / 9dc5f9c88be02f33 / fe6f55125a07c3bf` |
| LOD5, 144 tiles | `5e4a8c38b8cea6fc / 08ee56998aaf21e5 / 541eea8558f26cc8 / 6539374a8b3336d8` |
| LOD6, 96 tiles | `e036e95b9006945b / 624a33f941a99b02 / 81b73e14f68bdf86 / 4de4c63ce1f80a56` |
| LOD7, 48 tiles | `8ee358af56a30d8d / 46ab3c6184048b7c / 0a6164b7e68e80c5 / 0c26b85bb03bc831` |
| LOD8, 153 tiles | `c3458e1cbdb9c471 / 46c03d0994d75192 / 8f89fc5bde12d230 / d16dc0cf62031898` |
| Exact queries: density / unclamped / detail / collision | `e4d4a8eb95b35933 / e4d4a8eb95b35933 / efcba20c0c70c415 / e604823a249029bf` |
FloatingIslands full-detail was `6d842d2878b08ef6 / 4b868a3184f08035 / 2cedf2236788752d / eac17d5e0cb5044a`; whole-view was `5be4d8cde79b2a76 / 96f75041f6861b3a / 3700a516cc89d50c / 6b99948d6eab4f21`. Its exact-query hashes also matched L14: `61daded9c303becb / 61daded9c303becb / efcba20c0c70c415 / 84d37463be9b0573`.
## Runs and limits
- First Clang build was interrupted during a silent compile phase. The next build exposed a const
error in the prototype file index; making that index mutable fixed it. Final Clang and GCC builds
passed.
- The first L1 command used the binary's incorrect default data path (`Standalone/bin/data`) and
exited before writing. Supplying `Standalone/data/owner_world.json` passed.
- The first codec run sampled 2,548 tiles because route parity had prepopulated five; it was kept
for Q16 measurements. A clean fill then sampled all 2,553 Q24 tiles.
- A route wrapper first required a moving hash when hashing was disabled; the route audit itself
passed. Seed 17's 24 m history probe had no departed-tile candidate and failed on both L16 and
the L14 control. The same L14 96 m history setup passed on both L16 compilers. The required 24 m
crossing was separately checked and passed.
- The first crossing-hash comparator used an incorrect old-log filename; correcting the filename
let all four comparisons pass. No run exceeded 30 minutes or stalled for 15 minutes.
- Final review found that the cache-hit route audit's `exact_arrays` field initially reported hash
agreement without comparing the arrays themselves. The audit was changed to compare complete
arrays; after rebuilding, both L1 and 24 m crossing route audits passed with zero mismatches.
Runs used CPUs 0–11, at most 12 build jobs, a 6 GiB address-space cap, and normal priority. The
governor stayed `powersave`; peak sampled single-process RSS was 943,844 KiB (FloatingIslands route
audit, GCC). No installs, system changes, or page-cache drops were made. The L3 FP-contract preamble
and self-test, L4 `FLazy`, L7 shared cache, L9/L12 proofs, L11 readiness/crash fix, L13 route binding,
and async worker/result rules remain enabled. Cache logic is recipe-agnostic.
**Owner note:** Saving generated terrain works exactly and fits well under the round's disk cap.
Lossless zlib saved about 56% of the serialized payload. The smaller Q24 mesh encoding passed the
screen gate but changed exact hashes, so the feature should use the lossless record format.
## Orchestrator review (Claude)
- Design accepted: the key, the pristine cache plus ordered edits, a server that never trusts client
caches, corruption/stale rejection, lossless zlib, and atomic writes.
- **Not merged into `assembler/world`:** `Standalone/Source/StreamBenchmarkPipeline.h` (included by the
Windows viewer `StandaloneViewer.cpp`) now unconditionally includes `TileCachePrototype.h`, which
includes `<unistd.h>`, `<fcntl.h>` and `<zlib.h>`. That would break the MSVC build. Kept on side
branch `wip/l16-tile-cache`. Before merging, the prototype must be platform-guarded (or the cache
given a portable I/O and codec layer), and zlib needs a Windows source (UE ships zlib).
- Cache-off cost re-checked by Luna at −0.14% (within noise).
@@ -0,0 +1,26 @@
# Owner note — L17 FloatingIslands steps
The ledges were real generated mesh geometry caused by two boundary mistakes that made empty space
look like flat ground: the FloatingIslands seal was applied as a solid cap across XY, and owner
chunks were treated as 8 m of Core voxels instead of their actual 4 m. At the measured flat square,
the native island field is air and cave/floor influence is zero. The point is about 100 m from the
four islands.
I removed the false cap and corrected the shared owner/Core coordinate conversion. Evaluator version
is 7. The before/after captures show the false sheet disappear and the actual island shape remain.
SurfaceWorld’s L1 hash changes because it now selects its intended `Heightfield2D` route; its route,
readiness and proof audits pass.
The export has nonempty meshes at LOD0–8, and the standalone viewer enables and draws all levels by
default. I cannot identify the screenshot’s dark square as a whole missing LOD from the Linux data;
it may be a specific tile or viewer draw/upload issue. I did not change the Windows viewer. Please
capture the view below and, if the square remains, repeat with `--capture-only-lod=0` through `8`.
The low-view camera is `(-22,-19,-22.8) m`, yaw 0°, pitch −4°, matching the Linux island pair.
```bat
VoxelForgeCoreStandalone.exe --world-assembler-prototype --recipe=floating-islands --clip-radius=3 --max-clip-level=8 --workers=12 --camera=-22,-19,-22.8,0,-4 --capture=Standalone\Research\WorldAssemblerM3\Linux17\captures\floating-islands-windows.png --frame-limit=60
```
Use a different `--capture=` filename for each isolated LOD. Send the all-level image plus the
isolated image that corresponds to the square.
@@ -0,0 +1,182 @@
# VoxelForge L17 — FloatingIslands boundary report
Branch `assembler/world`, starting HEAD `9a7c87e`. No cache code was changed. The shared evaluator
version is now 7; the recipe schema stays at 1.
## Cause and fix
FloatingIslands uses the sparse `FloatingIslandFieldV1` manifest field. SurfaceWorld uses the
separate planar `Heightfield2D` field. The owner voxel is 12.5 cm and the Core voxel is 25 cm, so
one 32-voxel owner chunk is **16 Core voxels / 4 m**. Several shared paths divided Core positions
by 32 directly, treating that chunk as 8 m. That doubled stratum bounds, selected the wrong
generator route near the SurfaceWorld boundary, and made the legacy layer envelope extend over
empty FloatingIslands space.
The FloatingIslands `boundarySeal` also had been applied as a solid cap over all XY. At the owner’s
flat-square probe `(-11.612444,-118.221237) m`, the raw island field is air: at Z=3.25 m it was
`+81,809` subvoxels. The old seal added `−82,065`, yielding `−256` (`−1` Core voxel, or −25 cm);
at Z=3.50 m it yielded `−1` subvoxel (−0.098 cm), then air again at Z=3.75 m. The wrong 8 m
legacy layer bound produced a second false top near Z=8 m (old world density at 7.75 m was
−0.743 Core voxels; at 8 m it was +0.073). The owner’s 4.5 m LOD0 jump is real mesh geometry
created by those bad boundaries, often inside a tile; it is not a renderer artifact or island relief.
Nested clipmap rectangles made its placement look like a tile-boundary-only issue.
The fix uses the resolved owner/Core scale for manager lookups, layer bounds, readiness, and
adjacent native strata; removes the XY-wide FloatingIslands seal cap and its all-solid proof; and
clips adjacent native FI/SW signed-distance fields at their shared physical boundary. This is in
Core and applies to every generator route. SurfaceWorld still uses `Heightfield2D`.
The cave-floor lead does not match the samples. Cave and floor influence were exactly zero at the
flat square, the island center, and the sampled ledge/ring point. The native FI field and its island
or connector bounds account for the surface. The owner world compiled 70 rooms, 69 tunnels and 2
passages in this run; those legacy primitives do not contribute to the measured FI ledge.
## Before/after measurements
`RingProbe.py` samples upward-facing mesh surfaces on adjacent XY tile edges only when the tiles’
vertical bands overlap. Values are median / p95 / maximum absolute height difference, in cm. `n/a`
means this sparse-island export had no same-band LOD0↔1 surface pair after removing the false cap;
it is not a zero-error result. Higher rings include the deep SurfaceWorld boundary and other deep
surfaces, so those rows are not all FloatingIslands ground.
| LOD edge | Before (cm) | After (cm) |
|---|---:|---:|
| 0→1 | 3.451 / 8.920 / 449.158 (266 samples) | n/a (no same-band pair) |
| 1→2 | 26.642 / 148.262 / 149.862 (514) | 0 / 0 / 0 (234) |
| 2→3 | 0.134 / 198.730 / 773.318 (596) | 0 / 0 / 0 (207) |
| 3→4 | 3.269 / 47.875 / 188.531 (277) | 0 / 0 / 0 (288) |
| 4→5 | 29.975 / 130.496 / 445.444 (544) | 0 / 0 / 30.957 (258) |
| 5→6 | 12.234 / 127.224 / 536.573 (266) | 12.234 / 127.224 / 536.573 (266) |
| 6→7 | 29.013 / 301.752 / 42,624.479 (264) | 28.892 / 291.861 / 945.477 (264) |
| 7→8 | 83.843 / 1,225.416 / 3,755.407 (275) | 83.843 / 1,225.416 / 3,755.407 (275) |
The valid worst pre-fix LOD0↔1 sample is the false cap: 3.500 m vs 7.992 m, a 449.158 cm
difference. Upward-face within-tile span p95 / maximum changed from 4.490 / 4.491 m to 1.186 /
1.927 m on LOD0. The remaining LOD0 span is the actual island shape. LOD1–3 after-fix upward
faces at the measured lower boundary are exactly at −60 m. The island tops around the matched
camera are roughly −30 to −25 m.
A separate exploratory column comparison initially reported a 34.7 m difference by pairing an
island top near −25 m with a −60 m SurfaceWorld surface from a vertically disjoint tile. That
comparison was rejected: it is not a same-band ring seam. The saved `RingProbe.py` output is the
cross-LOD evidence used above.
## History, viewer and SurfaceWorld
Prebuilt L7, L9, L12, L13 and L14 binaries/logs all have the same legacy hashes: whole-view D/M/P/T
`92ba6a57a8690c00 / 9c6b56dfab6241c9 / 82394dd7c368a061 / 445e40bdb69b0bdb`; full-detail
`93ee3b6fb6b446f3 / 3ebc72d2027ab80b / cd5f55a96de12458 / 2f61c29af247b547`. The pattern
predates L7; these measurements show no output change at L9 or L13. S9 `e7586a1`, S12 `212814a`
and S14 `ec2afe9` do not contain the headless pipeline source, so they cannot be measured this way.
No old commit was rebuilt: `git worktree add` failed because `.git/worktrees` is read-only, and the
available old binaries were used as-is.
The headless mesh export has nonempty tiles at **all** LODs 0–8 (matched view counts:
15, 64, 40, 48, 48, 96, 48, 48, 153). The standalone viewer initializes all nine `bShowLevel`
flags to true and its draw loop visits all streaming batches. There is no evidence that a whole LOD
is absent from generated data or globally filtered by the viewer. The screenshot’s dark square
cannot be mapped to a particular tile/LOD from this Linux export; a localized viewer draw/upload
or camera issue remains unconfirmed. No viewer change was made because the Windows D3D11 build and
capture are unavailable here. The Unreal comparison does not identify the cause of that square.
SurfaceWorld L1 hashes changed for the shared coordinate fix. Old L14 LOD1 D/M/P/T was
`5043975b1e5b5a3d / 1c2a5658f10fdeaa / 23b6779ef35c3a0a / 1a6d2e2d152b4f84`; L17 is
`393ad79fd8c07132 / 47c9ba17e9f5ceaa / d5d6a948ac880e17 / 8b85ea08b2c440c4`. Before, readiness
was 0/27; now it is 27/27 on the near ring. The old mapping selected the wrong route at the
SurfaceWorld stratum; the corrected mapping selects its manifest `Heightfield2D` plan. Page/native
route parity and exact queries pass, so this is the intended shared-route output change.
## Gates, captures and limits
All 28 determinism rows passed: FI and SW, Clang 19 `-ffp-contract=off` and GCC 14 default,
W1/W8/W12 with five W12 repeats. Each recipe had one unique full, whole, nine-LOD and exact-query
hash tuple across all configurations. FI whole-view D/M/P/T is
`8339509b4d5ec231 / 70e5b2b9085b517c / 4e72e53745f20ed0 / 1a2643e5138e0407`; SW whole-view is
`b286ee4f4c38b7fc / 6862deb8ab9c2af9 / f23480a4953457f9 / 62977edfd04b3afe`.
FI route parity: 8 page pairs, 14 higher-LOD exact pairs, 782,026 exact samples, zero mismatches;
uniform proof: 19,288 blocks / 25,672,328 samples / zero violations. SW: 5 page and 9 native-only
pairs, 814,625 exact samples, zero mismatches; uniform proof: 13,297 blocks / 17,698,307 samples /
zero violations. Readiness negative controls were caught. The Clang FP-contraction-off and GCC
default builds passed; the Core startup FP self-test did not reject either. No async/MPSC/Epoch
code changed; `FLazy`, shared column caches, L9/L12 proof paths and L13 route binding remain in the
tested build.
Readable Linux capture mode adds directional light with soft ambient, gentle height tint, and an
optional faint tile-edge overlay. Five 1600×900 JPEGs, all below 300 KB, are in `captures/`:
- `floating-islands-flat-square-before.jpg` / `floating-islands-flat-square-after.jpg`: same owner
probe camera `(-11.6124,-118.2212,-19.8452) m`, yaw 0, pitch 0, before/after.
- `floating-islands-island-view-before.jpg` / `floating-islands-island-view-after.jpg`: same low
island camera `(-22,-19,-22.8) m`, yaw 0, pitch −4°, before/after.
- `surface-world-l1-readable-tiles.jpg`: SurfaceWorld L1 sanity view, camera `(0,-35,30) m`, yaw 0,
pitch −60°.
All are 1600×900 JPEGs; SHA256 is included for byte-level review.
| Capture | Bytes | SHA256 |
|---|---:|---|
| `floating-islands-flat-square-before.jpg` | 70,166 | `c41ed7645735ebefea97fbc1aed167b66a3e06c019c25b1c7d8cae9449713999` |
| `floating-islands-flat-square-after.jpg` | 47,612 | `f8fb5f937ac65be9db70a41473c7a10d7f35943ba6ef5c94ab03fde9ded5c544` |
| `floating-islands-island-view-before.jpg` | 70,813 | `5c7a8eda446f51a51ab22e45ed7286bf4180e69d8e3b2180780349facadacd32` |
| `floating-islands-island-view-after.jpg` | 51,429 | `3aeedef903fce62e81ea1f07bb460dd2beb42b893bbd9bf29220973951295b4c` |
| `surface-world-l1-readable-tiles.jpg` | 53,351 | `23f1753ed100c87607e22d2adc4f8e8a2856b8af3f1d37aa4f4cec9420a92b93` |
Clang/GCC compile peak RSS was 435,588 / 902,000 KiB. Determinism peak was 538,140 KiB; FI/SW
route-audit peaks were 621,404 / 763,112 KiB. The governor remained `powersave`; runs were limited
to CPUs 0–11, at most 12 workers, 6 GiB address space; llvmpipe used 12 threads.
## Failed or retried attempts
- The first headless invocation omitted the explicit owner-world input; it was rerun with
`Standalone/data/owner_world.json`.
- An initial SurfaceWorld export failed the native-only readiness guard; corrected owner/Core
mapping and rerun passed.
- A SurfaceWorld `--max-clip-level=1` attempt expanded to 35,435,983 tiles and failed the bounded
compiler (20.985 s, 3,988,160 KiB peak RSS). Retried with `--max-level=1` (960 tiles), which
passed.
- `BoundaryProbe.py` was first called with unsupported named Z arguments; rerun with positional
bounds passed.
- The first XY-only ring comparison mixed vertically disjoint surfaces; replaced by the
overlapping-band `RingProbe.py` used above. The exploratory column probe was also rejected for
pairing different vertical bands.
- The first offscreen SurfaceWorld command reversed scene/output arguments and failed to open the
mesh; rerun with the documented order passed.
- The first density-probe invocation used `Standalone/data/owner_world.json` without a resolved FI
manifest and failed. It was rerun with `Saved/Linux/l17-fi-owner-snapshot.json` and passed.
- `/usr/bin/time` was unavailable and an early process monitor mishandled a zombie child; the
process-tree monitor in `MeasureBuild.py` replaced both attempts.
- `git worktree add` could not write `.git/worktrees`; no worktree was created and no old commit was
built outside the repository.
- Mesa could not create `/home/jahni/.cache` in the read-only environment, disabled shader caching,
and completed all captures. No file was written outside the repository.
## Windows confirmation
Run from the repository root on Windows to capture the low island view:
```bat
VoxelForgeCoreStandalone.exe --world-assembler-prototype --recipe=floating-islands --clip-radius=3 --max-clip-level=8 --workers=12 --camera=-22,-19,-22.8,0,-4 --capture=Standalone\Research\WorldAssemblerM3\Linux17\captures\floating-islands-windows.png --frame-limit=60
```
For isolation, repeat with `--capture-only-lod=0` through `--capture-only-lod=8`, changing the
capture filename each time. Please send the all-level image and the isolated image matching the
dark square; those will identify whether it is a per-tile draw gap or a particular LOD payload.
## Orchestrator review (Claude) — NOT MERGED
- **The fix breaks SurfaceWorld.** I exported the L1 view (camera `0,-35,-487.94`) from L14 and from
L17 and rendered both in the new readable mode (`Saved/Linux/claude/sw/{before,after}-{l1,hz}.jpg`).
After L17, the ground under the spawn camera is gone (black void below), the terrain sits far
away, and the mesh export shrank from 58.7 MB to 31.7 MB. Halving the strate chunk size (8 m → 4 m)
moves and squashes every stratum: a world change, not a fix.
- **What the approved world uses:** the Core world the owner played and approved places strata
with 8 m chunks (32 Core voxels of 25 cm). The "owner chunk = 4 m" claim must be checked against
what the Unreal Core route actually does (`AVoxelWorld::CoreVoxelSizeCm`, the Core bridge,
`ResolvedWorldSnapshot`), not assumed.
- **Probably real and separable:** the FloatingIslands `boundarySeal` applied as a solid cap over all
XY (the false floors at 3.5/8 m). That needs its own minimal fix with SurfaceWorld unchanged.
- **Still open in FloatingIslands after the fix:** dark tile-aligned rectangles on the ground (the L17
"after" captures, lower left).
- Kept on side branch `wip/l17-fi-scale`. Only the capture tool's readable shading
(`LinuxOffscreenCapture.cpp`) is taken into `assembler/world`.
Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

@@ -0,0 +1,9 @@
# L18 build resources
Limits: CPUs 0–11, `-j12`, normal priority, 6 GiB address-space cap. Governor stayed `powersave`.
These are the final builds after the cell-coverage and owner ceiling corrections.
- Clang 19, `-ffp-contract=off`: exit 0, 31.689 s, peak process RSS 436,088 KiB, peak VMS 586,240 KiB.
- GCC 14, default FP contraction: exit 0, 48.648 s, peak process RSS 903,168 KiB, peak VMS 1,014,716 KiB.
- Largest measured runtime process was the final Clang gate run at 897,276 KiB RSS. The determinism matrix peaked at 603,172 KiB and the crossing matrix at 548,664 KiB.
- An earlier GCC build was interrupted by owner steering before producing a binary; the final GCC build above completed successfully.
@@ -0,0 +1,52 @@
#!/usr/bin/env python3
"""Render the matched L18 review views as small readable JPEGs."""
import os
import subprocess
from pathlib import Path
ROOT = Path(__file__).resolve().parents[4]
CAPTURE = ROOT / "Standalone/bin/linux/VoxelForgeOffscreenCapture-linux18-clang"
EXPORTS = ROOT / "Standalone/Research/WorldAssemblerM3/Linux18/exports"
OUT = ROOT / "Standalone/Research/WorldAssemblerM3/Linux18/captures"
LOGS = ROOT / "Saved/Linux"
OUT.mkdir(parents=True, exist_ok=True)
env = os.environ.copy()
env["LP_NUM_THREADS"] = "12"
env["XDG_CACHE_HOME"] = str(ROOT / "Saved/Linux/mesa-cache")
views = [
("floating-islands-flat-square-after", "floating-islands-flat-square.vfmesh",
(-11.612444, -118.221237, -19.8452), 0, 0, True),
("floating-islands-flat-square-no-edges", "floating-islands-flat-square.vfmesh",
(-11.612444, -118.221237, -19.8452), 0, 0, False),
("floating-islands-island-view-after", "floating-islands-island-view.vfmesh",
(-22, -19, -22.8), 0, -4, True),
("floating-islands-ceiling-up", "floating-islands-island-view.vfmesh",
(-22, -19, -22.8), 0, 80, True),
("surface-world-l1-spawn-after", "surface-world-l1-spawn.vfmesh",
(0, -35, -487.94), 0, -22, False),
("surface-world-horizon-after", "surface-world-l1-spawn.vfmesh",
(0, -35, -487.94), 0, 0, False),
]
for name, scene_name, camera, yaw, pitch, tile_edges in views:
scene = EXPORTS / scene_name
png = LOGS / f"l18-{name}.png"
jpg = OUT / f"{name}.jpg"
render_log = LOGS / f"l18-{name}-render.log"
convert_log = LOGS / f"l18-{name}-jpeg.log"
command = [str(CAPTURE), str(scene), str(png), "--size=1600x900",
"--shade=readable", f"--tile-edges={'on' if tile_edges else 'off'}",
"--tile-edge-width-m=0.15", "--camera-m="+",".join(map(str, camera)),
f"--yaw-deg={yaw}", f"--pitch-deg={pitch}"]
with render_log.open("w", encoding="utf-8") as stream:
subprocess.run(command, cwd=ROOT, env=env, stdout=stream,
stderr=subprocess.STDOUT, check=True)
ffmpeg = ["ffmpeg", "-nostdin", "-hide_banner", "-loglevel", "error", "-y",
"-i", str(png), "-frames:v", "1", "-q:v", "4", str(jpg)]
with convert_log.open("w", encoding="utf-8") as stream:
subprocess.run(ffmpeg, cwd=ROOT, env=env, stdout=stream,
stderr=subprocess.STDOUT, check=True)
if jpg.stat().st_size > 300_000:
raise SystemExit(f"{jpg.name} exceeds the 300 KB review limit")
print(f"[Capture] {jpg.relative_to(ROOT)} bytes={jpg.stat().st_size} status=PASS")
@@ -0,0 +1,165 @@
#!/usr/bin/env python3
"""Audit the emitted FloatingIslands roof faces and same-LOD tile-edge continuity."""
import array
import collections
import math
import struct
import sys
def read_exact(stream, size):
data = stream.read(size)
if len(data) != size:
raise EOFError(f"wanted {size} bytes, got {len(data)}")
return data
def height_at(triangles, x, y, preferred_z):
best = None
for (x0, y0, z0), (x1, y1, z1), (x2, y2, z2) in triangles:
den = (y1-y2)*(x0-x2)+(x2-x1)*(y0-y2)
if abs(den) < 1.0e-10:
continue
a = ((y1-y2)*(x-x2)+(x2-x1)*(y-y2))/den
b = ((y2-y0)*(x-x2)+(x0-x2)*(y-y2))/den
c = 1.0-a-b
if min(a,b,c) >= -1.0e-5:
z = a*z0+b*z1+c*z2
if best is None or abs(z-preferred_z) < abs(best-preferred_z):
best = z
return best
def quantile(values, fraction):
if not values:
return math.nan
ordered = sorted(values)
return ordered[math.floor(fraction*(len(ordered)-1))]
if len(sys.argv) != 3:
raise SystemExit("usage: CeilingContinuity.py scene.vfmesh expected-cap-plane-metres")
scene_path = sys.argv[1]
root_z = float(sys.argv[2])
tiles = {}
voxel_size_m = None
with open(scene_path, "rb") as stream:
if read_exact(stream, 8) != b"VFMSH001":
raise SystemExit("invalid VFMSH001 scene")
version, voxel_um, tile_count = struct.unpack("<3I", read_exact(stream, 12))
camera = struct.unpack("<3d", read_exact(stream, 24))
yaw, pitch = struct.unpack("<2d", read_exact(stream, 16))
voxel_size_m = voxel_um/1_000_000.0
for _ in range(tile_count):
key = struct.unpack("<4i", read_exact(stream, 16))
surface_vertices, skirt_count, vertex_count, index_count, mask_count = struct.unpack(
"<5I", read_exact(stream, 20))
positions = array.array("f")
positions.frombytes(read_exact(stream, vertex_count*12))
normals = array.array("f")
normals.frombytes(read_exact(stream, vertex_count*12))
indices = array.array("I")
indices.frombytes(read_exact(stream, index_count*4))
masks = read_exact(stream, mask_count)
if sys.byteorder != "little":
positions.byteswap()
normals.byteswap()
indices.byteswap()
extent = 32*(1 << key[3])*voxel_size_m
z0, z1 = key[2]*extent, (key[2]+1)*extent
ceiling = []
for triangle in range(index_count//3):
if masks and masks[triangle] != 0:
continue
a,b,c = indices[triangle*3:triangle*3+3]
if max(a,b,c) >= surface_vertices:
continue
nz = (normals[a*3+2]+normals[b*3+2]+normals[c*3+2])/3.0
if nz > -0.65:
continue
points = tuple((positions[v*3],positions[v*3+1],positions[v*3+2])
for v in (a,b,c))
center_z = sum(point[2] for point in points)/3.0
if abs(center_z-root_z) <= 1.0:
ceiling.append(points)
tiles[key] = {
"extent": extent, "x0": key[0]*extent, "y0": key[1]*extent,
"x1": (key[0]+1)*extent, "y1": (key[1]+1)*extent,
"z0": z0, "z1": z1, "ceiling": ceiling,
}
by_lod = collections.defaultdict(dict)
for key, tile in tiles.items():
if tile["z0"] <= root_z+1.0 and tile["z1"] >= root_z-1.0:
by_lod[key[3]][key] = tile
print(f"scene={scene_path} version={version} voxel_um={voxel_um} tiles={tile_count} "
f"camera_m={camera} yaw={yaw} pitch={pitch} expected_cap_m={root_z:.9f}")
print("lod zband_tiles cap_tiles missing_tiles cap_triangles face_z_m_p05/median/p95 "
"tile_samples hit_samples max_abs_root_delta_cm shared_edges shared_hits edge_gaps "
"edge_delta_cm_median/p95/max")
all_pass = True
for lod in range(9):
target = by_lod[lod]
cap_tiles = {key: tile for key,tile in target.items() if tile["ceiling"]}
face_z = [point[2] for tile in cap_tiles.values() for tri in tile["ceiling"]
for point in tri]
deltas = []
sample_count = 0
hit_count = 0
for key,tile in target.items():
if not tile["ceiling"]:
continue
for iy in range(16):
for ix in range(16):
x = tile["x0"]+(ix+0.5)*tile["extent"]/16
y = tile["y0"]+(iy+0.5)*tile["extent"]/16
sample_count += 1
height = height_at(tile["ceiling"],x,y,root_z)
if height is not None:
hit_count += 1
deltas.append(abs(height-root_z)*100.0)
edge_deltas = []
edge_count = 0
edge_gaps = 0
for key,a in cap_tiles.items():
x,y,z,level = key
for neighbor_key,axis in (((x+1,y,z,level),"x"),((x,y+1,z,level),"y")):
b = cap_tiles.get(neighbor_key)
if b is None:
continue
edge_count += 1
epsilon = min(0.02,a["extent"]*1.0e-4)
matched = 0
for index in range(33):
t = (index+0.5)/33
if axis == "x":
fixed = a["x1"]
varying = a["y0"]+(a["y1"]-a["y0"])*t
za = height_at(a["ceiling"],fixed-epsilon,varying,root_z)
zb = height_at(b["ceiling"],fixed+epsilon,varying,root_z)
else:
fixed = a["y1"]
varying = a["x0"]+(a["x1"]-a["x0"])*t
za = height_at(a["ceiling"],varying,fixed-epsilon,root_z)
zb = height_at(b["ceiling"],varying,fixed+epsilon,root_z)
if za is not None and zb is not None:
edge_deltas.append(abs(za-zb)*100.0)
matched += 1
if matched == 0:
edge_gaps += 1
missing = len(target)-len(cap_tiles)
max_root = max(deltas) if deltas else math.nan
print(f"{lod} {len(target)} {len(cap_tiles)} {missing} "
f"{sum(len(tile['ceiling']) for tile in cap_tiles.values())} "
f"{quantile(face_z,.05):.6f}/{quantile(face_z,.5):.6f}/{quantile(face_z,.95):.6f} "
f"{sample_count} {hit_count} {max_root:.3f} {edge_count} {len(edge_deltas)} "
f"{edge_gaps} {quantile(edge_deltas,.5):.3f}/{quantile(edge_deltas,.95):.3f}/"
f"{max(edge_deltas) if edge_deltas else math.nan:.3f}")
if lod >= 4 and target and (missing or hit_count != sample_count or edge_gaps):
all_pass = False
print(f"[CeilingContinuity] result={'PASS' if all_pass else 'FAIL'} "
"criteria=LOD4-8 requested z-band tiles emit an upper-boundary ceiling; 16x16 ray samples hit; "
"shared same-LOD tile edges have paired hits")
raise SystemExit(0 if all_pass else 1)
@@ -0,0 +1,25 @@
#!/usr/bin/env python3
"""Compare all L18 crossing configurations to the L14 24 m crossing hashes."""
import re
from pathlib import Path
ROOT = Path(__file__).resolve().parents[4]
RUNS = ROOT / "Saved/Linux/l18-crossing"
PATTERN = re.compile(
r"^\[Pipeline(?:FullDetailHash|WholeViewHash|LODHash|ExactQueryHash)\].*$", re.M)
failed = []
logs = sorted(RUNS.glob("*-w*-r*.log"))
for path in logs:
parts = path.stem.split("-")
compiler = parts[0]
reference_compiler = "clang" if compiler == "clang" else "gcc"
reference_path = ROOT / f"Saved/Linux/l14-final-crossing-24m-{reference_compiler}-w12.log"
expected = PATTERN.findall(reference_path.read_text(encoding="utf-8"))
actual = PATTERN.findall(path.read_text(encoding="utf-8", errors="replace"))
if actual != expected:
failed.append(path.name)
print(f"[CrossingReferenceMismatch] {path.name} expected_rows={len(expected)} "
f"actual_rows={len(actual)}")
print(f"[CrossingSurfaceHashGate] reference=L14-final-crossing-24m-W12 rows={len(logs)} "
f"result={'FAIL' if failed else 'PASS'}")
raise SystemExit(1 if failed or len(logs) != 14 else 0)
@@ -0,0 +1,25 @@
#!/usr/bin/env python3
"""Compare every L18 SurfaceWorld matrix hash row with the approved L14 reference."""
import re
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[4]
RUNS = ROOT / "Saved/Linux/l18-matrix"
REFERENCE = ROOT / "Saved/Linux/l14-final-hash-sw-clang-off-w12-r5.log"
PATTERN = re.compile(r"^\[Pipeline(?:FullDetailHash|WholeViewHash|LODHash|ExactQueryHash)\].*$", re.M)
expected = PATTERN.findall(REFERENCE.read_text(encoding="utf-8"))
if not expected or len(expected) != 12:
raise SystemExit(f"invalid L14 reference hash rows: {len(expected)}")
logs = sorted(RUNS.glob("surface-world-*.log"))
if len(logs) != 14:
raise SystemExit(f"expected 14 SurfaceWorld matrix logs, found {len(logs)}")
failed = []
for path in logs:
actual = PATTERN.findall(path.read_text(encoding="utf-8", errors="replace"))
if actual != expected:
failed.append(path.name)
print(f"[SurfaceHashMismatch] {path.name} expected={len(expected)} actual={len(actual)}")
print(f"[SurfaceHashGate] reference={REFERENCE.name} rows={len(logs)} expected_rows=14 "
f"result={'FAIL' if failed else 'PASS'}")
raise SystemExit(1 if failed else 0)
@@ -0,0 +1,149 @@
#include "Json.h"
#include "OwnerWorldLoader.h"
#include "StandaloneCoreScheduler.h"
#include "WorldAssemblyPrototype.h"
#include "StandaloneSnapshotAdapter.h"
#include <cmath>
#include <cstdio>
#include <fstream>
#include <iterator>
#include <memory>
#include <string>
namespace
{
constexpr double CoreVoxelsPerMeter=4.0;
constexpr std::int64_t SubvoxelsPerCoreVoxel=
VoxelForgeCore::WorldAssemblySubvoxelsPerVoxel;
void PrintDensity(VoxelForgeCore::World& World,const char* Label,double X,double Y,double Z)
{
const VoxelForgeCore::Vec3d Point{X*CoreVoxelsPerMeter,Y*CoreVoxelsPerMeter,
Z*CoreVoxelsPerMeter};
const double Density=World.densityAt(Point);
const double Raw=World.unclampedDensityAt(Point);
std::printf("[DensitySample] label=%s xyz_m=%.6f,%.6f,%.6f density_core_vox=%.9f "
"density_cm=%.4f unclamped_core_vox=%.9f sign=%s\n",Label,X,Y,Z,Density,
Density*25.0,Raw,Density<0.0?"solid":"air");
}
void PrintCrossing(VoxelForgeCore::World& World,const char* Label,double X,double Y,
double BottomM,double TopM)
{
const auto DensityAt=[&](double Z)
{
return World.densityAt({X*CoreVoxelsPerMeter,Y*CoreVoxelsPerMeter,
Z*CoreVoxelsPerMeter});
};
double Lo=BottomM,Hi=TopM;
double LoDensity=DensityAt(Lo),HiDensity=DensityAt(Hi);
if((LoDensity<0.0)==(HiDensity<0.0))
{
std::printf("[DensityCrossing] label=%s bracket_m=%.6f..%.6f signs=%s/%s result=none\n",
Label,Lo,Hi,LoDensity<0.0?"solid":"air",HiDensity<0.0?"solid":"air");
return;
}
for(int Iteration=0;Iteration<64;++Iteration)
{
const double Mid=(Lo+Hi)*0.5;
const double MidDensity=DensityAt(Mid);
if((MidDensity<0.0)==(LoDensity<0.0))
{Lo=Mid;LoDensity=MidDensity;}
else
{Hi=Mid;HiDensity=MidDensity;}
}
std::printf("[DensityCrossing] label=%s z_m=%.9f bracket_m=%.6f..%.6f "
"density_core_vox=%.9f/%.9f\n",Label,(Lo+Hi)*0.5,BottomM,TopM,
LoDensity,HiDensity);
}
}
int main(int argc,char** argv)
{
if(argc!=2)
{
std::fprintf(stderr,"usage: %s owner-world.json\n",argv[0]);
return 2;
}
VFJson::Value Root;
std::string Error;
{
std::ifstream Input(argv[1],std::ios::binary);
if(!Input){std::fprintf(stderr,"owner JSON open failed\n");return 2;}
std::string Text{std::istreambuf_iterator<char>(Input),std::istreambuf_iterator<char>{}};
if(!VFJson::Parser(std::move(Text)).Parse(Root,Error))
{std::fprintf(stderr,"owner JSON parse failed: %s\n",Error.c_str());return 2;}
}
if(!StandaloneWorldAssemblyPrototype::SelectTopStrateAsFloatingIslands(Root,Error))
{std::fprintf(stderr,"FI selection failed: %s\n",Error.c_str());return 2;}
auto Owner=std::make_shared<FStandaloneOwnerWorld>();
if(!StandaloneOwnerLoader::Resolve(Root,*Owner,Error))
{std::fprintf(stderr,"owner resolve failed: %s\n",Error.c_str());return 2;}
VoxelForgeCore::WorldAssemblyManifest Assembly;
if(!StandaloneWorldAssemblyPrototype::AttachRound1WorldAssemblyPrototype(
*Owner,Root,Error,{},&Assembly)
||!StandaloneWorldAssemblyPrototype::AttachFloatingIslandWorldAssembly(
*Owner,Root,Assembly,Error))
{std::fprintf(stderr,"plan construction failed: %s\n",Error.c_str());return 2;}
auto Snapshot=VoxelForgeCore::MakeStandaloneSnapshotFromParsedJson(Root,Owner->Seed,3,8,
false,false,Error);
if(!Snapshot)
{std::fprintf(stderr,"snapshot resolve failed: %s\n",Error.c_str());return 2;}
const auto* ResolvedAssembly=Snapshot.worldAssembly();
if(!ResolvedAssembly||ResolvedAssembly->floatingIslands.empty())
{std::fprintf(stderr,"resolved FloatingIslands plan missing\n");return 2;}
VoxelForgeCore::World World(std::move(Snapshot));
VoxelForgeCore::ShapeBuildRequest Request;
Request.minVoxel={-96,-512,-288};
Request.maxVoxel={96,96,64};
Request.clipMinVoxel=Request.minVoxel;
Request.clipMaxVoxel=Request.maxVoxel;
Request.workerLimit=12;
Request.includeFarWorld=false;
FStandaloneCoreScheduler Scheduler;
if(!World.compile(Request,Scheduler,Error))
{std::fprintf(stderr,"shape compile failed: %s\n",Error.c_str());return 2;}
const auto& Plan=ResolvedAssembly->floatingIslands.front();
const auto& Recipe=Plan.manifest.recipe;
std::printf("[FloatingIslandBounds] geometry_version=%u owner_voxel_um=%u core_voxel_um=%u "
"owner_to_core=%u/%u chunks=%d..%d layout_z_m=%.6f..%.6f ceiling_start_m=%.6f "
"seal_m=%.6f bottom_cap=%s\n",Recipe.geometryVersion,Recipe.ownerVoxelSizeMicrons,
Recipe.coreVoxelSizeMicrons,Recipe.ownerToCoreScaleNumerator,
Recipe.ownerToCoreScaleDenominator,Plan.topChunkZ,Plan.bottomChunkZ,
static_cast<double>(Recipe.layoutMinimumZSubvoxels)/SubvoxelsPerCoreVoxel/4.0,
static_cast<double>(Recipe.layoutMaximumZSubvoxels)/SubvoxelsPerCoreVoxel/4.0,
static_cast<double>(Recipe.layoutMaximumZSubvoxels-Recipe.boundarySealSubvoxels)
/SubvoxelsPerCoreVoxel/4.0,
static_cast<double>(Recipe.boundarySealSubvoxels)/SubvoxelsPerCoreVoxel/4.0,
Recipe.geometryVersion<3?"legacy":"removed");
std::printf("[DensityProbe] flat_square_xy_m=-11.612444,-118.221237 "
"compiled=%d core_voxel_size_cm=25\n",World.isCompiled()?1:0);
constexpr double X=-11.612443923950195;
constexpr double Y=-118.22123718261719;
for(double Z:{2.75,2.99,3.00,3.01,3.25,3.49,3.50,3.51,3.75,3.99,4.00,4.01,
4.05,4.125,4.25,4.50,5.00,
7.75,8.00,8.25,-60.25,-60.00,-59.75,-59.50,-59.25})
PrintDensity(World,"flat-square",X,Y,Z);
PrintCrossing(World,"shared-upper-ceiling",X,Y,3.50,3.75);
PrintCrossing(World,"upper-boundary-cap",X,Y,4.00,4.25);
PrintCrossing(World,"old-eight-metre-wrapper",X,Y,7.75,8.25);
PrintCrossing(World,"removed-lower-boundary-seal",X,Y,-60.25,-59.75);
for(const auto& Probe:std::array<std::array<double,2>,3>{{
{{-66.3,-38.7}},{{-62.3,-54.6}},{{-53.34,-22.84}}}})
{
std::printf("[DensityProbeXY] xy_m=%.3f,%.3f\n",Probe[0],Probe[1]);
for(double Z:{3.49,3.50,3.51,3.75,3.875,3.99,4.00,4.01,4.05,4.125})
PrintDensity(World,"boundary-ray",Probe[0],Probe[1],Z);
PrintCrossing(World,"boundary-ray",Probe[0],Probe[1],3.49,4.125);
}
for(const auto& Probe:std::array<std::array<double,2>,4>{{
{{-67.0,-39.0}},{{-66.0,-39.0}},{{-67.0,-38.0}},{{-66.0,-38.0}}}})
{
PrintDensity(World,"boundary-grid-node",Probe[0],Probe[1],3.875);
PrintDensity(World,"boundary-grid-node",Probe[0],Probe[1],4.125);
}
return 0;
}
@@ -0,0 +1,67 @@
#!/usr/bin/env python3
"""Measure peak per-process RSS for a build process tree under the L17 limits."""
import os
import subprocess
import sys
import time
from pathlib import Path
def descendants(root):
pending = [root]
seen = set()
while pending:
pid = pending.pop()
if pid in seen:
continue
seen.add(pid)
try:
children = Path(f"/proc/{pid}/task/{pid}/children").read_text().split()
pending.extend(int(child) for child in children)
except (FileNotFoundError, PermissionError, ProcessLookupError):
pass
return seen
def status(pid):
try:
fields = {}
for line in Path(f"/proc/{pid}/status").read_text().splitlines():
if line.startswith(("Name:", "VmRSS:", "VmSize:")):
key, *value = line.split()
fields[key[:-1]] = value[0] if value else ""
return (int(fields.get("VmRSS", "0")), int(fields.get("VmSize", "0")),
fields.get("Name", ""))
except (FileNotFoundError, PermissionError, ProcessLookupError, ValueError):
return None
if len(sys.argv) < 2:
raise SystemExit("usage: MeasureBuild.py command [arguments ...]")
if not os.sched_getaffinity(0).issubset(set(range(12))):
raise SystemExit("run under taskset -c 0-11")
started = time.monotonic()
process = subprocess.Popen(sys.argv[1:], start_new_session=True)
peak_rss = (0, 0, "")
peak_vms = (0, 0, "")
while process.poll() is None:
for pid in descendants(process.pid):
measured = status(pid)
if measured is None:
continue
rss, vms, name = measured
if rss > peak_rss[0]:
peak_rss = (rss, pid, name)
if vms > peak_vms[0]:
peak_vms = (vms, pid, name)
time.sleep(0.1)
exit_code = process.wait()
elapsed = time.monotonic() - started
print(f"[BuildTreeResources] exit_code={exit_code} wall_s={elapsed:.3f} "
f"peak_process_rss_kib={peak_rss[0]} peak_rss_pid={peak_rss[1]} "
f"peak_rss_name={peak_rss[2]} peak_process_vms_kib={peak_vms[0]} "
f"peak_vms_pid={peak_vms[1]} peak_vms_name={peak_vms[2]} "
"monitor_interval_s=0.1", flush=True)
raise SystemExit(exit_code)
@@ -0,0 +1,100 @@
#!/usr/bin/env python3
"""Summarize exported tile geometry and upward-facing ground for L17."""
import array
import collections
import math
import struct
import sys
def read_exact(stream, size):
data = stream.read(size)
if len(data) != size:
raise EOFError(f"wanted {size} bytes, got {len(data)}")
return data
path = sys.argv[1]
with open(path, "rb") as stream:
if read_exact(stream, 8) != b"VFMSH001":
raise SystemExit("bad VFMSH001 header")
version, voxel_um, tile_count = struct.unpack("<3I", read_exact(stream, 12))
camera = struct.unpack("<3d", read_exact(stream, 24))
yaw, pitch = struct.unpack("<2d", read_exact(stream, 16))
per_lod = collections.defaultdict(lambda: {"tiles": 0, "vertices": 0,
"triangles": 0, "surface_triangles": 0, "up_triangles": 0,
"up_centroids": [], "tile_spans": [], "empty": 0})
tile_rows = []
for _ in range(tile_count):
key = struct.unpack("<4i", read_exact(stream, 16))
surf_vertices, skirt_count, vertex_count, index_count, mask_count = struct.unpack(
"<5I", read_exact(stream, 20))
p = array.array("f")
p.frombytes(read_exact(stream, vertex_count * 12))
n = array.array("f")
n.frombytes(read_exact(stream, vertex_count * 12))
if sys.byteorder != "little":
p.byteswap(); n.byteswap()
indices = array.array("I")
indices.frombytes(read_exact(stream, index_count * 4))
masks = read_exact(stream, mask_count)
if sys.byteorder != "little":
indices.byteswap()
lod = key[3]
row = per_lod[lod]
row["tiles"] += 1
row["vertices"] += vertex_count
row["triangles"] += index_count // 3
row["surface_triangles"] += index_count // 3 - skirt_count
up = []
for tri in range(index_count // 3):
if masks and masks[tri] != 0:
continue
a, b, c = indices[tri * 3:tri * 3 + 3]
if max(a, b, c) >= surf_vertices:
continue
if (n[a * 3 + 2] + n[b * 3 + 2] + n[c * 3 + 2]) / 3.0 < 0.65:
continue
up.append((p[a * 3 + 2] + p[b * 3 + 2] + p[c * 3 + 2]) / 3.0)
row["up_triangles"] += len(up)
row["up_centroids"].extend(up)
if up:
up.sort()
span = up[math.floor(0.95 * (len(up) - 1))] - up[math.floor(0.05 * (len(up) - 1))]
row["tile_spans"].append(span)
tile_rows.append((key, vertex_count, index_count // 3, skirt_count,
len(up), up[0], up[len(up) // 2], up[-1], span))
else:
row["empty"] += 1
tile_rows.append((key, vertex_count, index_count // 3, skirt_count,
0, math.nan, math.nan, math.nan, math.nan))
print(f"version={version} voxel_um={voxel_um} tiles={tile_count} camera_m={camera} yaw={yaw} pitch={pitch}")
print("lod tiles mesh_tiles vertices triangles skirt_triangles upward_surface_triangles "
"upward_centroid_z_m_p05/median/p95 tile_up_z_span_m_p50/p95/max")
for lod in sorted(per_lod):
r = per_lod[lod]
z = sorted(r["up_centroids"])
s = sorted(r["tile_spans"])
def q(values, fraction):
return values[math.floor(fraction * (len(values) - 1))] if values else math.nan
print(f"{lod} {r['tiles']} {r['tiles']-r['empty']} {r['vertices']} {r['triangles']} "
f"{sum(row[3] for row in tile_rows if row[0][3] == lod)} {r['up_triangles']} "
f"{q(z,.05):.4f}/{q(z,.5):.4f}/{q(z,.95):.4f} "
f"{q(s,.5):.4f}/{q(s,.95):.4f}/{max(s) if s else math.nan:.4f}")
print("near_camera_up_tiles (sorted by XY tile-centre distance):")
near = []
for row in tile_rows:
key = row[0]
lod = key[3]
extent = 32 * (1 << lod) * voxel_um / 1_000_000.0
cx = (key[0] + 0.5) * extent
cy = (key[1] + 0.5) * extent
near.append((math.hypot(cx-camera[0], cy-camera[1]), row))
for distance, row in sorted(near)[:30]:
key, verts, tris, skirts, ups, lo, med, hi, span = row
if ups:
print(f"key={key} xy_distance_m={distance:.2f} vertices={verts} triangles={tris} "
f"skirt_triangles={skirts} upward_triangles={ups} z_m={lo:.3f}/{med:.3f}/{hi:.3f} "
f"tile_span_p05_p95_m={span:.3f}")
@@ -0,0 +1,152 @@
#!/usr/bin/env python3
"""Trace review-image pixels through the exported clipmap mesh."""
import array
import math
import struct
import sys
def read_exact(f, count):
data = f.read(count)
if len(data) != count:
raise EOFError((len(data), count))
return data
def floor_div(n, d):
q, r = divmod(n, d)
return q - (r < 0)
def visible_mask(key, desired):
x, y, z, lod = key
extent = 32 << lod
origin = (x * extent, y * extent, z * extent)
mask = 0
for axis in range(3):
for side in range(2):
probe = [origin[i] + extent // 2 for i in range(3)]
probe[axis] = origin[axis] + (extent if side else -1)
neighbor = None
for level in range(9):
neighbor_extent = 32 << level
coord = tuple(floor_div(probe[i], neighbor_extent) for i in range(3)) + (level,)
if coord in desired:
neighbor = level
break
if neighbor is None or neighbor != lod:
mask |= 1 << (axis * 2 + side)
return mask
def ray_box(origin, direction, low, high):
lo, hi = 0.1, 20000.0
for axis in range(3):
if abs(direction[axis]) < 1e-12:
if origin[axis] < low[axis] or origin[axis] > high[axis]:
return None
else:
a = (low[axis] - origin[axis]) / direction[axis]
b = (high[axis] - origin[axis]) / direction[axis]
if a > b:
a, b = b, a
lo, hi = max(lo, a), min(hi, b)
if lo > hi:
return None
return lo, hi
def ray_tri(origin, direction, a, b, c):
e1 = tuple(b[i] - a[i] for i in range(3))
e2 = tuple(c[i] - a[i] for i in range(3))
p = (direction[1]*e2[2]-direction[2]*e2[1],
direction[2]*e2[0]-direction[0]*e2[2],
direction[0]*e2[1]-direction[1]*e2[0])
det = sum(e1[i]*p[i] for i in range(3))
if abs(det) < 1e-10:
return None
inv = 1.0/det
tvec = tuple(origin[i]-a[i] for i in range(3))
u = sum(tvec[i]*p[i] for i in range(3))*inv
if u < 0 or u > 1:
return None
q = (tvec[1]*e1[2]-tvec[2]*e1[1],
tvec[2]*e1[0]-tvec[0]*e1[2],
tvec[0]*e1[1]-tvec[1]*e1[0])
v = sum(direction[i]*q[i] for i in range(3))*inv
if v < 0 or u+v > 1:
return None
t = sum(e2[i]*q[i] for i in range(3))*inv
return t if t >= 0.1 else None
if len(sys.argv) < 8 or len(sys.argv) % 2 != 1:
raise SystemExit("usage: ProbeCaptureRays.py scene.vfmesh camX camY camZ yaw pitch pixelX pixelY [pixelX pixelY ...]")
scene_path = sys.argv[1]
cam = tuple(map(float, sys.argv[2:5]))
yaw, pitch = map(math.radians, map(float, sys.argv[5:7]))
pixels = [(int(sys.argv[i]), int(sys.argv[i+1])) for i in range(7, len(sys.argv), 2)]
width, height, fov = 1600, 900, math.radians(90)
tan_h = math.tan(fov/2)
tan_v = tan_h / (width/height)
forward = (math.sin(yaw)*math.cos(pitch), math.cos(yaw)*math.cos(pitch), math.sin(pitch))
right = (math.cos(yaw), -math.sin(yaw), 0.0)
up = (right[1]*forward[2]-right[2]*forward[1], right[2]*forward[0]-right[0]*forward[2], right[0]*forward[1]-right[1]*forward[0])
with open(scene_path, "rb") as f:
if read_exact(f, 8) != b"VFMSH001":
raise SystemExit("bad scene")
version, voxel_um, count = struct.unpack("<3I", read_exact(f, 12))
scene_cam = struct.unpack("<3d", read_exact(f, 24))
scene_yaw, scene_pitch = struct.unpack("<2d", read_exact(f, 16))
voxel_m = voxel_um / 1_000_000.0
tiles = []
desired = set()
for _ in range(count):
key = struct.unpack("<4i", read_exact(f, 16))
surface_vertices, skirt_count, vertex_count, index_count, mask_count = struct.unpack("<5I", read_exact(f, 20))
positions = array.array("f"); positions.frombytes(read_exact(f, vertex_count*12))
normals = array.array("f"); normals.frombytes(read_exact(f, vertex_count*12))
indices = array.array("I"); indices.frombytes(read_exact(f, index_count*4))
masks = read_exact(f, mask_count)
if sys.byteorder != "little":
positions.byteswap(); normals.byteswap(); indices.byteswap()
desired.add(key)
tiles.append((key, surface_vertices, skirt_count, positions, normals, indices, masks))
print(f"scene={scene_path} tiles={count} camera={cam} yaw={math.degrees(yaw):.3f} pitch={math.degrees(pitch):.3f}")
for px, py in pixels:
nx = 2*px/width - 1
ny = 1 - 2*py/height
direction0 = tuple(forward[i] + nx*tan_h*right[i] + ny*tan_v*up[i] for i in range(3))
length = math.sqrt(sum(v*v for v in direction0))
direction = tuple(v/length for v in direction0)
hits = []
candidate_tiles = 0
for key, surface_vertices, skirt_count, positions, normals, indices, masks in tiles:
x,y,z,lod = key
extent = 32*(1<<lod)*voxel_m
low = (x*extent, y*extent, z*extent)
high = tuple(v+extent for v in low)
if ray_box(cam, direction, low, high) is None:
continue
candidate_tiles += 1
show_mask = visible_mask(key, desired)
for tri in range(len(indices)//3):
m = masks[tri] if masks else 0
if m and (m & show_mask) == 0:
continue
ia,ib,ic = indices[tri*3:tri*3+3]
a,b,c = [],[],[]
for idx, out in ((ia,a),(ib,b),(ic,c)):
base=idx*3
out.extend((positions[base],positions[base+1],positions[base+2]))
t=ray_tri(cam,direction,a,b,c)
if t is None: continue
p=tuple(cam[i]+t*direction[i] for i in range(3))
nz=(normals[ia*3+2]+normals[ib*3+2]+normals[ic*3+2])/3
hits.append((t,key,tri,m,p,nz,ia>=surface_vertices or ib>=surface_vertices or ic>=surface_vertices))
hits.sort(key=lambda h:h[0])
print(f"pixel=({px},{py}) ray={direction} candidate_tiles={candidate_tiles} hits={len(hits)}")
for t,key,tri,m,p,nz,skirt in hits[:12]:
print(f" t={t:.3f}m key={key} tri={tri} mask={m} skirt={skirt} z={p[2]:.3f} normal_z={nz:.3f} xyz=({p[0]:.3f},{p[1]:.3f},{p[2]:.3f})")
@@ -0,0 +1,132 @@
# Linux18 — FloatingIslands stratum boundaries
**Result:** FloatingIslands geometry v3 removes its false lower all-XY seal, keeps the ceiling from the shared upper-boundary seal, and projects missing ceiling cells for every generator. SurfaceWorld hashes match the approved L14 baseline at `8704129` in every checked configuration.
## Scale in the Unreal route
`AVoxelWorld::CoreVoxelSizeCm` defaults to 25 cm, and `GetActiveVoxelSizeCm()` resolves the runtime value ([VoxelWorld.h:300](../../../../Source/VoxelForge/Public/VoxelWorld.h), [VoxelWorld.cpp:7495](../../../../Source/VoxelForge/Private/VoxelWorld.cpp)). The adapter writes the resolved size to the snapshot ([VoxelForgeCoreAdapter.cpp:1019](../../../../Source/VoxelForge/Private/VoxelForgeCoreAdapter.cpp)); `AVoxelWorld` imports it with `ResolvedWorldSnapshot::FromJson` ([VoxelWorld.cpp:7597](../../../../Source/VoxelForge/Private/VoxelWorld.cpp), [VoxelForgeCore.cpp:916](../../../../Standalone/Core/src/VoxelForgeCore.cpp)). S1 records this single active size source and the 32-Core-voxel tile rule ([Round5 REPORT.md](../Round5/REPORT.md#1-one-core-voxel-size-source)).
At the current 25 cm setting, **SurfaceWorld strata use 8 m per slot chunk**: the Unreal surface plan multiplies the slot range by 32 Core voxels ([VoxelForgeCoreAdapter.cpp:280](../../../../Source/VoxelForge/Private/VoxelForgeCoreAdapter.cpp); `CHUNK_SIZE=32` in [VoxelTypes.h:211](../../../../Source/VoxelForge/Public/VoxelTypes.h)). **FloatingIslands uses 4 m per owner-authored chunk**: the adapter’s owner size is `VOXEL_SIZE` ([VoxelForgeCoreAdapter.cpp:33](../../../../Source/VoxelForge/Private/VoxelForgeCoreAdapter.cpp); 12.5 cm in [VoxelTypes.h:213](../../../../Source/VoxelForge/Public/VoxelTypes.h)), and its plan multiplies 32 owner voxels by the serialized owner/Core ratio, currently 12.5/25 = 1/2, or 16 Core voxels ([VoxelForgeCoreAdapter.cpp:441](../../../../Source/VoxelForge/Private/VoxelForgeCoreAdapter.cpp)). For chunks 0…−15 that gives z bounds −60…+4 m. This is the two explicit coordinate conventions in the game route, not a global change from 8 m to 4 m.
Standalone uses the same owner/Core ratio and chunk formula ([OwnerWorldLoader.h:302](../../../../Standalone/Source/OwnerWorldLoader.h), [WorldAssemblyPrototype.h:488](../../../../Standalone/Source/WorldAssemblyPrototype.h)); no current Unreal/standalone scale disagreement was found. L18 also removed the standalone-only two-Core-voxel bounds inset so recipe bounds match the Unreal plan. The owner decides whether either authored scale changes.
## Fix and ceiling
Geometry version 3 preserves the island shapes and removes only the lower all-XY seal. The upper seal calls the shared `VF_ApplyUpperBoundarySeal` density primitive; the shared two-sided seal uses the same upper-band math ([VoxelDensityPrimitives.h:44](../../../../Source/VoxelForge/Public/VoxelDensityPrimitives.h)). Resolved bounds come from each strate’s own range. The shared `AppendStratumBoundaryCeilings` mesh path runs for every generator and LOD, adding a plane at the resolved upper boundary where the mesh lacks coverage. It suppresses an existing plane only when nine probes show full cell coverage ([ShapeWorldInternal.h:36](../../../../Standalone/Core/src/ShapeWorldInternal.h), [FarShellsInternal.h:894](../../../../Standalone/Core/src/FarShellsInternal.h), [VoxelForgeCore.cpp:2207](../../../../Standalone/Core/src/VoxelForgeCore.cpp)). The underside normal points into the room, so the existing material lighting renders the interior face. This adds no FloatingIslands-specific height.
For the captured FloatingIslands strate, the upper bound is **z=+4 m** and its configured 0.5 m seal gives an interior-facing ceiling surface beginning around **z=+3.5 m**. The density probe crosses into the seal at 3.5 m and exits at z=4.019 m; z=7.75, 8.0, and 8.25 m remain air with no crossing. The lower all-XY seal is removed; remaining geometry below −60 m belongs to the lower world and is visible in the ray traces. Thus the apparent 3.5 m “floor” is the retained ceiling when viewed from inside; the 8 m floor is absent. No chunk size changed.
The owner’s decision and version-3 recipe say an underground strate has a ceiling at its configured upper boundary. “Farther to breathe” comes from a taller configured range. I updated the stale architecture-table wording “open void” to say the islands sit beneath the shared ceiling.
## Ceiling continuity
The final audit used 16×16 interior samples per tile and paired samples along same-LOD tile edges. Far LODs pass continuously:
| LOD | Tiles with cap | Interior hits | Max root delta | Edge gaps |
|---:|---:|---:|---:|---:|
| 4 | 48/48 | 12,288/12,288 | 0 cm | 0 |
| 5 | 48/48 | 12,288/12,288 | 0 cm | 0 |
| 6 | 48/48 | 12,288/12,288 | 0 cm | 0 |
| 7 | 48/48 | 12,288/12,288 | 0 cm | 0 |
| 8 | 153/153 | 39,168/39,168 | 0 cm | 0 |
LOD0, 2, and 3 also hit all tested samples. LOD1 missed 3 of 12,288 interior samples (0.387 cm maximum root delta) and had no shared-edge gaps. The readable upward view is `captures/floating-islands-ceiling-up.jpg`.
## Dark tile-aligned patches
They are lower SurfaceWorld triangles visible below the removed false lower cap, not empty rays and not a viewer dark-square overlay. Traces in the final island export found:
- Pixel (700,720): first hit at 104.924 m on non-skirt LOD2 tile `(-2,2,-2,2)`, z=−62.925 m, normal-z 0.266; another LOD2 tile hits z=−69.942 m.
- Pixel (1050,650): first hit at 168.051 m on non-skirt LOD3 tile `(0,2,-2,3)`, z=−72.594 m, normal-z 0.895; lower LOD4 geometry is also hit at z=−112.229 m and −120 m.
The ring probe measures real LOD height steps on those lower surfaces. I left them visible: suppressing those triangles would hide valid lower-stratum geometry, while changing the lower strata or SurfaceWorld would exceed this local fix. The sampled rectangles are not missing tiles or floor holes.
## Cross-LOD ring steps
Entries are median / p95 / maximum absolute edge-height difference in centimetres, then gap count. The L18 column is the final matched island camera. The large remaining steps are lower-stratum terrain, not the upper ceiling.
| LOD edge | L17 before | L17 after | L18 final |
|---|---:|---:|---:|
| 0→1 | 3.451 / 8.920 / 449.158; 14 | —; 0 samples | —; 0 samples |
| 1→2 | 26.642 / 148.262 / 149.862; 0 | 0 / 0 / 0; 0 | 147.141 / 148.403 / 149.862; 0 |
| 2→3 | 0.134 / 198.730 / 773.318; 8 | 0 / 0 / 0; 0 | 128.603 / 200.789 / 773.318; 8 |
| 3→4 | 3.269 / 47.875 / 188.531; 27 | 0 / 0 / 0; 0 | 3.269 / 47.774 / 188.531; 27 |
| 4→5 | 29.975 / 130.496 / 445.444; 6 | 0 / 0 / 30.957; 1 | 29.992 / 124.373 / 443.482; 6 |
| 5→6 | 12.234 / 127.224 / 536.573; 32 | 12.234 / 127.224 / 536.573; 32 | 12.234 / 127.224 / 536.573; 21 |
| 6→7 | 29.013 / 301.752 / 42,624.479; 0 | 28.892 / 291.861 / 945.477; 0 | 29.013 / 301.752 / 42,624.479; 0 |
| 7→8 | 83.843 / 1,225.416 / 3,755.407; 32 | 83.843 / 1,225.416 / 3,755.407; 0 | 83.843 / 1,225.416 / 3,755.407; 0 |
## SurfaceWorld regression hashes
The 14-run check compared each final output to `Saved/Linux/l14-final-hash-sw-clang-off-w12-r5.log` from the L14/`8704129` baseline: Clang `-ffp-contract=off` and GCC default, W1/W8/W12, with five W12 repeats. All 14 matched the whole-view, full-detail, LOD0–8, and exact-query rows. The 24 m crossing check likewise passed all 14 compiler/worker configurations against their L14 compiler-specific references.
Whole view D/M/P/T: `c10697a8f48380c7 / e75c9119a1498cd5 / 49a9a8d1835a6c8c / edcb23288b5e8724`.
Full detail D/M/P/T: `0ee0579bd15cbbe4 / 32e5d4964d610fee / 1932b96ee4b1d910 / 69743c6bad3447dc`.
| LOD | Density | Mesh | Payload | Topology |
|---:|---|---|---|---|
| 0 | `769f2a706d585a72` | `33eeeb39fa443816` | `645621a1d968983f` | `c2457ed905036c9d` |
| 1 | `69cc5a5c0a2c60af` | `b48335f5410c57d5` | `d15c5480162ab8ba` | `feca1bd025823604` |
| 2 | `85deed5683a77202` | `53469895987aeea2` | `e55f8ae7e1532033` | `d5feb12a0e85c09b` |
| 3 | `6518caefb3be7e7f` | `ec513c90b853a614` | `f62fa1137ff17f82` | `ccf1dcf681965816` |
| 4 | `62d4be96021992f4` | `f1e4c6efcc2615a9` | `9dc5f9c88be02f33` | `fe6f55125a07c3bf` |
| 5 | `5e4a8c38b8cea6fc` | `08ee56998aaf21e5` | `541eea8558f26cc8` | `6539374a8b3336d8` |
| 6 | `e036e95b9006945b` | `624a33f941a99b02` | `81b73e14f68bdf86` | `4de4c63ce1f80a56` |
| 7 | `8ee358af56a30d8d` | `46ab3c6184048b7c` | `0a6164b7e68e80c5` | `0c26b85bb03bc831` |
| 8 | `c3458e1cbdb9c471` | `46c03d0994d75192` | `8f89fc5bde12d230` | `d16dc0cf62031898` |
Exact query: 9 probes; density/unclamped `e4d4a8eb95b35933`, detail `efcba20c0c70c415`, collision `e604823a249029bf`.
The 24 m crossing W12×5 hashes match those same aggregate whole-view, full-detail, and exact-query values on both compiler references; the full check compared all 12 rows per run.
FloatingIslands’ representative W12×5 whole-view D/M/P/T is `ca7f375cded78f1d / da003331c554f8f3 / 0d2e74862b4ee500 / b7a7177af8915a21`; full-detail is `fc71abf85f5b9373 / e139b32d42ecfa29 / 28a2414e41de59bd / d61ca68ca64f74ca`. Exact query is `4ef614485815ee30` density/unclamped, `efcba20c0c70c415` detail, `e604823a249029bf` collision. Clang and GCC representative hashes agree, and all nine LOD rows stayed stable across the 28-run matrix.
## Other invariants and Unreal edits
- Final matrix: 28/28 rows passed; repeated runs were stable within each compiler. Route parity had 0 mismatches across 782,026 FI and 910,651 SurfaceWorld exact samples. Proof audits had 0 violations: FI 9,048 blocks / 12,042,888 samples; SurfaceWorld 27,479 / 36,574,549. Readiness negative controls were caught; walkability passed 4,000/4,000 FI and 5,642/5,642 SurfaceWorld samples.
- L3 FP-contract preamble/self-test, L4 `FLazy`, L7 shared cache, L9/L12 proofs, L11 readiness/crash handling, L13 route binding, ARCHITECTURE §8.10, and async/MPSC/Epoch paths remain intact. Both final compiler runs started without the Core FP-contract self-test refusing the build. No async route was added.
- Unreal-side edits are limited to [VoxelForgeCoreAdapter.cpp](../../../../Source/VoxelForge/Private/VoxelForgeCoreAdapter.cpp:453), bumping FI geometry version 2→3 so serialized recipes pick up the lower-seal removal, and the shared [VoxelDensityPrimitives.h](../../../../Source/VoxelForge/Public/VoxelDensityPrimitives.h:44), extracting the common upper-seal math used by v3. The Unreal target could not be compiled on this Linux host.
## Captures
All JPEGs are below 300 KB. Before/after pairs use matched cameras: FI flat square `(-11.6124,-118.2212,-19.8452), yaw/pitch 0/0`; FI island `(-22,-19,-22.8), 0/−4`; SurfaceWorld spawn `(0,-35,-487.94), 0/−22`; horizon uses the same spawn camera with pitch 0. The ceiling view uses the island camera with pitch 80. The SurfaceWorld pairs look the same; the exact hash checks certify its output bit-for-bit.
- FI flat square: `captures/floating-islands-flat-square-before.jpg`, `captures/floating-islands-flat-square-after.jpg`.
- FI low island: `captures/floating-islands-island-view-before.jpg`, `captures/floating-islands-island-view-after.jpg`.
- FI upward ceiling: `captures/floating-islands-ceiling-up.jpg`.
- SurfaceWorld L1 spawn: `captures/surface-world-l1-spawn-before.jpg`, `captures/surface-world-l1-spawn-after.jpg`.
- SurfaceWorld horizon: `captures/surface-world-horizon-before.jpg`, `captures/surface-world-horizon-after.jpg`.
- Flat-square diagnostic without tile edges: `captures/floating-islands-flat-square-no-edges.jpg`.
## Failed or retried runs
- The first density-probe link omitted legacy compatibility objects and failed with undefined references. Relinking with the legacy implementation objects succeeded; both boundary probes then ran.
- The initial 4×4 continuity audit failed at far LODs 4–6 and found edge gaps. The shared all-LOD boundary cap and final full-cell coverage check replaced the center-only deduplication; final 16×16 LOD4–8 continuity passed with zero edge gaps.
- An early matrix checker compared Clang contraction-off hashes directly with GCC default hashes and reported FI mismatches. The checker was corrected to test repeated runs within each compiler and the L14 compiler-specific references; the final 28-row matrix passed.
- An early offscreen capture drew all skirts and showed an artificial slab. The capture now applies the viewer’s hidden-skirt mask; final matched captures were regenerated.
- A GCC build interrupted by owner steering produced no binary and was rerun. A pre-correction Clang build was superseded by the final build. No final build or matrix run failed or exceeded the runtime limits.
## Resources and owner note
Final builds: Clang 19 exit 0 in 31.689 s, peak RSS 436,088 KiB; GCC 14 exit 0 in 48.648 s, peak RSS 903,168 KiB. The largest measured runtime process was 897,276 KiB RSS. All processes stayed below the 6 GiB address-space cap; CPU affinity was 0–11, worker maximum 12, normal priority, and governor `powersave`. No run exceeded 30 minutes or stalled for 15 minutes. See [BuildResources.md](BuildResources.md).
**Owner note:** SurfaceWorld stayed bit-identical to L14. FloatingIslands now retains a ceiling at its configured upper strate boundary while removing the false lower all-XY floor. At the current plan that is a z=+4 m boundary with a 0.5 m seal; its distance above the islands comes from the configured range. The small Unreal edits are listed above and need an owner-machine UBT compile.
## Orchestrator review (Claude)
- **Merged.** SurfaceWorld is bit-identical (14 configs plus the 24 m crossing); the FI false all-XY lower seal
is removed; the ceiling comes from the shared, strate-parameter upper-boundary seal and ceiling path
(owner rule: every strate has a ceiling, height from its own parameters). The Unreal edits are a pure
extraction of the existing upper-seal math plus the FI `geometryVersion` 2→3; they need a UBT compile on
the owner PC.
- **The scale answer:** both conventions are deliberate and agree between Unreal and the standalone
(SurfaceWorld 32 Core voxels per chunk; FloatingIslands 32 owner voxels = 16 Core voxels). Nothing
rescaled.
- **Still open (L19):**
1. Small black holes in the FI ceiling, visible near the top of `floating-islands-flat-square-after.jpg`;
compare LOD1 missing 3/12,288 continuity samples.
2. The owner's ledges are most likely the LOWER stratum's terrain seen through the floorless FI void:
ring steps of 147 cm median at LOD1→2 and 129 cm at 2→3 remain in that terrain. "Valid lower-stratum
geometry" with metre-scale cross-LOD steps is still a bug the owner can see.
- Exports (229 MB `.vfmesh`) are not committed.
@@ -0,0 +1,151 @@
#!/usr/bin/env python3
"""Compare upward mesh heights on shared XY edges between adjacent LOD rings."""
import array
import collections
import math
import struct
import sys
def read_scene(path):
tiles = []
with open(path, "rb") as f:
if f.read(8) != b"VFMSH001":
raise SystemExit(f"{path}: invalid mesh header")
version, voxel_um, count = struct.unpack("<3I", f.read(12))
camera = struct.unpack("<3d", f.read(24))
yaw, pitch = struct.unpack("<2d", f.read(16))
voxel_m = voxel_um / 1_000_000.0
for _ in range(count):
key = struct.unpack("<4i", f.read(16))
surface_vertices, skirt_count, vertex_count, index_count, mask_count = struct.unpack(
"<5I", f.read(20))
positions = array.array("f")
positions.frombytes(f.read(vertex_count * 12))
normals = array.array("f")
normals.frombytes(f.read(vertex_count * 12))
indices = array.array("I")
indices.frombytes(f.read(index_count * 4))
masks = f.read(mask_count)
if sys.byteorder != "little":
positions.byteswap(); normals.byteswap(); indices.byteswap()
triangles = []
for i in range(0, index_count, 3):
if masks and masks[i // 3] != 0:
continue
a, b, c = indices[i:i + 3]
if max(a, b, c) >= surface_vertices:
continue
nz = (normals[a * 3 + 2] + normals[b * 3 + 2] + normals[c * 3 + 2]) / 3.0
if nz < 0.65:
continue
tri = tuple((positions[j * 3], positions[j * 3 + 1], positions[j * 3 + 2])
for j in (a, b, c))
triangles.append(tri)
if triangles:
lod = key[3]
extent = 32 * (1 << lod) * voxel_m
tiles.append({"key": key, "lod": lod, "extent": extent,
"x0": key[0] * extent, "y0": key[1] * extent,
"x1": (key[0] + 1) * extent, "y1": (key[1] + 1) * extent,
"z0": key[2] * extent, "z1": (key[2] + 1) * extent,
"triangles": triangles})
return camera, yaw, pitch, tiles
def height_at(tile, x, y):
best = None
for tri in tile["triangles"]:
(x0, y0, z0), (x1, y1, z1), (x2, y2, z2) = tri
den = (y1 - y2) * (x0 - x2) + (x2 - x1) * (y0 - y2)
if abs(den) < 1.0e-10:
continue
a = ((y1 - y2) * (x - x2) + (x2 - x1) * (y - y2)) / den
b = ((y2 - y0) * (x - x2) + (x0 - x2) * (y - y2)) / den
c = 1.0 - a - b
if min(a, b, c) >= -1.0e-5:
z = a * z0 + b * z1 + c * z2
if best is None or z > best:
best = z
return best
path = sys.argv[1]
camera, yaw, pitch, tiles = read_scene(path)
by_lod = collections.defaultdict(list)
for tile in tiles:
by_lod[tile["lod"]].append(tile)
print(f"scene={path} camera_m={camera} yaw={yaw} pitch={pitch} nonempty_mesh_tiles={len(tiles)}")
print("lod_pair shared_edges samples_both median_abs_cm p95_abs_cm max_abs_cm median_delta_cm gaps")
for lod in range(8):
fine = by_lod[lod]
coarse = by_lod[lod + 1]
deltas = []
edge_rows = []
edge_count = 0
gap_count = 0
# Shared XY edges occur only where tile extents touch and overlap on the other axis.
for a in fine:
for b in coarse:
zlo, zhi = max(a["z0"], b["z0"]), min(a["z1"], b["z1"])
if zhi - zlo <= 1.0e-4:
continue
edge = None
if abs(a["x1"] - b["x0"]) < 1.0e-4 or abs(b["x1"] - a["x0"]) < 1.0e-4:
lo, hi = max(a["y0"], b["y0"]), min(a["y1"], b["y1"])
if hi - lo > 1.0e-4:
edge = ("x", a["x1"] if abs(a["x1"] - b["x0"]) < 1.0e-4 else a["x0"], lo, hi)
if edge is None and (abs(a["y1"] - b["y0"]) < 1.0e-4 or abs(b["y1"] - a["y0"]) < 1.0e-4):
lo, hi = max(a["x0"], b["x0"]), min(a["x1"], b["x1"])
if hi - lo > 1.0e-4:
edge = ("y", a["y1"] if abs(a["y1"] - b["y0"]) < 1.0e-4 else a["y0"], lo, hi)
if edge is None:
continue
edge_count += 1
axis, fixed, lo, hi = edge
epsilon = min(0.02, a["extent"] * 0.001, b["extent"] * 0.001)
samples = 9
matched = 0
edge_deltas = []
for i in range(samples):
t = (i + 0.5) / samples
varying = lo + (hi - lo) * t
if axis == "x":
side_a = 1.0 if abs(a["x1"] - fixed) < 1.0e-4 else -1.0
side_b = 1.0 if abs(b["x1"] - fixed) < 1.0e-4 else -1.0
za = height_at(a, fixed - side_a * epsilon, varying)
zb = height_at(b, fixed - side_b * epsilon, varying)
else:
side_a = 1.0 if abs(a["y1"] - fixed) < 1.0e-4 else -1.0
side_b = 1.0 if abs(b["y1"] - fixed) < 1.0e-4 else -1.0
za = height_at(a, varying, fixed - side_a * epsilon)
zb = height_at(b, varying, fixed - side_b * epsilon)
if za is not None and not zlo - 1.0e-3 <= za <= zhi + 1.0e-3:
za = None
if zb is not None and not zlo - 1.0e-3 <= zb <= zhi + 1.0e-3:
zb = None
if za is not None and zb is not None:
delta = (za - zb) * 100.0
deltas.append(delta)
edge_deltas.append((delta, za, zb, varying))
matched += 1
if matched == 0:
gap_count += 1
elif edge_deltas:
edge_rows.append((max(abs(row[0]) for row in edge_deltas),
a["key"], b["key"], edge, edge_deltas))
if deltas:
absolute = sorted(abs(x) for x in deltas)
signed = sorted(deltas)
p95 = absolute[math.floor(0.95 * (len(absolute) - 1))]
median_abs = absolute[len(absolute) // 2]
median_delta = signed[len(signed) // 2]
print(f"{lod}->{lod+1} {edge_count} {len(deltas)} {median_abs:.3f} {p95:.3f} {max(absolute):.3f} {median_delta:.3f} {gap_count}")
for worst, fine_key, coarse_key, edge, rows in sorted(edge_rows, reverse=True)[:2]:
row = max(rows, key=lambda item: abs(item[0]))
print(f" worst_edge max_abs_cm={worst:.3f} fine={fine_key} coarse={coarse_key} "
f"axis={edge[0]} fixed_m={edge[1]:.3f} span_m={edge[2]:.3f}..{edge[3]:.3f} "
f"sample_v_m={row[3]:.3f} fine_z_m={row[1]:.3f} "
f"coarse_z_m={row[2]:.3f} delta_cm={row[0]:.3f}")
else:
print(f"{lod}->{lod+1} {edge_count} 0 n/a n/a n/a n/a {gap_count}")
@@ -0,0 +1,82 @@
#!/usr/bin/env python3
"""Run the L18 24 m SurfaceWorld crossing hash matrix."""
import os
import re
import signal
import subprocess
import time
from pathlib import Path
ROOT = Path(__file__).resolve().parents[4]
OUT = ROOT / "Saved/Linux/l18-crossing"
OUT.mkdir(parents=True, exist_ok=True)
if not os.sched_getaffinity(0).issubset(set(range(12))):
raise SystemExit("run under taskset -c 0-11")
BINARIES = {
"clang-off": ROOT / "Standalone/bin/linux/VoxelForgeCoreHeadless-linux18-clang",
"gcc-default": ROOT / "Standalone/bin/linux/VoxelForgeCoreHeadless-linux18-gcc",
}
PATTERN = re.compile(r"^\[Pipeline(?:FullDetailHash|WholeViewHash|LODHash|ExactQueryHash)\].*$", re.M)
rows = []
passed = True
for compiler, binary in BINARIES.items():
for workers, repeat in [(1, 1), (8, 1), (12, 1), (12, 2), (12, 3), (12, 4), (12, 5)]:
name = f"{compiler}-w{workers}-r{repeat}"
logfile = OUT / f"{name}.log"
command = ["prlimit", "--as=6442450944", "--", str(binary),
str(ROOT / "Standalone/data/owner_world.json"),
"--world-assembler-prototype", "--stream-benchmark", "--stream-pipeline",
"--stream-hash", "--force-generate", "--clip-radius=3", "--max-clip-level=8",
f"--workers={workers}", "--camera=0,-35,-487.94,0,-22",
"--camera-step=24,0,0", "--region-crossing", "--recipe=surface-world"]
started = time.monotonic()
peak_rss = 0
with logfile.open("w", encoding="utf-8") as stream:
process = subprocess.Popen(command, stdout=stream, stderr=subprocess.STDOUT,
start_new_session=True)
while process.poll() is None:
pending = [process.pid]
seen = set()
while pending:
pid = pending.pop()
if pid in seen:
continue
seen.add(pid)
try:
pending.extend(int(value) for value in
Path(f"/proc/{pid}/task/{pid}/children").read_text().split())
for line in Path(f"/proc/{pid}/status").read_text().splitlines():
if line.startswith("VmRSS:"):
peak_rss = max(peak_rss, int(line.split()[1]))
break
except (FileNotFoundError, PermissionError, ProcessLookupError, ValueError):
pass
if time.monotonic() - started > 900:
os.killpg(process.pid, signal.SIGTERM)
try:
process.wait(timeout=5)
except subprocess.TimeoutExpired:
os.killpg(process.pid, signal.SIGKILL)
process.wait()
passed = False
break
time.sleep(0.1)
code = process.wait()
elapsed = time.monotonic() - started
actual = PATTERN.findall(logfile.read_text(encoding="utf-8", errors="replace"))
ok = code == 0 and len(actual) == 12
passed &= ok
rows.append((compiler, workers, repeat, code, elapsed, peak_rss, ok, actual))
print(f"[CrossingRun] {name} exit={code} seconds={elapsed:.3f} "
f"peak_rss_kib={peak_rss} hash_rows={len(actual)} status={'PASS' if ok else 'FAIL'}",
flush=True)
reference = None
for compiler, workers, repeat, code, elapsed, peak_rss, ok, hashes in rows:
if reference is None:
reference = hashes
elif hashes != reference:
passed = False
print(f"[CrossingHashMismatch] {compiler} workers={workers} repeat={repeat}", flush=True)
print(f"[CrossingSummary] rows={len(rows)} expected=14 result={'PASS' if passed else 'FAIL'} "
f"path={OUT}", flush=True)
raise SystemExit(0 if passed and len(rows) == 14 else 1)
@@ -0,0 +1,132 @@
#!/usr/bin/env python3
"""Run the L18 deterministic W1/W8/W12 x5 matrix on both supported Linux builds."""
import os
import re
import signal
import subprocess
import sys
import time
from pathlib import Path
ROOT = Path(__file__).resolve().parents[4]
OUT = ROOT / "Saved/Linux/l18-matrix"
OUT.mkdir(parents=True, exist_ok=True)
if not os.sched_getaffinity(0).issubset(set(range(12))):
raise SystemExit("run under taskset -c 0-11")
BINARIES = {
"clang-off": ROOT / "Standalone/bin/linux/VoxelForgeCoreHeadless-linux18-clang",
"gcc-default": ROOT / "Standalone/bin/linux/VoxelForgeCoreHeadless-linux18-gcc",
}
RECIPES = {
"floating-islands": "-10,-31,-22,0,-8",
"surface-world": "0,-35,-487.94,0,-22",
}
HASH_PATTERNS = {
"full": re.compile(r"^\[PipelineFullDetailHash\].*$", re.M),
"whole": re.compile(r"^\[PipelineWholeViewHash\].*$", re.M),
"lod": re.compile(r"^\[PipelineLODHash\].*$", re.M),
"exact": re.compile(r"^\[PipelineExactQueryHash\].*$", re.M),
}
rows = []
all_pass = True
for recipe, camera in RECIPES.items():
for compiler, binary in BINARIES.items():
if not binary.exists():
raise SystemExit(f"missing binary: {binary}")
for workers, repeat in [(1, 1), (8, 1), (12, 1), (12, 2), (12, 3), (12, 4), (12, 5)]:
name = f"{recipe}-{compiler}-w{workers}-r{repeat}"
logfile = OUT / f"{name}.log"
command = ["prlimit", "--as=6442450944", "--", str(binary),
str(ROOT / "Standalone/data/owner_world.json"),
"--world-assembler-prototype", "--stream-benchmark", "--stream-pipeline",
"--stream-hash", "--force-generate", "--clip-radius=3",
"--max-clip-level=8", f"--workers={workers}", f"--camera={camera}",
f"--recipe={recipe}"]
started = time.monotonic()
peak_rss_kib = 0
with logfile.open("w", encoding="utf-8") as stream:
process = subprocess.Popen(command, stdout=stream, stderr=subprocess.STDOUT,
start_new_session=True)
while process.poll() is None:
pending = [process.pid]
seen = set()
while pending:
pid = pending.pop()
if pid in seen:
continue
seen.add(pid)
try:
children = Path(f"/proc/{pid}/task/{pid}/children").read_text().split()
pending.extend(int(value) for value in children)
for line in Path(f"/proc/{pid}/status").read_text().splitlines():
if line.startswith("VmRSS:"):
peak_rss_kib = max(peak_rss_kib, int(line.split()[1]))
break
except (FileNotFoundError, PermissionError, ProcessLookupError, ValueError):
pass
if time.monotonic() - started > 900:
os.killpg(process.pid, signal.SIGTERM)
try:
process.wait(timeout=5)
except subprocess.TimeoutExpired:
os.killpg(process.pid, signal.SIGKILL)
process.wait()
all_pass = False
break
time.sleep(0.1)
code = process.wait()
elapsed = time.monotonic() - started
output = logfile.read_text(encoding="utf-8", errors="replace")
matched = {key: pattern.findall(output) for key, pattern in HASH_PATTERNS.items()}
ok = code == 0 and all(matched.values()) and len(matched["lod"]) == 9
if not ok:
all_pass = False
row = {"recipe": recipe, "compiler": compiler, "workers": workers,
"repeat": repeat, "exit": code, "seconds": elapsed,
"peak_rss_kib": peak_rss_kib, "ok": ok,
"full": matched["full"][-1] if matched["full"] else "",
"whole": matched["whole"][-1] if matched["whole"] else "",
"lod": " || ".join(matched["lod"]),
"exact": matched["exact"][-1] if matched["exact"] else ""}
rows.append(row)
print(f"[MatrixRun] {name} exit={code} seconds={elapsed:.3f} "
f"peak_rss_kib={peak_rss_kib} hash_rows={sum(map(len,matched.values()))} "
f"status={'PASS' if ok else 'FAIL'}", flush=True)
summary = OUT / "summary.tsv"
columns = ["recipe", "compiler", "workers", "repeat", "exit", "seconds", "peak_rss_kib",
"ok", "full", "whole", "lod", "exact"]
with summary.open("w", encoding="utf-8") as f:
f.write("\t".join(columns) + "\n")
for row in rows:
f.write("\t".join(str(row[key]) for key in columns) + "\n")
for recipe in RECIPES:
for compiler in BINARIES:
reference = None
for row in rows:
if row["recipe"] != recipe or row["compiler"] != compiler:
continue
signature = (row["full"], row["whole"], row["lod"], row["exact"])
if reference is None:
reference = signature
elif signature != reference:
print(f"[MatrixMismatch] recipe={recipe} workers={row['workers']} "
f"compiler={compiler} repeat={row['repeat']}", flush=True)
all_pass = False
# Compiler defaults are intentionally recorded separately: Clang uses contraction off,
# while GCC default is the owner-requested control. Report rather than hide any cross-build
# difference; worker/repeat determinism is asserted within each compiler above.
compiler_signatures = {}
for row in rows:
if row["recipe"] == recipe:
compiler_signatures.setdefault(row["compiler"],
(row["full"], row["whole"], row["lod"], row["exact"]))
if len(set(compiler_signatures.values())) > 1:
print(f"[MatrixCompilerDifference] recipe={recipe} compilers="
f"{','.join(compiler_signatures)}", flush=True)
print(f"[MatrixSummary] rows={len(rows)} expected=28 result={'PASS' if all_pass else 'FAIL'} "
f"path={summary}", flush=True)
raise SystemExit(0 if all_pass and len(rows) == 28 else 1)
Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

@@ -0,0 +1,70 @@
#!/usr/bin/env python3
"""Render matched L19 review captures from the L18 and L19 scene exports."""
import os
import subprocess
from pathlib import Path
ROOT = Path(__file__).resolve().parents[4]
CAPTURE = ROOT / "Standalone/bin/linux/VoxelForgeOffscreenCapture-linux19-clang"
BEFORE = ROOT / "Standalone/Research/WorldAssemblerM3/Linux18/exports"
AFTER = ROOT / "Saved/Linux/l19-diagnostics"
OUT = ROOT / "Standalone/Research/WorldAssemblerM3/Linux19/captures"
PNG_OUT = ROOT / "Saved/Linux/l19-captures-temp"
LOGS = ROOT / "Saved/Linux/l19-diagnostics"
OUT.mkdir(parents=True, exist_ok=True)
PNG_OUT.mkdir(parents=True, exist_ok=True)
env = os.environ.copy()
env["LP_NUM_THREADS"] = "12"
env["XDG_CACHE_HOME"] = str(ROOT / "Saved/Linux/mesa-cache")
views = [
("floating-islands-flat-square-before", BEFORE / "floating-islands-flat-square.vfmesh",
(-11.612444, -118.221237, -19.8452), 0, 0, True),
("floating-islands-flat-square-after", AFTER / "floating-islands-flat-square-after.vfmesh",
(-11.612444, -118.221237, -19.8452), 0, 0, True),
("floating-islands-owner-angle-before", BEFORE / "floating-islands-island-view.vfmesh",
(-22, -19, -22.8), 0, -4, True),
("floating-islands-owner-angle-after", AFTER / "floating-islands-island-view-after.vfmesh",
(-22, -19, -22.8), 0, -4, True),
("floating-islands-owner-ground-before", AFTER / "floating-islands-owner-ground-before.vfmesh",
(-6.3, -19.06, -21.0), 0, -4, True),
("floating-islands-owner-ground-after", AFTER / "floating-islands-owner-ground-after.vfmesh",
(-6.3, -19.06, -21.0), 0, -4, True),
("floating-islands-ceiling-up-after", AFTER / "floating-islands-island-view-after.vfmesh",
(-22, -19, -22.8), 0, 80, True),
("surface-world-l1-spawn-before", BEFORE / "surface-world-l1-spawn.vfmesh",
(0, -35, -487.94), 0, -22, False),
("surface-world-l1-spawn-after", AFTER / "surface-world-l1-spawn-after.vfmesh",
(0, -35, -487.94), 0, -22, False),
("surface-world-horizon-before", BEFORE / "surface-world-l1-spawn.vfmesh",
(0, -35, -487.94), 0, 0, False),
("surface-world-horizon-after", AFTER / "surface-world-l1-spawn-after.vfmesh",
(0, -35, -487.94), 0, 0, False),
("surface-world-rings-above-before", BEFORE / "surface-world-l1-spawn.vfmesh",
(0, -35, -280), 0, -90, True),
("surface-world-rings-above-after", AFTER / "surface-world-l1-spawn-after.vfmesh",
(0, -35, -280), 0, -90, True),
]
for name, scene, camera, yaw, pitch, tile_edges in views:
if not scene.exists():
raise SystemExit(f"missing scene: {scene}")
png = PNG_OUT / f"{name}.png"
jpg = OUT / f"{name}.jpg"
render_log = LOGS / f"{name}-render.log"
convert_log = LOGS / f"{name}-jpeg.log"
command = [str(CAPTURE), str(scene), str(png), "--size=1600x900",
"--shade=readable", f"--tile-edges={'on' if tile_edges else 'off'}",
"--tile-edge-width-m=0.15", "--camera-m="+",".join(map(str, camera)),
f"--yaw-deg={yaw}", f"--pitch-deg={pitch}"]
with render_log.open("w", encoding="utf-8") as stream:
subprocess.run(command, cwd=ROOT, env=env, stdout=stream,
stderr=subprocess.STDOUT, check=True)
ffmpeg = ["ffmpeg", "-nostdin", "-hide_banner", "-loglevel", "error", "-y",
"-i", str(png), "-frames:v", "1", "-q:v", "4", str(jpg)]
with convert_log.open("w", encoding="utf-8") as stream:
subprocess.run(ffmpeg, cwd=ROOT, env=env, stdout=stream,
stderr=subprocess.STDOUT, check=True)
if jpg.stat().st_size > 300_000:
raise SystemExit(f"{jpg.name} exceeds the 300 KB review limit")
print(f"[Capture] {jpg.relative_to(ROOT)} bytes={jpg.stat().st_size} status=PASS", flush=True)
@@ -0,0 +1,172 @@
#!/usr/bin/env python3
"""Strict L19 audit of FloatingIslands roof coverage at every LOD."""
import array
import collections
import math
import struct
import sys
def read_exact(stream, size):
data = stream.read(size)
if len(data) != size:
raise EOFError(f"wanted {size} bytes, got {len(data)}")
return data
def height_at(triangles, x, y, preferred_z):
best = None
for (x0, y0, z0), (x1, y1, z1), (x2, y2, z2) in triangles:
den = (y1-y2)*(x0-x2)+(x2-x1)*(y0-y2)
if abs(den) < 1.0e-10:
continue
a = ((y1-y2)*(x-x2)+(x2-x1)*(y-y2))/den
b = ((y2-y0)*(x-x2)+(x0-x2)*(y-y2))/den
c = 1.0-a-b
if min(a,b,c) >= -1.0e-5:
z = a*z0+b*z1+c*z2
if best is None or abs(z-preferred_z) < abs(best-preferred_z):
best = z
return best
def quantile(values, fraction):
if not values:
return math.nan
ordered = sorted(values)
return ordered[math.floor(fraction*(len(ordered)-1))]
if len(sys.argv) != 3:
raise SystemExit("usage: CeilingContinuity.py scene.vfmesh expected-cap-plane-metres")
scene_path = sys.argv[1]
root_z = float(sys.argv[2])
tiles = {}
voxel_size_m = None
with open(scene_path, "rb") as stream:
if read_exact(stream, 8) != b"VFMSH001":
raise SystemExit("invalid VFMSH001 scene")
version, voxel_um, tile_count = struct.unpack("<3I", read_exact(stream, 12))
camera = struct.unpack("<3d", read_exact(stream, 24))
yaw, pitch = struct.unpack("<2d", read_exact(stream, 16))
voxel_size_m = voxel_um/1_000_000.0
for _ in range(tile_count):
key = struct.unpack("<4i", read_exact(stream, 16))
surface_vertices, skirt_count, vertex_count, index_count, mask_count = struct.unpack(
"<5I", read_exact(stream, 20))
positions = array.array("f")
positions.frombytes(read_exact(stream, vertex_count*12))
normals = array.array("f")
normals.frombytes(read_exact(stream, vertex_count*12))
indices = array.array("I")
indices.frombytes(read_exact(stream, index_count*4))
masks = read_exact(stream, mask_count)
if sys.byteorder != "little":
positions.byteswap()
normals.byteswap()
indices.byteswap()
extent = 32*(1 << key[3])*voxel_size_m
z0, z1 = key[2]*extent, (key[2]+1)*extent
ceiling = []
for triangle in range(index_count//3):
if masks and masks[triangle] != 0:
continue
a,b,c = indices[triangle*3:triangle*3+3]
if max(a,b,c) >= surface_vertices:
continue
nz = (normals[a*3+2]+normals[b*3+2]+normals[c*3+2])/3.0
if nz > -0.65:
continue
points = tuple((positions[v*3],positions[v*3+1],positions[v*3+2])
for v in (a,b,c))
center_z = sum(point[2] for point in points)/3.0
if abs(center_z-root_z) <= 1.0:
ceiling.append(points)
tiles[key] = {
"extent": extent, "x0": key[0]*extent, "y0": key[1]*extent,
"x1": (key[0]+1)*extent, "y1": (key[1]+1)*extent,
"z0": z0, "z1": z1, "ceiling": ceiling,
}
by_lod = collections.defaultdict(dict)
for key, tile in tiles.items():
if tile["z0"] <= root_z+1.0 and tile["z1"] >= root_z-1.0:
by_lod[key[3]][key] = tile
print(f"scene={scene_path} version={version} voxel_um={voxel_um} tiles={tile_count} "
f"camera_m={camera} yaw={yaw} pitch={pitch} expected_cap_m={root_z:.9f}")
print("lod zband_tiles cap_tiles missing_tiles cap_triangles face_z_m_p05/median/p95 "
"tile_samples hit_samples max_abs_root_delta_cm shared_edges expected_edge_samples "
"paired_edge_samples edge_gaps edge_delta_cm_median/p95/max")
all_pass = True
all_misses = []
for lod in range(9):
target = by_lod[lod]
cap_tiles = {key: tile for key,tile in target.items() if tile["ceiling"]}
face_z = [point[2] for tile in cap_tiles.values() for tri in tile["ceiling"]
for point in tri]
deltas = []
sample_count = 0
hit_count = 0
for key,tile in target.items():
if not tile["ceiling"]:
continue
for iy in range(16):
for ix in range(16):
x = tile["x0"]+(ix+0.5)*tile["extent"]/16
y = tile["y0"]+(iy+0.5)*tile["extent"]/16
sample_count += 1
height = height_at(tile["ceiling"],x,y,root_z)
if height is not None:
hit_count += 1
deltas.append(abs(height-root_z)*100.0)
else:
all_misses.append((lod,key,ix,iy,x,y))
edge_deltas = []
edge_count = 0
edge_gaps = 0
edge_gap_samples = 0
for key,a in cap_tiles.items():
x,y,z,level = key
for neighbor_key,axis in (((x+1,y,z,level),"x"),((x,y+1,z,level),"y")):
b = cap_tiles.get(neighbor_key)
if b is None:
continue
edge_count += 1
epsilon = min(0.02,a["extent"]*1.0e-4)
matched = 0
for index in range(33):
t = (index+0.5)/33
if axis == "x":
fixed = a["x1"]
varying = a["y0"]+(a["y1"]-a["y0"])*t
za = height_at(a["ceiling"],fixed-epsilon,varying,root_z)
zb = height_at(b["ceiling"],fixed+epsilon,varying,root_z)
else:
fixed = a["y1"]
varying = a["x0"]+(a["x1"]-a["x0"])*t
za = height_at(a["ceiling"],varying,fixed-epsilon,root_z)
zb = height_at(b["ceiling"],varying,fixed+epsilon,root_z)
if za is not None and zb is not None:
edge_deltas.append(abs(za-zb)*100.0)
matched += 1
edge_gap_samples += 33-matched
if matched != 33:
edge_gaps += 1
missing = len(target)-len(cap_tiles)
max_root = max(deltas) if deltas else math.nan
print(f"{lod} {len(target)} {len(cap_tiles)} {missing} "
f"{sum(len(tile['ceiling']) for tile in cap_tiles.values())} "
f"{quantile(face_z,.05):.6f}/{quantile(face_z,.5):.6f}/{quantile(face_z,.95):.6f} "
f"{sample_count} {hit_count} {max_root:.3f} {edge_count} {edge_count*33} {len(edge_deltas)} "
f"{edge_gaps} {quantile(edge_deltas,.5):.3f}/{quantile(edge_deltas,.95):.3f}/"
f"{max(edge_deltas) if edge_deltas else math.nan:.3f}")
if target and (missing or hit_count != sample_count or edge_gap_samples):
all_pass = False
for lod,key,ix,iy,x,y in all_misses:
print(f" miss lod={lod} key={key} sample=({ix},{iy}) xy_m=({x:.6f},{y:.6f})")
print(f"[CeilingContinuityL19] total_misses={len(all_misses)} "
f"result={'PASS' if all_pass else 'FAIL'} criteria=LOD0-8 every 16x16 interior ray hits; "
"every shared same-LOD edge sample has paired hits")
raise SystemExit(0 if all_pass else 1)
@@ -0,0 +1,50 @@
#!/usr/bin/env python3
"""Check deterministic matrices and protected SurfaceWorld identities against L14."""
import re
from pathlib import Path
ROOT = Path(__file__).resolve().parents[4]
MATRIX = ROOT / "Saved/Linux/l19-matrix"
CROSSING = ROOT / "Saved/Linux/l19-crossing"
ROW = re.compile(r"^\[Pipeline(?:FullDetailHash|WholeViewHash|LODHash|ExactQueryHash)\].*$", re.M)
LOD = re.compile(r"^\[PipelineLODHash\] lod=(\d+) .*$", re.M)
failed = []
def stable_rows(path):
rows = ROW.findall(path.read_text(encoding="utf-8", errors="replace"))
full = next((row for row in rows if row.startswith("[PipelineFullDetailHash]")), None)
exact = next((row for row in rows if row.startswith("[PipelineExactQueryHash]")), None)
lods = {int(match.group(1)): match.group(0) for match in LOD.finditer(
path.read_text(encoding="utf-8", errors="replace"))}
return rows, full, exact, {level: lods.get(level) for level in range(3)}
for compiler in ("clang-off", "gcc-default"):
baseline_name = "clang-off" if compiler == "clang-off" else "gcc-default"
baseline = ROOT / f"Saved/Linux/l14-final-hash-sw-{baseline_name}-w12-r5.log"
expected = stable_rows(baseline)
logs = sorted(MATRIX.glob(f"surface-world-{compiler}-w*-r*.log"))
if len(logs) != 7:
failed.append(f"matrix {compiler}: expected 7 rows, found {len(logs)}")
for path in logs:
actual = stable_rows(path)
if len(actual[0]) != 12 or actual[1:] != expected[1:]:
failed.append(f"protected SurfaceWorld mismatch: {path.name}")
crossing_baseline_name = "clang" if compiler == "clang-off" else "gcc"
crossing_baseline = ROOT / f"Saved/Linux/l14-final-crossing-24m-{crossing_baseline_name}-w12.log"
expected_crossing = stable_rows(crossing_baseline)
crossing_logs = sorted(CROSSING.glob(f"{compiler}-w*-r*.log"))
if len(crossing_logs) != 7:
failed.append(f"crossing {compiler}: expected 7 rows, found {len(crossing_logs)}")
for path in crossing_logs:
actual = stable_rows(path)
if len(actual[0]) != 12 or actual[1:] != expected_crossing[1:]:
failed.append(f"protected crossing identity mismatch: {path.name}")
print(f"[L19ProtectedHashGate] SurfaceWorld LOD0-2, full-detail, and exact query hashes "
f"result={'FAIL' if failed else 'PASS'}")
for failure in failed:
print(f"[L19HashMismatch] {failure}")
raise SystemExit(1 if failed else 0)
@@ -0,0 +1,123 @@
# Linux19 — FloatingIslands ceiling and LOD ledges
**Status:** The ceiling is now closed at every LOD. The lower-terrain ledges are diagnosed but remain visible: the required change affects protected SurfaceWorld LOD2 output, so I stopped before changing it and asked for your decision.
## Findings and changes
The ceiling holes came from two checks in the shared boundary-cap path. It required density to cross from solid just below a strate's configured top to air just above it. Some of the field remains solid above that top, so the old test omitted those cap cells. The duplicate-cap check also sampled only inside each cell and could miss partial perimeter coverage. The path now emits a cap wherever the field is solid just below the configured top, and checks a 5×5 grid including the perimeter before suppressing a fallback cap.
The ledges are real upward-facing, non-skirt terrain triangles from the lower SurfaceWorld stratum visible below the FloatingIslands stratum. The combined recipe log identifies the SurfaceWorld field as strate index 1, chunks −16…−79, built from the owner surface parameters and biome map; the FloatingIslands plan is index 0, chunks 0…−15. At the worst LOD1→2 sample, the fine mesh is at z=−60.497 m and the coarse mesh at z=−61.996 m (149.862 cm apart). The LOD2→3 maximum is 773.318 cm, at z=−73.080 m versus −65.347 m.
The ring probe excludes skirts and masked triangles. The far-ground refinement routine only runs at LOD4 and above, so it cannot cause the LOD1→2 or LOD2→3 steps. Density dispatch is coordinate-based rather than LOD-based; the meshes sample that field on progressively coarser grids (0.5 m, 1 m, and 2 m at LOD1–3). The evidence points to resolution-dependent surface extraction of the lower SurfaceWorld terrain near the strate transition, not a different LOD recipe or a ceiling triangle. The L13 route audit also found no page/native or exact-query mismatches. The owner’s lower-stratum reading is supported.
SurfaceWorld at its L1 spawn has small L1→2 and L2→3 median differences, but it has larger outliers at farther rings: L3→4 reaches 1,190.974 cm, and L4→5 reaches 491.570 cm. Those high far-ring values are in the table below; the matched spawn, horizon, and above-ring captures are byte-identical before and after.
I did not change the ledge geometry. The most direct fix needs to change SurfaceWorld LOD2, which your rule protects pending an owner decision. The pending question is whether to allow that change.
The shared Core fix changes the recipe output identity version from `farHorizonVersion` 3 to 4. It changes no density query, stratum position, scale, or async route. No Unreal files were edited.
## Ring tables
Values are median / p95 / maximum absolute edge-height difference in cm, then the probe's no-hit edge count. `Before → after` is identical for every row because this round changed the ceiling path, not the lower upward-facing terrain.
### FloatingIslands camera
| LOD edge | Edges / samples | Before (cm; gaps) | After (cm; gaps) |
|---|---:|---:|---:|
| 0→1 | 0 / 0 | — | — |
| 1→2 | 33 / 231 | 147.141 / 148.403 / 149.862; 0 | 147.141 / 148.403 / 149.862; 0 |
| 2→3 | 49 / 308 | 128.603 / 200.789 / 773.318; 8 | 128.603 / 200.789 / 773.318; 8 |
| 3→4 | 64 / 277 | 3.269 / 47.774 / 188.531; 27 | 3.269 / 47.774 / 188.531; 27 |
| 4→5 | 72 / 544 | 29.992 / 124.373 / 443.482; 6 | 29.992 / 124.373 / 443.482; 6 |
| 5→6 | 64 / 266 | 12.234 / 127.224 / 536.573; 32 | 12.234 / 127.224 / 536.573; 32 |
| 6→7 | 32 / 264 | 29.013 / 301.752 / 42,624.479; 0 | 29.013 / 301.752 / 42,624.479; 0 |
| 7→8 | 64 / 275 | 83.843 / 1,225.416 / 3,755.407; 32 | 83.843 / 1,225.416 / 3,755.407; 32 |
### SurfaceWorld L1 spawn camera
| LOD edge | Edges / samples | Before (cm; gaps) | After (cm; gaps) |
|---|---:|---:|---:|
| 0→1 | 46 / 288 | 0.178 / 0.594 / 1.171; 10 | 0.178 / 0.594 / 1.171; 10 |
| 1→2 | 32 / 288 | 1.419 / 4.990 / 10.438; 0 | 1.419 / 4.990 / 10.438; 0 |
| 2→3 | 34 / 256 | 2.179 / 12.648 / 35.355; 2 | 2.179 / 12.648 / 35.355; 2 |
| 3→4 | 40 / 265 | 5.099 / 35.999 / 1,190.974; 5 | 5.099 / 35.999 / 1,190.974; 5 |
| 4→5 | 58 / 270 | 0.235 / 3.694 / 491.570; 14 | 0.235 / 3.694 / 491.570; 14 |
| 5→6 | 65 / 266 | 12.234 / 127.224 / 536.573; 33 | 12.234 / 127.224 / 536.573; 33 |
| 6→7 | 41 / 269 | 28.238 / 291.861 / 945.477; 7 | 28.238 / 291.861 / 945.477; 7 |
| 7→8 | 32 / 275 | 83.843 / 1,225.416 / 3,755.407; 0 | 83.843 / 1,225.416 / 3,755.407; 0 |
## Ceiling continuity
The strict audit casts 16×16 interior rays per tile and pairs every shared same-LOD edge sample. Before the fix it found three LOD1 interior misses, one LOD2 interior miss, and 10 unpaired LOD1 perimeter samples. After the fix it found zero misses and zero edge gaps at all LODs.
| LOD | Cap tiles | Interior hits | Paired edge samples | Max root delta (cm) | Misses / gaps |
|---:|---:|---:|---:|---:|---:|
| 0 | 64/64 | 16,384/16,384 | 3,696/3,696 | 0 | 0 / 0 |
| 1 | 48/48 | 12,288/12,288 | 2,376/2,376 | 0 | 0 / 0 |
| 2 | 48/48 | 12,288/12,288 | 2,376/2,376 | 0.025 | 0 / 0 |
| 3 | 48/48 | 12,288/12,288 | 2,376/2,376 | 0.025 | 0 / 0 |
| 4 | 48/48 | 12,288/12,288 | 2,376/2,376 | 0 | 0 / 0 |
| 5 | 48/48 | 12,288/12,288 | 2,376/2,376 | 0 | 0 / 0 |
| 6 | 48/48 | 12,288/12,288 | 2,376/2,376 | 0 | 0 / 0 |
| 7 | 48/48 | 12,288/12,288 | 2,376/2,376 | 0 | 0 / 0 |
| 8 | 153/153 | 39,168/39,168 | 8,976/8,976 | 0 | 0 / 0 |
Full output is in `Saved/Linux/l19-diagnostics/fi_roof_after.log`; the pre-fix strict audit is `Saved/Linux/l19-diagnostics/baseline-fi-ceiling-strict.log`.
## Hashes and audits
Clang 19 (`-ffp-contract=off`) and GCC 14 (default) passed 28/28 runs: FI and SW, W1/W8/W12, with W12 repeated five times. The 24 m crossing passed 14/14 runs, with 12 matching hash rows each; its W1/W8/W12×5 hashes also matched the L14 compiler-specific references. The protected SurfaceWorld hash gate passed across the matrix and crossing. SurfaceWorld LOD0–2, full-detail, and exact-query hashes match L14 across the matrix and crossing; the representative W12 LOD3 hash also matches. LOD4–8 mesh/payload/topology hashes include the version-4 salt, and the tested captures show no visible SW change.
Representative Clang W12 hashes (density / mesh / payload / topology):
| Output | Full detail | Whole view |
|---|---|---|
| FloatingIslands | `43034299d33f2536 / a41e8353ec4bbe9c / cd0e3e15eef827b0 / 0b3c3f13cc1d6f8a` | `00bc3607a7839854 / 4baa66127c2b0892 / e11ef05e851a1517 / 1278bc4b1fffb869` |
| SurfaceWorld | `0ee0579bd15cbbe4 / 32e5d4964d610fee / 1932b96ee4b1d910 / 69743c6bad3447dc` | `c10697a8f48380c7 / 4197fc1072f0ff58 / 7b3e616ec9459851 / c879e35592bf33e5` |
SurfaceWorld LOD0–2 hashes (density / mesh / payload / topology):
| LOD | Hash |
|---:|---|
| 0 | `769f2a706d585a72 / 33eeeb39fa443816 / 645621a1d968983f / c2457ed905036c9d` |
| 1 | `69cc5a5c0a2c60af / b48335f5410c57d5 / d15c5480162ab8ba / feca1bd025823604` |
| 2 | `85deed5683a77202 / 53469895987aeea2 / e55f8ae7e1532033 / d5feb12a0e85c09b` |
Exact queries: FI density/unclamped `87e5c0dbf9ee9ee2`; SW density/unclamped `e4d4a8eb95b35933`; both detail `efcba20c0c70c415`, collision `e604823a249029bf`.
L13 route parity passed in all four audit runs (both recipes, both compilers), with zero mismatches. FI checked 782,026 exact-query samples; SW checked 910,651. L9 proof audits reported zero violations: FI 9,192 blocks / 12,234,552 samples; SW 27,479 / 36,574,549 samples. Full logs are in `Saved/Linux/l19-audits/`.
L3 FP-contract preamble/self-test, L4 `FLazy`, L7 shared cache, L9/L12 proofs, L11 readiness and crash handling, L13 route binding, the L18 shared ceiling, `ARCHITECTURE.md` §8.10, and the CLAUDE.md async rules remain intact. The only source edits are in shared Core; the only architecture addition is §8.38.
## Captures
Every JPEG is at most 50 KiB (limit 300 KB). `floating-islands-owner-ground-after.jpg` is the low view across the FI ground, matching the owner's angle. SurfaceWorld spawn, horizon, and above-ring before/after JPEGs are byte-identical.
- FI: `captures/floating-islands-flat-square-before.jpg`, `captures/floating-islands-flat-square-after.jpg`, `captures/floating-islands-owner-angle-before.jpg`, `captures/floating-islands-owner-angle-after.jpg`, `captures/floating-islands-owner-ground-before.jpg`, `captures/floating-islands-owner-ground-after.jpg`, `captures/floating-islands-ceiling-up-after.jpg`.
- SW: `captures/surface-world-l1-spawn-before.jpg`, `captures/surface-world-l1-spawn-after.jpg`, `captures/surface-world-horizon-before.jpg`, `captures/surface-world-horizon-after.jpg`, `captures/surface-world-rings-above-before.jpg`, `captures/surface-world-rings-above-after.jpg`.
## Failed and retried runs
- The pre-fix strict FI ceiling audit failed as expected: 4 interior misses and 10 unpaired LOD1 edge samples. The earlier loose report had counted only the 3 LOD1 interior misses. The final strict audit passed.
- A ceiling audit was mistakenly run on the ordinary SW terrain export; it reported 47,837 non-roof ray misses. That was the wrong target for this audit and was discarded.
- The first continuity-audit attempt was interrupted before results. `/usr/bin/time` was unavailable (exit 127); the repository `MeasureBuild.py` wrapper was used instead.
- The first FI auto-camera export used clip radius 0 / max LOD 0 and exited with `std::bad_alloc` (1.710 s, peak RSS 2,151,292 KiB). Retrying at radius 3 / LOD8 / W12 succeeded (10.786 s, peak RSS 597,976 KiB).
- An exploratory native-heightfield refinement extension did not change the FI L1→2 or L2→3 ring values and was reverted. A temporary debug probe/build used to inspect the ceiling field was also removed before the final build.
- The first hash-gate run happened before crossing logs existed and failed for zero crossing rows. After the 24 m crossing completed, the gate passed.
- The first SW ring probe did not inherit the CPU affinity limit; it was rerun under `taskset -c 0-11`, and the constrained table is unchanged.
- `renice -n 0` was denied by the environment. Runs stayed at inherited nice level 5 (below normal priority); the governor was left unchanged at `powersave`.
No build or run exceeded 15 minutes or 30 minutes. All final builds and run children used CPUs 0–11, at most 12 workers, `LP_NUM_THREADS=12` for llvmpipe, and the 6 GiB address-space cap. Peak RSS was 903,324 KiB (GCC build); the matrix, crossing, audits, roof audit, and captures peaked at 583,180, 550,832, 857,964, 541,972, and 510,680 KiB respectively. The outer matrix took 343.684 s; the crossing took 46.354 s. Governor: `powersave`.
**Owner note:** The FI ceiling now closes cleanly at z=+4 m. The visible ledges are lower SurfaceWorld terrain and are a real LOD sampling mismatch, not skirts. SurfaceWorld L1→2 and L2→3 agree closely at the spawn, but its far rings have larger outliers. The ledge fix needs permission to change SurfaceWorld LOD2; no such mesh change is included here. Nothing was committed, pushed, or stashed.
## Orchestrator review (Claude)
- Merged. The ceiling specks seen in L18's flat-square capture are gone in the L19 capture (checked by me),
and the strict audit reads 0 misses / 0 gaps at all LODs. SurfaceWorld LOD0–2, full-detail and exact
queries are unchanged; the far mesh hashes carry the `farHorizonVersion` 3→4 salt, with byte-identical
captures.
- Luna correctly stopped at the protected SurfaceWorld LOD2 rule. Ledge decision: the defect is at the
strate interface (lower stratum top near z≈−60…−73 m, sampled on 0.5/1/2 m grids at LOD1–3), which is
where the two chunk-unit conventions meet. It goes into L20 (the units/layers design round) as its
concrete test case, rather than being patched alone first.
@@ -0,0 +1,79 @@
#!/usr/bin/env python3
"""Run the L9 uniform-block proof and L13 route parity audits."""
import os
import signal
import subprocess
import time
from pathlib import Path
ROOT = Path(__file__).resolve().parents[4]
OUT = ROOT / "Saved/Linux/l19-audits"
OUT.mkdir(parents=True, exist_ok=True)
if not os.sched_getaffinity(0).issubset(set(range(12))):
raise SystemExit("run under taskset -c 0-11")
BINARIES = {
"clang-off": ROOT / "Standalone/bin/linux/VoxelForgeCoreHeadless-linux19-clang",
"gcc-default": ROOT / "Standalone/bin/linux/VoxelForgeCoreHeadless-linux19-gcc",
}
RECIPES = {
"floating-islands": ("-22,-19,-22.8,0,-4", "--recipe=floating-islands"),
"surface-world": ("0,-35,-487.94,0,-22", "--recipe=surface-world"),
}
passed = True
for recipe, (camera, recipe_flag) in RECIPES.items():
for compiler, binary in BINARIES.items():
name = f"{recipe}-{compiler}"
logfile = OUT / f"{name}.log"
command = ["prlimit", "--as=6442450944", "--", str(binary),
str(ROOT / "Standalone/data/owner_world.json"),
"--world-assembler-prototype", "--stream-benchmark", "--stream-pipeline",
"--stream-hash", "--force-generate", "--clip-radius=3", "--max-clip-level=8",
"--workers=12", f"--camera={camera}", recipe_flag,
"--audit-uniform-block-proofs", "--audit-route-parity"]
started = time.monotonic()
peak_rss = 0
timed_out = False
with logfile.open("w", encoding="utf-8") as stream:
process = subprocess.Popen(command, stdout=stream, stderr=subprocess.STDOUT,
start_new_session=True)
while process.poll() is None:
pending, seen = [process.pid], set()
while pending:
pid = pending.pop()
if pid in seen:
continue
seen.add(pid)
try:
pending.extend(int(value) for value in
Path(f"/proc/{pid}/task/{pid}/children").read_text().split())
for line in Path(f"/proc/{pid}/status").read_text().splitlines():
if line.startswith("VmRSS:"):
peak_rss = max(peak_rss, int(line.split()[1]))
break
except (FileNotFoundError, PermissionError, ProcessLookupError, ValueError):
pass
if time.monotonic() - started > 900:
os.killpg(process.pid, signal.SIGTERM)
try:
process.wait(timeout=5)
except subprocess.TimeoutExpired:
os.killpg(process.pid, signal.SIGKILL)
process.wait()
timed_out = True
passed = False
break
time.sleep(0.1)
code = process.wait()
elapsed = time.monotonic() - started
log = logfile.read_text(encoding="utf-8", errors="replace")
route_lines = [line for line in log.splitlines() if line.startswith("[RouteParityAudit]")]
proof_lines = [line for line in log.splitlines() if line.startswith("[UniformBlockProofAudit]")]
route_ok = bool(route_lines) and route_lines[-1].endswith("status=PASS")
proof_ok = bool(proof_lines) and "violations=0" in proof_lines[-1]
ok = code == 0 and not timed_out and route_ok and proof_ok
passed &= ok
print(f"[AuditRun] {name} exit={code} seconds={elapsed:.3f} peak_rss_kib={peak_rss} "
f"route={route_ok} proofs={proof_ok} status={'PASS' if ok else 'FAIL'}", flush=True)
print(f"[AuditSummary] rows={len(RECIPES)*len(BINARIES)} expected=4 "
f"result={'PASS' if passed else 'FAIL'} path={OUT}", flush=True)
raise SystemExit(0 if passed else 1)
@@ -0,0 +1,81 @@
#!/usr/bin/env python3
"""Run the L19 24 m SurfaceWorld crossing hash matrix."""
import os
import re
import signal
import subprocess
import time
from pathlib import Path
ROOT = Path(__file__).resolve().parents[4]
OUT = ROOT / "Saved/Linux/l19-crossing"
OUT.mkdir(parents=True, exist_ok=True)
if not os.sched_getaffinity(0).issubset(set(range(12))):
raise SystemExit("run under taskset -c 0-11")
BINARIES = {
"clang-off": ROOT / "Standalone/bin/linux/VoxelForgeCoreHeadless-linux19-clang",
"gcc-default": ROOT / "Standalone/bin/linux/VoxelForgeCoreHeadless-linux19-gcc",
}
PATTERN = re.compile(r"^\[Pipeline(?:FullDetailHash|WholeViewHash|LODHash|ExactQueryHash)\].*$", re.M)
RUNS = [(1, 1), (8, 1), (12, 1), (12, 2), (12, 3), (12, 4), (12, 5)]
passed = True
for compiler, binary in BINARIES.items():
reference = None
for workers, repeat in RUNS:
name = f"{compiler}-w{workers}-r{repeat}"
logfile = OUT / f"{name}.log"
command = ["prlimit", "--as=6442450944", "--", str(binary),
str(ROOT / "Standalone/data/owner_world.json"),
"--world-assembler-prototype", "--stream-benchmark", "--stream-pipeline",
"--stream-hash", "--force-generate", "--clip-radius=3", "--max-clip-level=8",
f"--workers={workers}", "--camera=0,-35,-487.94,0,-22",
"--camera-step=24,0,0", "--region-crossing", "--recipe=surface-world"]
started = time.monotonic()
peak_rss = 0
timed_out = False
with logfile.open("w", encoding="utf-8") as stream:
process = subprocess.Popen(command, stdout=stream, stderr=subprocess.STDOUT,
start_new_session=True)
while process.poll() is None:
pending, seen = [process.pid], set()
while pending:
pid = pending.pop()
if pid in seen:
continue
seen.add(pid)
try:
pending.extend(int(value) for value in
Path(f"/proc/{pid}/task/{pid}/children").read_text().split())
for line in Path(f"/proc/{pid}/status").read_text().splitlines():
if line.startswith("VmRSS:"):
peak_rss = max(peak_rss, int(line.split()[1]))
break
except (FileNotFoundError, PermissionError, ProcessLookupError, ValueError):
pass
if time.monotonic() - started > 900:
os.killpg(process.pid, signal.SIGTERM)
try:
process.wait(timeout=5)
except subprocess.TimeoutExpired:
os.killpg(process.pid, signal.SIGKILL)
process.wait()
timed_out = True
passed = False
break
time.sleep(0.1)
code = process.wait()
elapsed = time.monotonic() - started
hashes = PATTERN.findall(logfile.read_text(encoding="utf-8", errors="replace"))
ok = code == 0 and not timed_out and len(hashes) == 12
if reference is None:
reference = hashes
elif hashes != reference:
ok = False
print(f"[CrossingMismatch] {name}", flush=True)
passed &= ok
print(f"[CrossingRun] {name} exit={code} seconds={elapsed:.3f} "
f"peak_rss_kib={peak_rss} hash_rows={len(hashes)} "
f"status={'PASS' if ok else 'FAIL'}", flush=True)
print(f"[CrossingSummary] rows={len(BINARIES)*len(RUNS)} expected=14 "
f"result={'PASS' if passed else 'FAIL'} path={OUT}", flush=True)
raise SystemExit(0 if passed else 1)
@@ -0,0 +1,88 @@
#!/usr/bin/env python3
"""Run the L19 W1/W8/W12 x5 matrix under inherited taskset limits."""
import os
import re
import signal
import subprocess
import time
from pathlib import Path
ROOT = Path(__file__).resolve().parents[4]
OUT = ROOT / "Saved/Linux/l19-matrix"
OUT.mkdir(parents=True, exist_ok=True)
if not os.sched_getaffinity(0).issubset(set(range(12))):
raise SystemExit("run under taskset -c 0-11")
BINARIES = {
"clang-off": ROOT / "Standalone/bin/linux/VoxelForgeCoreHeadless-linux19-clang",
"gcc-default": ROOT / "Standalone/bin/linux/VoxelForgeCoreHeadless-linux19-gcc",
}
RECIPES = {
"floating-islands": "-22,-19,-22.8,0,-4",
"surface-world": "0,-35,-487.94,0,-22",
}
PATTERN = re.compile(r"^\[Pipeline(?:FullDetailHash|WholeViewHash|LODHash|ExactQueryHash)\].*$", re.M)
RUNS = [(1, 1), (8, 1), (12, 1), (12, 2), (12, 3), (12, 4), (12, 5)]
passed = True
for recipe, camera in RECIPES.items():
for compiler, binary in BINARIES.items():
if not binary.exists():
raise SystemExit(f"missing binary: {binary}")
reference = None
for workers, repeat in RUNS:
name = f"{recipe}-{compiler}-w{workers}-r{repeat}"
logfile = OUT / f"{name}.log"
command = ["prlimit", "--as=6442450944", "--", str(binary),
str(ROOT / "Standalone/data/owner_world.json"),
"--world-assembler-prototype", "--stream-benchmark", "--stream-pipeline",
"--stream-hash", "--force-generate", "--clip-radius=3",
"--max-clip-level=8", f"--workers={workers}", f"--camera={camera}",
f"--recipe={recipe}"]
started = time.monotonic()
peak_rss = 0
timed_out = False
with logfile.open("w", encoding="utf-8") as stream:
process = subprocess.Popen(command, stdout=stream, stderr=subprocess.STDOUT,
start_new_session=True)
while process.poll() is None:
pending, seen = [process.pid], set()
while pending:
pid = pending.pop()
if pid in seen:
continue
seen.add(pid)
try:
pending.extend(int(value) for value in
Path(f"/proc/{pid}/task/{pid}/children").read_text().split())
for line in Path(f"/proc/{pid}/status").read_text().splitlines():
if line.startswith("VmRSS:"):
peak_rss = max(peak_rss, int(line.split()[1]))
break
except (FileNotFoundError, PermissionError, ProcessLookupError, ValueError):
pass
if time.monotonic() - started > 900:
os.killpg(process.pid, signal.SIGTERM)
try:
process.wait(timeout=5)
except subprocess.TimeoutExpired:
os.killpg(process.pid, signal.SIGKILL)
process.wait()
timed_out = True
passed = False
break
time.sleep(0.1)
code = process.wait()
elapsed = time.monotonic() - started
hashes = PATTERN.findall(logfile.read_text(encoding="utf-8", errors="replace"))
ok = code == 0 and not timed_out and len(hashes) == 12
if reference is None:
reference = hashes
elif hashes != reference:
ok = False
print(f"[MatrixMismatch] {name}", flush=True)
passed &= ok
print(f"[MatrixRun] {name} exit={code} seconds={elapsed:.3f} "
f"peak_rss_kib={peak_rss} hash_rows={len(hashes)} "
f"status={'PASS' if ok else 'FAIL'}", flush=True)
print(f"[MatrixSummary] rows={len(RECIPES)*len(BINARIES)*len(RUNS)} expected=28 "
f"result={'PASS' if passed else 'FAIL'} path={OUT}", flush=True)
raise SystemExit(0 if passed else 1)
Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

@@ -0,0 +1,81 @@
# Linux20 — design research for metre-based strata and generation layers
**Date:** 2026-10-20
**Scope:** read current owner/Core code and L19 evidence; measure unit conversions and LOD ring
errors; write the L20 design only.
## Findings
- `CHUNK_SIZE` is 32 and legacy `VOXEL_SIZE` is 12.5 cm, so the owner chunk is 4 m
(`Source/VoxelForge/Public/VoxelTypes.h`). Core defaults to 25 cm and keeps 32 voxels per tile.
- `BuildSurfaceStratumPlan` computes SurfaceWorld layout from `Slot.*ChunkZ × CHUNK_SIZE` in Core
voxel units. This is 32 × 25 cm = **8 m per slot chunk**. L18 records this as the retained
SurfaceWorld `topChunkZ × 32` interpretation.
- `BuildFloatingIslandStratumPlan` serializes owner/Core voxel size and the reduced ratio. At the
default 12.5/25 cm ratio, its slot chunk is 32 × 0.5 = 16 Core voxels = **4 m**. Core reverses
sample Z using `GetCoreVoxelsPerOwnerChunk` in `ShapeWorldInternal.h`.
- This factor-of-two difference is real, but it is not enough to claim that it caused the L19 ring
heights. L19's ring evidence points to LOD-dependent extraction of the lower SurfaceWorld field.
It does mean there is no single metres-per-chunk conversion that both preserves the current native
bounds and makes their shared slot indices one physical interface. The design records the current
resolved bounds and treats a later interface unification as an explicit change.
- The L19 FloatingIslands-camera table reports LOD1→2 median / p95 / max = 147.141 / 148.403 /
149.862 cm, zero no-hit samples; LOD2→3 = 128.603 / 200.789 / 773.318 cm, with 8 no-hit samples
among 308. LOD1/2/3 step sizes at 25 cm are 0.5/1/2 m. The ring audit excludes skirts and masked
triangles. Native far-ground refinement starts at LOD4, so it cannot fix those two transitions.
- The exact location and current geometry evidence are from `Linux19/REPORT.md`: lower SurfaceWorld
terrain at approximately −60…−73 m; its terrain triangles remain visible below FloatingIslands.
The worst sampled LOD1→2 roots are −60.497 m and −61.996 m. The LOD2→3 pair is −73.080 m and
−65.347 m.
## Layer map
The owner-facing layout is composed by `VoxelStrateComposer.cpp`, stored/loaded by
`VoxelSeasonManifest.cpp`, and resolved into `FStrateSlot`s by `VoxelStrateManager.cpp`. The Core
snapshot adapter (`VoxelForgeCoreAdapter.cpp`) builds separate SurfaceWorld and FloatingIslands
plans. Core streams work from `VoxelForgeCore.cpp` and evaluates native fields in
`WorldAssemblerInternal.h` / `FloatingIslandsInternal.h`; legacy `UVoxelGenerator::GetDensityAt`
and operator-stack/cave paths remain in `VoxelGenerator.cpp`, `VoxelDensityOpStack.cpp`, and
`VoxelCaveMorphology.cpp`.
Shared pieces already include Core's FP-contract preamble, fixed-point field code, feature bounds,
column caches, and interval proofs. `ShapeWorldInternal.h` still chooses among native fields, manager
state, and the copied legacy evaluator. `World::generateTile` in `VoxelForgeCore.cpp` owns MC setup,
recipe feature branches, native SurfaceWorld far-ground/cap refinement, and recipe identity salts.
`FarShellsInternal.h` adds shared boundary ceilings and GPU far-shell repairs; its connector repair
input is prepared from FloatingIslands geometry in `ShapeWorldInternal.h`.
The complete mapping, boundary proposal, ranked violations, generator contract, and migration plan
are in [`DESIGN_STRATA_UNITS_AND_LAYERS.md`](../../../DESIGN_STRATA_UNITS_AND_LAYERS.md).
## Direction review
The proposed metre authoring, 25 cm per-strate default, fixed 32³ internal tiles, and separation of
director/generators/shared composition/mesher are sound. Two qualifications are recorded in the
design:
1. “Units cost nothing” is true for metre conversion itself. Voxel size affects the physical width
of 32³ tiles and the number of tiles/tasks/caches; halving spacing in XYZ implies about 8× the
density samples per physical volume, with more per-tile overhead on top.
2. A no-movement migration cannot use one global chunk-to-metre multiplier. Current Core paths use
8 m per SurfaceWorld slot chunk and 4 m per FloatingIslands slot chunk at defaults. Preserve and
report those current resolved bounds first; decide separately whether to leave any gap/overlap or
intentionally make the new metre-authored interface contiguous.
The L19 density/mesh evidence supports LOD extraction as the direct cause of the measured lower-ground
ring steps. A shared explicit ceiling surface is the right approach for seals/caps, but not sufficient
for those upward-facing ground ledges. Step 5 therefore exposes the SurfaceWorld ground profile to a
generic explicit-surface/transition contract and remains subject to the protected LOD2 approval.
## Output and worktree status
No source, manifest, generator, mesher, or build input was changed. No build or world run was made.
Thus no new W12 hash claim is needed for this documentation-only round. The L19 reference hashes
remain the expected equality gates for later source changes:
- SurfaceWorld whole view: `c10697a8f48380c7 / 4197fc1072f0ff58 / 7b3e616ec9459851 / c879e35592bf33e5`
- FloatingIslands whole view: `00bc3607a7839854 / 4baa66127c2b0892 / e11ef05e851a1517 / 1278bc4b1fffb869`
The pre-existing untracked `Standalone/Research/WorldAssemblerM3/Linux18/exports/` directory was
left untouched. No commit, push, or stash was made.
@@ -0,0 +1,233 @@
# Sol 6.1 (medium) read-only review of the L20 design — 2026-10-20
Requested by the owner. Prompt: `Saved/Linux/claude/sol-l20-review.md` (copied below the answer). Session `01a1582c-547a-7701-9d9e-35239b7f0a26`, 68,458 tokens, sandbox read-only.
**The direction is right. Preserve today’s world during conversion, but treat inconsistent bounds as compatibility data, not valid new layout. Allow the SurfaceWorld LOD2 boundary fix, with a precisely defined affected region and unchanged density.**
L20 needs a stronger bedrock model and an earlier ownership contract. Adding floor bedrock everywhere is also a deliberate geometry change: current FloatingIslands v3 explicitly omits its lower seal.
I only read files; I did not build, run, or modify anything.
**1. The two decisions**
**Decision 1: preserve first, repair separately.** L17 demonstrates why: unifying the chunk scale removed the approved SurfaceWorld ground and moved the world ([Linux17/REPORT.md:168](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Research/WorldAssemblerM3/Linux17/REPORT.md:168)).
The mismatch is real. SurfaceWorld uses slot chunks directly as 32 Core voxels; FloatingIslands applies the owner/Core ratio ([VoxelForgeCoreAdapter.cpp:290](/home/jahni/VoxelM/Plugins/VoxelForge/Source/VoxelForge/Private/VoxelForgeCoreAdapter.cpp:290), [VoxelForgeCoreAdapter.cpp:464](/home/jahni/VoxelM/Plugins/VoxelForge/Source/VoxelForge/Private/VoxelForgeCoreAdapter.cpp:464)).
However, preserve **effective behavior**, not just converted endpoints. Dispatch itself uses different conversions: SurfaceWorld divides Z by 32, while FloatingIslands uses the owner/Core scale ([ShapeWorldInternal.h:2130](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/ShapeWorldInternal.h:2130), [ShapeWorldInternal.h:2158](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/ShapeWorldInternal.h:2158)). An apparent interval between bounds therefore does not prove that interval currently generates air.
Keep historical overlaps and ambiguities in a versioned compatibility snapshot. **Reject overlaps in newly authored layouts.** Otherwise preservation becomes permanent acceptance of the bug.
**Decision 2: approve the change in principle.** L19 measured actual lower-ground extraction differences, not ceiling triangles: up to 1.50 m and 7.73 m ([Linux19/REPORT.md:9](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Research/WorldAssemblerM3/Linux19/REPORT.md:9)). An explicit ceiling cannot fix these.
Define the affected tiles from the observed surface and transition support, including halos—not merely distance from a nominal strate plane. Preserve exact queries and unaffected near-player geometry. Validate against the same physical surface so the audit cannot “improve” by pairing different surfaces or hiding terrain.
Metre authoring and default 25 cm voxels are sound. Fixed 32³ tiles mean physical tile width still follows voxel size; if Jahni wants fixed physical streaming regions, introduce those separately from internal tiles.
**2. A concrete strate structure**
Use one immutable, versioned director output. Distinguish a strate’s **generator interior** from the bedrock separating interiors. This makes thickness and ownership unambiguous.
```text
ResolvedWorld
schemaVersion, evaluatorVersion, seed, worldIdentity
physicalUnit = fixed integer unit independent of voxel size
strates[] // ordered downward
verticalSegments[] // exact partition of declared world extent
interfaces[]
passages[]
Strate
stableId // persisted; independent of array position
order
bottomM, topM // generator interior: [bottomM, topM)
voxelSizeM = 0.25
latticeOriginM
generatorKind
recipeId, recipeVersion, resolvedRecipe, seedKey
floorBandId, ceilingBandId
interfaceAboveId, interfaceBelowId
VerticalSegment
stableId, bottomM, topM
kind = StrateInterior | Bedrock | VoidGap
ownerId
BedrockBand
stableId, bottomM, topM
thicknessM = topM - bottomM
volumeMaterialId
upperFaceMaterialId, lowerFaceMaterialId
digPolicy = Diggable | Protected | Restricted
allowedPassageIds[]
surfaceDescriptorIds[]
Interface
stableId, upperStrateId, lowerStrateId
orderedSegmentIds[] // bedrock, optional void, further bedrock
passagePlacementRecipe
resolvedPassageIds[]
Passage
stableId, interfaceId
physical tunnel shape, aperture boundaries
upper/lower endpoints, landing/support geometry
crossedBandIds[], clearance, carvePermission
```
Author in metres; serialize canonical fixed physical units with explicit rounding. The resolved fields above are produced once, not independently editable copies.
For a shared slab, the upper strate’s floor and lower strate’s ceiling reference **the same band**. Its thickness and digging policy cannot disagree between sides. Separate skins with a void between them require three explicit segments.
I recommend ordinary inter-strate bedrock remain diggable, preserving the established player-dug descent behavior ([ARCHITECTURE.md:472](/home/jahni/VoxelM/Plugins/VoxelForge/ARCHITECTURE.md:472)). Protection should be an explicit band policy.
The invariants are:
- Unique stable IDs; explicit order; finite bounds; positive interior height and bedrock thickness.
- Every physical height within the declared stack belongs to exactly one segment. No overlaps or implicit gaps.
- Every strate has floor and ceiling bedrock, including terminal strates.
- Interiors remain closed except through registered passages or authorized player-created apertures.
- A void gap lies between closed skins. A freely open connection requires an explicit aperture, potentially covering the whole interface.
- Passages cross every intervening band and provide usable entrances, exits, and support.
- All generators, proofs, streaming, meshing, collision, and material queries consume this snapshot. None reconstruct boundaries from chunk indices.
Keep legacy recipe seed keys frozen during migration. Switching randomness from strate index to stable ID must be versioned separately to avoid changing the world.
**3. Bedrock should be both volume and explicit geometry**
Use an authoritative solid volume for density, digging, collision queries, and conservative proofs, plus explicit boundary surfaces for reliable extraction. Both representations derive from the same band and aperture descriptors.
Density alone cannot guarantee a thin band survives coarse sampling. Conversely, a visual plane alone supplies no solid interior and can disagree with collision or digging.
Current code illustrates the mismatch: the upper seal fills inward over its thickness, while fallback ceiling vertices are placed at `Bounds.TopZ` ([VoxelDensityPrimitives.h:44](/home/jahni/VoxelM/Plugins/VoxelForge/Source/VoxelForge/Public/VoxelDensityPrimitives.h:44), [FarShellsInternal.h:1238](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/FarShellsInternal.h:1238)). The new contract must distinguish the band’s outer boundary from its room-facing surface.
For a ceiling above an interior, its lower face is at `topM`; for a floor below an interior, its upper face is at `bottomM`. Thickness extends away from the interior.
The mesher should own each exposed face once, suppress overlapping ordinary extraction, and use shared edge anchors across LODs. Passage mouths need explicit clipping and wall geometry; corner sampling alone can miss a small aperture.
Authorized edits must modify both density and surface extraction. Protected bands require explicit edit masking. Generated passages carve after bedrock composition, consistent with today’s passage ordering ([VoxelDensityPrimitives.h:86](/home/jahni/VoxelM/Plugins/VoxelForge/Source/VoxelForge/Public/VoxelDensityPrimitives.h:86)).
Collision uses the same geometry semantics at a gameplay resolution independent of camera LOD. Peers reproduce bands and generated passages from the versioned plan; only player edits need synchronization.
Cost stays local: cheap band queries and flat faces generally, extra refinement around openings and edited areas.
**4. What I would change in L20**
My top three risks are:
1. **Migrating bounds without migrating dispatch.** Today’s “resolved” bounds still consult the manager and branch by generator ([ShapeWorldInternal.h:67](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/ShapeWorldInternal.h:67)). Snapshot ownership, fallback behavior, and recipe anchors together.
2. **Changing gameplay under structural cleanup.** FloatingIslands v3 applies only an upper seal ([ShapeWorldInternal.h:2192](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/ShapeWorldInternal.h:2192)). Restoring a floor changes visibility and descent. Require a new layout version; do not silently reintroduce the removed floor.
3. **Maintaining conflicting density, mesh, and collision boundaries.** Explicit surfaces must be authoritative constraints derived from bands, rather than another repair overlay.
Reorder the migration to: compatibility snapshot → canonical ownership and bedrock schema → minimal shared boundary composition → targeted LOD transition prototype → metre authoring and generator adapters. Keep the broad generator/helper refactor incremental. Mixed resolutions remain last.
**5. Smallest first implementation**
Implement a **versioned resolved-layout snapshot and validator**, populated by the existing director/adapter. Record actual physical bounds, recipe/cap anchors, voxel sizes, current floor/ceiling behavior, and dispatch provenance. Flag incompatible intervals explicitly. Leave evaluation unchanged.
Its acceptance test should require:
- Exact preservation of existing resolved anchors and recipe values, including routes and cap profiles.
- Boundary probes immediately below, at, and above every endpoint, comparing actual old dispatch with the snapshot’s recorded behavior.
- Deterministic identity across worker counts and serialization round trips.
- Rejection of overlapping or uncovered new layouts.
- Existing SurfaceWorld density and geometry hashes unchanged; L19 ceiling coverage unchanged.
This delivers inspectable strate structure first. Enforcing new floors and repairing ledges then become separate, measurable world changes.
---
## Prompt
# VoxelForge — design review (Sol, read-only): strate structure, bedrock and the L20 decisions
You are reviewing a design for VoxelForge, a voxel terrain plugin for a multiplayer Unreal Engine
game, with its generation done in a C++ Core library. The game is underground: the world is a
vertical stack of **strates** (layers). Each strate has its own generator type:
- SurfaceWorld: an enclosed surface-like heightfield world;
- FloatingIslands;
- caves, and future types.
Players travel between strates through passages. Every machine generates the same terrain from a
seed. Only player edits cross the network.
**This is a read-only review.** Read files, but don't build, run, edit or create anything. The
owner pays for this review, so be efficient: read what you need, and keep the answer focused and
concrete.
## Read first
- `/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/DESIGN_STRATA_UNITS_AND_LAYERS.md`: the design
under review (round L20).
- `/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Research/WorldAssemblerM3/Linux20/REPORT.md`
- For the bugs that motivated it: `.../Linux17/REPORT.md`, `.../Linux18/REPORT.md` and
`.../Linux19/REPORT.md`, in the same folder. Each has an "Orchestrator review" section at the end.
- Code, as needed:
- `Source/VoxelForge/Private/VoxelForgeCoreAdapter.cpp` (plan building: SurfaceWorld vs
FloatingIslands chunk conversion);
- `Source/VoxelForge/Private/VoxelStrateManager.cpp` and `Source/VoxelForge/Public/VoxelStrateTypes.h`
(strate slots and params);
- `Standalone/Core/src/ShapeWorldInternal.h` (`FResolvedStratumBounds`, `GetResolvedStratumBounds`);
- `Standalone/Core/src/FarShellsInternal.h` (`AppendStratumBoundaryCeilings`);
- `Source/VoxelForge/Public/VoxelDensityPrimitives.h` (boundary seals);
- `CLAUDE.md`, and `ARCHITECTURE.md` (§8) for the hard rules.
## The owner's direction
The owner is Jahni. Quotes:
- "Everything should use a parameter like on the strate, saying which voxel size it is, by default
25 for everyone, same for island."
- "Our system should be in different categories: the director/orchestrator, the generators (all
using the same kind of format, helper functions … from a shared library like noise functions) and
the mesher; the generators are dictated by our current strate parameters."
- "The voxel size shouldn't dictate the size of a chunk … wouldn't it be better to have like Unreal
unit distance, and have x voxels fill it?"
- "Any strate should have a ceiling, since we're underground."
- "The ceiling height is decided by the strate parameter, it's not something unique to sky island."
- Now: **"we need proper strate structure, knowing where each starts etc."**, including the strate
**bedrocks (ceiling and floor)**.
## What I (the orchestrator) recommended, which he wants judged
1. **Layout is authored in metres;** each strate has a voxel size (default 25 cm); internal tiles
stay 32³ voxels. Units cost nothing at run time, while the voxel count does.
2. **Decision 1 (preservation):** when converting today's chunk-based strate parameters to metres,
keep every strate exactly where it currently is in the generated world, including any gap or
overlap that the current 8 m (SurfaceWorld) vs 4 m (FloatingIslands) per-chunk mismatch creates.
Report those gaps and overlaps, then tune in metres. The alternative is to force them to meet
during the migration.
3. **Decision 2:** allow step 5 of the migration (an explicit, LOD-stable interface surface) to
change SurfaceWorld LOD2 output near strate boundaries, to fix the owner's "ledges" (cross-LOD
ring steps of up to 1.5 m and 7.7 m at the FloatingIslands/SurfaceWorld interface). Near-player
terrain away from boundaries must stay identical.
## Questions (answer each)
1. **Are the two decisions and the direction right?** Say where you'd decide differently, and why.
Is preserving today's possibly-inconsistent bounds the right first step, or does it entrench a
bug? Is there a better migration order?
2. **Propose a proper strate structure.** A concrete data model the director owns. For each strate:
- its stable ID and order;
- top and bottom in metres;
- **floor bedrock and ceiling bedrock:** thickness in metres, material, whether players can dig
through, and how passages pierce them;
- its voxel size;
- its generator and recipe;
- its interfaces to the strate above and below: solid bedrock band, open void, passage
placement.
Define the invariants: no overlaps; every metre owned by exactly one strate or one explicit
bedrock/gap band; ceiling and floor always closed, except at passages; contiguous or explicit
gaps. Show how "where each strate starts and ends" becomes a single source of truth that every
generator and the mesher read, never re-derive.
3. **Bedrock as geometry.** Should a ceiling or floor be a density band (a seal), an explicit
surface the mesher knows about, or both? Weigh LOD stability (the ledge problem: thin seals
extract at different heights per LOD), collision, player digging, multiplayer determinism, and
cost. Give a recommendation.
4. **What in the L20 design would you change, cut, or reorder?** Name the top 3 risks.
5. **The smallest first implementation step** that delivers the strate structure without moving the
approved SurfaceWorld world, and its acceptance test.
## Answer format
Plain English. The owner reads it, so lead with your verdicts in a few lines, then the details.
Around 1,500 words at most, plus the data-model sketch. Cite file:line where you rely on code.
@@ -0,0 +1,203 @@
# World Assembler L21 — resolved strate layout
This round adds a read-only layout snapshot and validator. It does not change density or mesh
evaluation.
## Snapshot and current stack
World identity is `owner-world/seed/0`; Core voxel size is 0.25 m, owner voxel size is 0.125 m, and
all lattice origins are `(0,0,0)`. Intervals below are half-open `[bottom, top)` metres. Stable strate
IDs are `owner-world/seed/0/strate/<index>/generator/<kind>`. The shared Core record uses canonical
JSON schema v1 and an FNV-1a payload identity.
The required structure, top to bottom, is:
```text
strate N ceiling band
content
bedrock band
strate N+1 ceiling band
content
bedrock band
```
Ceiling and bedrock remain distinct bands owned by their own strate. Their nominal edges touch; a
separate `EVoxelStrateTransition` declaration describes possible interpenetration.
| Prototype | Order / stable suffix | Generator; recipe version | Interior/content (m) | Current ceiling | Current bedrock | Transition at lower interface |
|---|---|---|---|---|---|---|
| SurfaceWorld | 0 / `TunnelNetwork` | TunnelNetwork; `legacy.TunnelNetwork` v0 | `[-120, 8)` | No Core density band. Manager configures a 1 m upper `VF_ApplyBoundarySeal` at `[8,9)`, but the compiled analytic Core path does not apply it. | No Core density band. Manager configures a 1 m lower `VF_ApplyBoundarySeal` at `[-121,-120)`, but the compiled analytic Core path does not apply it. | Gradient, 2 chunks = 8 m by the 4 m manager chunk. Core does not apply it; manager/dispatch chunk widths are 4/8 m. |
| SurfaceWorld | 1 / `SurfaceWorld` | SurfaceWorld; `SurfaceWorld.Heightfield2D` v1 | `[-632,-120)` | No separate volumetric band; cap profile is in content, with `AppendStratumBoundaryCeilings` mesh fallback. | None. | Gradient, 1 chunk = 4 m by manager units; no lower strate in this plan. Manager/dispatch widths are 4/8 m. |
| FloatingIslands | 0 / `FloatingIslands` | FloatingIslands; `FloatingIslands.ClusterField` geometry v3 | `[-60,4)` | Active one-sided upper seal `[3.5,4)` = 0.5 m. It overlaps the content range by 0.5 m. | None in geometry v3. | Gradient, 2 chunks = 8 m. Core does not apply it; manager/dispatch widths are both 4 m. |
| FloatingIslands | 1 / `SurfaceWorld` | SurfaceWorld; `SurfaceWorld.Heightfield2D` v1 | `[-632,-120)` | No separate volumetric band; cap profile is in content, with mesh fallback. | None. | Gradient, 1 chunk = 4 m; no lower strate in this plan. Manager/dispatch widths are 4/8 m. |
Dispatch provenance is recorded per stratum in the JSON snapshot:
- SurfaceWorld bounds come from `BuildSurfaceStratumPlan`, which converts each chunk with 32 Core
voxels = 8 m. `NativeSurfaceDensityAt` selects with `floor(CoreZ/32)`, then calls
`GetGeneratorTypeForChunk` / `GetStrateIndex`. The manager's owner chunk is 4 m.
- FI bounds come from `BuildFloatingIslandStratumPlan`, which converts each 32-voxel owner chunk
through the 12.5/25 cm owner/Core ratio = 16 Core voxels = 4 m. `NativeFloatingIslandDensityAt`
uses the same conversion before the manager lookup.
- Legacy TunnelNetwork selection uses the Core 32-voxel chunk lookup. The manager helper assigns
the upper strate's transition to its lower interface.
SurfaceWorld strata carry four cap profiles, 33 route points and their attached passages. The FI
strate carries four island anchors and its attached passages. The snapshot preserves these recipe
anchors in their source fixed-point units.
The owner configuration’s non-Hard transitions are currently not honored by Core at these interfaces.
`UVoxelStrateManager::GetGenerationParams` contains legacy vector blending, but Core’s compiled
dispatcher selects the resolved/native per-strate fields without applying that blend. FI v3 calls
`VF_ApplyUpperBoundarySeal` for its ceiling; player edit brushes are applied after the native field,
so that seal remains diggable. Bands default to `diggable=true`, `protected=false`; protection is an
explicit option.
```text
Current SurfaceWorld plan, top → bottom
TunnelNetwork ceiling [8,9) (configured; inactive in Core density)
TunnelNetwork content [-120,8)
TunnelNetwork bedrock [-121,-120) (configured; inactive in Core)
SurfaceWorld ceiling: none
SurfaceWorld content [-632,-120)
SurfaceWorld bedrock: none
Current FI prototype, top → bottom
FI ceiling [3.5,4) active, inset into FI content by 0.5 m
FI content [-60,4)
FI bedrock: missing
Unassigned interval [-120,-60) = 60 m
SurfaceWorld ceiling: none
SurfaceWorld content [-632,-120)
SurfaceWorld bedrock: none
```
The SurfaceWorld and FI content interiors therefore do not overlap: the FI prototype has a 60 m gap.
The owner manager slots meet at −60 m when both use 4 m owner chunks, but SurfaceWorld plan/query
dispatch converts chunks at 8 m while FI converts at 4 m. In the gap, Core answers through the
compiled analytic FloatingIslands fallback, not either planned recipe; probes at −68 m returned
solid density −4.125. SurfaceWorld and TunnelNetwork content interiors touch at −120 m in the
SurfaceWorld prototype, but Core does not apply the declared Gradient there.
## Compatibility validation and boundary probes
Compatibility mode accepted both layouts with seven reported issues apiece. SurfaceWorld reports
unhonored transition, 4/8 m dispatch-unit ambiguity on both strates, and missing current-field
ceiling and bedrock bands on both. FI reports its unhonored transition, missing FI bedrock, the
0.5 m ceiling/content overlap, the 60 m uncovered interval, and missing SurfaceWorld ceiling and
bedrock. These are recorded as compatibility deviations, not world changes.
Strict mode accepted a valid synthetic two-strate fixture. Its seven negative controls rejected:
| Control | Strict check that rejects it |
|---|---|
| Nominal band overlap | Bedrock(N) bottom must equal ceiling(N+1) top. |
| Nominal band gap | The same exact nominal contiguity check. |
| Missing bedrock | `bedrock.present` is required. |
| Missing ceiling | `ceiling.present` is required. |
| Wrong band order | Each band kind and the ceiling → content → bedrock edges must match. |
| Gap between bedrock(N) and ceiling(N+1) | Their nominal endpoints must be equal. |
| Interpenetration wider than transition | Explicit overlap must be at most the mode’s limit; this control uses 4,000,001 µm against a 4,000,000 µm Gradient zone. |
Hard has a 0 m limit. Gradient uses `TransitionBlendChunks × 4 m`; Interleaved adds its recorded
two-manager-chunk warp amplitude to the blend width. The nominal bands still touch exactly; the
separate interpenetration field records any permitted physical crossing. Current Core
interpenetration is 0 m because it does not apply the declared blends.
Each plan audited 21 points: one Core voxel (0.25 m) below, at, and above every distinct content,
active-band, configured-band, and transition-zone endpoint. The remaining points agreed with the
snapshot. Every disagreement was an uncovered snapshot point answered by a named compiled analytic
fallback:
| Prototype | Probe Z (m) | Actual Core dispatch | Density / occupancy |
|---|---|---|---|
| SurfaceWorld | −632.250 | `compiled-analytic/TunnelNetwork` | `+1`, air |
| SurfaceWorld | 8.000, 8.250, 8.750, 9.000, 9.250 | `compiled-analytic/TunnelNetwork` | `+9.648438`, `+10.64844`, `+12.64844`, `+13.64844`, `+14.64844`; all air |
| FI | −632.250 | `compiled-analytic/TunnelNetwork` | `+1`, air |
| FI | −120.000, −119.750 | `compiled-analytic/FloatingIslands` | `−108.4793`, `−107.4969`; solid |
| FI | −68.250, −68.000, −67.750, −60.250 | `compiled-analytic/FloatingIslands` | `−4.125`; solid at each point |
| FI | 4.000, 4.250 | `compiled-analytic/FloatingIslands` | `+0.671875`, `+2.253906`; air |
Probe summaries: SurfaceWorld 6/21 disagreements; FI 9/21. Full per-point records are in
`Saved/Linux/linux21/boundary-probes-{surface-world,floating-islands}.log`.
## Identity, output parity and cost
Snapshots round-tripped through canonical JSON. At W1/W8/W12 their bytes were identical per recipe:
| Recipe | Stable identity | Canonical JSON SHA-256 |
|---|---|---|
| SurfaceWorld | `resolved-layout-v1-fnv64:63cf4d2661149fcd` | `267586b3da9bc5c08c654c097559b205222f53c594c4c4332cb4929fd3d75c05` |
| FloatingIslands | `resolved-layout-v1-fnv64:1d90167f37ef9323` | `7bb9e9d745de3a2edf4276f507a5e4c082ff86aa73d9c1ad7e77c1b4d8b8bea8` |
The 28 hash runs (both recipes, Clang `fp-contract=off` and GCC default, W1/W8/W12 and W12×5)
matched all 12 L19 rows per run. The 14 dedicated 24 m crossing runs also matched all 12 L19
crossing rows. The table gives the final Clang W12×5 rows, in density/mesh/payload/topology order;
each equals its L19 reference.
| Scope | SurfaceWorld | FloatingIslands |
|---|---|---|
| Full detail | `0ee0579bd15cbbe4 / 32e5d4964d610fee / 1932b96ee4b1d910 / 69743c6bad3447dc` | `43034299d33f2536 / a41e8353ec4bbe9c / cd0e3e15eef827b0 / 0b3c3f13cc1d6f8a` |
| Whole view | `c10697a8f48380c7 / 4197fc1072f0ff58 / 7b3e616ec9459851 / c879e35592bf33e5` | `00bc3607a7839854 / 4baa66127c2b0892 / e11ef05e851a1517 / 1278bc4b1fffb869` |
| LOD 0 | `769f2a706d585a72 / 33eeeb39fa443816 / 645621a1d968983f / c2457ed905036c9d` | `ccf97d8e95163a35 / 3333fa0ddebdece2 / d1906bffc2b9d6f2 / a261f3d965e15c12` |
| LOD 1 | `69cc5a5c0a2c60af / b48335f5410c57d5 / d15c5480162ab8ba / feca1bd025823604` | `25fa2f0fa7fbb6e6 / c549c519707ac1d7 / 66f797cde4ebdecf / 2383982a12a27ee5` |
| LOD 2 | `85deed5683a77202 / 53469895987aeea2 / e55f8ae7e1532033 / d5feb12a0e85c09b` | `c0577decd8a02cab / 3ccf08b7be6edc5b / 0abcbbda5a06c110 / 11c77b71b606fe75` |
| LOD 3 | `6518caefb3be7e7f / ec513c90b853a614 / f62fa1137ff17f82 / ccf1dcf681965816` | `386e0c0ef2d7c920 / 1ee2c82d34ad9918 / 000a6514ba018406 / 1b4523b19e90f305` |
| LOD 4 | `62d4be96021992f4 / 42706847cb9c744a / eab76f9634e4b9bd / 207ffbb6ef184397` | `e8117a3a803be9f8 / 8a6c36cae1fe0e30 / c839f1b1629eff8c / 0ce9d7ea77b4f62b` |
| LOD 5 | `5e4a8c38b8cea6fc / 76adc9ae86988e27 / 938975bf7cc6d94d / 42e135856abdbcac` | `ca6d1df453c6b600 / 02c90d834d9a3fb6 / 4364c37d526f4104 / 1b1cf40d25e50ddf` |
| LOD 6 | `e036e95b9006945b / a880cc101a4ed957 / bd82f1aefad6dd89 / 5e9f3408345d95b3` | `6764e347b08603a0 / 46c6ed9a1f029b94 / 5b8dc9d5b7cb0d3d / a10a4a69a93eac4d` |
| LOD 7 | `8ee358af56a30d8d / 5cbd8e5965a2cc3f / d4a7fe5d9e4bde30 / 4dd52cd090a9af78` | `c7cd1b483c598595 / a545eb567dc4a0df / b0a1fb225437e05a / 301d1b884c509550` |
| LOD 8 | `c3458e1cbdb9c471 / fba3698d21dd1be0 / 77dfb814eac3a24c / c9514f1580c42449` | `7b6e9279b4993109 / cc63440d9867a18d / 12f5cec78b38fa1b / eed919db6db6b2a7` |
Exact-query rows (density/unclamped, detail, collision): SurfaceWorld `e4d4a8eb95b35933 / e4d4a8eb95b35933`,
`efcba20c0c70c415`, `e604823a249029bf`; FloatingIslands `87e5c0dbf9ee9ee2 / 87e5c0dbf9ee9ee2`,
`efcba20c0c70c415`, `e604823a249029bf`. The representative 24 m crossing W12×5 whole-view row is the
SurfaceWorld row above; all crossing full-detail, LOD and exact-query rows matched the L19 crossing
reference.
Five interleaved hashing-off W12 pairs against L19 measured SurfaceWorld medians 1.510 s old / 1.512 s
new (+0.14%) and FI 13.487 s old / 13.381 s new (−0.79%). The opt-in snapshot is constructed once
at plan time, outside tile workers; ordinary standalone evaluation does not request it. No hash rows
were produced during these pairs.
Clang and GCC builds passed at 12 jobs. Final build peak process-tree/single-process RSS was
2,697,676/450,248 KiB (Clang) and 4,570,704/897,024 KiB (GCC). The final evidence runner's maximum
single-process RSS was 583,736 KiB. All runs used CPUs 0–11 and stayed below the per-run limit; no
governor or system changes were made.
## Failed and retried runs
- An initial snapshot invocation omitted `--stream-benchmark --stream-pipeline` and exited 2; adding
the required flags passed.
- Early Clang builds caught a `strates` member typo, then an audit initializer/type error. Both were
fixed; the final Clang builds passed.
- The first complete evidence pass exited 1 at boundary probing because the audit read the host
manager after the harness had released it. Dispatch provenance was moved to Core's live selector;
the final audits passed.
- One GCC build wrapper was interrupted (exit 130) while diagnosing an empty progress log, then
rerun successfully. No runtime/hash run timed out or exceeded 15 minutes, and no L19 hash mismatch
remained.
## Owner note
This records the present strata and confirms the selected ceiling → content → bedrock model. FI still
has no floor in v3; SurfaceWorld has no volumetric floor or separate ceiling; the 8 m / 4 m dispatch
conversions leave a 60 m FI-prototype gap answered by analytic fallback. Core currently ignores the
configured transition blend at these interfaces. Bedrock and ceiling protection remain explicit
options with diggable defaults. This round changes no world output.
The Unreal adapter adds only a separate `resolved_layout` JSON field beside `world_assembly`; that
small edit could not be compiled on this Linux machine. No async path, density evaluator, hash input,
or recipe version changed. No commit, push, or stash was made.
## Orchestrator review (Claude)
- Merged: read-only snapshot + validator, no world change (28 hash runs and 14 crossing runs equal L19;
cost within noise). The Unreal adapter gains a 193-line `resolved_layout` export beside
`world_assembly`. It is export-only, but UNCOMPILED here; it must be built on the owner PC.
- Key facts for the owner: the authored params put the SW top at −60 m (4 m owner chunks), Core
builds SW at −120…−632 m (8 m conversion); the 60 m between FI and SW is unowned and answered by
the analytic FloatingIslands fallback as solid. No strate has an active bedrock band; SW has no
ceiling band (mesh fallback only); configured Gradient transitions are ignored by Core.
- To check next: whether the "ledges" ground seen under the islands is this fallback solid in the
unowned gap rather than SW terrain (L19 attributed them to SW at about −60…−73 m).
@@ -0,0 +1,165 @@
#!/usr/bin/env python3
"""Constrained L21 snapshot, output-parity, crossing, and off-cost evidence."""
import os
import re
import signal
import statistics
import subprocess
import time
from pathlib import Path
ROOT = Path(__file__).resolve().parents[4]
OUT = ROOT / "Saved/Linux/linux21"
OUT.mkdir(parents=True, exist_ok=True)
if not os.sched_getaffinity(0).issubset(set(range(12))):
raise SystemExit("run under taskset -c 0-11")
BIN = {
"clang-off": ROOT / "Standalone/bin/linux/VoxelForgeCoreHeadless-linux21-clang",
"gcc-default": ROOT / "Standalone/bin/linux/VoxelForgeCoreHeadless-linux21-gcc",
}
OLD_CLANG = ROOT / "Standalone/bin/linux/VoxelForgeCoreHeadless-linux19-clang"
OLD_GCC = ROOT / "Standalone/bin/linux/VoxelForgeCoreHeadless-linux19-gcc"
DATA = ROOT / "Standalone/data/owner_world.json"
HASH_ROW = re.compile(r"^\[Pipeline(?:FullDetailHash|WholeViewHash|LODHash|ExactQueryHash)\].*$", re.M)
LODS = [(1, 1), (8, 1), (12, 1), (12, 2), (12, 3), (12, 4), (12, 5)]
RECIPES = {
"surface-world": "0,-35,-487.94,0,-22",
"floating-islands": "-22,-19,-22.8,0,-4",
}
results = []
def launch(name, argv, timeout=900):
logfile = OUT / f"{name}.log"
command = ["taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--", *map(str, argv)]
started = time.monotonic()
peak_tree = 0
peak_process = 0
timed_out = False
with logfile.open("w", encoding="utf-8") as stream:
process = subprocess.Popen(command, stdout=stream, stderr=subprocess.STDOUT,
start_new_session=True)
while process.poll() is None:
pending, seen, total = [process.pid], set(), 0
while pending:
pid = pending.pop()
if pid in seen:
continue
seen.add(pid)
try:
pending.extend(int(x) for x in Path(f"/proc/{pid}/task/{pid}/children").read_text().split())
values = {}
for line in Path(f"/proc/{pid}/status").read_text().splitlines():
if line.startswith(("VmRSS:", "VmHWM:")):
key, amount, *_ = line.split()
values[key] = int(amount)
total += values.get("VmRSS:", 0)
peak_process = max(peak_process, values.get("VmRSS:", 0), values.get("VmHWM:", 0))
except (FileNotFoundError, PermissionError, ProcessLookupError, ValueError):
pass
peak_tree = max(peak_tree, total)
if time.monotonic() - started > timeout:
os.killpg(process.pid, signal.SIGTERM)
try:
process.wait(timeout=5)
except subprocess.TimeoutExpired:
os.killpg(process.pid, signal.SIGKILL)
process.wait()
timed_out = True
break
time.sleep(0.1)
code = process.wait()
elapsed = time.monotonic() - started
rows = HASH_ROW.findall(logfile.read_text(encoding="utf-8", errors="replace"))
results.append((name, code, elapsed, peak_process, peak_tree, timed_out, len(rows)))
print(f"[L21Run] {name} exit={code} seconds={elapsed:.3f} peak_process_rss_kib={peak_process} "
f"peak_tree_rss_kib={peak_tree} hash_rows={len(rows)} timed_out={str(timed_out).lower()}", flush=True)
return logfile
def base_args(binary, recipe, workers, hash_output=False, crossing=False):
args = [binary, DATA, "--world-assembler-prototype", "--stream-benchmark", "--stream-pipeline",
"--force-generate", "--clip-radius=3", "--max-clip-level=8", f"--workers={workers}",
f"--camera={RECIPES[recipe]}", f"--recipe={recipe}"]
if hash_output:
args.append("--stream-hash")
if crossing:
args += ["--camera-step=24,0,0", "--region-crossing"]
return args
# Plan-time identities and canonical serialization at W1/W8/W12, both field recipes.
snapshots = {}
for recipe in RECIPES:
for workers, repeat in [(1, 1), (8, 1), (12, 1)]:
path = OUT / f"snapshot-{recipe}-w{workers}-r{repeat}.json"
args = [BIN["clang-off"], DATA, "--world-assembler-prototype", "--stream-benchmark",
"--stream-pipeline", f"--recipe={recipe}", f"--workers={workers}",
f"--resolved-layout-output={path}", "--resolved-layout-only"]
log = launch(f"snapshot-{recipe}-w{workers}-r{repeat}", args)
if results[-1][1] != 0:
raise SystemExit(f"snapshot plan failed: {log}")
snapshots[(recipe, workers)] = path.read_bytes()
if len({snapshots[(recipe, workers)] for workers in (1, 8, 12)}) != 1:
raise SystemExit(f"snapshot serialization changed with worker count: {recipe}")
print(f"[L21SnapshotIdentity] recipe={recipe} worker_counts=1,8,12 canonical_bytes=identical status=PASS", flush=True)
# Full matrix. Every row is compared against the L19 W12x5 reference.
for recipe in RECIPES:
for compiler, binary in BIN.items():
for workers, repeat in LODS:
name = f"matrix-{recipe}-{compiler}-w{workers}-r{repeat}"
log = launch(name, base_args(binary, recipe, workers, hash_output=True))
rows = HASH_ROW.findall(log.read_text(encoding="utf-8", errors="replace"))
reference_name = f"{recipe}-{compiler}-w12-r5.log"
reference = ROOT / "Saved/Linux/l19-matrix" / reference_name
expected = HASH_ROW.findall(reference.read_text(encoding="utf-8", errors="replace"))
if results[-1][1] != 0 or len(rows) != 12 or rows != expected:
print(f"[L21HashMismatch] {name} expected_rows={len(expected)} actual_rows={len(rows)}", flush=True)
raise SystemExit(1)
# The crossing matrix retains the 24 m two-view query proof on both compilers.
for compiler, binary in BIN.items():
for workers, repeat in LODS:
name = f"crossing-{compiler}-w{workers}-r{repeat}"
log = launch(name, base_args(binary, "surface-world", workers, hash_output=True, crossing=True))
rows = HASH_ROW.findall(log.read_text(encoding="utf-8", errors="replace"))
reference = ROOT / "Saved/Linux/l19-crossing" / f"{compiler}-w12-r5.log"
expected = HASH_ROW.findall(reference.read_text(encoding="utf-8", errors="replace"))
if results[-1][1] != 0 or len(rows) != 12 or rows != expected:
print(f"[L21CrossingHashMismatch] {name} expected_rows={len(expected)} actual_rows={len(rows)}", flush=True)
raise SystemExit(1)
# Five interleaved W12 pairs per recipe, hashing disabled. Alternate order by pair to reduce drift.
off_pairs = {recipe: {"old": [], "new": []} for recipe in RECIPES}
for recipe in RECIPES:
for pair in range(1, 6):
order = [("old", OLD_CLANG), ("new", BIN["clang-off"])] if pair % 2 else [("new", BIN["clang-off"]), ("old", OLD_CLANG)]
for label, binary in order:
name = f"offcost-{recipe}-pair{pair}-{label}"
log = launch(name, base_args(binary, recipe, 12, hash_output=False), timeout=900)
if results[-1][1] != 0:
raise SystemExit(f"hashing-off cost run failed: {log}")
off_pairs[recipe][label].append(results[-1][2])
print(f"[L21OffCostPair] recipe={recipe} pair={pair} old_seconds={off_pairs[recipe]['old'][-1]:.3f} "
f"new_seconds={off_pairs[recipe]['new'][-1]:.3f}", flush=True)
for recipe, pair in off_pairs.items():
old = statistics.median(pair["old"])
new = statistics.median(pair["new"])
print(f"[L21OffCostSummary] recipe={recipe} pairs=5 median_old_seconds={old:.3f} "
f"median_new_seconds={new:.3f} delta_percent={(new-old)/old*100.0:.2f}", flush=True)
# Query the real compiled Core field at every distinct recorded stratum/band endpoint.
for recipe in RECIPES:
name = f"boundary-probes-{recipe}"
args = base_args(BIN["clang-off"], recipe, 12, hash_output=False)
args += ["--audit-resolved-layout-boundaries"]
log = launch(name, args)
if results[-1][1] != 0:
raise SystemExit(f"Core boundary probes failed: {log}")
print(f"[L21EvidenceSummary] snapshots=6 matrix=28 crossing=14 off_cost_pairs=10 boundary_audits=2 status=PASS", flush=True)
for name, code, elapsed, rss, tree, timed_out, rows in results:
print(f"[L21RunDetail] {name} exit={code} seconds={elapsed:.3f} peak_process_rss_kib={rss} "
f"peak_tree_rss_kib={tree} hash_rows={rows} timed_out={str(timed_out).lower()}", flush=True)
@@ -0,0 +1,173 @@
# Linux22 — one strate-layout unit and the closed stack
The owner setting is now **8 m per layout chunk** for every generator. FloatingIslands spans **+8 to −120 m** (128 m) and SurfaceWorld spans **−120 to −632 m** (512 m). Their shared boundary is −120 m, so the old 60 m gap is gone. SurfaceWorld keeps the same physical interval and content field as L21.
## Stack and bands
| Strate | Full interval | Ceiling | Content | Bedrock |
|---|---:|---:|---:|---:|
| FloatingIslands | +8…−120 m | +7.5…+8 m (0.5 m) | +7.5…−119.5 m (127 m) | −119.5…−120 m (0.5 m) |
| SurfaceWorld | −120…−632 m | −120…−126.25 m (6.25 m) | −126.25…−625.75 m (499.5 m) | −625.75…−632 m (6.25 m) |
```text
z=+8.00 m FloatingIslands ceiling outer face
z=+7.50 m FloatingIslands content begins
Islands: bottoms −63.468…−60.912 m; tops −57.419…−52.357 m
z=−119.50 m FloatingIslands bedrock inner face
z=−120.00 m FI/SW boundary: FI bedrock meets SW ceiling; no gap
z=−126.25 m SurfaceWorld content begins; cap profiles rise above here
z=−625.75 m SurfaceWorld bedrock inner face
z=−632.00 m SurfaceWorld bedrock outer face
```
The alternate owner SurfaceWorld recipe also exercises TunnelNetwork above it: TunnelNetwork uses the same +8…−120 m interval, with a 1 m ceiling, 126 m content band, and 1 m bedrock band. Every tested strate type receives both solid bands in the shared composition path. Existing `BoundarySealThickness` supplies each band’s thickness: TunnelNetwork 8 owner voxels = 1 m, FloatingIslands 4 = 0.5 m, SurfaceWorld 50 = 6.25 m. `BaseDensity` supplies solid density. Bands are diggable and unprotected by default. `InterStrateGapChunks=0` controls spacing, not band thickness; `EdgeSealThickness` remains horizontal. No new thickness parameter was needed.
Visible ceilings use the shared L18/L19 boundary path, extended to floors. The authored transitions are Gradient (blend widths 2 chunks for the upper strate and 1 for SurfaceWorld), but Core still uses the explicit **Hard fallback with zero interpenetration**. The snapshot records this deviation; Gradient and Interleaved blending are not claimed as implemented.
## Unit resolution and validation
`StrateLayoutChunkSizeMeters` is one world setting with an 8.0 m default. The director/adapter and standalone loader resolve it to micrometres and Core fixed-point width. At 25 cm Core voxels the width is 8,192 subvoxels = 32 Core voxels; at the S1 20 cm check it is 10,240 subvoxels = 40 Core voxels. The internal 32³ Core tile remains a separate concept.
Changed conversion and consumer sites:
- `UVoxelStrateManager` resolves the world setting; `VoxelForgeCoreAdapter::AttachValidatedWorldAssembly` passes one fixed-point width into recipes and `ResolvedLayoutSnapshotV2`. `OwnerWorldLoader::Resolve` mirrors that resolution in the standalone path.
- `BuildSurfaceStratumPlan` now scales chunk bounds by the resolved width instead of `CHUNK_SIZE` (32 Core voxels). `BuildFloatingIslandStratumPlan` writes the same width into geometry version 4.
- `NativeSurfaceDensityAt` and native SurfaceWorld strata classification use snapshot width for `floor(CoreZ / width)` and bounds. FloatingIslands dispatch uses its validated snapshot recipe width. Legacy TunnelNetwork chunk lookup uses the same snapshot width.
- Shared ceiling and floor composition, far-shell clipping, cap bounds, endpoint probes, and strict layout validation use the resolved width. `FloatingIslandManifestV1::FromJson` no longer reconstructs legacy width from Core tile size or owner/Core voxel ratio; world assembly supplies and validates the resolved value.
Current owner snapshots:
- SurfaceWorld recipe: `resolved-layout-v2-fnv64:96d6a8b64f73c2d8`.
- FloatingIslands recipe: `resolved-layout-v2-fnv64:2b343bc155f181d5`.
- 20 cm S1 snapshot: `resolved-layout-v2-fnv64:0a56caef7dd44cac`.
Strict validation passed on the generated owner world for both recipes: zero issues, 7/7 negative controls rejected, and 27 boundary probes per recipe with **zero dispatch/snapshot disagreements**. Both stacks have zero unowned gap and zero undeclared band overlap. The 20 cm snapshot also passed strict validation.
## SurfaceWorld clearance and spawn
The clearance scan samples a 4,096 × 4,096 m area at 1 m spacing around the derived route spawn (16,785,409 samples). Clearance is ceiling inner face minus the higher of ground and cap. Negative values mean a cap pokes through the ceiling at −126.25 m.
| Biome slot / ID | Max ground | Max cap/surface | Minimum sampled clearance |
|---|---:|---:|---:|
| 0 / 4097 | −442.333 m | −44.496 m | **−81.754 m** |
| 1 / 4098 | −313.660 m | −30.881 m | **−95.369 m** |
| 2 / 4099 | −419.399 m | −0.425 m | **−125.825 m** |
| 3 / 4100 | −361.088 m | −109.922 m | **−16.328 m** |
Ground/mountain surfaces stay below −313.660 m in this scan. The collisions come from cap profiles: authored `CeilingUndulation` is 1000 or 900 Core voxels (250 m or 225 m). They were not clamped. The owner can raise the strate or reduce those cap profiles. Since SurfaceWorld’s interval and content are unchanged from L21, this clearance issue is unchanged too.
The SurfaceWorld plan produces 33 route points. The L1 benchmark and spawn camera now derive from `route.front`: **(9.250, 41.250, −502.848) m**, yaw 0°, pitch −22°. Route planning passed (648 candidates, 366 grade rejects, zero sweep rejects); walkability passed 5,642/5,642. The highest route point is −501.714 m, giving 375.464 m clearance to the ceiling face. FloatingIslands walkability passed 4,000/4,000.
| Island | Bottom…top | Bedrock margin | Ceiling margin |
|---:|---:|---:|---:|
| 0 | −62.700…−57.419 m | 56.800 m | 64.919 m |
| 1 | −61.410…−56.000 m | 58.090 m | 63.500 m |
| 2 | −63.468…−55.878 m | 56.032 m | 63.378 m |
| 3 | −60.912…−52.357 m | 58.588 m | 59.857 m |
## Captures
All six L22 captures are 1600×900 JPEGs under 50 KB (limit 300 KB). SurfaceWorld images compare with L19’s same-named views. The FI review angle is the owner-style low view at (−22, −19, −61) m; separate views look up at the ceiling and down at the new bedrock floor.
| View | L22 | L19 equivalent |
|---|---|---|
| SurfaceWorld, route-derived spawn | [L22](captures/surface-world-l1-spawn-after.jpg) | [L19](../Linux19/captures/surface-world-l1-spawn-after.jpg) |
| SurfaceWorld horizon | [L22](captures/surface-world-horizon-after.jpg) | [L19](../Linux19/captures/surface-world-horizon-after.jpg) |
| SurfaceWorld rings from above | [L22](captures/surface-world-rings-above-after.jpg) | [L19](../Linux19/captures/surface-world-rings-above-after.jpg) |
| FloatingIslands low owner angle | [L22](captures/floating-islands-owner-angle-after.jpg) | [L19](../Linux19/captures/floating-islands-owner-angle-after.jpg) |
| FloatingIslands ceiling | [L22](captures/floating-islands-ceiling-up-after.jpg) | [L19](../Linux19/captures/floating-islands-ceiling-up-after.jpg) |
| FloatingIslands bedrock floor | [L22](captures/floating-islands-bedrock-down-after.jpg) | — |
A whole-stack side render was not readable from the surface-only mesh export. The vertical stack diagram above gives the exact interfaces and bands.
## L19 ring tables rerun
RingProbe ran on L19 and L22 meshes at the same historical cameras: SurfaceWorld (0, −35, −487.94) m and FloatingIslands (−22, −19, −22.8) m. Values are median / p95 / maximum absolute edge-height difference in centimetres, followed by no-hit edge count. These are LOD mesh-edge gaps, not gaps in the validated strate stack.
### SurfaceWorld rings
| LOD | L19 edges/samples | L19 cm (gaps) | L22 edges/samples | L22 cm (gaps) |
|---|---:|---:|---:|---:|
| 0→1 | 46/288 | 0.178 / 0.594 / 1.171 (10) | 46/288 | 0.178 / 0.594 / 1.171 (10) |
| 1→2 | 32/288 | 1.419 / 4.990 / 10.438 (0) | 32/288 | 1.419 / 4.990 / 10.438 (0) |
| 2→3 | 34/256 | 2.179 / 12.648 / 35.355 (2) | 66/544 | 0 / 8.260 / 35.355 (2) |
| 3→4 | 40/265 | 5.099 / 35.999 / 1,190.974 (5) | 72/537 | 0 / 22.456 / 1,190.974 (6) |
| 4→5 | 58/270 | 0.235 / 3.694 / 491.570 (14) | 104/835 | 0 / 77.070 / 5,751.081 (6) |
| 5→6 | 65/266 | 12.234 / 127.224 / 536.573 (33) | 96/576 | 0 / 0 / 6,935.708 (32) |
| 6→7 | 41/269 | 28.238 / 291.861 / 945.477 (7) | 64/288 | 0 / 2,991.225 / 9,240.525 (32) |
| 7→8 | 32/275 | 83.843 / 1,225.416 / 3,755.407 (0) | 32/288 | 0 / 10,444.014 / 10,839.630 (0) |
The 0→1 and 1→2 rows are unchanged. Higher rings changed as the complete strata bands and far boundaries entered the view; the largest far-ring discrepancies increased. The full LOD-stable interface surface remains future work.
### FloatingIslands / SurfaceWorld interface rings
| LOD | L19 edges/samples | L19 cm (gaps) | L22 edges/samples | L22 cm (gaps) |
|---|---:|---:|---:|---:|
| 0→1 | 0/0 | — (0) | 63/185 | 1.328 / 6.795 / 10.623 (17) |
| 1→2 | 33/231 | 147.141 / 148.403 / 149.862 (0) | 0/0 | — (0) |
| 2→3 | 49/308 | 128.603 / 200.789 / 773.318 (8) | 32/288 | 0 / 0 / 0 (0) |
| 3→4 | 64/277 | 3.269 / 47.774 / 188.531 (27) | 32/288 | 0 / 0 / 0 (0) |
| 4→5 | 72/544 | 29.992 / 124.373 / 443.482 (6) | 72/547 | 0 / 74.140 / 552.186 (6) |
| 5→6 | 64/266 | 12.234 / 127.224 / 536.573 (32) | 64/288 | 0 / 0 / 0 (32) |
| 6→7 | 32/264 | 29.013 / 301.752 / 42,624.479 (0) | 32/288 | 0 / 0 / 0 (0) |
| 7→8 | 64/275 | 83.843 / 1,225.416 / 3,755.407 (32) | 64/288 | 0 / 0 / 0 (32) |
The FI table changed substantially. The new bedrock floor is visible at −119.5 m and supplies flat matched samples in several coarser rings; the old L1→2 interface edge is absent in this camera’s L22 mesh. This does not implement the later full LOD-stable interface design.
## Hashes, determinism, invariants, and cost
Versions: evaluator 7, recipe schema 2, layout snapshot schema 2, FloatingIslands geometry 4. New W12 baseline rows are density / mesh / payload / topology:
| Recipe/view | Full detail | Whole view |
|---|---|---|
| SurfaceWorld, derived spawn | `e7e0b0668a491c46 / ca35fe7a91099574 / 19f29f621cfdbbc7 / e37b3191a7200c67` | `4932f16f7d8dd5ab / 98e68419a13b76db / 56124d542206790c / 75ef1148afa20ca8` |
| FloatingIslands, auto island camera | `647bcb4038627e16 / 87324ad688a49bfa / a0c5b9a73288e393 / f9c316a79dd42152` | `2b5b06283399ad9d / 5c66f389b526f6bb / f2e7ff68d9dc2262 / 121abcf0607f0cf1` |
For the same historical SurfaceWorld camera, L21 and L22 exact-query density/unclamped hashes match at `e4d4a8eb95b35933`; detail is `efcba20c0c70c415`, collision is `e604823a249029bf`. Full-detail hashes also match exactly: `0ee0579bd15cbbe4 / 32e5d4964d610fee / 1932b96ee4b1d910 / 69743c6bad3447dc`. Whole-view hashes differ because shared bands and complete outer strata now contribute to the mesh.
Determinism passed 28/28 runs (both recipes, Clang 19 with FP contraction off and GCC 14 default; W1, W8, W12×5). The 24 m SurfaceWorld crossing passed 14/14. Resolved snapshots were byte-identical across W1/W8/W12. Final W12 smoke hashes on both post-guard binaries still match their baselines. SurfaceWorld route parity passed with 782,026 exact-query samples and zero mismatches; FloatingIslands also passed with 782,026 samples and zero mismatches. SurfaceWorld’s proof audit checked 25,927 blocks / 34,508,837 samples with zero violations. FI had zero checked blocks and 24,576 conservative unknown/fallback blocks, zero violations; it did not claim positive proof coverage. Shape readiness, base/page equivalence, and walkability audits passed.
The W12 hashing-off five-pair median cost against the L21 binary was 1.613 s → 1.411 s for SurfaceWorld (−12.52%) and 11.087 s → 18.840 s for FloatingIslands (+69.93%), reflecting FI’s added 64 m of volume. Largest measured process RSS was 897,840 KiB; largest process-tree RSS was 4,603,848 KiB. Builds and runs stayed under the 6 GiB address-space limit, CPUs 0–11, at most 12 workers, and the 15/30 minute limits. The governor was unchanged.
The L3 FP-contract preamble/self-test and L4 `FLazy`, L7 shared cache, L9/L12 proofs, L11 readiness/crash handling, L13 route binding, L18/L19 shared ceiling, L21 snapshot/validator, `ARCHITECTURE.md` §8.10, and CLAUDE.md async rules remain in place. The Linux22 architecture note is §8.40.
## Unreal edits and Windows checklist
Unreal edits are limited to:
- `Source/VoxelForge/Public/VoxelSettings.h` — world setting `StrateLayoutChunkSizeMeters`, default 8.0.
- `Source/VoxelForge/Public/VoxelStrateManager.h` and `Private/VoxelStrateManager.cpp` — resolve and use one layout width for manager strate bounds/lookups.
- `Source/VoxelForge/Private/VoxelForgeCoreAdapter.cpp` — pass that width to plans and the V2 snapshot; compose the same parameter-driven ceiling and bedrock bands for each generator.
The Unreal module cannot be compiled on this Linux machine. Windows checklist:
1. Rebuild the VoxelForge module and confirm the setting defaults to 8.0 m.
2. Load the owner world with FloatingIslands and SurfaceWorld; verify +8…−120 m and −120…−632 m, with no gap at −120 m.
3. Verify ceiling and bedrock are visible and breakable, then check the route-derived SurfaceWorld spawn and cap/ceiling collisions against the captures.
4. Run the boundary validator and compare the generated snapshot with the two Linux22 identities above.
## Failed and retried runs
- Three early Clang builds failed while implementation files were being synchronized: the standalone loader referenced settings/API not yet copied; the next compile found three undeclared copied-manager width references; a later attempt found a missing closing brace in the clearance audit. These were corrected; the final Clang and GCC builds passed.
- One final smoke attempt used a nonexistent `linux22-clang-off` binary suffix and exited 127 before running a workload. It was rerun with the correct `linux22-clang` and `linux22-gcc` paths; all four W12 hash checks passed.
- A zero-byte `build-clang-off-floor.log` has no recorded compiler output and was superseded by the successful measured final builds.
- The clearance scan completed successfully and reported the cap collisions above; this is a world-fit finding, not a failed run. No build or run timed out or exceeded its limit.
Nothing was committed, pushed, or stashed.
## Orchestrator review (Claude)
- Merged. The strict validator passes on the real owner world; SW full-detail and exact-query hashes are
unchanged (content did not move); FI is +8…−120 m with a bedrock floor.
- Captures checked by me: the FI owner-angle view shows islands above a clean, flat bedrock floor with a
closed ceiling, and the ledges are gone. The SW rings-from-above view shows continuous terrain with no
visible ring steps, so the large far-ring values in the RingProbe table (up to ~108 m) are most likely the
probe pairing different surfaces now that bands are in view, not real breaks. Treat that table with care
until the probe filters by surface owner. The SW horizon is from the new route-derived spawn, so it is not
the same angle as L19.
- Owner decision needed: SW cap profiles (`CeilingUndulation` 225–250 m) exceed the new ceiling band by up
to ~126 m; reported, not clamped.
- Cost: FI whole view +70% (its strate doubled in volume); SW −12.5%.
- Unreal edits (VoxelSettings `StrateLayoutChunkSizeMeters` = 8.0, StrateManager, CoreAdapter) are
UNCOMPILED here; Windows checklist above. CLAUDE.md's scale rule was updated to match.
- Transitions are still Hard (recorded deviation).
Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

@@ -0,0 +1,158 @@
# L23 — inter-strate passage
## Owner answer
**After L22, Core did not have a resolved-layout passage through the new bands.** L22 exported
`FVoxelPassage` points as `milli owner voxels` metadata, but the native FloatingIslands and
SurfaceWorld Core paths did not use that metadata to carve the resolved bands. The legacy manager
still has `UVoxelStrateManager::GeneratePassages`; its coordinates are in owner voxels, not metres.
The owner voxel is 12.5 cm (`OwnerVoxelSizeMicrons=125000`); `voxel_size_cm=25` is the Core voxel.
The legacy 0→1 passage therefore had upper `(-19.594, 3.137, -14.255) m` and lower
`(-19.594, 3.137, -102.959) m`, with radius 1 m. Its lower point was still in FloatingIslands
content (`-119.5…+7.5 m`), 23.29 m above SurfaceWorld content (`-625.75…-126.25 m`). It did not
open the FI bedrock (`-120…-119.5 m`) and SW ceiling (`-126.25…-120 m`). The JSON also contains a
legacy 0→0 passage; L23 plans only adjacent resolved strata.
L23 now derives the passage from the director-resolved bands and route anchors. For the FI recipe,
mouths are `(9.800, 4.571, -54.831) m` and `(9.250, 9.250, -502.608) m`. For the SurfaceWorld
recipe the unanchored upper mouth is `(10.732, -5.775, -107.766) m`; the lower mouth is the same.
Both locations are inside the actual content and within 24 m of `(0,0)`.
## Planner, radius, and routes
`UVoxelStrateManager::GeneratePassages` remains the legacy Unreal planner. L22's season manifest
carried recipes/routes, while the adapter copied manager passage points into V2 anchors with the
legacy units. L23's adapter and headless director convert each upper strate's `PassageConfig` to
Core fixed units, build a V3 layout with route anchors, then call `PlanResolvedLayoutPassagesV1`.
The planner hashes seed, upper/lower strate, connection, and salt, so peers with the same resolved
input choose the same path. Strate moves and route changes trigger a new plan; exported root
`passages` are not imported.
The placement disk comes from `PassageConfig.DistanceMax=192` owner voxels = 24 m; when no route
anchor is available, `DistanceMin=64` owner voxels = 8 m supplies the inner annulus. `OriginSpineRadius`
and spawn radius are separate settings. `MouthRadius`/`MidRadius` set tunnel cross-section; Core
enforces a 1.25 m minimum radius for the player capsule. Neither ceiling nor cap parameters changed.
In the FI snapshot, route point 28 (last of 29) equals the FI departure mouth; SW route point 0
(first of 33) equals its arrival mouth. Both route audits pass. This owner layout has exactly two
strata, so SW has no next interface/departure mouth; its free route endpoint is
`(54.750, 54.750, -502.308) m`.
## Passage audit
Capsule is 0.34 m × 1.76 m. A passage fails on any blocked capsule sample, unsupported floor probe,
grade failure, mouth outside content/radius, route-mouth mismatch, or if the no-passage control
does not detect blockage.
| Recipe | Interfaces | Center samples | Capsule samples | Blocked | Support probes / unsupported | Grade failures | Mouths in content / radius |
|---|---:|---:|---:|---:|---:|---:|---:|
| FloatingIslands → SurfaceWorld | 1/1 | 5,174 | 325,962 | 0 | 40,412 / 0 | 0 | 2/2 · 2/2 |
| TunnelNetwork → SurfaceWorld | 1/1 | 4,513 | 284,319 | 0 | 35,254 / 0 | 0 | 2/2 · 2/2 |
The deliberate no-passage controls found 17,218 blocked capsule samples (FI recipe) and 23,876
(SurfaceWorld recipe); both were detected. FI’s 29-point route and SW’s 33-point route pass with
0 blocked samples, 0 unsupported probes, 0 grade failures, and mouth binding 2/2. The
SurfaceWorld-only route passes 33 points with the same zero failures and binding 1/1.
The shared composition layer applies each generator field, then bedrock/ceiling bands, then the
bounded passage carve and support shelf. Only the tunnel path opens a band. The full 0→1 capsule
audit crosses the FI bedrock and SW ceiling; support stays below the capsule.
The audit samples the resolved Core field by interface owner and does not reuse the old ring-table
probe, so it does not pair band and content samples from different surface owners.
Runtime passage checks covered all eight generator kinds: TunnelNetwork, FlatPlain, CrystalChamber,
Maze, VerticalShafts, and Underwater as upper-strate fixtures; FloatingIslands in the FI recipe;
SurfaceWorld as the real lower strate in both owner-world recipes. The SurfaceWorld-as-upper fixture
could not produce its separate route: all 648 route candidates failed the grade filter. That fixture
is recorded as a failed route setup, not counted as a passage pass. The real SurfaceWorld lower
strate audits pass.
## Determinism, proofs, and content hashes
Clang 19 (`--fp-contract=off`) and GCC 14 (`--fp-contract=default`) builds passed. Both executables
ran the mandatory Core FP-contraction self-test without rejection. For both recipes, W1/W8/W12×5
across both compilers produced one distinct result per hash class. The same 28-run matrix passed the
24 m region crossing: 314 moving tiles, stable within each recipe. Route parity passed on both
compilers: 8/8 page pairs, 14 higher-LOD exact pairs, 782,026 exact-query samples, and one edit,
all with zero mismatches. V3 strict validation accepted both layouts with 0 issues; all 9 malformed
layout controls were rejected.
Passage-centered uniform-proof boxes are conservatively unknown/fallback (FI: 21,504 fallback and
unknown, 0 violations); no false certificate is emitted around the new carve. Away from the passage,
SurfaceWorld at `(512,512,-500) m` matches the L22 baseline bit-for-bit: 27,368 certified blocks,
36,426,808 samples, 1,304 fallbacks, 0 unknowns/violations. Full-detail hash is
`66ac781666579e3e / 914873894a0e38c4 / ec8b03ade039cd56 / a2b621b0321d43dc` (density/mesh/payload/
topology); whole-view hash is `ddc6d1942db48f52 / bce985905e70dac4 / 266f5a008bcf4491 /
e6fa520c5ad2817b`. LOD0–3 and 9 exact-query hashes also match. The earlier unbounded comparison
included the far horizon and was discarded; this comparison used render-distance 0 and max LOD 3.
Changes are limited to resolved passage planning, band openings along those paths, and supported
landings. SurfaceWorld content away from the passage is unchanged by the hashes above. L3 FP
contract setup/self-test, L4 `FLazy`, L7 shared cache, L9/L12 proof behavior, L11 readiness/crash
path, L13 route binding, L18/L19 shared ceiling, L21/L22 layout bands, ARCHITECTURE §8.10, and
`CLAUDE.md` async/Epoch rules remain intact. The route and passage audits exercise L13 binding; the
async/cache files were not edited.
## Captures
Small 1280×720 JPEGs (all render inputs/PNG intermediates stay in `Saved/Linux/linux23/`):
- [FI passage mouth](captures/fi-mouth.jpg)
- [Tunnel at the FI bedrock / SW ceiling interface](captures/tunnel-interface.jpg)
- [Arrival in SurfaceWorld](captures/sw-arrival.jpg)
## Changes and Windows checklist
Version bumps: resolved-layout snapshot V3, evaluator 9, FloatingIslands geometry 4. The only
Unreal-side source edit is `Source/VoxelForge/Private/VoxelForgeCoreAdapter.cpp`: it binds V3
routes/configs and invokes the resolved planner. Core and standalone sources build here; the Unreal
adapter cannot be compiled on this Linux host.
On Windows:
1. Build the Editor/plugin with the updated Core header and adapter; check UHT and link.
2. Load the owner world at seed 0 and verify strict V3 validation and stable mouth coordinates.
3. Walk the FI route, passage, and SW route with the 0.34 m × 1.76 m capsule; inspect all three
capture viewpoints in-engine.
4. Move a strate or route anchor, reload, and verify the passage is re-derived and peer-identical.
5. Confirm SW away from the passage and its ceiling/cap parameters remain unchanged.
## Failed and retried runs
Failed development audit logs (all retained under `Saved/Linux/linux23/`): FI
`audit-floating-islands.log`, `r2–r5`, `r17–r19`, `r21–r36`, `r38–r41`; SurfaceWorld
`audit-surface-world.log`, `audit-surface-world-diagnostic.log`, `audit-surface-world-diagnostic-r2/r3`,
and `audit-surface-world-r2–r7`, `r19`, `r21–r22`, `r24–r26`, `r28–r31`, `r33`, `r35`. The early
failures were blocked capsule samples or unsupported landing probes. r35 still had 10 unsupported
passage support probes; r36’s correction left 1,977 blocked capsule samples. r37 build failed on
undeclared `begin/end`; r38 regressed to 10 unsupported probes. r39–r41 diagnostics traced support
search across a non-monotone lower route tail; r42 build failed on `continue` inside a lambda. The
lower-mouth split/index fix passed r43; final Clang/GCC builds and audits pass.
Other retries: `plan-surface-world-r2.log` used the wrong data path; two layout-only calls omitted
the required benchmark/pipeline flags and exited 2. The first upper-SurfaceWorld fixture failed its
648-candidate route search as noted above. Initial offscreen renders hit the read-only Mesa cache
location and were rerun with cache disabled and the CPU/address-space limits. Initial captures were
also rerendered under affinity/memory limits. Camera trials were replaced by the three listed JPEGs.
The first SurfaceWorld away hash comparison included the far horizon and was replaced with the
bounded L22/L23 comparison. The hash parser initially reported missing rows because its regex was
not multiline; corrected parsing found 28/28 runs and zero mismatches.
Runs were pinned to CPUs 0–11 and capped at 6 GiB address space; no task exceeded 30 minutes or
stalled for 15. This shell inherited nice level 5; an attempt to restore normal priority was denied,
so I made no priority or governor change. No commit, push, or stash was made.
## Orchestrator review (Claude)
- Merged as a correctness fix: the strates were not connected after L22 (and Core never carved the
passage at all); now a planned, deterministic passage crosses FI bedrock and the SW ceiling, with a
capsule audit of 0 blocked / 0 unsupported and a detected negative control.
- **The look is not yet "natural" (my capture review):** `fi-mouth.jpg` shows a stepped tube hanging in
FI's open void (there is no rock to carve between the island-level mouth at −54.8 m and the bedrock at
−119.5 m); `sw-arrival.jpg` shows flat stacked terraces; `tunnel-interface.jpg` is too close to read.
Owner input needed on where an FI passage should start (island vs bedrock floor) and how it should
look.
- Open: the SurfaceWorld-as-upper-strate fixture can't plan its route (648/648 grade-rejected), a real
limit for future layouts.
- Unreal adapter edit uncompiled here; Windows checklist above.
Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Loaded 100 of 164 files, more files were not shown because too many files have changed in this diff. Show more