Author SHA1 Message Date
Fr0zkaandClaude Opus 5.5 70c37aaab3 unreal: startup boost spans epoch churn; empty collision tiles stay classified (L92)
- Startup apply boost (24 meshes / 14 ms) now ends on initial LOD0-2 + collision readiness or
  the 30 s timeout, not on the first desired-epoch change: FI LOD0-2 settled 3.49 -> 3.40 s.
- Known-empty LOD0 collision classifications persist across unloads within a modification epoch
  and are invalidated on edits; commandlet readiness accepts CollisionNotRequired tiles. The 30 m/s
  movement trace now passes (no re-requests of the 4 support tiles).
- Startup trace events: SerializeResolvedWorld ~466 ms synchronous in BeginPlay (unchanged);
  SW bReady at 2.74 s vs FI 0.75 s (to investigate). Redundant second parse removed.
- Core output identical. Fast tier PASS; Linux UE builds. R42 notes attached.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-28 06:54:59 +01:00
Fr0zkaandClaude Opus 5.5 8805291d3e diag: passage source-floor clamp rejected (L91); field has steep non-distance tails
Clamping the passage-composition source density at -c (c=2..6 voxels, diagnostic, default off)
changes the surface far beyond the bar: c=6 still 65 sign flips, up to 165 cm displacement, 120 deg
normal change (downstream composition consumes deep values). Source gradient at crossings is
distance-like at the median but has huge tails (FI p90 |grad| 512, max 894 vox/vox), so the
density-dependent passage reach is inflated by non-distance values. No world change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-28 05:50:11 +01:00
Fr0zkaandClaude Opus 5.5 a7a03d42b4 diag: passage candidate compiler census (L90, opt-in); falsifier failed at 10 m reach
54,324 sparse 4 m bricks, uncapped carve/tread/clearance/mouth lists, built in 26-28 ms,
~12 MiB. Weighted over 30.7M near-LOD sample hits: active carve p90 13, mouth p90 13; reach
fallback keeps 18.3% of passage time (FI 12%, TN 19%) - all because the density-dependent reach
(-d*Q + 0.24 m) exceeds 10 m for deeply negative source samples. Not wired into production.
R41 notes (Unreal LOD0-2 gap: ~0.7 s pre-request in BeginPlay, LOD2 tail, apply boost reset;
L80's 4 missing tiles = re-requested empty collision-support tiles) attached.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-28 05:28:27 +01:00
Fr0zkaandClaude Opus 5.5 04cdd197fb research: Astra pass 3, compiled spatial passage evaluator design (read-only)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-28 04:46:50 +01:00
Fr0zkaandClaude Opus 5.5 fa78192c86 diag: passage vs boundary-band ceiling split (L88); coarse passage cache rejected
Verified ablations (zero passage work / zero band calls). LOD0-2 @W12: exact FI 2.27 / TN 2.25 s;
passages off FI 0.81 / TN 0.85; bands off FI 2.11 / TN 2.06. Passages cost ~1.4-1.6 s of near
readiness, bands ~0.1-0.2 s. A tile-local 4-voxel trilinear passage-delta cache increased carve
segment visits (FI 34.5M -> 56.2M) and slowed LOD0-2 (FI 2.58 -> 3.77 s); removed. No world change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-28 03:37:24 +01:00
Fr0zkaandClaude Opus 5.5 0fe7f371f7 diag: corrected passage-off ceiling + cold worker/tile timelines (L87); passages ARE the gate
L86's switch left ApplyResolvedStratePassageCarves running (near-tile service unchanged at ~21
worker-s), so its "no change" ceiling was wrong. Corrected (bands + carves off): FI LOD0-2
2.34 -> 0.66 s, whole 3.47 -> 1.49 s @W12; TN 2.27 -> 0.74 / 3.28 -> 1.52 s. Near-tile service
15.6-22.5 -> 2.6-3.8 worker-s. Critical chain: shape/base compile -> LOD0-1 -> far-parent build
(107-153 ms, pipeline thread) -> LOD2. Workers 81-85% busy in the direct window.
No production scheduling change; hashes equal L85. Fast tier PASS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-28 03:07:30 +01:00
Fr0zkaandClaude Opus 5.5 4f5f6667ae diag: passage-disabled ceiling (L86); readiness unchanged without passages
Environment-only diagnostic hook disables passage composition (never a world setting).
Cold LOD0-2 / whole @W12 WITHOUT passages: SW 1.12/2.25, FI 2.18/3.34, TN 2.15/3.15, VS 1.12/2.03 s
- the same as with passages (FI 2.16 s). Passages are ~58% of sampled CPU but not the
readiness bottleneck. A lazy exact passage-result cache was +47% slower (24% hit rate, ~700 MB)
and was removed. No world change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-28 02:13:43 +01:00
Fr0zkaandClaude Opus 5.5 06f558dc91 streaming: split dense passage-junction grid fills; heavy-first order + far-parent deferral in Unreal (L85)
Tiles with passage-overlap score >= 9 split grid fill over up to 4 helper lanes (disjoint rows,
same per-sample order, join before MC) when workers are idle. FI junction tile fill 173 -> 99 ms;
estimated serial floor ~0.55-0.60 s. Readiness essentially unchanged (FI/TN LOD0-2 ~2.15 s @W12):
the limit is now aggregate work, not single tiles.
Unreal: LOD0-2 ordered by passage overlap before travel/distance (L80 modes kept); far parents
built after LOD0-1, LOD2 gated on them; helper budget via ParallelFor. Unreal null-RHI FI
arrival: LOD0-2 resident at 3.65 s.
All tile hashes identical to L84 (four whole views). Fast tier PASS; Linux UE host builds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-28 02:02:32 +01:00
Fr0zkaandClaude Opus 5.5 0a98da6fd0 streaming: passage-heavy tiles first, far parents after LOD0-1 (L84, headless only)
Predicted passage-overlap tiles are scheduled earlier (FI worst tile rank 116 -> 69, dispatch
0.95 -> 0.82 s); LOD0-1 publish from the base shape before far parents, which are built before
LOD2 is queued. Every tile hash identical to L83 (all four whole views). Fast tier PASS.
Cold LOD0-2 W8 / W12: SW 1.02 / 0.99, FI 2.26 / 2.18, TN 2.27 / 2.15, VS 1.13 / 1.09 s.
Heaviest tiles (FI/TN junction band, z=-93) still take 0.5-0.7 s each, mostly full-grid fill;
idealized floor ~0.92 s. Unreal scheduler not yet updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-28 01:02:59 +01:00
Fr0zkaandClaude Opus 5.5 a81b5b7d06 passages: contiguous BVH node ranges + child-bound reuse (L83); scaling and serial floor measured
Exact through LOD2 (all near tile hashes equal L82). W8 LOD0-2: SW 1.09->1.06, FI 2.47->2.34,
TN 2.39->2.43 (noise), VS 1.20->1.18 s. Fast tier PASS.
Scaling W4/W8/W12/W16 (LOD0-2, FI): 3.59 / 2.48 / 2.33 / 2.34 s - flattens past W8-W12.
Estimated infinite-worker floor ~1.0 s FI/TN = shape compile (0.35-0.41 s, not overlapped:
no shape-free tiles in these views) + slowest single LOD0 tile service (0.51-0.59 s).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-28 00:24:49 +01:00
Fr0zkaandClaude Opus 5.5 f572108dc4 passages: exact relief skip + per-tile BVH node masks (L82); FI/TN LOD0-2 -12%
- Wall relief noise is skipped when its hard-bounded contribution cannot change the final max;
  mouth surface/tread noise only on paths that use it.
- Exact active BVH-node masks cached per tile/passage/segment range; no per-sample lower_bound.
- Full-view audit imports the exported Core plan (not the stale 26-point root route): 21,425/21,425
  walkability samples pass.
Cold (L80 protocol, medians) LOD0-2: SW 1.16->1.11, FI 2.86->2.51, TN 2.88->2.54, VS 1.23->1.22 s.
Passage share FI 64.6->58.7%, TN 65.4->58.4%. Hashes identical (v214). TN "slowdown" from L81
not reproduced (5 pairs, 3.08 -> 2.75 s). Fast tier PASS; Linux UE host builds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-27 23:46:15 +01:00
Fr0zkaandClaude Opus 5.5 9cb5e53b17 passages: exact density-aware outer bound skips passage work beyond its reach (L81, v214)
The carve is max(source, -roughSDF/Q), so its reach grows with -source; the outer test uses
-d*Q + 0.24 m (wall relief 0.21 + margin) beyond the route radius, disabled in mouth-support
and column-overlap tiles. Skips 16% of passage iterations on the highest-activity tiles and
all of them on ordinary tiles. 84 candidate/full pairs identical in every hash; 0 changed samples.
Evaluator 214 for cache invalidation only. Cold LOD0-2 (L80 protocol): SW 1.30->1.25,
FI 3.59->2.93, TN 3.18->3.51 (noise?), VS 1.33->1.22 s. Fast tier PASS.

Note: the export's legacy 26-point root route owner_world.passages[0] fails a full-view
pre-audit (65 solid samples, unchanged since L70); the canonical 211-point route used by the
plan passes. Stale data to clean up.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-27 22:58:34 +01:00
Fr0zkaandClaude Opus 5.5 b06397df9c streaming: speed-aware scheduler with hysteresis (L80); arrival near-first, fast travel keeps the horizon
Policy 3 (headless + Unreal): walkable ring always first; at rest/arrival LOD0-2 before far;
walking interleaves near:far ~4:1 toward heading; fast travel admits far coarse tiles right after
the walkable ring. Hysteresis: walking 0.75/0.35 m/s, fast 12/8 m/s.
Headless, far holes while moving 30 m/s: L77 9.0% / L79 77.2% / L80 8.9%. Cold LOD0-2 ready
(one clean protocol, medians): SW 1.30, FI 3.61, TN 3.07, VS 1.43 s.
Unreal 30 m/s traces end 2,233/2,237 loaded (commandlet readiness exit 1) for all policies.
Passage zero-padding cut: ~50% fewer passage iterations on active tiles, max 6.6 cm surface
displacement, no sign flips; not adopted yet (padding sweep next). World unchanged (v213).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-27 21:39:21 +01:00
Fr0zkaandClaude Opus 5.5 2c8a26c0d0 streaming: far LODs keep a share while near work is pending (L79); no more horizon starvation
L78's strict near-first order starved far LODs at 30 m/s (100% far holes, never completed).
Unreal policy 2: once the collision ring is ready, LOD0-2 keep their reserve and far tiles are
admitted as low-priority Horizon work; headless gives far work 1 of every 16 requests.
Moving camera, far holes while moving: 1.4 m/s L77 8% / L78 29% / L79 31%; 30 m/s L77 8% /
L78 100% / L79 72% (completes on dwell). Near readiness while moving at 30 m/s: 52 / 51 / 67%.
Still worse than L77 for fast travel -> speed-adaptive policy next. World unchanged (v213).
Fast tier PASS; Linux UE host builds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-27 20:17:35 +01:00
Fr0zkaandClaude Opus 5.5 ec20994a8e streaming: near LODs first (walkable ring, LOD0, LOD1, LOD2, then far); exact passage trims (L78)
- Headless and Unreal schedulers drain the collision-critical ring, then LOD0-2, then far LODs
  at low priority. LOD0-2 ready (W8 medians): SW 4.36->1.76, FI 6.89->5.26, TN 4.88->3.22,
  VS 2.71->1.56 s. Whole view roughly unchanged (FI/VS slightly later).
  KNOWN RISK: far tiles wait until every near tile is ready, so far LODs may starve while
  moving fast (to address next).
- Exact composer trims: tile-level upper-mouth candidate list, segment-index min/max rejection
  before lower_bound, 64-entry thread-local value-noise corner cache. Passage share 65 -> 63%.
- World exact: 24/24 hash matrix + pinned L75 owner hash. Fast tier PASS. Linux UE host builds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-27 19:13:45 +01:00
Fr0zkaandClaude Opus 5.5 5e091d254c profile: in-process SIGPROF sampler + exclusive route/phase census (L77); closes to 0.1%
Opt-in (L77 build + --linux77-profile; compiled out by default, 0.02% handler cost).
FI/TN cost account closes against direct grid-fill timing within 0.15% (LOD0-2 bins within 1.4%).
Passage carving = 66% of LOD0-2 CPU (52-54% whole view), passage support 10-14%, base packed
+ analytic field ~3%. Hotspots: value noise 17%, lower_bound in VisitNearestPassageSpatialNode
14%, ApplyResolvedStratePassageCarves 6.5%. LOD0/1 complete LAST (4.1/4.6 s) while LOD2 is
ready at 2.2 s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-27 17:55:39 +01:00
Fr0zkaandClaude Opus 5.5 68cba5a51d research: Astra pass 2, whole generation chain cost map (read-only)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-27 16:49:49 +01:00
Fr0zkaandClaude Opus 5.5 2dfe599148 research: Astra design review of the ~1 s whole-view goal (read-only)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-27 16:39:34 +01:00
Fr0zkaandClaude Opus 5.5 90378a585f profile: per-term legacy FI/TN sample profiler (L76); passage/support is ~75% of field time
Opt-in at build time (VOXELFORGE_PROFILE_LEGACY_TERMS=1; compiled out by default, ~2% when on).
Per legacy sample: passage/support composer ~1.05 us vs primitive scan ~0.19 us, boundary
band ~0.06 us, noise ~0.01 us. Resolved-passage constants are cached at field binding
(arithmetic order unchanged); whole-view effect within noise. Per-tile hashes identical to L75
in all 24 compiler x worker x view comparisons; fast tier PASS; Linux UE host builds.
R40 researcher notes attached.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-27 16:25:19 +01:00
Fr0zkaandClaude Opus 5.5 9d5455ec68 skip: passage proof bounds include wall/floor relief (L75 soundness fix); FI -7.6%
L74's passage bound omitted the 0.21 m wall relief and 0.20 m floor relief, so its whole-tile
proof was unsound in principle (no tested view hit it). Passage support is now bounded per route
segment by four parameter-subinterval boxes using Catmull-Rom derivative extrema, local max
radius and relief padding. Stratum slicing only at LOD0-2 in FI/VS. Legacy sub-tile block
certificates are audit-only (runtime version was slower). TN regression (-80,-20,-3218) kept.

Exact full-grid vs skip hashes on every tile, 4 views, Clang/GCC, W1/W8/W12; control caught;
80-camera sweep 0 violations. Whole view vs c67b200: SW -1.3%, FI -7.6%, TN -2.3%, VS +0.2%.
Compiles in the Linux UE host (VFHostEditor, 27/27 actions).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-27 14:34:49 +01:00
Fr0zkaandClaude Opus 5.5 c67b2006aa skip: sound whole-tile proofs for legacy FI/TN/VS fields (L74); FI -30%, TN -22%
The compiled-analytic stratum interval now certifies a legacy tile uniform only when it stays
beyond the detail envelope (and smooth-min slack for solid) with no intersecting primitive,
edit, native field, composer candidate, passage or active transition; everything else fails
closed. The stream layer uses the proof for whole-tile skips; legacy sub-tile skips stay off
(two block proofs failed the falsifier in TN).

Falsifier: full-grid reference vs skip-enabled run, identical mesh/payload/topology hashes on
every tile of all four owner views, Clang and GCC, W1/W8/W12; 20-camera sweep per strate,
0 violations; a too-tight control changed 3/184/233/238 tiles and was caught.
Whole view (8 workers): SW 2.61->2.48, FI 7.18->5.05, TN 5.97->4.63, VS 2.70->2.40 s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-27 10:19:31 +01:00
Fr0zkaandClaude Opus 5.5 bd1b2a8f1d profile: per-LOD whole-view breakdown for the four-strate owner world (L73, no world change)
FI/TN/VS (legacy compiled-analytic) skip ZERO tiles at every LOD and evaluate ~44k density
points per LOD0/1 tile; SW skips 359/512 at LOD0. The whole-tile skip requires a native
tile with a uniform verdict, and the legacy paths return Mixed/unknown (R39 notes attached).
Opt-in stage timers, sampled field timer, per-LOD classification and composer counters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-27 08:48:57 +01:00
Fr0zkaandClaude Opus 5.5 d970d75be8 streaming: deeper ready queue + startup apply cap; tile-local mouth-support culling (L72)
- Unreal: ready queue depth 8 -> 16 (cap 4 worker-sets / 64), startup mesh-apply cap
  12 -> 24 within the unchanged 14 ms budget. Owner SW arrival, same 2,850 keys:
  initial set ready 4.78 -> 3.74 s, queue p95 123 -> 35 ms, request-to-apply p95
  139 -> 45 ms; walkable gate 1.07 -> 1.11 s; per-frame apply p95 0.73 ms.
- Core composer: mouth-support segments filtered by tile bounds, mouth relief result reused
  (route checks -80/-87% in passage tiles). Hashes identical W1/W8/W12, Clang and GCC.
- Opt-in per-tile composer counters. Verify control meshes stored as .xz (78.5 -> 18.4 MB).
- Fast tier 269 PASS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-27 08:25:14 +01:00
Fr0zkaandClaude Opus 5.5 971206c2ea trace: Unreal timing traces run without hash capture (L71); verify baselines tracked
The L70 "2x SurfaceWorld GenerateTile in Unreal" was the instrument: the trace enabled
bCaptureVoxelForgeCoreHashesForValidation, which disables the native heightfield-band
shortcut and whole-tile skips (W1 same keys: 9.00 s hash-off vs 28.46 s hash-on). With
hashing off, Unreal and headless match at W8 within 1.2-2.5% (Core 14.42 s vs 14.26 s) on
identical tile keys. LOD0 p95 tail = real cost of non-empty passage tiles near the spawn mouth
(p50/p95 18.8/105 ms); most LOD0 tiles are empty.

verify.py reads its baselines from Standalone/Tools/verify/baselines/ instead of untracked
Saved/Linux. The 11 .vfmesh control meshes (~78 MB) are not committed yet (to be stored
compressed). Fast tier green.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-27 06:55:46 +01:00
Fr0zkaandClaude Opus 5.5 018c0e1ec8 verify: track the pinned owner hash baselines (L67/L68/L70); .gitignore had dropped them
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-27 06:23:13 +01:00
Fr0zkaandClaude Opus 5.5 bd68aee1ca parity: Unreal and headless resolve the same four-strate plan (L70, v214)
- Export commandlet writes the live Core adapter's world_assembly + resolved layout pair;
  the headless owner path imports that pair (manifest/layout equal, layout_chunk_width_q
  validated). owner_world.json re-exported from the owner's staged assets on the Linux host.
- Adapter SW route: Core clearance/radius floors, 0.5 m support search, outward-facing
  tie-break; passage mouth/mid radius floors match Core (36/24 owner voxels).
- FI in Unreal now uses the legacy (compiled analytic) generator unless a plan is imported:
  the auto native-FI plan failed the passage audit on the owner plan (1843 blocked samples,
  945 open-air violations). Owner decides whether native FI returns.
- In-engine spawn traces per strate (3 each): SW GenerateTile 42.7 worker-s vs 20.1 headless
  for equal tile counts; LOD0 p95 45-169 ms in UE.
- Fast tier green; all three passages pass on the shared plan.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-27 06:22:48 +01:00
Fr0zkaandClaude Opus 5.5 81e2452a3d captures: readable player-view captures with a coverage gate (L69); R36 native-generator survey
- Capture exports now cover a 90-degree player frustum (radius 3, LOD 0-8, overlap patches);
  a 17x9 ray coverage probe aborts before rendering if tiles are missing (truncated-mesh
  control: 480 uncovered samples, rejected). Clear colour is sky blue, so un-meshed space can't
  pass as dark rock. 16 views of the owner's four-strate plan.
- Explore commandlet: finite XYZ spawn override for traces (Source/, Linux-compiled).
- In-engine four-strate trace NOT obtained: the engine-generated plan fails passage validation
  at a solid centerline voxel (~(-43,-34.5,-448.5) m) while the headless owner_world.json
  plan passes. Engine and headless plans diverge.
- R36 (read-only): order TN -> VS -> FI for native migration; native FI is reachable from the
  adapter but not selected in the owner run, cause unknown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-27 04:00:49 +01:00
Fr0zkaandClaude Opus 5.5 bd7bba994c passages: smooth 12 m lower-mouth radius taper; all four-strate passages pass (L68, v213)
The FI->TN wall beat (4.77 cm at 7.06 m) was the lower-mouth flare: the full mouth radius
was assigned to the penultimate control point, a one-segment radius jump. The shared route
builder now blends to the mouth radius over 12 m with a smoothstep. Wall ripple 1-2:
7.27 -> 1.62 cm. All three passages pass support/blocked/grade/ripple/naturalness; controls
detected. Fast tier 269/269 incl. the new-plan stage; W1/W8/W12 equal, Clang and GCC.
Hash pins: FI style 2 re-pinned at v213.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-27 03:17:27 +01:00
Fr0zkaandClaude Opus 5.5 087333bf8a passages: four-strate passage floors supported (L67, evaluator v212); 1-2 wall beat still red
- Shared composer: a passage's restored support is applied after a physically overlapping
  later bore, instead of being carved away by it (0-1: 59 -> 0 unsupported).
- Capsule clearance for support restoration is tested against nearby route segments only
  (1-2: 3 -> 0, 2-3: 2 -> 0 unsupported).
- L66 index switches replaced by a physical criterion (both mouths inside their strata bands,
  neither a SurfaceWorld landing).
- Audit: floor zero-crossing refined by bisection (the 0.2498 m "step" was the gauge);
  wall ripple keeps the authored radius, cubic detrend per 32 m window. Controls detected:
  L35 ribs, beads, synthetic 0.25 m step, L36 washboard, L23 terrace.
- Result: 0-1 and 2-3 pass all audits; 1-2 fails wall ripple 7.27 cm (limit 3.5) from an
  authored-radius beat at 7.06 m. Fast tier was green before the final gauge change and was
  not re-run after it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-27 02:27:40 +01:00
Fr0zkaandClaude Opus 5.5 5e2fc53d39 planner: four-strate owner plan spawns (L66); pinned 2-strate regression fixture
- Core caps each passage mouth reach to its own strate's usable content band (owner
  DA_Strate1 exports ReachMax=5000 owner voxels, which put the SW->FI lower mouth 79.5 m
  below FI, inside TN).
- Unreal adapter: SW route search keeps the old 64 m candidates first, then a bounded
  single-mouth search with shorter lengths; logs candidate/rejection counts.
- Internal-chain passage floor/support tweaks (only with >2 strates): ripple 1-2 4.78->2.90 cm,
  2-3 3.57->0.10 cm. Interfaces still 0/3 walkable (59/3/2 unsupported).
- verify.py: legacy tiers use Standalone/data/regression/owner_world_2strate_l61.json; new
  four-strate stage reads its expectations from owner_world.json (currently red on interfaces).
- Unreal trace L14 vs HEAD, same assets (16-chunk FlatPlain): 12.20 vs 12.56 worker-s; no x2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-26 22:13:22 +01:00
Fr0zkaandClaude Opus 5.5 47148e0a0d build: VoxelForge compiles in Unreal 5.7 on Linux (L65); Linux-only Unreal trace timing fields
Linux UE builds failed on the Core wrapper module: the Linux-only PerModuleInline.gen.cpp saw Standalone/Compat
shadow headers instead of the engine's, and WITH_EDITOR was redefined under -Werror. Compat headers now forward
to the engine headers with include_next for generated Linux module TUs (canonical Core TUs opt into the Compat
definitions via CoreNamespacePreamble.h); CoreMinimal.h undefines WITH_EDITOR first. VoxelForgeCore.Build.cs
enables that forwarding and AVX2 on Linux only; VoxelForge.Build.cs disables Unity on Linux only. Portability:
std::int64_t consistently in VoxelContentManager.cpp; grouped &&/|| in VoxelRedefinedDensityField.cpp. Linux-only
trace fields split Core generateTile / mesh copy / RMC stream build. Standalone Clang and GCC whole-view hashes
are unchanged vs 3202193. The Unreal spawn trace is blocked by the owner's new assets (SW route sweep fails).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-26 19:19:07 +01:00
Fr0zkaandClaude Opus 5.5 e157847509 research(L64, R33): regression bisect -- Core +16% worker time L14->L61, not 2x; four-strate plan baseline
Per-round bisect of a176d07..3202193 (56 builds; timings inflated by concurrent UE builds) plus a clean
quiet-machine endpoint re-measure: L14 12.62 vs L61 14.65 worker-s (+16%), LOD0 3.99 vs 4.99 ms/tile. The
owner's Windows x2 is therefore mostly on the Unreal side or not like-for-like. Four-strate U2 plan: all
strates generate and are deterministic; passage 0-1 lower mouth is out of FI's band, 0/3 interfaces pass,
FI/TN/VS use legacy evaluators. R33: ranked Unreal-side suspects and Windows experiments.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-26 18:38:27 +01:00
Fr0zkaandClaude Opus 5.5 9136f5f0e7 chore(unreal): U2 -- owner's four-generator plan staged; owner_world.json re-exported
Owner re-saved strates 2026-10-26: DA_Strate1 SurfaceWorld, 2 FloatingIslands,
3 TunnelNetwork, 4 VerticalShafts (default params). BuildHost copies and the
enforced SHA-256 tables updated (old U1 set kept in the report); the export
commandlet handles the four-strate plan; Standalone/data/owner_world.json
regenerated (SHA-256 F42F96AD...). One normal BuildHost gate passed (64/64
tiles) but its top-strate window produced 0 triangles, and a missing
NewDataAsset reference warns -- both to check. No measurements this round.
Report: Standalone/Research/WorldAssemblerM3/Unreal2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 14:18:19 +01:00
Fr0zkaandClaude Opus 5.5 fc9227f9e0 fix(unreal): U1 -- Unreal compiles again on L61; CoreGeometry asset section; versioned layout-unit upgrade
Windows MSVC catch-up after abyss L15-L61 (no Unreal there): 64-bit clipmap
shift (C4334), qualified VoxelForgeCore::WorldAssemblySubvoxelsPerVoxel, UHT
metadata and duplicate-signature fixes. Optional CoreGeometry section on
UVoxelStrateDefinition (native caves, lattice, profiled heightfields, named
stamps, rooms/tunnels; off/empty by default), resolved after passage planning.
VoxelForgeAssetVersion 2 converts strate height/transition/gap to metres on
load (exact, 0 m change on the owner's 5 assets; packages never saved).
Gates pass (SurfaceWorld, FloatingIslands, Core-off, M2, W1/W8/W16).
KNOWN REGRESSION vs L14 (2026-10-20, same command, same PC): full set 3.9 ->
5.37 s, worker-seconds 15.8 -> 30, LOD0 1.11 -> 1.69 s, ring 0.50 -> 0.80 s;
not yet attributed (Core L15-L61 vs Unreal side).
Report: Standalone/Research/WorldAssemblerM3/Unreal1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 12:12:08 +01:00
Fr0zkaandClaude Opus 5.5 32021930d2 research(R32, self-checked): first-principles work budget for ~1 s and the active-cell/sparse-brick path
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-26 09:48:37 +01:00
Fr0zkaandClaude Opus 5.5 135957831b fix: sanitizer sweep across all generators; bound signed shifts/division/overflow at coordinate limits (L61); R31
New verify.py sanitize tier (Clang address,undefined,float-cast-overflow; GCC address,undefined;
-fno-sanitize-recover) runs 19 cases per compiler at LOD0-8 across every generator, passages and the
crossing: 0 runtime reports; a planted signed-overflow control is caught by both. A static scan fixed
INT_MIN negation in floor division, unbounded signed LOD shifts and coordinate-times-extent overflow in
VoxelClipmapDesiredTiles.h and VoxelTypes.h (plugin and standalone), and VoxelWorld.cpp, VoxelContentManager.cpp
and VoxelDensityVolume.cpp (plugin only, uncompiled here). Supported-input output unchanged (version 211).
fast/medium/full PASS. Research R31 (self-checked): far-LOD 4-8 cut plan.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-26 05:19:18 +01:00
Fr0zkaandClaude Opus 5.5 c0c204ba50 fix: signed-overflow UB in VoxelHash made cave placement compiler-dependent; all generators LOD0-8; speed matrix (L60)
VoxelHash::Cell/Pair, legacy Cellular3D and the shared Core cellular hash added 0x7FFFFFFF to a signed
int32 before casting to uint32; overflow is undefined, so Clang and GCC placed cave passage 1 differently
(first differing sample at LOD1 tile (0,64,-512)). The bias is now done in unsigned arithmetic, in both the
standalone copy and the Unreal plugin header (Source/VoxelForge/Public/VoxelCaveMorphology.h). Native
caves, motifs and lattice now stream LOD0-8 with skirts and cross-level transitions. New verify.py
--speed-matrix runs every generator on one asserted-identical view (5 interleaved runs): motifs 1.33,
profiles 1.30-1.32, caves 1.41, natural SW 1.67, lattice 1.70, FI 4.93 s whole view. fast/medium/full PASS,
Clang/GCC peer hashes equal. Research R29 (open-edge ledge) and R30 (compiler-divergence suspects).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-26 01:50:15 +01:00
Fr0zkaandClaude Opus 5.5 fbae82e024 research(R28, self-checked): per-generator cost ledger; caves/motifs/lattice timings were LOD0-only views, not comparable
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-25 20:27:56 +01:00
Fr0zkaandClaude Opus 5.5 6c6cc37e1d feat(core): native lattice generator, slice 1 -- helix-ramp spine + small maze (L58); research R27
Core.Lattice.PrimitiveField v1, opt-in per strate (legacy Maze/VerticalShaft stay legacy): resolves the real
arrival and departure mouths first, plans a mandatory spine, then maze cells and two dead ends (9 rooms,
9 edges, stable IDs). The spine descends 20 m through four helix turns (6 m radius, 3 m clear width, 5 m
pitch, 2.6 m clearance; max grade 10.0 deg); each feature is one filleted void (0.57 m measured). Final-field
reachability passes at 883 stations; an orphaned shaft control is rejected; exact intervals (0 misses) and
a whole-surface audit with 0 flags. Whole view 1.69 s (above the 1 s target). fast/medium/full PASS.
Research R27 (self-checked): static stream-to-pool water design.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-25 15:45:32 +01:00
Fr0zkaandClaude Opus 5.5 1e3e04bbac perf(core): FI LOD0 attribution, exact Z-inner traversal; fix a mesh gap at the passage shaft foot (L57); R26
Sampled cycle attribution of FI LOD0 field work: grid fill 83%, boundary 13%, skirts 4%; island roots,
columns and helix dominate, the column cache path is real but secondary (no thrashing). FI-only Z-inner
traversal at LOD0 (same lattice samples, exact) cuts FI whole view 5.35 -> 5.03 s and moving p50 by 12%;
global Z-inner and <=4-island culling were measured and rejected. The meshing band now includes the planned
passage support column's conservative bounds, closing a real gap where the arrival shaft meets the floor
(WorldAssemblyEvaluatorVersion 208 -> 209). fast/medium/full PASS, Clang and GCC.
Research R26 (self-checked): native lattice (maze/shaft) generator design.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-25 10:47:44 +01:00
Fr0zkaandClaude Opus 5.5 4e64b75044 feat(core): slab + sparse motifs, slice 1 -- flat field, monolith, platform at 0.52 s (L56); research R25
Motif vocabulary v3: version-1 records keyed by (seed, strate, stable ID) with route keepouts, band
clearance and pairwise spacing. A rounded capped-cylinder monolith (r 1.4 m, 24 m tall) and a rounded-box
plinth, smooth-unioned into a flatField floor with a 0.55 m geometric rounding (measured fillets 0.73-1.17 m).
Exact radial/box interval bounds, a BVH, isTileShapeFree aware (0 brute-force misses, false-proof controls
rejected). Final-field route passes; whole-surface audit covers foot, cap and platform edges. Cold whole
view 0.524 s. Owner world unchanged. fast/medium/full PASS (Clang and GCC).
Research R25 (self-checked): FloatingIslands LOD0 column cache conflicts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-25 07:47:15 +01:00
Fr0zkaandClaude Opus 5.5 aee1487410 perf(core): tile-drain instrumentation; parallel FI sign-edge repair, FI first tile 1.28 -> 0.85 s (L55); R24
Opt-in --instrument-tile-drain records per-tile queue/dispatch/finish timelines, stage spans and counters
(proof skips, X8 lanes, GradAt/midpoint memo, skirts, FI cache stats); <2% when off. Measured: SW 13.3 and
FI 50.2 worker-s across LOD0-8, tails are work-saturated. FI sign-edge repair now computes in parallel and
publishes in sorted serial order (exact output): sign-edge 535 -> 47 ms, FI first tile 1.28 -> 0.85 s, near
ring 1.46 -> 1.04 s, whole view 6.09 -> 5.65 s. Proof block size, lane batching, SW midpoint memo and helper
cap 12 measured and left off. fast/medium/full PASS, Clang and GCC. Research R24: slab + motif generator.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-25 06:16:07 +01:00
Fr0zkaandClaude Opus 5.5 e35a77f676 chore(L54): drop duplicate control SVG maps (already in Linux48)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-25 04:10:37 +01:00
Fr0zkaandClaude Opus 5.5 9458217d34 feat(core): native Core caves generator, slice 1 -- spine + room, whole view 0.73 s (L54); research R23
Core.Caves.PrimitiveField v1, opt-in per strate (legacy TunnelNetwork assets stay legacy): solid host rock
and one smooth union of two elliptical spine tubes and an ellipsoid room, each intersected with its rising
floor by cubic smooth-max (W 2.4 m, measured fillet 0.70 m, no trailing floor cap). Bound in the L40 field
table and L42 capabilities, BVH feature candidates, isTileShapeFree aware, exact interval boxes (0 misses).
Capsule flood fill arrival -> departure passes (headroom >= 0.3 m, grade <= 15 deg); the generalized
whole-surface audit passes with its controls failing. Cold whole view 0.727 s, near ring 0.19 s. Graph
ordering/serialization changes are scoped to native caves (the flagged L47 demo is unchanged); verify
tiers write captures under --out only. fast/medium/full PASS, Clang and GCC.
Research R23 (deepened): per-tile LOD0 kernel speed plan.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-25 04:10:19 +01:00
Fr0zkaandClaude Opus 5.5 20f6c98ec5 feat(core): profiled heightfields, slice 1: periodicHills, mirroredRelief, flatField (L53); research R22
WorldAssemblySurfaceProfileV1 on the native SurfaceWorld recipe and plan; version 0 'natural' is omitted
from serialized identity, so the owner world is unchanged. periodicHills (seeded cosine hills, plan-time
grade <= 15 deg), mirroredRelief (cap mirrors the floor by lambda, clearance checked) and flatField share
one profile function for points, lattice classification and exact cosine-extrema intervals (0 interval
misses in brute-force audits). Style-override fixtures with planned passages. Cold whole view about 1.33 s
for each profile vs 1.74 s natural SW (Clang). Owner hashes identical to L52; fast/medium/full PASS.
Research R22: SurfaceWorld critical path to about 1 s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-25 01:49:11 +02:00
Fr0zkaandClaude Opus 5.5 408c14baff perf(mesher): shared proof-driven sampling skips certified-uniform blocks (L52); FI 7.1 -> 5.6 s; R21
The shared marching-cubes mesher applies its 8-cell block proofs at step 2 for standalone shape contexts
and skips density-grid fills outside certified-uniform blocks (plus a one-sample normal halo); mixed and
unknown blocks still sample exactly. FI certified-air boxes 1,959 -> 14,119; FI LOD1 samples -63%. FI whole
view 7.08 -> 5.61 s (-21%), moving p50 about -33%; SW unchanged. Geometry hashes identical (no version
bump); proof audit 36.9 M samples, 0 violations, Clang and GCC. Source stamp now covers the standalone
mesher copy. Research R21 (deepened): native Core cave generator design.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-24 23:53:43 +02:00
Fr0zkaandClaude Opus 5.5 c42c785e2c docs(L51): complete the truncated orchestrator review
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-24 20:37:10 +02:00
Fr0zkaandClaude Opus 5.5 75550256ef perf(core): FloatingIslands whole view 16.7 s -> 7.4 s (L51); research R20
Measured first: 45% of FI tiles are all-air, yet FloatingIslandFieldV1 returned unknown for any box near
an island AABB (25,536 unknown boxes, 0 tile skips). Conservative ranges for island bodies, root lobes,
buttresses, connectors, surface detail and smooth-min budgets now let the shared box classifier prove FI
air/solid (216 tile skips; 28.6 M audited samples, 0 violations). The X8 path reuses its FI preflight
samples. LOD7-8 far-shell and column work is skipped outside per-tile island/connector influence bounds
(farHorizonVersion 4 -> 5). FI 16.74 -> 7.36 s (-56%), FI moving entering-tile p50 halved; SW unchanged.
Peer determinism (Clang/GCC W1/W8/W12, random cameras) PASS; fast/medium/full PASS.
Research R20: world-type catalogue and dreamcore/liminal concepts (revised after a deepening pass).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-24 20:36:54 +02:00
Fr0zkaandClaude Opus 5.5 ca85e876ad feat(core): ore vein records and a materialAt query, off by default (L50); research R18, R19
Versioned capsule vein records (stable ID, resource ID, endpoints, radius, seeded irregularity) resolved
into the snapshot only when requested, placed beside the route and away from passages, landings and
landmarks (forced-passage control rejected). The bound field table gains materialAt (host + two resource
IDs + Q16 weights) behind a per-tile BVH; mesh export v2 carries per-vertex materials; a measurement-only
yield computes removed resource volume (0 on already-air space). With veins on, every density, mesh,
payload and topology hash is unchanged; demo off: owner hashes identical to L47. fast/medium/full PASS.
Research R18 (cavern-graph planner) and R19 (why FloatingIslands costs ~10x SurfaceWorld).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-24 18:25:03 +02:00
Fr0zkaandClaude Opus 5.5 b9ccff4ad6 research(R17): authoring and adapter wiring to bring Core stamps and cavern graphs into Unreal
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-24 16:38:55 +02:00
Fr0zkaandClaude Opus 5.5 6110f118e3 research(R16): why hard SDF intersections alias under marching cubes; fillet sizing per LOD
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-24 15:44:49 +02:00
Fr0zkaandClaude Opus 5.5 3073d1b2fd tools(audit): whole-surface mesh artifact audit with historical controls (L48, tool only); research R15
AuditWholeSurfaceL48.py scans every LOD0 triangle in the route corridor + 3 m and the chamber box + 3 m:
welded-edge normal variation, high-angle edge density, max jumps and sliver area in 1 m cells, clustered
and located, with thresholds from native patches in the same export, plus a detrended full-width floor
profile. L45 ramp, L46 entrance and L47 wall-foot meshes fail it; plain native terrain passes. Red-triangle
SVG maps included. Not wired into the tiers yet; the attempted Core fix is parked on wip/l48-surface-audit.
Research R15: mesh artifact metrics.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-24 14:53:11 +02:00
Fr0zkaandClaude Opus 5.5 c091e4434f fix(core): smooth tunnel entrance floor; verifier keeps baselines out of /tmp (L47); research R14
The demo tunnel's hard floor cap used a vertical Z - floorZ on a sloped Bezier floor, which is not a signed
distance, so marching cubes produced a staircase through the first 7 m (40-51 mm ripple, 82 mm steps). The
cap now uses the grade-normalised signed distance with a floor-adjacent bore re-application fading over the
entrance; mesh tile Z bounds include cavern bounds. New three-rail entrance audit: L46 fails, L47 passes.
verify: the cost baseline exports only build inputs into Saved/Linux/<out>/baseline-<commit> and removes it;
/tmp unchanged after a full tier. Demo off: owner hashes identical to L46. fast/medium/full PASS.
Known: sawtooth at the tunnel wall foot (next round). Research R14: Windows/MSVC readiness review.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-24 12:54:39 +02:00
Fr0zkaandClaude Opus 5.5 e016f6a20f feat(core): cavern graph v1, one continuous floor-capped tunnel into the landmark chamber (L46); R13
The flagged SW demo's ramp (57 carves + 107 support pillars, visibly ribbed) becomes one cubic-Bezier
sweep: closest point by 17-point seed plus 5 Newton steps, a cubic floor profile, a rounded 2.6 m bore,
and a hard floor cap applied after unions and relief that only adds support where the field is air.
Optional resolved cavern-graph records (one room, one edge) enter canonical identity only when present;
their bounds extend World::isTileShapeFree. Reachability passes (L43 control fails), headroom 2.8 m,
floor ripple 1.8 mm (L45 ramp control fails at 17.9 mm), shape limits met; demo off: owner hashes
identical to L45. fast/medium/full PASS. Research R13 (read-only): continuous SDF sweeps along curves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-24 09:53:06 +02:00
Fr0zkaandClaude Opus 5.5 f13b145f23 feat(core): reachable SW landmark chamber demo with a reachability audit (L45); research R12
Stamp vocabulary v2; the flagged SW demo opens through a side-facing portal and a bent ramp (max 14 deg,
two landings) into a 17 x 15 m chamber with a rock dais. New reachability audit: a capsule surface search
from walkable ground near the arrival mouth to the chamber floor (66 samples, 0 blocked/unsupported); the
buried L43 layout fails it. Demo off: owner hashes identical to L44. fast/medium/full PASS (Clang+GCC).
Research R12 (read-only): composite cavern-graph generator design and slices.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-24 07:42:30 +02:00
Fr0zkaandClaude Opus 5.5 036bd530fc fix(core): worker-count-dependent tiles near passage support columns (L44); random-camera determinism sweep
L27 added passage support columns, but World::isTileShapeFree only bounded the route and bridge, so tiles
touched by a column could be approved for early native-only generation; depending on scheduling they used
that incomplete field or the compiled one (six LOD0 tiles differed between W1 and W12 at an SW camera near
the arrival mouth). The shape-free proof now includes a conservative envelope for every possible column.
The compiled world is unchanged (the old W1 variant), so no version bump. verify tiers gain a seeded
(SplitMix64 0x4c3434) random-camera W1/W8/W12 sweep across both recipes and several clip settings; it fails
before the fix and passes after. fast/medium/full PASS; cost within noise. Research R11: suspect review.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-23 23:00:21 +02:00
Fr0zkaandClaude Opus 5.5 422dd7761a feat(core): deterministic bounded SDF landmark stamps, off by default (L43); research R10
Stamp vocabulary v1 (carve ellipsoid/arch, fill pillar/dais) with smooth CSG and seeded relief; the
director resolves records (stable ID, strate, micrometre position, conservative bounds) from
hash(seed, strate, ID) with up to 512 candidates and rejects any that touch a passage mouth, walk corridor,
content face or ceiling/bedrock band; a stamp BVH skips tiles outside all bounds. No requests: canonical
JSON and owner hashes unchanged. --landmark-chamber-demo adds a SW chamber (buried; see review).
fast/medium/full PASS on clean builds. Research R10 (read-only): ore/resource channel design.
Review also records a pre-existing W1/W12 determinism mismatch at a non-spawn camera (L37+, not S14).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-23 21:50:56 +02:00
Fr0zkaandClaude Opus 5.5 497e974178 research(R9): drop the chat preamble from the saved report
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-23 20:23:04 +02:00
Fr0zkaandClaude Opus 5.5 2566f53734 refactor(core): boundary policy as resolved capabilities, not generator-name tests (L42, step 6); R9
ResolvedLayoutSnapshotV3::finalize maps each strate's generator and interface once into capability
records (FI gradient air-gap, surface/FI landing support, passage-anchor columns, SW-to-TN floor);
ApplyResolvedStrateBoundaryBand and passage composition read those instead of generator kinds. Derived
records stay out of canonical JSON, so layout identity is unchanged. Owner hashes identical to L41;
fast/medium/full PASS on clean Clang and GCC builds; cost within noise.
Research R9 (read-only): player-visible roadmap refresh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-23 20:22:49 +02:00
Fr0zkaandClaude Opus 5.5 1abee91721 refactor: resolved metre layout is the runtime authority (L41, migration step 3); stamp covers plugin sources; R8
UVoxelStrateManager::Initialize resolves the layout width to integer micrometres before passages or
scheduling; each slot stores physical [bottom, top) bounds, transition mode/width and passage settings;
chunk indices remain a floor-based compatibility projection. The Core adapter derives interiors and L29
bands from those resolved values. verify: full-tier cost baseline is HEAD (or --baseline), tier timeout
7200 s with 1800 s per process; the source stamp now includes the plugin Source tree compiled on Linux
(it previously missed VoxelStrateManager.cpp and friends). Owner hashes identical to L37; fast, medium
and full PASS on a clean rebuild. Unreal manager/adapter edits are uncompiled on Windows.
Research R8: inventory of unit-bearing UPROPERTYs and a custom-version asset migration plan.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-23 19:36:51 +02:00
Fr0zkaandClaude Opus 5.5 efa9e89468 refactor(core): bind generator fields once per resolved strate (L40, migration step 2); research R7
SurfaceWorld, FloatingIslands and legacy evaluators sit behind one immutable densityAt adapter held in
a variant (no virtual call per sample); BindResolvedStratumFields builds a sorted strate table at world
setup, so DensityAt, native SW/FI sampling and ClassifyBoxDetailed no longer ask the strate manager per
sample. No arithmetic change: owner hashes identical to L37/L39 at W1/W12. Cost vs L39: FI -0.66%,
SW -1.31% (noise). verify fast/medium/full PASS (full re-run alone: 407 gates).
Research R7: disk cache design for UE5/Windows/multiplayer and a zlib probe (about 1/3 size, 0.1 ms/tile).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-23 17:15:46 +02:00
Fr0zkaandClaude Opus 5.5 753cc9c259 tools(verify): fast/medium/full verification tiers with a compiled-in source stamp (L39); research R6
BuildLinux.sh hashes a sorted manifest of compiled inputs into VOXELFORGE_SOURCE_STAMP, printed first by
every executable; Standalone/Tools/verify/verify.py checks it before and after each tier and records
binary/input hashes and the resolved recipe, style map and layout. Fast (163 s) runs on the canonical owner
world only and asserts FI Style 2 / SW Style 1; medium (8 min) and full (26 min) add the style matrix,
GCC, determinism and cost. Controls: stale source, mislabelled style-0 owner, all-black capture, L30/L31,
L35/L36 and the L38 step are all rejected. No geometry change; owner hashes identical to L37.
Research R6: leak table, generator contract and a 10-step metre-native migration plan.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-23 15:27:52 +02:00
Fr0zkaandClaude Opus 5.5 88c54eab44 research(R5): tiered verification (fast/medium/full) and a final-source stamp
Inventory of every audit gate with controls and wall times; a fast tier (~3-4 min, real owner styles)
per trial, medium (~8-10 min) per candidate, full (~32-34 min) once. A compiled-in source manifest stamp
that every runner checks, so evidence provably comes from the committed tree. Lists duplicate runners.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-23 11:24:57 +02:00
Fr0zkaandClaude Opus 5.5 cf57c87daf research(R4): L38 wall "ripple" is a coil-ownership step, not a wave
Offline replay of the L37 and L38 tube fields on the FI Style 2 helix shows no 7.8 m ripple from the
tube distance itself (< 0.3 cm). The real signal is a step: the upper coil's 1 m fallback floor strip,
composed independently, puts a support root 0.44 m from the lower bore's centreline at head height;
the 7.8 m "period" is a sinusoid fitted to that step. Proposes pairing the floor cap with its bore.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-23 08:30:59 +02:00
Fr0zkaandClaude Opus 5.5 945225d942 research(R3): floor ownership on an overlapping helical passage
Read-only study for L38: a synthetic FI Style 2 helix (3 m radius, 3.31 m pitch) shows Euclidean
closest-centerline ownership is wrong when bore radius > pitch/2; a floor-near (+-0.125 m, within bore
radius) nearest-floor-point owner gives 2.9 cm p-p on helix and style-like paths. The L38 0.94 m ripple
period equals the 20-segment chord. L38's continuation applied it: floor ripple 0; wall ripple open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-23 07:35:16 +02:00
Fr0zkaandClaude Opus 5.5 7f2d84d2c7 fix: L37 Core compile error (stray paren) and Unreal-side issues from review R2
ShapeWorldInternal.h kept an extra ')' after a diagnostic edit was restored post-build, so the L37
commit did not compile; the fixed build reproduces L37's verified owner-world hashes exactly.
Unreal (uncompiled here): SetHardTransitionFallbackForAssembly is const over a mutable runtime flag
(the adapter calls it through a const manager); the legacy fallback clears the flag; VoxelStrateManager
includes <cmath> for std::llround. Adds research R2 (read-only Unreal compile/behaviour review).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-23 06:55:53 +02:00
Fr0zkaandClaude Opus 5.5 3e443bf81c wip(assembler): round L37 -- FI mouth carve-fade fix, no raised bridge (style 0); research R1
The passage mouth fade multiplied the signed carve distance by zero, which turned native rock into an
open surface (the reason earlier rounds stamped walk pads at mouths); it now blends between the
uncarved field and the full signed carve. The FI style-0 route followed a lifted grade envelope over
the crater (the "bridge"); it now runs on the rim and follows the native surface. New built-shape and
crease audits with thresholds frozen before the fix (L36 and box controls fail). 24/24 passage rows,
30/30 determinism, 16/16 invariants, 18/18 interface/ring. Unreal: one recipe setter (uncompiled).
Research R1 (read-only, web): ranked proposals for natural walkable mouths, floor-limited carve first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-23 05:51:50 +02:00
Fr0zkaandClaude Opus 5.5 8be1c4d9ef wip(assembler): round L36 -- tunnel floor without washboard; FI mouth without shards (evaluator v23)
The walk tread was built per segment as a one-sided density clamp, so its crossing with the native
field moved at segment joins (L35: 2.25-2.48 cm washboard). Treads now overlap up to 2 m as bounded
signed-distance slabs (0.06 cm residual). The FI mouth's crater detail and tread met without a smooth
join; v23 filters the local field, drops thin isolated solids and smooth-unions the tread with the
terrain. New floor ripple and mouth fragment/crease audits with L35 as failing controls. 24/24
passage rows, 30/30 determinism, 16/16 invariants, LOD0-8 rings; cost within noise.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CSFYgsdW8ejZSyiMf4qRSX
2026-10-22 13:01:54 +02:00
Fr0zkaandClaude Opus 5.5 ba017077d1 wip(assembler): round L35 -- smooth passage walls without regular ribs (evaluator v21)
The shared passage carve took the minimum of piecewise-linear capsules (scallops at joins) and added
wall relief on regular 8 m / 4 m octaves, which read as evenly spaced ribs. Interior sweep joins are
now Catmull-Rom smoothed and the relief uses irregular rotated 43/29/19 m scales; the natural wobble
remains. New axial ripple audit (0.125 m radius samples, 0.5-8 m periods): beaded control and L34
geometry fail, all 24 passage rows pass. FI mouth tread apron tapered. 30/30 determinism, 16/16
invariants, ring audits LOD0-8 pass; cost within noise.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CSFYgsdW8ejZSyiMf4qRSX
2026-10-22 07:28:50 +02:00
Fr0zkaandClaude Opus 5.5 49e29fcd36 wip(assembler): round L34 -- passage mouth profile audit and standard capture set
Adds a density-field floor/wall profile audit along passages near mouths (0.125 m spacing; L23
terraced negative control detected) and a reusable 12-view passage capture set (80 deg FOV, eye
height, LOD0, skirts off, capped clip planes). The old blurry mouth shot was camera framing; the
L33 entry ledges were tile skirts. Owner world hashes unchanged; 24/24 passage rows, 30/30
determinism, 16/16 invariants; cost within noise.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CSFYgsdW8ejZSyiMf4qRSX
2026-10-22 01:12:40 +02:00
Fr0zkaandClaude Opus 5.5 b7a47bef95 wip(assembler): round L33 -- SurfaceWorld can be an upper strate; FloorProfileBlend measures seams
Route planning for an upper SurfaceWorld failed on long candidate chords over steep relief; chords
are now capped to the arrival/departure radii on an 8 m centre grid with an origin-proximity cost
(21.5 m walk, about 4 deg). The departure passage starts at the SW ground and tunnels down through rock.
FI -> SW -> TN fixture: all 4 styles pass every passage audit on both compilers. FloorProfileBlend
now checks endpoint height/tangent seams (step and tangent-step negative controls detected). Owner
world hashes unchanged; 30/30 determinism; cost within noise.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CSFYgsdW8ejZSyiMf4qRSX
2026-10-21 22:30:36 +02:00
Fr0zkaandClaude Opus 5.5 d0158c6019 wip(assembler): round L32 -- smooth Gradient interface at full amplitude (no rings, not flat)
Band faces now use signed distance to the displaced solid intervals, continuous across bands, so
MC interpolates the interface instead of terracing at density levels. The Gradient amplitude is
restored to width/8 (about 4 m peak-to-peak at 16 m). Ring/terrace audit at LOD0-8 on the FI floor and SW
ceiling passes; negative controls: L30 (rings) and L31 (flat) both fail. Hole/interface audits,
16 passage rows and 24/24 determinism pass. Evaluator 20. Cost vs L31 SW +1.9%, FI +1.5%.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CSFYgsdW8ejZSyiMf4qRSX
2026-10-21 20:27:29 +02:00
Fr0zkaandClaude Opus 5.5 28069f0d98 wip(assembler): round L31 -- FI recipe column audit corrected; recipe-stamped audit runner
On the real FloatingIslands recipe, column caps sit inside anchor-island rock and native bedrock;
the old check sampled the route foot. The audit now samples each planned cap against the native
field (negative control: a cap moved into air is detected). The audit runner records requested vs
actual recipe and exits on mismatch. All 16 passage rows (4 styles x 2 recipes x 2 compilers) pass.
The readable shader uses a smooth tint. Interim: FI Gradient displacement capped at width/256
(flat floor, no contour rings); restoring real undulation is L32. Evaluator 19.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CSFYgsdW8ejZSyiMf4qRSX
2026-10-21 14:13:18 +02:00
Fr0zkaandClaude Opus 5.5 103d8b471e wip(assembler): round L30 -- FI floor ring defect fixed; transition cost recovered
The Gradient interface left native solid density in the air-side gap and snapped the face to
voxel levels (concentric ring steps on the FI floor). The owner Gradient path now writes signed
distance both sides; match error RMS 0.36 -> 0.11 m. Band and fade-tile culling cut transition
cost: whole view vs L24 SW +2.7%, FI +0.2%. Evaluator 16. Deterministic across compilers and
workers; interface and passage audits pass. Found: on the real FloatingIslands recipe, the
rock-column connected-ends audit fails (all styles); earlier matrices ran SurfaceWorld twice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CSFYgsdW8ejZSyiMf4qRSX
2026-10-21 11:40:27 +02:00
Fr0zkaandClaude Opus 5.5 63c7e563d0 wip(assembler): round L29 -- strate transitions honoured at the bedrock/ceiling interface
EVoxelStrateTransition from the upper strate shapes the bedrock(N)/ceiling(N+1) interface in the
shared composition layer: Hard flat; Gradient = smooth 2D hash surface (16 m owner width, about 4 m
measured undulation); Interleaved = 3D domain-warped fingered overlap within the width. Each band
keeps >= 2 Core voxels solid; faces return to the seam near passage mouths. Interface audit over
512 m: 0 hole columns for all modes; wider-than-declared and too-thin controls rejected. All passage,
route, proof and validator audits pass; deterministic Clang = GCC. Evaluator 15. Cost +4% SW,
+1.3% FI vs L28. Open: ring-like artifact on the FI floor capture; transition look unverified.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CSFYgsdW8ejZSyiMf4qRSX
2026-10-21 09:16:12 +02:00
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
637 changed files with 970988 additions and 1416 deletions

No files matched your search

+335 -2
View File
@@ -1883,8 +1883,9 @@ Each record separates the nominal ceiling, content, and bedrock bands. A strict
sequence for every strate and requires bedrock(N) to touch the next strate's ceiling(N+1). The two 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 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` 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 is expressed in owner-chunk metres. L21 recorded the older Interleaved allowance as blend width plus
fingers beyond the blend width and is recorded separately. Compatibility validation reports current warp amplitude; L29 now treats the declared blend width as the complete physical crossing allowance.
Domain warp changes finger placement, but cannot extend overlap beyond that width. Compatibility validation reports current
gaps, overlaps, ambiguities, inactive/missing bands, and unhonoured transitions while accepting them; 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 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, parameter blend, even though the legacy manager helper implements it. Both band types default diggable,
@@ -1943,6 +1944,7 @@ opens a band; the support strip stays below the player capsule. The lower mouth
monotone descent from the short route-bound landing tail, whose height may vary with the route. 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 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. 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 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, 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, the blocked control, captures, and the Windows adapter checklist. §8.10's cache, proof, streaming,
@@ -1983,6 +1985,337 @@ cutaway views. Both affect captures only, not generated geometry.
[`Standalone/Research/WorldAssemblerM3/Linux24/REPORT.md`](Standalone/Research/WorldAssemblerM3/Linux24/REPORT.md) [`Standalone/Research/WorldAssemblerM3/Linux24/REPORT.md`](Standalone/Research/WorldAssemblerM3/Linux24/REPORT.md)
records the evidence and owner-facing caveats. 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.
### 8.46 Honored bedrock/ceiling transitions — World Assembler L29
The upper strate's `EVoxelStrateTransition` controls the shared interface between its bedrock band
and the next strate's ceiling band in the Core composition path. `TransitionBlendChunks` is converted
using the resolved layout chunk width (8 m by default). Hard preserves the flat interface. Gradient
moves the shared surface with a smooth 2D hash field whose peak-to-peak range is at most one quarter
of the declared width. Interleaved uses a seed/interface/coordinate-keyed, domain-warped 3D hash field
to set actual overlap between the facing bands from zero to the declared width. The two faces move
inward by half that overlap; the warp changes finger placement without increasing the crossing
allowance. Both bands keep authored thickness, and their solid intervals touch or overlap in every
XY column. Core does not blend unrelated generator fields.
Each boundary band keeps at least **two Core voxels** of solid thickness (0.5 m at the default 25 cm
voxel size). Strict validation rejects thinner bands and declared interpenetration beyond the
transition width. The world audit samples a 512 m square XY area, measures actual crossing depth and
minimum band thickness, and sweeps every non-passage column through both bands at half-voxel spacing.
Passage columns are excluded from the hole sweep. Near an interface mouth, the shared face returns to
its nominal height inside the mouth radius plus a 1 m support margin, then fades back to the selected
transition over 2 m so the authored landing floor remains supported. Negative controls reject a
transition one micrometre wider than declared and a band one micrometre below the minimum. See
[`Standalone/Research/WorldAssemblerM3/Linux29/REPORT.md`](Standalone/Research/WorldAssemblerM3/Linux29/REPORT.md)
for audit measurements, hashes, timings, captures and run history.
### 8.47 Ground-bound SurfaceWorld departure routes — World Assembler M3 Linux L33
An intra-strate SurfaceWorld route follows the resolved terrain ground profile. Its route-point Z
is the ground height plus the player's half-height; the route does not descend to the strate's
bedrock boundary. Bedrock belongs to the separate inter-strate passage, which begins at the
SurfaceWorld departure mouth on the ground and tunnels outward and down through native rock and
the boundary into the next strate.
The old fixed candidate envelope used a 64 m chord and 16 m centre spacing. On the L33 upper-SW
fixture, replaying that envelope sampled ground from −507.767 to −464.857 m; 366/648 candidate paths
exceeded the 15° grade limit. The worst failures clustered near the outer west/northwest terrain
shoulder (up to 79.971°) and the steep approach slopes around the origin. Candidate diagnostics
separate grade failures from endpoints outside the bounded arrival/departure placement disks.
The bounded search now limits its longest chord to the two mouth radii minus a 3 m clearance
margin, checks centres every 8 m, and ranks endpoints near the route anchors. It finds a 21.5 m
route from (−2.75, 0) to (18.75, 0), sampled on ground and accepted by the full capsule/support/
grade audit.
The SurfaceWorld departure passage starts at the ground mouth with a 1.5 m portal, then smoothsteps
to a 3.5 m rock tunnel over 9 m. Its ring is sized and oriented outward from the mouth, so the
approach does not cut back under the walk route. The `FloatingIslands → SurfaceWorld → TunnelNetwork`
fixture passes all four passage styles, including both interfaces, capsule clearance, support,
grade, walkability, naturalness, open-air, column ends, long-bridge and route-binding audits.
`FloorProfileBlend` previously compared each curved floor profile with its straight chord and
applied a 2-voxel limit. That is a curvature measurement, not a seam measurement. It now checks
endpoint height and tangent continuity at 0.01 voxel and 0.001 voxel/m; the 3-voxel step and
0.25 voxel/m tangent-step controls are both detected. SurfaceWorld owner hashes remain identical
to L32 because the route-mouth, expanded column sizing and short-span support changes apply only
when SurfaceWorld is the upper strate. No evaluator or recipe version changed.
[`Standalone/Research/WorldAssemblerM3/Linux33/REPORT.md`](Standalone/Research/WorldAssemblerM3/Linux33/REPORT.md)
records the four-style audits, captures, determinism, owner hashes, costs and retries.
### 8.48 Irregular passage-wall relief and grounded tread shoulders — World Assembler M3 L35
L34's owner-SW profile had a 7.438 m radius repeat with 0.0361 m (3.61 cm) amplitude; an independent
mesh-normal scan also found a 4.750 m period at 0.02682 (1.537°). The geometry came from piecewise
capsule joins, while broad value-noise bands added a second regular pattern. The shared carve now
uses Catmull–Rom centerline interpolation on eligible interior segments, excluding short spans and
terminal controls. Passage walls use deterministic, rotated 43/29/19 m relief with reduced terrain
band contribution; other `VF_FieldSurfaceRelief` users, including grounded bridge columns, are
unchanged. The shared evaluator is version 21.
The residual radius scan on owner-SW style 0 measures a 7.062 m period at 0.0109 m (1.09 cm),
with 0.0044 m (0.44 cm) coherent amplitude. The independent L35 mesh-normal scan passes at 8 m
and 0.02496 axial amplitude, below its 0.0255 threshold. The ripple audit samples both side-wall
radii every 0.125 m in 32 m windows, scans 0.5–8 m periods, and rejects amplitudes of 0.035 m or
more. Its synthetic control uses 2 m radius spheres spaced every 1.5 m; it measures 0.0599 m and
must fail.
At the FI mouth, the flat apron is the shared passage support tread, not `LandingExtensionQ`, a tile
edge or a separate support layer. The tread is required by capsule and support probes. L35 gives its
outer entry shoulder a shallow taper and seeded grain while preserving the supported walk core and
lower-mouth overlap width. The shallow quarter-weight support-height/radius spline keeps the tread
continuous without moving its XY footprint.
Cascade routes also replace identical full-depth cosine lobes with a seeded shallow profile on each
turn. Passage, capsule, support, open-air, bridge, binding, strict layout, capture, determinism, ring,
and cost evidence are recorded in
[`Standalone/Research/WorldAssemblerM3/Linux35/REPORT.md`](Standalone/Research/WorldAssemblerM3/Linux35/REPORT.md).
### 8.49 Walk-floor washboard and FI mouth naturalness — World Assembler M3 L36
L35's exported owner-SW mid-tunnel floor measured a 7.250 m repeat at 0.02252 m amplitude; its
upper-SW fixture arrival measured a 1.438 m repeat at 0.02482 m. Both came from segment-built,
one-sided support treads meeting the native terrain zero crossing at per-segment joins. The floor
probe samples the exported walk mesh along the resolved route, separately from the wall-radius scan.
Eligible tread sections overlap by up to 2 m and all sparse route segments now use a bounded
signed-distance slab, including SurfaceWorld-to-TunnelNetwork routes. This keeps the tread top stable
across segment joins while capsule-clearance and native-solid gates retain walkability and open air.
Regular tread tops remain seated 5 cm lower and ease back to 0.20 m within 20 m of a lower landing;
seeded shoulder grain is removed, and gravity-facing relief is reduced while side-wall and ceiling
relief remain irregular.
On v23, the same mesh probes measure 7.188 m / 0.00067 m (0.067 cm) on owner-SW and 6.500 m /
0.00057 m (0.057 cm) on the upper fixture. The density audit checks five 32 m walk-floor windows at
0.125 m spacing, rejects amplitudes of 0.015 m or more, and detects its beaded control. The FI mouth
uses a local 2 m symmetric signed-field filter with the route protected and joins route-mouth support
to native terrain with a 1.5 m smooth signed-distance union. Its mesh audit reduces the L35
42.27° fade-ring jump to 27.13° and finds no detached component above the 0.0001 m² area floor; one
8-triangle subthreshold component at 0.0000266 m² is recorded. The evaluator is version 23. Full
recipe/style audits, route support, open-air, strict layout, legacy validators, determinism, capture and
paired-cost results are in
[`Standalone/Research/WorldAssemblerM3/Linux36/REPORT.md`](Standalone/Research/WorldAssemblerM3/Linux36/REPORT.md).
### 8.50 Immutable field binding — World Assembler M3 L40
`FStandaloneShapeWorld` now keeps a sorted `FBoundStratumField` table built from the resolved layout
at world construction. Each entry owns a concrete SurfaceWorld, FloatingIslands, or legacy adapter
in `FGeneratorFieldAdapterV1`, plus the resolved bounds and native plan pointer. The adapters share
the immutable `densityAt(x,y,z,out)` shape, while `std::variant` keeps dispatch concrete instead of
adding a virtual call to every density sample. FloatingIslands keeps its original fixed-point entry
point for sample evaluation and its boundary parameter table is captured when the adapter is bound.
`DensityAt`, native SurfaceWorld/FloatingIslands evaluation, legacy SurfaceWorld bridging and
`ClassifyBoxDetailed` select from the bound table. The native adapters no longer ask the manager
which generator or plan to use per sample; box proof reuses the bound field objects. The existing
float-to-fixed conversion order, density arithmetic and shared boundary composition remain intact.
The manager's layout-width value is captured once for the legacy-compatible chunk-index projection.
The legacy adapter is still a compatibility bridge: `UVoxelGenerator::GetDensityAt` retains its
own manager routing when invoked for legacy SurfaceWorld fields or out-of-plan fallback queries.
Other shared-composition policy branches and passage/boundary planning remain outside this slice.
No Unreal adapter or `VoxelWorld.cpp` change was needed, and the evaluator version is unchanged.
L37/L39 owner hashes are the parity baseline; the L40 report records fast, medium, full and paired
cost evidence.
### 8.51 Resolved metre layout authority — World Assembler M3 L41
`UVoxelStrateManager::Initialize` now resolves the layout in integer micrometres before passages or
Core work are scheduled. The configured layout width is rounded once to micrometres; legacy height
and inter-strate gap counts are multiplied by that width. Each slot stores its half-open physical
interval `[bottom, top)`, height, transition mode/width, copied passage settings and their physical
dimensions. The effective world seed is captured in the manager before passage generation.
The historical 8 m layout keeps its old placement: the first upper edge is +8 m, and each authored
chunk of height or gap is exactly 8 m. `TopChunkZ` and `BottomChunkZ` are floor-based projections of
the resolved interval, including mathematical floor for negative Z. Season schema v2 still validates
its aligned top/bottom chunk values and stacked order as before, then maps those accepted projections
to the same physical intervals. L29's facing ceiling/bedrock bands are derived from these physical
intervals and the copied transition width, so their metre bounds retain the prior chunk-based values.
The Core adapter builds SurfaceWorld and FloatingIslands bounds, shared-layout bands, and resolved
passage dimensions from the micrometre fields. FI and SW both receive the same
`LayoutChunkWidthSubvoxels = round(layoutWidthMicrometres * 256 / coreVoxelMicrometres)`; layout
conversion does not use the owner/Core scale. Owner/Core ratios remain in the legacy FloatingIslands
parameter adapter for generator dimensions that are still authored in owner voxels. The manager's
legacy passage builder converts resolved passage micrometres back to owner voxels only at its legacy
geometry API boundary.
Chunk coordinates remain in `GetStrateForChunk`, `GetGeneratorTypeForChunk`, chunk-parameter queries,
season-v2 validation, and legacy generator dispatch because those interfaces accept layout-chunk
indices. Their values are cached projections from the physical slot bounds. World-Z queries and the
Core snapshot use the half-open metre intervals. L40's bound Core field table remains the native
per-sample dispatch path; this migration adds no manager lookup to it. The Unreal manager and adapter
cannot be compiled in this Linux workspace, so their small source changes still need the Windows
Unreal build before integration.
### 8.52 Resolved boundary and landing capabilities — World Assembler M3 L42
`ResolvedLayoutSnapshotV3::finalize` materializes runtime capability records from the immutable
strate/interface fields before sampling begins. The upper interface records whether its Gradient FI
bedrock air gap remains open and whether a SurfaceWorld-to-TunnelNetwork passage gets the special
landing support profile. Per-strate passage records carry the existing SurfaceWorld landing profile,
FloatingIslands route-support behavior, and passage-anchor column center policy. Shared boundary and
passage composition reads these records; it no longer compares generator-kind strings.
The records are deterministic derivatives of `generator_kind`, `transition_mode`, and the resolved
adjacent strate, and are omitted from canonical JSON. Those source fields remain in the hashed layout,
so owner layout IDs and density hashes retain their L41 identity. The upper strate still controls
Hard/Gradient/Interleaved evaluation; each strate still composes ceiling, content, then breakable
bedrock. L29 transition samples and the passage-mouth fade arithmetic are unchanged.
`BindResolvedStratumFields` still tests the resolved generator kind once to bind the concrete
SurfaceWorld, FloatingIslands, or legacy evaluator. Passage planning in `ResolvedLayoutInternal.h`
also retains generator-specific anchor and default-mouth placement rules; those are outside the
shared composition boundary policy. No Unreal source changed. See the L42 report for hashes, tier
results and paired cost measurements.
### 8.53 Shared Core landmark SDF stamps — World Assembler M3 L43
`ResolvedLayoutStampV1` adds a small, version-1 SDF vocabulary to the shared resolved layout:
carve ellipsoid, carve arch, fill pillar and fill dais. Requests and resolved records use integer
micrometres and carry a stable ID, strate, position, conservative bounds, half extents, smooth-CSG
width, bounded irregularity amplitude/wavelength and quarter-turn orientation. A stamp's seeded
noise and bounded placement offsets derive from `(world seed, strate, stable ID)`; records are
sorted by stable ID before the layout identity is finalized. If no request is made, the stamp fields
are omitted from canonical JSON, preserving the no-stamp layout identity and density hashes.
Resolution retries a finite, deterministic set of candidates and rejects a record if its complete
bound intersects a passage mouth or walk corridor, reaches a strate content face, or overlaps the
ceiling or bedrock band. The director reports failure if no safe candidate exists. The strict-layout
negative control forces a candidate onto a route and into a ceiling band and expects both rejections.
`FStandaloneShapeWorld` applies stamps after the shared resolved-strate boundary and passage
composition. Carves use smooth maximum with the negated stamp SDF; fills use smooth minimum. Seeded
trilinear value noise adds low-frequency relief without changing the conservative bound. The tile
query scope builds a BVH candidate list from each tile's sample bounds. Samples in a tile outside
every stamp box do no stamp SDF evaluation. Box classification marks stamp-intersecting boxes mixed,
and native-only readiness refuses to skip them.
The `--landmark-chamber-demo` recipe flag adds an irregular ellipsoid chamber, a separate arched
entrance and a low fill dais in the owner SurfaceWorld strate, about 31 m from the passage arrival
mouth and off the walk route. It stays disabled by default. Active records carry vocabulary version
1 in the layout identity, making the demo an explicit world change; no Unreal adapter was added.
L43's report records the off/on hashes, walk and interface audits, outside-stamp timing, tier
results, captures and any failed runs.
### 8.54 Opt-in native lattice field — World Assembler M3 R26 slice 1 (Linux L58)
`Core.Lattice.PrimitiveField` is a version-1 recipe selected only for one Maze or VerticalShafts
strate by `--recipe=lattice --lattice-strate=N`. The legacy generator assets and their default
dispatch stay unchanged. Planning first binds the actual incoming lower mouth and outgoing upper
mouth from the resolved passage records, then creates arrival/exit overlap corridors, a mandatory
four-turn helix and the maze spine; two deterministic dead ends are added after that route. The
resolved room and edge seeds use `(world seed, strate, recipe version, stable ID)`. An audit control
translates the helix 20 m away from both route junctions to make the shaft network orphaned.
The prototype helix uses a 6 m centreline radius, 3 m clear width, 5 m pitch, four turns and 2.6 m
finished floor-to-soffit height. Its centreline descends 20 m over roughly 151 m; the inner-edge
grade is about 10.0 degrees. The 2.4 m floor-wall smooth-max gives an isolated ideal fillet radius
of 0.8485 m. A separate 0.4 m feature-union blend prevents adjoining ramps from erasing the tread.
The swept-clear diameter is 15 m; the conservative padded feature envelope is about 20.6 m (the
approved approximately 21 m site envelope).
The layout reuses the resolved cavern graph vocabulary. A per-strate opt-in selects the native
negative-solid/positive-air field; canonical feature order is stable-ID order. Room/corridor bounds
are indexed by the graph BVH and polyline segments have a nested deterministic BVH for density and
interval queries. Box classification stays conservative, and `isTileShapeFree` refuses any tile
that intersects the graph. The L58 pipeline audits the composed field from actual mouth to mouth
with a 0.34 m by 1.76 m capsule, per-station support, 2.2 m clearance and a 15 degree grade limit;
it also checks the orphan control, brute-force interval samples and the composed wall-foot fillet.
The Linux58 report contains the measured reachability, surface, peer-determinism, timing and capture
results; the code path is not promoted to legacy Maze/VerticalShafts generation.
### 8.55 Unreal CoreGeometry asset bridge and U1 asset version
`UVoxelStrateDefinition::CoreGeometry` is optional and defaults to recipe `None` with no stamps,
rooms, or tunnels. The Unreal adapter preserves the established passage planner, then resolves
authored stamps and cavern graph records, then finalizes the layout. Stable names are required and
are scoped by strate in Core; landmarks may target a stamp, room, or tunnel by that stable name.
Core profile heightfields are restricted to SurfaceWorld. Native caves require the TunnelNetwork or
Underwater archetype; native lattice requires Maze or VerticalShafts. Core recipe/version fields
enter the resolved layout identity when selected. An imported manifest cannot be mixed with a
per-strate profiled heightfield.
The checked-out Core API contains stamp vocabularies V1, V2, and V3. Unreal uses V1 for the original
stamp kinds and V3 for monolith/platform motifs, then combines and strictly validates the result.
Research17 names V2, but the source API and motif vocabulary require V3; source was followed.
Research27 water remains out of scope for U1.
The shared VoxelForge custom asset version is 2: version 1 records the tunnel-floor slope migration;
version 2 adds load-time conversion for inter-strate gap, strate height, and transition width. The
saved strate-layout width is used, currently 8 m. Old packages are converted in memory and marked
dirty, but U1 does not save them. This does not yet migrate the rest of Research8's reflected
spatial-property inventory: legacy chunk distances, owner/Core voxel lengths and frequencies,
placement vectors, and other centimetre fields remain in their prior units. The U1 report records
the five BuildHost asset values, hashes, and remaining work.
## 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
+197 -26
View File
@@ -30,7 +30,7 @@ A **density-field voxel terrain** plugin for Unreal Engine, built around undergr
| Term | Meaning | | Term | Meaning |
|------|---------| |------|---------|
| 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. | | 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. | | Strate-layout chunk | World-level `StrateLayoutChunkSizeMeters`, default 8 m, shared by all generators and independent of voxel size. `UVoxelStrateManager::Initialize` resolves it to integer micrometres; slot bounds, heights, gap and transition widths use those physical values. Core derives the common `LayoutChunkWidthSubvoxels` from that same width. 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. | | 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. |
@@ -70,8 +70,10 @@ A **density-field voxel terrain** plugin for Unreal Engine, built around undergr
(RealtimeMeshComponent) (RealtimeMeshComponent)
``` ```
`UVoxelStrateManager` is the side oracle: "what strate is at this Z, what params, `UVoxelStrateManager` owns resolved half-open metre intervals (`[bottom, top)`) and is the side
what generator type, and is there a passage/elevator SDF near here?" oracle: "what strate is at this Z, what params, what generator type, and is there a passage/elevator
SDF near here?" Integer chunk bounds on each slot are compatibility projections for existing chunk
dispatch APIs.
--- ---
@@ -86,19 +88,22 @@ therefore **128 m**, and a 64-chunk strate is **512 m**. Core still stores work
at 25 cm those tiles happen to span 8 m, but they are not the layout unit. The gameplay capsule remains 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 **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 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 shape 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. U1 adds a
versioned in-memory conversion for strate height, transition width, and inter-strate gap only; the
broader Research8 voxel/chunk/centimetre inventory is not yet migrated.
The intended metre-scale families remain: room diameters **8-20 m**, origin hub **24 m**, room cells The intended metre-scale families remain: room diameters **8-20 m**, origin hub **24 m**, room cells
**32 m**, round tunnel bores **3-4 m**, maze cells **16 m** with a **6.25 m nominal bore** (**3.125 m** **32 m**, round tunnel bores **3-4 m**, maze cells **16 m** with a **6.25 m nominal bore** (**3.125 m**
radius; **3.0625 m** worst-case usable floor after roughness), slab open span **22.4 m**, shaft radius; **3.0625 m** worst-case usable floor after roughness), slab open span **22.4 m**, shaft
diameters **4-7 m**, island diameters **12-24 m**, and ordinary inter-strate bores **3-4 m**. Source diameters **4-7 m**, island diameters **12-24 m**, and ordinary inter-strate bores **3-4 m**. Source
new fixed physical dimensions are authored in metres and converted to voxel counts at the boundary. new fixed physical dimensions are authored in metres and converted to voxel counts at the boundary.
The owner's voxel-valued live strate assets are not migrated by C++: unchanged saved values therefore The owner's voxel-valued live strate shape settings are not migrated by U1: unchanged saved values
produce half-size rooms, tunnels, features and noise periods in metres. See the step-3 migration list therefore produce half-size rooms, tunnels, features and noise periods in metres. See the U1 report
in the handoff report for the exact `DA_Settings` fields and values. for the conversion coverage and remaining Research8 fields.
**Owner asset migration (no packages were edited):** preserve `DA_Settings` distances by changing **Prior reauthoring recommendation (not applied in U1; no packages were edited):** preserve
`DA_Settings` distances by changing
`ViewDistanceXY 32→64`, `ViewDistanceUp/Down 10→20`, `PawnCollisionRadiusChunks 2→4`, `ViewDistanceXY 32→64`, `ViewDistanceUp/Down 10→20`, `PawnCollisionRadiusChunks 2→4`,
`StrateViewMarginChunks 6→12`, `ClipRadius 6→12`, `RenderDistanceChunks 1536→3072`, `StrateViewMarginChunks 6→12`, `ClipRadius 6→12`, `RenderDistanceChunks 1536→3072`,
`EdgeSealThickness 128→256 voxels`, decoration radius/near radius `12/6→24/12 chunks`, region `EdgeSealThickness 128→256 voxels`, decoration radius/near radius `12/6→24/12 chunks`, region
@@ -108,8 +113,9 @@ size `8→16 cells`, spacing/far spacing `8→16 voxels`, march step `4→8 voxe
`12→24 cells`; it is currently disabled. Keep `MaxClipLevel=6` and zero-valued disabled/unbounded `12→24 cells`; it is currently disabled. Keep `MaxClipLevel=6` and zero-valued disabled/unbounded
limits unchanged; double finite world radii and gaps, and multiply finite voxel-volume caps by 8. limits unchanged; double finite world radii and gaps, and multiply finite voxel-volume caps by 8.
The loaded `Crystal Cave` slot in `DA_Strate3` is 64 chunks tall; use 128 chunks to preserve its The loaded `Crystal Cave` slot in `DA_Strate3` is 64 chunks tall; use 128 chunks to preserve its
former 512 m span. Its voxel-authored live-generator lengths remain half-size until that asset is former 512 m span. U1 automatically converts only strate height and transition widths and the
re-authored; the editor-only research field is the step-3 target. settings gap at load; the remaining recommendations above are pending. Its voxel-authored
live-generator lengths remain half-size until their asset fields are migrated.
Step-3 six-worker scale benchmark (idle machine, `Saved/Research/step3/scale/step3_scale_cacheperf_v1`): Step-3 six-worker scale benchmark (idle machine, `Saved/Research/step3/scale/step3_scale_cacheperf_v1`):
the 519³ field took **7.133834–7.825292 s** across three runs (median **7.347496 s**); the 259³ the 519³ field took **7.133834–7.825292 s** across three runs (median **7.347496 s**); the 259³
@@ -167,14 +173,17 @@ remains `0`, and lateral regions remain gated off.
| `../../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/include/VoxelForgeCore/VoxelForgeCore.h` / `../../Standalone/Core/src/ResolvedLayoutInternal.h` | `ResolvedLayoutSnapshotV3`: physical layout-chunk width, versioned micrometre intervals, owned ceiling/content/bedrock bands, honored transition settings, deterministic per-column transition bands, 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.42, §8.46. |
| `ResolvedLayoutStratePassageCapabilitiesV1::{hasNativeCaveField,hasNativeLatticeField}`, `IsNativeLatticeFieldStratum`, `HasNativeGraphField` | `Standalone/Core/include/VoxelForgeCore/VoxelForgeCore.h` / `Standalone/Core/src/ResolvedLayoutInternal.h` | Explicit per-strate native graph capability; `Core.Lattice.PrimitiveField` is restricted to Maze/VerticalShafts recipe version 1. Lattice seeds include world seed, strate, recipe version and stable feature ID; explicit polyline records keep their endpoints and receive conservative bounds. §8.54. |
| `FCavernRuntimeFeature::FSegmentNode`, `ApplyResolvedNativeCavesField`, `ClassifyNativeCaveFieldBox` | `Standalone/Core/src/ShapeWorldInternal.h` | A deterministic nested segment BVH accelerates native graph distance and conservative interval evaluation; the outer graph BVH still supplies tile candidates and protects `isTileShapeFree`. The 0.4 m feature-union width is separate from the floor fillet width. §8.54. |
| `../../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. | `ApplyOwnerFourStratePlan` | `Source/VoxelForgeEditor/Private/VoxelForgeExploreCommandlet.cpp` | BuildHost-only transient fixed-slot plan from the four staged owner strate assets; leaves the authored settings and strate packages untouched. |
| `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|standalone-export|compile-only|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, allows the owner's interactive editor while refusing overlapping `UnrealEditor-Cmd` launches, runs owned processes at Normal priority with a 12-logical-CPU cap, 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 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/VoxelForge/Private/VoxelForgeCoreAdapter.cpp` | Resolves Core's common `LayoutChunkWidthSubvoxels` from the manager's physical layout width; builds SurfaceWorld/FloatingIslands bounds, L29 bands and passage settings from resolved micrometre slot fields; keeps owner/Core ratios in the legacy FloatingIslands parameter adapter. Chunk fields validate imported plans as compatibility projections. Exports canonical `resolved_layout` separately from `world_assembly` and its hash. 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. |
@@ -598,13 +607,16 @@ content lists, audio, `GameplayTags`(393). EditConditions show/hide param groups
type. type.
**`Public/VoxelStrateManager.h` + `.cpp`** — `UVoxelStrateManager : UObject` (h:152). **`Public/VoxelStrateManager.h` + `.cpp`** — `UVoxelStrateManager : UObject` (h:152).
Maps depth→strate at runtime; owns passages. Resolves each slot's physical metre interval, layout gap, transition width, world seed and passage
settings during `Initialize`, then owns passages. World-Z APIs query the physical intervals; legacy
chunk APIs use the cached integer projection.
- `FVoxelPassage` (h:46): standing endpoints, radius, type, wandering control points, and - `FVoxelPassage` (h:46): standing endpoints, radius, type, wandering control points, and
upper/lower local landing descriptors (room, floor, and door; no root connector). upper/lower local landing descriptors (room, floor, and door; no root connector).
- `FStrateSlot` (h:128): definition + chunk-Z range + index. - `FStrateSlot` (h:128): content definition, resolved micrometre bounds/height, resolved transition
and passage inputs, and compatibility chunk-Z projection + strate index.
| Method | .cpp line | Role | | Method | .cpp line | Role |
|--------|-----------|------| |--------|-----------|------|
| `Initialize` | 1164 | Keeps the existing sequencing through `GeneratePassages`, but selects one slot source: a validated cooked season (exact ordered bounds/vector/recipe) or the unchanged authored fixed+sorted/shuffled pool. Assigned-invalid seasons fail closed. Authored source definitions are duplicated as content bags; generated slots use deterministic C++ defaults and zero auto-passages because schema 2 does not store passage configuration. | | `Initialize` | 1186 | Keeps the existing sequencing through `GeneratePassages`, but selects one slot source: a validated cooked season (exact ordered bounds/vector/recipe) or the unchanged authored fixed+sorted/shuffled pool. Assigned-invalid seasons fail closed. Authored source definitions are duplicated as content bags; generated slots use deterministic C++ defaults and zero auto-passages because schema 2 does not store passage configuration. |
| `GeneratePassages` | 1659 | Deterministic passages between consecutive strates (per-strate `PassageConfig::Style` control points; auto passages retain the existing `EVoxelPassageType` default); placement and shape values are independently salted hashes of seed + boundary slot + connection index. Each mouth independently queries its own strate's pure player-fit `VF_SuggestLandingPoint` with its contract seed (cave room salt, otherwise world seed), may move within its archetype-specific budget, then receives a body-sized local room/floor. The origin landing is reserved for the future shaft; no landing-to-root road is generated. Unsupported/no-fit answers preserve the old random reach; a deterministic level dog-leg is inserted when the final ramp needs it to stay ≤44°. All descriptors and bounds are generated without reading another passage. | | `GeneratePassages` | 1659 | Deterministic passages between consecutive strates (per-strate `PassageConfig::Style` control points; auto passages retain the existing `EVoxelPassageType` default); placement and shape values are independently salted hashes of seed + boundary slot + connection index. Each mouth independently queries its own strate's pure player-fit `VF_SuggestLandingPoint` with its contract seed (cave room salt, otherwise world seed), may move within its archetype-specific budget, then receives a body-sized local room/floor. The origin landing is reserved for the future shaft; no landing-to-root road is generated. Unsupported/no-fit answers preserve the old random reach; a deterministic level dog-leg is inserted when the final ramp needs it to stay ≤44°. All descriptors and bounds are generated without reading another passage. |
| `EvaluateModifierSDF` | 2643 | SDF of passage tubes plus local landing rooms at a point. A per-chunk `thread_local` shortlist (`PassagesVersion`-stamped) → far chunks return `FLT_MAX` without walking `Passages`; the same cache serves floor membership. `FPassageEvaluationCache::FloorProjections` reuses native/generic floor projections and walkable-air results once per `(sample, passage)` using exact double XYZ equality and unchanged float outputs; `voxel.FloorRound1PassageProjectionCache=0` disables only this A/B cache. §8.10. | | `EvaluateModifierSDF` | 2643 | SDF of passage tubes plus local landing rooms at a point. A per-chunk `thread_local` shortlist (`PassagesVersion`-stamped) → far chunks return `FLT_MAX` without walking `Passages`; the same cache serves floor membership. `FPassageEvaluationCache::FloorProjections` reuses native/generic floor projections and walkable-air results once per `(sample, passage)` using exact double XYZ equality and unchanged float outputs; `voxel.FloorRound1PassageProjectionCache=0` disables only this A/B cache. §8.10. |
| `ApplyPassageModifier` | 2772 | Shared legacy/op-stack passage post: carves tube and local landing air through the idempotent landing primitive, then restores the local landing support slab in internal positive-solid density. | | `ApplyPassageModifier` | 2772 | Shared legacy/op-stack passage post: carves tube and local landing air through the idempotent landing primitive, then restores the local landing support slab in internal positive-solid density. |
@@ -612,18 +624,18 @@ Maps depth→strate at runtime; owns passages.
| `ApplyPassageLandingFloorMC` | 2983 | Reasserts the same support slab after MC-space disturbances and before the final XY edge seal. | | `ApplyPassageLandingFloorMC` | 2983 | Reasserts the same support slab after MC-space disturbances and before the final XY edge seal. |
| `AnyPassageNearBox` | — | Conservative sphere-vs-AABB test of every passage's bound against a voxel box (+carve blend pad). Per TILE (ClassifyTile guard), never per voxel. | | `AnyPassageNearBox` | — | Conservative sphere-vs-AABB test of every passage's bound against a voxel box (+carve blend pad). Per TILE (ClassifyTile guard), never per voxel. |
| `AnyPassageLandingFloorNearBox` | — | Conservative local-landing-floor AABB guard. It kills the `AllAir` hypothesis wherever a proved landing floor can occur; the op-stack returns `Both` for the same box. | | `AnyPassageLandingFloorNearBox` | — | Conservative local-landing-floor AABB guard. It kills the `AllAir` hypothesis wherever a proved landing floor can occur; the op-stack returns `Both` for the same box. |
| `FindSlotIndexForChunkZ` | 6111 | Z → layout index. | | `FindSlotIndexForChunkZ` / `FindSlotIndexForWorldZCentimetres` | 6239 / 6251 | Chunk callers use the cached compatibility projection; world-Z callers search physical half-open micrometre intervals. |
| `GetStrateAt` / `GetStrateIndex` | 6127 / 6139 | World-Z queries. | | `GetStrateAt` / `GetStrateIndex` | 6276 / 6287 | World-Z queries against half-open micrometre intervals. |
| `GetLayoutVersion` | h:250 (inline) | Layout/passage generation counter (= `PassagesVersion`, bumped by every `Initialize` and by the editor composer override). Hot-path callers key `thread_local` memos on it (strate-index memo in `GetDensityWithParams`, passage shortlist) so live changes never serve stale data. | | `GetLayoutVersion` | h:250 (inline) | Layout/passage generation counter (= `PassagesVersion`, bumped by every `Initialize` and by the editor composer override). Hot-path callers key `thread_local` memos on it (strate-index memo in `GetDensityWithParams`, passage shortlist) so live changes never serve stale data. |
| `GetStrateForChunk` | 6150 | Chunk → definition. | | `GetStrateForChunk` | 6298 | Chunk → definition via the compatibility projection. |
| `GetGeneratorTypeForChunk` | 6176 | Chunk → generator type. | | `GetGeneratorTypeForChunk` | 6324 | Chunk → generator type via the compatibility projection. |
| `UsesOperatorStackForChunk` | 6203 | Chunk → does its slot have an operator stack? True for any in-layout slot with a definition whose archetype is one of the 8 (Maze, FlatPlain, CrystalChamber, SurfaceWorld, VerticalShafts, FloatingIslands, TunnelNetwork, Underwater); false outside the layout. **That list is written down here and nowhere else.** `ClassifyTile` guards on it; `GetDensityAt` uses it to share TunnelNetwork stacks by chunk Z. | | `UsesOperatorStackForChunk` | 6351 | Chunk → does its slot have an operator stack? True for any in-layout slot with a definition whose archetype is one of the 8 (Maze, FlatPlain, CrystalChamber, SurfaceWorld, VerticalShafts, FloatingIslands, TunnelNetwork, Underwater); false outside the layout. **That list is written down here and nowhere else.** `ClassifyTile` guards on it; `GetDensityAt` uses it to share TunnelNetwork stacks by chunk Z. |
| `GetRecipeForChunk` | — | Runtime immutable recipe/vector/strate-seed copy for cooked seasons; editor slot overrides use the same worker hand-off. | | `GetRecipeForChunk` | — | Runtime immutable recipe/vector/strate-seed copy for cooked seasons; editor slot overrides use the same worker hand-off. |
| `GetSlabParamsForChunk` | 6263 | Slab params with runtime Z bounds (no blend — slabs use Hard). | | `GetSlabParamsForChunk` | 6415 | Slab params with runtime Z bounds (no blend — slabs use Hard). |
| `GetBiomeContextForChunk` | — | Flatten the strate's `Biomes[]` + `BiomeMapParams` into a POD `FBiomeContext` for the biome field. Empty ⇒ biomes disabled. §8.14. | | `GetBiomeContextForChunk` | — | Flatten the strate's `Biomes[]` + `BiomeMapParams` into a POD `FBiomeContext` for the biome field. Empty ⇒ biomes disabled. §8.14. |
| `GetGenerationParams` | 6509 | **Blended** TunnelNetwork params (handles Gradient/Hard/Interleaved transitions). | | `GetGenerationParams` | 6661 | **Blended** TunnelNetwork params (handles Gradient/Hard/Interleaved transitions). |
| `SetComposerOverrideForStrate` / `GetComposerOverrideForChunk` | editor-only | Temporary density-only candidate overlay for one existing slot. Copies immutable params/recipe into the worker refetch path, leaves layout/content/passages intact, and bumps `PassagesVersion` to invalidate generator memos. | | `SetComposerOverrideForStrate` / `GetComposerOverrideForChunk` | editor-only | Temporary density-only candidate overlay for one existing slot. Copies immutable params/recipe into the worker refetch path, leaves layout/content/passages intact, and bumps `PassagesVersion` to invalidate generator memos. |
| `BuildParamsFromDefinition` (static) | 6815 | Returns the definition's base `GenerationParams` only. Terrain-op assets are passed separately to `BuildChunkCache`, which applies one selected op per room and pre-bakes Column/Pit/Chimney features. | | `BuildParamsFromDefinition` (static) | 6985 | Returns the definition's base `GenerationParams` only. Terrain-op assets are passed separately to `BuildChunkCache`, which applies one selected op per room and pre-bakes Column/Pit/Chimney features. |
**`Public/VoxelTerrainOpDefinition.h` + `.cpp`** — `UVoxelTerrainOpDefinition : UPrimaryDataAsset` **`Public/VoxelTerrainOpDefinition.h` + `.cpp`** — `UVoxelTerrainOpDefinition : UPrimaryDataAsset`
(h:67). One asset = one terrain op. `EVoxelTerrainOpType` (h:36): Terrace, LayerLines, (h:67). One asset = one terrain op. `EVoxelTerrainOpType` (h:36): Terrace, LayerLines,
@@ -1160,7 +1172,7 @@ and [`Standalone/Research/WorldAssemblerM3/Linux18/REPORT.md`](Standalone/Resear
| Symbol | Canonical file | Role | | 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. | | `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. | | `FStandaloneShapeWorld::ApplyResolvedStrateComposition`, `ApplyResolvedStratePassageCarves` | `Standalone/Core/src/ShapeWorldInternal.h` | Applies resolved 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. | | `--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 The evaluator version is 9. See ARCHITECTURE §8.41 and
@@ -1181,6 +1193,165 @@ The shared evaluator is version 10, the FI recipe geometry is version 5, and res
V3 is unchanged. See ARCHITECTURE §8.42 and V3 is unchanged. See ARCHITECTURE §8.42 and
[`Standalone/Research/WorldAssemblerM3/Linux24/REPORT.md`](Standalone/Research/WorldAssemblerM3/Linux24/REPORT.md). [`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).
### 3.29 Honored bedrock/ceiling transitions — World Assembler L29
| Symbol | Canonical file | Role |
|---|---|---|
| `EvaluateResolvedLayoutTransitionBandsV1`, `AuditResolvedStrateTransitions` | Public Core header / `Standalone/Core/src/ResolvedLayoutInternal.h`; `Standalone/Source/StreamBenchmarkPipeline.h` | Resolve the deterministic mode field from seed, interface and coordinates; audit actual crossing depth, minimum band thickness, passage-excluded holes, and strict negative controls. |
| `FStandaloneShapeWorld::ApplyResolvedStrateBoundaryBand` | `Standalone/Core/src/ShapeWorldInternal.h` | Applies Hard, Gradient or Interleaved to both facing bands in the shared Core composition path; tapers locally at passage mouths to preserve landing support. |
The shared evaluator is version 15. Recipe and resolved-layout schema versions are unchanged.
The Unreal adapter now forwards the authored transition type and chunk width; those Unreal edits
were not compiled here. See ARCHITECTURE §8.46 and
[`Standalone/Research/WorldAssemblerM3/Linux29/REPORT.md`](Standalone/Research/WorldAssemblerM3/Linux29/REPORT.md).
### 3.30 SurfaceWorld as an upper strate and floor-profile joins — World Assembler L33
| Symbol | Canonical file | Role |
|---|---|---|
| `BuildFiniteStrateRoute` | `Standalone/Source/WorldAssemblyPrototype.h` | Samples route heights from the composed terrain ground; bounds candidate chords by the arrival/departure placement radii and records per-segment grade failures. |
| `PlanResolvedLayoutPassagesV1` | `Standalone/Core/src/ResolvedLayoutInternal.h` | Starts an upper-SurfaceWorld departure at its terrain mouth, opens a small portal and smoothsteps to the rock tunnel while orienting the ring outward. |
| `BuildPassageVoidCrossingPlan`, `PassageBridgeSignedDistance` | `Standalone/Core/src/ShapeWorldInternal.h` | Sizes unsupported ranges from the full control-segment window only for upper SurfaceWorld; other upper generators keep the previous bracketing-sample bounds. |
| `--audit-resolved-layout-passages` | `Standalone/Source/StreamBenchmarkPipeline.h` | Uses floor height rather than bore-centre height for naturalness and records failed-only wall probes for column audits. |
| `FloorProfileBlend` | `Standalone/Core/src/ShapeWorldInternal.h` | Measures endpoint height/tangent continuity; chord deviation is informational, with step and tangent-step negative controls. |
The owner SurfaceWorld hashes match L32 and evaluator/recipe versions are unchanged. See
ARCHITECTURE §8.47 and
[`Standalone/Research/WorldAssemblerM3/Linux33/REPORT.md`](Standalone/Research/WorldAssemblerM3/Linux33/REPORT.md).
### 3.31 Passage-wall ripple and FI tread-shoulder audit — World Assembler M3 L35
| Symbol | Canonical file | Role |
|---|---|---|
| `VF_FieldPassageWallRelief` | `Standalone/Core/src/VoxelForgeFieldShared.h` | Supplies passage-only irregular wall relief at rotated 43/29/19 m scales. Other `VF_FieldSurfaceRelief` users stay unchanged. |
| `ApplyResolvedStratePassageCarves` | `Standalone/Core/src/ShapeWorldInternal.h` | Catmull–Rom smooths eligible interior sweep joins, applies passage-only wall relief, and tapers/grains the entry support shoulder below the capsule/support probe footprint. |
| `PlanResolvedLayoutPassagesV1` | `Standalone/Core/src/ResolvedLayoutInternal.h` | Gives each Cascade turn a seeded shallow radial profile instead of identical repeated full-depth cosine lobes. |
| `auditPassageRipples` / `PassageRippleAudit` | `Standalone/Source/StreamBenchmarkPipeline.h` | Samples wall radii and walk-floor zero crossings at 0.125 m spacing, scans periods 0.5–8 m in 32 m windows, and rejects wall/floor amplitudes ≥0.035/0.015 m. Sphere and beaded-floor controls must be detected. |
`WorldAssemblyEvaluatorVersion=21`. See ARCHITECTURE §8.48 and
[`Standalone/Research/WorldAssemblerM3/Linux35/REPORT.md`](Standalone/Research/WorldAssemblerM3/Linux35/REPORT.md).
### 3.32 Walk-floor washboard and FI mouth blend — World Assembler M3 L36
| Symbol | Canonical file | Role |
|---|---|---|
| `ApplyResolvedStratePassageCarves` | `Standalone/Core/src/ShapeWorldInternal.h` | Extends eligible tread sections by up to 2 m and uses bounded signed-distance support on every sparse route, including SurfaceWorld-to-TunnelNetwork, removes seeded shoulder grain, and seats regular tread tops 5 cm lower with a smooth return at the lower landing. Capsule/open-air gates remain. Gravity-facing wall relief is reduced; side and ceiling relief remain. |
| `ApplyResolvedStratePassageCarves` mouth support | `Standalone/Core/src/ShapeWorldInternal.h` | Builds exact signed-distance route-mouth tread boxes and smooth-unions them with native terrain over 1.5 m. |
| `NativeFloatingIslandDensityAt` | `Standalone/Core/src/ShapeWorldInternal.h` | Applies a local 2 m symmetric signed-field filter around FI passage mouths, exempts resolved route support, and removes isolated negative samples thinner than 2 m on all axes. |
| `auditPassageRipples` / `PassageRippleAudit` | `Standalone/Source/StreamBenchmarkPipeline.h` | Keeps the wall-radius audit and adds walk-floor zero-crossing profiles at 0.125 m, with five 32 m windows and a 0.015 m limit plus a beaded-floor negative control. |
| `RunMouthFragmentAuditL36.py`, `ProbeWalkFloorProfileL36.py` | `Standalone/Research/WorldAssemblerM3/Linux36/` | Compare L35 floor and FI-mouth controls with L36; the mouth check fails on detached components at or above 0.0001 m² and checks normal jumps across the fade ring. |
`WorldAssemblyEvaluatorVersion=23`. See ARCHITECTURE §8.49 and
[`Standalone/Research/WorldAssemblerM3/Linux36/REPORT.md`](Standalone/Research/WorldAssemblerM3/Linux36/REPORT.md).
### 3.33 Immutable field binding — World Assembler M3 L40
| Symbol | Canonical file | Role |
|---|---|---|
| `FSurfaceWorldFieldAdapter`, `FFloatingIslandFieldAdapter`, `FLegacyGeneratorFieldAdapter`, `FGeneratorFieldAdapterV1` | `Standalone/Core/src/ShapeWorldInternal.h` | Concrete, immutable density adapters with one shared `densityAt(x,y,z,out)` call shape; the variant avoids per-sample virtual dispatch. FI retains its fixed-point entry point and prebound legacy boundary parameters. |
| `FBoundStratumField`, `BindResolvedStratumFields`, `FindBoundStratumForChunk` | `Standalone/Core/src/ShapeWorldInternal.h` | Bind a resolved strate's plan, evaluator and chunk interval once during world initialization; native field and classification queries select this table. |
| `NativeSurfaceDensityAt`, `NativeFloatingIslandDensityAt`, `ClassifyBoxDetailed` | `Standalone/Core/src/ShapeWorldInternal.h` | Consume the prebound adapters and plan pointers instead of looking up strate type/parameters through the manager per query. |
Hash parity is unchanged from L37/L39; see ARCHITECTURE §8.50 and
[`Standalone/Research/WorldAssemblerM3/Linux40/REPORT.md`](Standalone/Research/WorldAssemblerM3/Linux40/REPORT.md).
### 3.34 Resolved boundary and landing capabilities — World Assembler M3 L42
| Symbol | Canonical file | Role |
|---|---|---|
| `ResolvedLayoutStratePassageCapabilitiesV1`, `ResolvedLayoutInterfaceCapabilitiesV1` | `Standalone/Core/include/VoxelForgeCore/VoxelForgeCore.h` | Runtime-only resolved records for surface/island landing, passage-column anchoring, the FI Gradient air gap, and SW-to-TunnelNetwork support. They are derived during layout finalization from fields already included in the canonical layout identity. |
| `ResolvedLayoutSnapshotV3::finalize` | `Standalone/Core/src/ResolvedLayoutInternal.h` | Resolves those capabilities once before sampling; canonical JSON and stable layout IDs stay unchanged. |
| `FStandaloneShapeWorld::ApplyResolvedStrateBoundaryBand`, `ApplyResolvedStratePassageCarves`, `BuildPassageVoidCrossingPlan`, `PassageBridgeSignedDistance` | `Standalone/Core/src/ShapeWorldInternal.h` | Consume resolved capability records. Generator-kind selection remains only in `BindResolvedStratumFields`, where it binds the concrete evaluator once. |
Owner hashes match L41; see ARCHITECTURE §8.52 and
[`Standalone/Research/WorldAssemblerM3/Linux42/REPORT.md`](Standalone/Research/WorldAssemblerM3/Linux42/REPORT.md).
### 3.35 Core landmark SDF stamps — World Assembler M3 L43
| Symbol | Canonical file | Role |
|---|---|---|
| `ResolvedLayoutStampRequestV1`, `ResolvedLayoutStampV1`, `ResolvedSdfStampKindV1` | `Standalone/Core/include/VoxelForgeCore/VoxelForgeCore.h` | Version-1 bounded stamp vocabulary and integer-micrometre request/resolved records shared by all Core generators. |
| `ResolveResolvedLayoutStampsV1`, `AuditResolvedLayoutStampPlacementV1` | `Standalone/Core/src/ResolvedLayoutInternal.h` | Seed/strate/stable-ID placement with bounded retries; rejects passage-mouth, walk-corridor, content-face, ceiling and bedrock conflicts. Empty requests preserve the old canonical layout payload. |
| `BuildStampSpatialIndex`, `ApplyResolvedSdfStamps`, `StampSdf` | `Standalone/Core/src/ShapeWorldInternal.h` | BVH-built conservative bounds select stamps once per tile; shared density composition applies smooth carve/fill SDFs with seeded value-noise relief. Box classification and native-only readiness decline boxes touched by a stamp. |
| `--landmark-chamber-demo` | `Standalone/Source/StreamBenchmarkHeadless.cpp` | Opt-in owner-world recipe: one SW ellipsoid chamber, arched entrance and low fill dais, placed beside the passage arrival. Off by default. |
See ARCHITECTURE §8.53 and
[`Standalone/Research/WorldAssemblerM3/Linux43/REPORT.md`](Standalone/Research/WorldAssemblerM3/Linux43/REPORT.md)
for layout identities, owner hashes, outside-box timing, audits and captures.
### 3.36 Native lattice field — World Assembler M3 R26 slice 1 (Linux L58)
| Symbol | Canonical file | Role |
|---|---|---|
| `IsNativeLatticeFieldStratum`, `LayoutLatticeFeatureSeed`, `ResolvedCavernRoomV1::unionWidthMicrometres`, `ResolvedCavernEdgeV1::unionWidthMicrometres` | `Standalone/Core/include/VoxelForgeCore/VoxelForgeCore.h`, `Standalone/Core/src/ResolvedLayoutInternal.h` | Versioned Maze/VerticalShafts opt-in and deterministic seed from `(seed, strate, recipe version, stable ID)`; optional union width preserves prior cave JSON when unset. |
| `MakeNativeLatticeSpine`, `--recipe=lattice`, `--lattice-strate=N` | `Standalone/Source/StreamBenchmarkHeadless.cpp` | Resolves actual adjacent mouths, builds a mandatory four-turn helix and maze spine, then adds two seeded dead ends; `--lattice-orphan-control` moves the helix away from both junctions. |
| `AuditNativeLatticeField` | `Standalone/Source/StreamBenchmarkPipeline.h` | Samples the final field along the mouth-to-mouth capsule route, checking support, headroom, grade, orphan rejection, composed fillet, interval signs and feature-tile exclusion. |
| `BuildLatticeFixtureL58.py`, `CaptureNativeLatticeL58.py`, `AuditLatticeSurfaceL58.py` | `Standalone/Research/WorldAssemblerM3/Linux58/` | Isolated Maze strate fixture, four reviewed captures and the L54 whole-surface triangle audit adapted to explicit native polylines. |
See ARCHITECTURE §8.54 and
[`Standalone/Research/WorldAssemblerM3/Linux58/REPORT.md`](Standalone/Research/WorldAssemblerM3/Linux58/REPORT.md)
for resolved records, final-field reachability, controls, timing, hashes and captures.
### 3.37 Unreal CoreGeometry assets and partial metre upgrade — World Assembler U1
`Public/VoxelStrateTypes.h` declares optional `FVoxelForgeCoreGeometry`. Its default recipe is Off
and its stamp, room, and tunnel arrays are empty. `Private/VoxelForgeCoreAdapter.cpp` maps authored
metres to Core layout requests after passage planning and before finalizing the layout. Stamps use
the V1 resolver for original stamp kinds and V3 for monolith/platform motifs because the checked-out
Core API exposes V3; authored cavern records use `ResolveResolvedCavernGraphV1`. Stable feature
names are namespaced by strate in the resolved layout. `FStrateLandmark::CoreGeometryStableName`
binds one landmark to such a resolved record, and `VoxelContentManager.cpp` builds its lookup from
the finalized snapshot. `VoxelWorld.cpp` retains resolved layout identity in content hashing.
`Private/VoxelForgeAssetVersion.h` sets the shared custom version to 2. `UVoxelSettings::Serialize`
and `UVoxelStrateDefinition::Serialize`/`PostLoad` upgrade only inter-strate gap, strate height,
and transition width using the saved 8 m layout chunk. These conversions are version-guarded and
idempotent. No package save is performed by the audit. Other Research8 chunks, owner-voxel lengths,
Core-voxel lengths/frequencies, and centimetre fields remain on their existing units and need a
separate migration.
Likely compile/UHT touchpoints are the reflected nested fields in `VoxelStrateTypes.h`, Core snapshot
and resolver signatures in `VoxelForgeCoreAdapter.cpp`, `FCustomVersionRegistration` and the old
tunnel-slope version in `VoxelStrateDefinition.cpp`, plus the standalone `VoxelForgeExplore` audit
in `VoxelForgeExploreCommandlet.cpp`. `GetStrateForChunk` still receives layout-chunk Z, not a Core
tile index. See `Standalone/Research/WorldAssemblerM3/Unreal1/REPORT.md` for BuildHost evidence.
## 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
@@ -399,6 +399,7 @@ bool FVoxelForgeComposerSeasonTest::RunTest(const FString& Parameters)
LegacySettings->WorldRadiusVoxels = 987.0f; LegacySettings->WorldRadiusVoxels = 987.0f;
LegacySettings->TotalStrates = 1; LegacySettings->TotalStrates = 1;
LegacyDefinition->StrateHeightInChunks = 7; LegacyDefinition->StrateHeightInChunks = 7;
LegacyDefinition->StrateHeightMeters = 7.0 * 8.0;
LegacySettings->StratePool.Add( LegacySettings->StratePool.Add(
TSoftObjectPtr<UVoxelStrateDefinition>(LegacyDefinition.Get())); TSoftObjectPtr<UVoxelStrateDefinition>(LegacyDefinition.Get()));
TStrongObjectPtr<UVoxelStrateManager> LegacyManager( TStrongObjectPtr<UVoxelStrateManager> LegacyManager(
@@ -525,6 +525,7 @@ bool FVoxelForgeZeroTransitionBlendTest::RunTest(const FString& Parameters)
{ {
UVoxelStrateDefinition* Definition = World.Definitions[Index].Get(); UVoxelStrateDefinition* Definition = World.Definitions[Index].Get();
Definition->TransitionBlendChunks = 0; Definition->TransitionBlendChunks = 0;
Definition->TransitionWidthMeters = 0.0;
Definition->TransitionType = (Index & 1) == 0 Definition->TransitionType = (Index & 1) == 0
? EVoxelStrateTransition::Gradient : EVoxelStrateTransition::Interleaved; ? EVoxelStrateTransition::Gradient : EVoxelStrateTransition::Interleaved;
} }
@@ -44,6 +44,7 @@ namespace
Settings->Seed = LayoutSeed; Settings->Seed = LayoutSeed;
Settings->TotalStrates = NumPoolDefinitions; Settings->TotalStrates = NumPoolDefinitions;
Settings->InterStrateGapChunks = 1; Settings->InterStrateGapChunks = 1;
Settings->InterStrateGapMeters = Settings->StrateLayoutChunkSizeMeters;
Settings->bOpenSurfaceEntry = true; Settings->bOpenSurfaceEntry = true;
static const ECaveGeneratorType GeneratorTypes[] = { static const ECaveGeneratorType GeneratorTypes[] = {
@@ -69,6 +70,8 @@ namespace
FString::Printf(TEXT("Layout order test strate %d"), Index)); FString::Printf(TEXT("Layout order test strate %d"), Index));
Def->GeneratorType = GeneratorTypes[Index]; Def->GeneratorType = GeneratorTypes[Index];
Def->StrateHeightInChunks = 3 + Index; Def->StrateHeightInChunks = 3 + Index;
Def->StrateHeightMeters = static_cast<double>(Def->StrateHeightInChunks)
* Settings->StrateLayoutChunkSizeMeters;
Def->TransitionType = EVoxelStrateTransition::Hard; Def->TransitionType = EVoxelStrateTransition::Hard;
// Non-trivial, distinct passage configs exercise the connection index and the // Non-trivial, distinct passage configs exercise the connection index and the
@@ -79,6 +79,8 @@ namespace VoxelForgeTest
NewObject<UVoxelSettings>(GetTransientPackage(), NAME_None, RF_Transient)); NewObject<UVoxelSettings>(GetTransientPackage(), NAME_None, RF_Transient));
Settings->Seed = InSeed; Settings->Seed = InSeed;
Settings->InterStrateGapChunks = InGapChunks; Settings->InterStrateGapChunks = InGapChunks;
Settings->InterStrateGapMeters = static_cast<double>(InGapChunks)
* Settings->StrateLayoutChunkSizeMeters;
// WorldRadiusVoxels/EdgeSealThickness intentionally inherit the UVoxelSettings defaults; // WorldRadiusVoxels/EdgeSealThickness intentionally inherit the UVoxelSettings defaults;
// WorldEdgeSeal overrides them explicitly when it needs a small test world or radius 0. // WorldEdgeSeal overrides them explicitly when it needs a small test world or radius 0.
@@ -110,6 +112,8 @@ namespace VoxelForgeTest
// refinement and roll tests use the smaller synthetic volume as a bounded memory // refinement and roll tests use the smaller synthetic volume as a bounded memory
// control; the owner-facing showcase opts into 8 chunks below. // control; the owner-facing showcase opts into 8 chunks below.
Def->StrateHeightInChunks = FMath::Max(1, InStrateHeightInChunks); Def->StrateHeightInChunks = FMath::Max(1, InStrateHeightInChunks);
Def->StrateHeightMeters = static_cast<double>(Def->StrateHeightInChunks)
* Settings->StrateLayoutChunkSizeMeters;
// Hard transitions: param blending across a boundary would make "which archetype // Hard transitions: param blending across a boundary would make "which archetype
// owns this chunk" ambiguous, and these tests want an unambiguous mapping. // owns this chunk" ambiguous, and these tests want an unambiguous mapping.
Def->TransitionType = EVoxelStrateTransition::Hard; Def->TransitionType = EVoxelStrateTransition::Hard;
@@ -4,6 +4,27 @@
namespace VoxelClipmapDesiredTiles namespace VoxelClipmapDesiredTiles
{ {
FORCEINLINE int64 FloorDivWide(int64 Value, int64 Divisor)
{
if (Divisor <= 0) { return 0; }
const int64 Quotient = Value / Divisor;
const int64 Remainder = Value % Divisor;
return Remainder < 0 ? Quotient - 1 : Quotient;
}
FORCEINLINE int64 CeilDivWide(int64 Value, int64 Divisor)
{
if (Divisor <= 0) { return 0; }
const int64 Quotient = Value / Divisor;
const int64 Remainder = Value % Divisor;
return Remainder > 0 ? Quotient + 1 : Quotient;
}
FORCEINLINE int32 ClampInt32(int64 Value)
{
return static_cast<int32>(FMath::Clamp<int64>(Value, MIN_int32, MAX_int32));
}
struct FParameters struct FParameters
{ {
int32 ClipRadius = 3; int32 ClipRadius = 3;
@@ -13,7 +34,10 @@ namespace VoxelClipmapDesiredTiles
FORCEINLINE int32 FloorDiv(int32 Value, int32 Divisor) FORCEINLINE int32 FloorDiv(int32 Value, int32 Divisor)
{ {
return Value >= 0 ? (Value / Divisor) : -(((-Value) + Divisor - 1) / Divisor); if (Divisor <= 0) { return 0; }
const int32 Quotient = Value / Divisor;
const int32 Remainder = Value % Divisor;
return Remainder < 0 ? Quotient - 1 : Quotient;
} }
FORCEINLINE FIntVector FloorDiv(const FIntVector& Value, int32 Divisor) FORCEINLINE FIntVector FloorDiv(const FIntVector& Value, int32 Divisor)
@@ -24,7 +48,10 @@ namespace VoxelClipmapDesiredTiles
FORCEINLINE int32 CeilDiv(int32 Value, int32 Divisor) FORCEINLINE int32 CeilDiv(int32 Value, int32 Divisor)
{ {
return -FloorDiv(-Value, Divisor); if (Divisor <= 0) { return 0; }
const int32 Quotient = Value / Divisor;
const int32 Remainder = Value % Divisor;
return Remainder > 0 ? Quotient + 1 : Quotient;
} }
FORCEINLINE void AlignedRingBounds(const FIntVector& Center, int32 Radius, int32 Alignment, FORCEINLINE void AlignedRingBounds(const FIntVector& Center, int32 Radius, int32 Alignment,
@@ -33,10 +60,12 @@ namespace VoxelClipmapDesiredTiles
const auto AlignAxis = [Radius, Alignment](int32 CenterAxis, const auto AlignAxis = [Radius, Alignment](int32 CenterAxis,
int32& OutAxisMin, int32& OutAxisMax) int32& OutAxisMin, int32& OutAxisMax)
{ {
const int32 BaseMin = CenterAxis - Radius; const int64 SafeRadius = FMath::Max<int64>(0, Radius);
const int32 BaseEnd = CenterAxis + Radius + 1; const int64 SafeAlignment = FMath::Max<int64>(1, Alignment);
OutAxisMin = FloorDiv(BaseMin, Alignment) * Alignment; const int64 BaseMin = static_cast<int64>(CenterAxis) - SafeRadius;
OutAxisMax = CeilDiv(BaseEnd, Alignment) * Alignment - 1; const int64 BaseEnd = static_cast<int64>(CenterAxis) + SafeRadius + 1;
OutAxisMin = ClampInt32(FloorDivWide(BaseMin, SafeAlignment) * SafeAlignment);
OutAxisMax = ClampInt32(CeilDivWide(BaseEnd, SafeAlignment) * SafeAlignment - 1);
}; };
AlignAxis(Center.X, OutMin.X, OutMax.X); AlignAxis(Center.X, OutMin.X, OutMax.X);
AlignAxis(Center.Y, OutMin.Y, OutMax.Y); AlignAxis(Center.Y, OutMin.Y, OutMax.Y);
@@ -49,8 +78,13 @@ namespace VoxelClipmapDesiredTiles
{ {
return Radius; return Radius;
} }
return FMath::Max(Radius, const int32 SafeLevel = FMath::Clamp(MaxLevel, 0, 8);
(Parameters.RenderDistanceChunks + (1 << MaxLevel) - 1) >> MaxLevel); const int64 Scale = int64{1} << static_cast<uint32>(SafeLevel);
const int64 Numerator = static_cast<int64>(Parameters.RenderDistanceChunks)
+ Scale - 1;
const int64 DesiredRadius = Numerator / Scale;
return static_cast<int32>(FMath::Clamp<int64>(
FMath::Max<int64>(Radius, DesiredRadius), 0, MAX_int32));
} }
FORCEINLINE void OuterShell(const FParameters& Parameters, int32 Radius, int32 MaxLevel, FORCEINLINE void OuterShell(const FParameters& Parameters, int32 Radius, int32 MaxLevel,
@@ -73,12 +107,12 @@ namespace VoxelClipmapDesiredTiles
return; return;
} }
OutMinChunkZ = CenterChunkZ - ViewDistanceDown; OutMinChunkZ = ClampInt32(static_cast<int64>(CenterChunkZ) - ViewDistanceDown);
OutMaxChunkZ = CenterChunkZ + ViewDistanceUp; OutMaxChunkZ = ClampInt32(static_cast<int64>(CenterChunkZ) + ViewDistanceUp);
if (bHasStrate) if (bHasStrate)
{ {
OutMinChunkZ = StrateBottomChunkZ - StrateViewMarginChunks; OutMinChunkZ = ClampInt32(static_cast<int64>(StrateBottomChunkZ) - StrateViewMarginChunks);
OutMaxChunkZ = StrateTopChunkZ + StrateViewMarginChunks; OutMaxChunkZ = ClampInt32(static_cast<int64>(StrateTopChunkZ) + StrateViewMarginChunks);
} }
} }
@@ -94,7 +128,7 @@ namespace VoxelClipmapDesiredTiles
for (int32 Level = 0; Level <= MaxLevel; ++Level) for (int32 Level = 0; Level <= MaxLevel; ++Level)
{ {
const int32 Pow = 1 << Level; const int32 Pow = static_cast<int32>(uint32{1} << static_cast<uint32>(Level));
const FIntVector CenterLevel = FloorDiv(Center, Pow); const FIntVector CenterLevel = FloorDiv(Center, Pow);
const int32 LevelRadius = (Level == MaxLevel) ? OuterRadius : Radius; const int32 LevelRadius = (Level == MaxLevel) ? OuterRadius : Radius;
@@ -105,24 +139,23 @@ namespace VoxelClipmapDesiredTiles
FIntVector RingMin, RingMax; FIntVector RingMin, RingMax;
AlignedRingBounds(CenterLevel, LevelRadius, RingAlignment, RingMin, RingMax); AlignedRingBounds(CenterLevel, LevelRadius, RingAlignment, RingMin, RingMax);
int32 DeltaZMin = RingMin.Z - CenterLevel.Z; int64 TileMinZ = RingMin.Z;
int32 DeltaZMax = RingMax.Z - CenterLevel.Z; int64 TileMaxZ = RingMax.Z;
if (LevelRadius > Radius && MinChunkZ != MIN_int32) if (LevelRadius > Radius && MinChunkZ != MIN_int32)
{ {
DeltaZMin = FMath::Max(DeltaZMin, FloorDiv(MinChunkZ, Pow) - CenterLevel.Z); TileMinZ = FMath::Max<int64>(TileMinZ, FloorDiv(MinChunkZ, Pow));
DeltaZMax = FMath::Min(DeltaZMax, FloorDiv(MaxChunkZ, Pow) - CenterLevel.Z); TileMaxZ = FMath::Min<int64>(TileMaxZ, FloorDiv(MaxChunkZ, Pow));
} }
for (int32 DeltaZ = DeltaZMin; DeltaZ <= DeltaZMax; ++DeltaZ) for (int64 Z = TileMinZ; Z <= TileMaxZ; ++Z)
for (int32 DeltaY = RingMin.Y - CenterLevel.Y; for (int64 Y = RingMin.Y; Y <= RingMax.Y; ++Y)
DeltaY <= RingMax.Y - CenterLevel.Y; ++DeltaY) for (int64 X = RingMin.X; X <= RingMax.X; ++X)
for (int32 DeltaX = RingMin.X - CenterLevel.X;
DeltaX <= RingMax.X - CenterLevel.X; ++DeltaX)
{ {
const FIntVector Tile = CenterLevel + FIntVector(DeltaX, DeltaY, DeltaZ); const FIntVector Tile(static_cast<int32>(X), static_cast<int32>(Y),
const int32 TileMinZ = Tile.Z << Level; static_cast<int32>(Z));
const int32 TileMaxZ = ((Tile.Z + 1) << Level) - 1; const int64 TileBottomChunkZ = static_cast<int64>(Tile.Z) * Pow;
if (TileMaxZ < MinChunkZ || TileMinZ > MaxChunkZ) const int64 TileTopChunkZ = (static_cast<int64>(Tile.Z) + 1) * Pow - 1;
if (TileTopChunkZ < MinChunkZ || TileBottomChunkZ > MaxChunkZ)
{ {
continue; continue;
} }
@@ -130,12 +163,12 @@ namespace VoxelClipmapDesiredTiles
if (Level > 0) if (Level > 0)
{ {
const bool bCovered = const bool bCovered =
(2 * Tile.X >= PreviousRingMin.X) (2 * static_cast<int64>(Tile.X) >= PreviousRingMin.X)
&& (2 * Tile.X + 1 <= PreviousRingMax.X) && (2 * static_cast<int64>(Tile.X) + 1 <= PreviousRingMax.X)
&& (2 * Tile.Y >= PreviousRingMin.Y) && (2 * static_cast<int64>(Tile.Y) >= PreviousRingMin.Y)
&& (2 * Tile.Y + 1 <= PreviousRingMax.Y) && (2 * static_cast<int64>(Tile.Y) + 1 <= PreviousRingMax.Y)
&& (2 * Tile.Z >= PreviousRingMin.Z) && (2 * static_cast<int64>(Tile.Z) >= PreviousRingMin.Z)
&& (2 * Tile.Z + 1 <= PreviousRingMax.Z); && (2 * static_cast<int64>(Tile.Z) + 1 <= PreviousRingMax.Z);
if (bCovered) if (bCovered)
{ {
continue; continue;
+124 -24
View File
@@ -18,6 +18,7 @@
#include "Materials/MaterialInterface.h" #include "Materials/MaterialInterface.h"
#include "Tasks/Task.h" #include "Tasks/Task.h"
#include "HAL/PlatformProcess.h" #include "HAL/PlatformProcess.h"
#include "Misc/Crc.h"
#include "ProfilingDebugging/CpuProfilerTrace.h" // Unreal Insights scopes #include "ProfilingDebugging/CpuProfilerTrace.h" // Unreal Insights scopes
#include <VoxelForgeCore/VoxelForgeCore.h> #include <VoxelForgeCore/VoxelForgeCore.h>
#include <cmath> #include <cmath>
@@ -240,10 +241,10 @@ static std::vector<VoxelForgeCore::WorldAssemblyFeatureQueryV1> VF_ContentFeatur
{ {
using namespace VoxelForgeCore; using namespace VoxelForgeCore;
constexpr double Q = WorldAssemblySubvoxelsPerVoxel; constexpr double Q = WorldAssemblySubvoxelsPerVoxel;
const std::array<int64,3> Min{static_cast<int64>(std::floor(MinX*Q)), const std::array<std::int64_t,3> Min{static_cast<std::int64_t>(std::floor(MinX*Q)),
static_cast<int64>(std::floor(MinY*Q)),static_cast<int64>(std::floor(MinZ*Q))}; static_cast<std::int64_t>(std::floor(MinY*Q)),static_cast<std::int64_t>(std::floor(MinZ*Q))};
const std::array<int64,3> Max{static_cast<int64>(std::ceil(MaxX*Q)), const std::array<std::int64_t,3> Max{static_cast<std::int64_t>(std::ceil(MaxX*Q)),
static_cast<int64>(std::ceil(MaxY*Q)),static_cast<int64>(std::ceil(MaxZ*Q))}; static_cast<std::int64_t>(std::ceil(MaxY*Q)),static_cast<std::int64_t>(std::ceil(MaxZ*Q))};
std::vector<WorldAssemblyFeatureQueryV1> Queries; std::vector<WorldAssemblyFeatureQueryV1> Queries;
if (Surface) if (Surface)
if (const auto* Plan = Surface->FindPlan(StrateIndex)) if (const auto* Plan = Surface->FindPlan(StrateIndex))
@@ -322,11 +323,54 @@ void UVoxelContentManager::Initialize(AActor* InOwner, UVoxelStrateManager* InSt
Seed = InSeed; Seed = InSeed;
NativeSurfaceSnapshot.Reset(); NativeSurfaceSnapshot.Reset();
NativeFloatingIslandSnapshot.Reset(); NativeFloatingIslandSnapshot.Reset();
CoreGeometryAnchors.Reset();
if (Settings) if (Settings)
{ {
FString ManifestJson, ManifestHash, ManifestError; FString ManifestJson, ManifestHash, ManifestError;
const AVoxelWorld* VoxelWorld = Cast<AVoxelWorld>(Owner.Get()); const AVoxelWorld* VoxelWorld = Cast<AVoxelWorld>(Owner.Get());
FString ResolvedLayoutJson, ResolvedLayoutIdentity;
if (VoxelWorld != nullptr
&& VoxelWorld->GetVoxelForgeCoreResolvedLayout(ResolvedLayoutJson, ResolvedLayoutIdentity))
{
FTCHARToUTF8 Utf8Layout(*ResolvedLayoutJson);
std::string LayoutError;
const std::optional<VoxelForgeCore::ResolvedLayoutSnapshotV3> ResolvedLayout =
VoxelForgeCore::ResolvedLayoutSnapshotV3::FromJson(
std::string_view(Utf8Layout.Get(), static_cast<std::size_t>(Utf8Layout.Length())), LayoutError);
if (ResolvedLayout)
{
const auto AddAnchor = [this](const std::string& StableId, int32 StrateIndex,
const std::array<std::int64_t, 3>& PositionMicrometres)
{
const FVector PositionCm(
static_cast<double>(PositionMicrometres[0]) / 10000.0,
static_cast<double>(PositionMicrometres[1]) / 10000.0,
static_cast<double>(PositionMicrometres[2]) / 10000.0);
const FString FullName = UTF8_TO_TCHAR(StableId.c_str());
FResolvedCoreGeometryAnchor Anchor{ StrateIndex, PositionCm };
CoreGeometryAnchors.Add(FullName, Anchor);
const int32 Marker = FullName.Find(TEXT("/core/"), ESearchCase::CaseSensitive, ESearchDir::FromEnd);
if (Marker != INDEX_NONE)
{
const FString ShortName = FullName.Mid(Marker + 6);
if (!ShortName.IsEmpty()) CoreGeometryAnchors.Add(ShortName, Anchor);
}
};
for (const VoxelForgeCore::ResolvedLayoutStampV1& Stamp : ResolvedLayout->stamps)
AddAnchor(Stamp.stableId, Stamp.strateIndex, Stamp.positionMicrometres);
for (const VoxelForgeCore::ResolvedCavernRoomV1& Room : ResolvedLayout->cavernRooms)
AddAnchor(Room.stableId, Room.strateIndex, Room.centerMicrometres);
for (const VoxelForgeCore::ResolvedCavernEdgeV1& Edge : ResolvedLayout->cavernEdges)
if (!Edge.polylineMicrometres.empty())
AddAnchor(Edge.stableId, Edge.strateIndex, Edge.polylineMicrometres.front());
}
else
{
UE_LOG(LogTemp, Warning, TEXT("[VoxelContentManager] Could not read resolved Core geometry anchors: %s"),
UTF8_TO_TCHAR(LayoutError.c_str()));
}
}
const bool bHasRuntimeAssembly = VoxelWorld != nullptr const bool bHasRuntimeAssembly = VoxelWorld != nullptr
&& VoxelWorld->GetVoxelForgeCoreWorldAssembly(ManifestJson, ManifestHash); && VoxelWorld->GetVoxelForgeCoreWorldAssembly(ManifestJson, ManifestHash);
if (!bHasRuntimeAssembly) if (!bHasRuntimeAssembly)
@@ -559,9 +603,13 @@ int32 UVoxelContentManager::RegionSize() const
// truncation, a negative-coord cell is queued under one region but routed back to another → its march // truncation, a negative-coord cell is queued under one region but routed back to another → its march
// result is dropped → blank chunk. Truncation == floor for A>=0 and for R==1, which is exactly why only // result is dropped → blank chunk. Truncation == floor for A>=0 and for R==1, which is exactly why only
// NEGATIVE coordinates at R>=2 were affected. R (region size) is always > 0 here. // NEGATIVE coordinates at R>=2 were affected. R (region size) is always > 0 here.
static FORCEINLINE int32 FloorDivPos(int32 A, int32 R) static FORCEINLINE int32 FloorDivPos(int64 A, int32 R)
{ {
return (A >= 0) ? (A / R) : -(((-A) + R - 1) / R); if (R <= 0) { return 0; }
const int64 Quotient = A / R;
const int64 Remainder = A % R;
return static_cast<int32>(FMath::Clamp<int64>(
Remainder < 0 ? Quotient - 1 : Quotient, MIN_int32, MAX_int32));
} }
static FORCEINLINE FIntPoint CellToRegion(const FIntPoint& Cell, int32 R) static FORCEINLINE FIntPoint CellToRegion(const FIntPoint& Cell, int32 R)
@@ -573,10 +621,10 @@ static FORCEINLINE FIntPoint CellToRegion(const FIntPoint& Cell, int32 R)
static FORCEINLINE bool IsRegionDesired(const FIntPoint& Region, const FIntPoint& PlayerCell, static FORCEINLINE bool IsRegionDesired(const FIntPoint& Region, const FIntPoint& PlayerCell,
int32 FarR, int32 R) int32 FarR, int32 R)
{ {
const int32 MinX = FloorDivPos(PlayerCell.X - FarR, R); const int32 MinX = FloorDivPos(static_cast<int64>(PlayerCell.X) - FarR, R);
const int32 MaxX = FloorDivPos(PlayerCell.X + FarR, R); const int32 MaxX = FloorDivPos(static_cast<int64>(PlayerCell.X) + FarR, R);
const int32 MinY = FloorDivPos(PlayerCell.Y - FarR, R); const int32 MinY = FloorDivPos(static_cast<int64>(PlayerCell.Y) - FarR, R);
const int32 MaxY = FloorDivPos(PlayerCell.Y + FarR, R); const int32 MaxY = FloorDivPos(static_cast<int64>(PlayerCell.Y) + FarR, R);
return Region.X >= MinX && Region.X <= MaxX && Region.Y >= MinY && Region.Y <= MaxY; return Region.X >= MinX && Region.X <= MaxX && Region.Y >= MinY && Region.Y <= MaxY;
} }
@@ -1038,8 +1086,19 @@ bool UVoxelContentManager::MeasurePlacementCostForValidation(
OutAudit.MaximumDensityResidual=FMath::Max(OutAudit.MaximumDensityResidual, OutAudit.MaximumDensityResidual=FMath::Max(OutAudit.MaximumDensityResidual,
FMath::Abs(static_cast<double>(Density))); FMath::Abs(static_cast<double>(Density)));
++OutAudit.AnchorChecks; ++OutAudit.AnchorChecks;
if (FMath::Abs(Density)>0.25f) // Core content crossings use the same finite-step column refinement as runtime
{ OutError=TEXT("Populated fixture is not anchored on the canonical field."); return false; } // placement. Allow at most half a Core voxel of field residual in this audit.
// Les croisements de contenu Core gardent le raffinement discret du runtime;
// l'audit tolere au plus un demi-voxel Core de residu de champ.
if (FMath::Abs(Density)>0.5f)
{
OutError=FString::Printf(
TEXT("Populated fixture is not anchored on the canonical field: residual=%.4f core_vox=(%.3f,%.3f,%.3f) local_cm=(%.2f,%.2f,%.2f)."),
Density, Local.X/CurrentCtx.VoxelSizeCm,
Local.Y/CurrentCtx.VoxelSizeCm, Local.Z/CurrentCtx.VoxelSizeCm,
Local.X, Local.Y, Local.Z);
return false;
}
} }
} }
if (!Spawns.IsEmpty()) if (!Spawns.IsEmpty())
@@ -1102,17 +1161,22 @@ void UVoxelContentManager::RebuildDesiredCells(FDecoGrid& G, const FIntPoint& Pl
const int32 R = RegionSize(); const int32 R = RegionSize();
// Desired regions = every region whose footprint touches the radius-FarR cell box around the player. // Desired regions = every region whose footprint touches the radius-FarR cell box around the player.
const FIntPoint RMin(FloorDivPos(PlayerCell.X - FarR, R), const FIntPoint RMin(FloorDivPos(static_cast<int64>(PlayerCell.X) - FarR, R),
FloorDivPos(PlayerCell.Y - FarR, R)); FloorDivPos(static_cast<int64>(PlayerCell.Y) - FarR, R));
const FIntPoint RMax(FloorDivPos(PlayerCell.X + FarR, R), const FIntPoint RMax(FloorDivPos(static_cast<int64>(PlayerCell.X) + FarR, R),
FloorDivPos(PlayerCell.Y + FarR, R)); FloorDivPos(static_cast<int64>(PlayerCell.Y) + FarR, R));
TSet<FIntPoint> DesiredRegions; TSet<FIntPoint> DesiredRegions;
DesiredRegions.Reserve((RMax.X - RMin.X + 1) * (RMax.Y - RMin.Y + 1)); constexpr int64 MaxRegionReserve = 4096;
for (int32 ry = RMin.Y; ry <= RMax.Y; ++ry) const int64 WidthX = static_cast<int64>(RMax.X) - RMin.X + 1;
for (int32 rx = RMin.X; rx <= RMax.X; ++rx) const int64 WidthY = static_cast<int64>(RMax.Y) - RMin.Y + 1;
const int64 ReserveCount = WidthY > 0 && WidthX > MaxRegionReserve / WidthY
? MaxRegionReserve : FMath::Max<int64>(0, WidthX * WidthY);
DesiredRegions.Reserve(static_cast<int32>(ReserveCount));
for (int64 ry = RMin.Y; ry <= RMax.Y; ++ry)
for (int64 rx = RMin.X; rx <= RMax.X; ++rx)
{ {
DesiredRegions.Add(FIntPoint(rx, ry)); DesiredRegions.Add(FIntPoint(static_cast<int32>(rx), static_cast<int32>(ry)));
} }
// Unload loaded regions no longer desired (plain DestroyComponent — no per-instance removal). // Unload loaded regions no longer desired (plain DestroyComponent — no per-instance removal).
@@ -1464,8 +1528,15 @@ void UVoxelContentManager::BuildCellSpawns(const UVoxelGenerator* Gen, const FTr
const uint32 CH = VoxelHash::Mix(H ^ (0x00C0FFEEu + (uint32)ci * 0x9E3779B1u)); const uint32 CH = VoxelHash::Mix(H ^ (0x00C0FFEEu + (uint32)ci * 0x9E3779B1u));
if (VoxelHash::ToFloat01(CH) > Comp.Probability) continue; if (VoxelHash::ToFloat01(CH) > Comp.Probability) continue;
const int32 Span = FMath::Max(0, Comp.CountMax - Comp.CountMin); const int64 Span = FMath::Max<int64>(0,
const int32 Count = Comp.CountMin + (int32)(VoxelHash::ToFloat01(VoxelHash::Mix(CH ^ 0x1234u)) * (float)(Span + 1)); static_cast<int64>(Comp.CountMax) - Comp.CountMin);
const uint64 CountRange = static_cast<uint64>(Span) + 1u;
const float CountOffset = VoxelHash::ToFloat01(
VoxelHash::Mix(CH ^ 0x1234u)) * static_cast<float>(CountRange);
const int64 CountWide = static_cast<int64>(Comp.CountMin)
+ static_cast<int64>(CountOffset);
const int32 Count = static_cast<int32>(FMath::Clamp<int64>(
CountWide, MIN_int32, MAX_int32));
for (int32 ii = 0; ii < Count; ++ii) for (int32 ii = 0; ii < Count; ++ii)
{ {
if (CompBudget <= 0) break; if (CompBudget <= 0) break;
@@ -1514,8 +1585,15 @@ void UVoxelContentManager::BuildCellSpawns(const UVoxelGenerator* Gen, const FTr
const uint32 SH = VoxelHash::Mix(IH ^ (0x0000544Bu + (uint32)si * 0x27D4EB2Fu)); const uint32 SH = VoxelHash::Mix(IH ^ (0x0000544Bu + (uint32)si * 0x27D4EB2Fu));
if (VoxelHash::ToFloat01(SH) > Sub.Probability) continue; if (VoxelHash::ToFloat01(SH) > Sub.Probability) continue;
const int32 SubSpan = FMath::Max(0, Sub.CountMax - Sub.CountMin); const int64 SubSpan = FMath::Max<int64>(0,
const int32 SubCount = Sub.CountMin + (int32)(VoxelHash::ToFloat01(VoxelHash::Mix(SH ^ 0x1234u)) * (float)(SubSpan + 1)); static_cast<int64>(Sub.CountMax) - Sub.CountMin);
const uint64 SubCountRange = static_cast<uint64>(SubSpan) + 1u;
const float SubCountOffset = VoxelHash::ToFloat01(
VoxelHash::Mix(SH ^ 0x1234u)) * static_cast<float>(SubCountRange);
const int64 SubCountWide = static_cast<int64>(Sub.CountMin)
+ static_cast<int64>(SubCountOffset);
const int32 SubCount = static_cast<int32>(FMath::Clamp<int64>(
SubCountWide, MIN_int32, MAX_int32));
for (int32 sj = 0; sj < SubCount; ++sj) for (int32 sj = 0; sj < SubCount; ++sj)
{ {
if (CompBudget <= 0) break; if (CompBudget <= 0) break;
@@ -2374,6 +2452,28 @@ void UVoxelContentManager::UpdateLandmarks(const FVector& PlayerWorldPos)
const float ExclWorld = FMath::Max(0.0f, L.ExclusionRadiusChunks) * ChunkWorld; const float ExclWorld = FMath::Max(0.0f, L.ExclusionRadiusChunks) * ChunkWorld;
if (ExclWorld > 0.0f) bAnyExclusion = true; if (ExclWorld > 0.0f) bAnyExclusion = true;
if (!L.CoreGeometryStableName.IsEmpty())
{
const FResolvedCoreGeometryAnchor* Anchor = CoreGeometryAnchors.Find(L.CoreGeometryStableName);
if (Anchor == nullptr || Anchor->StrateIndex != StrateIndex) continue;
const uint32 StableNameHash = FCrc::StrCrc32(*L.CoreGeometryStableName);
const uint32 H = DecoHash(static_cast<int32>(StableNameHash), StrateIndex,
0, 0, 0, EntryIdx, LocalSeed, 0xC04E6E0u);
if (VoxelHash::ToFloat01(H) > L.SpawnProbability) continue;
const float LocalX = static_cast<float>(Anchor->LocalPositionCm.X);
const float LocalY = static_cast<float>(Anchor->LocalPositionCm.Y);
const float dx = LocalX - LocalPlayer.X, dy = LocalY - LocalPlayer.Y;
const float DistSq = dx * dx + dy * dy;
if (DistSq <= GatherWorld * GatherWorld)
{
// A Core-bound landmark is one stable candidate, independent of the hash lattice.
// Un landmark lie a Core reste un candidat stable, independant de la grille de hachage.
Cands.Add({ FIntVector(EntryIdx, 0, EntryIdx), EntryIdx, H, LocalX, LocalY,
ExclWorld, L.Priority, DistSq <= RadiusWorld * RadiusWorld });
}
continue;
}
if (L.AnchorMode == ELandmarkAnchor::HashLattice) if (L.AnchorMode == ELandmarkAnchor::HashLattice)
{ {
const float SpacingChunks = FMath::Max(1.0f, L.SpacingChunks); const float SpacingChunks = FMath::Max(1.0f, L.SpacingChunks);
@@ -155,9 +155,11 @@ int32 UVoxelDensityVolume::NumLevels() const
FORCEINLINE int32 UVoxelDensityVolume::FloorDiv(int32 A, int32 B) FORCEINLINE int32 UVoxelDensityVolume::FloorDiv(int32 A, int32 B)
{ {
// True floor division (B > 0). FMath::DivideAndRoundDown truncates toward zero for negatives — // True floor division (B > 0). Remainder adjustment handles INT_MIN without negating it.
// a footgun the content manager hit too (see FloorDivPos there). Cells span the origin, so floor. if (B <= 0) { return 0; }
return (A >= 0) ? (A / B) : -(((-A) + B - 1) / B); const int32 Quotient = A / B;
const int32 Remainder = A % B;
return Remainder < 0 ? Quotient - 1 : Quotient;
} }
FORCEINLINE uint8 UVoxelDensityVolume::Quantize(float MCDensity) FORCEINLINE uint8 UVoxelDensityVolume::Quantize(float MCDensity)
@@ -180,7 +182,8 @@ void UVoxelDensityVolume::EnsureAllocated()
for (int32 L = 0; L < N; ++L) for (int32 L = 0; L < N; ++L)
{ {
FClipLevel& Lv = Levels[L]; FClipLevel& Lv = Levels[L];
Lv.Step = 1 << L; Lv.Step = static_cast<int32>(uint32{1}
<< static_cast<uint32>(FMath::Clamp(L, 0, 8)));
Lv.OriginCells = FIntVector(INT32_MAX, INT32_MAX, INT32_MAX); Lv.OriginCells = FIntVector(INT32_MAX, INT32_MAX, INT32_MAX);
Lv.bHasData = false; Lv.bHasData = false;
Lv.Density.SetNumZeroed(Count); // start all-air (0) Lv.Density.SetNumZeroed(Count); // start all-air (0)
@@ -632,7 +635,8 @@ void UVoxelDensityVolume::ProcessOneFill(const FPendingFill& F)
if (!Gen) return; if (!Gen) return;
if (bShuttingDown.load(std::memory_order_relaxed) || bFillThreadStop.load(std::memory_order_relaxed)) return; if (bShuttingDown.load(std::memory_order_relaxed) || bFillThreadStop.load(std::memory_order_relaxed)) return;
const int32 Step = 1 << F.Level; const int32 Step = static_cast<int32>(uint32{1}
<< static_cast<uint32>(FMath::Clamp(F.Level, 0, 8)));
FFillResult R; FFillResult R;
R.Level = F.Level; R.Level = F.Level;
R.Epoch = F.Epoch; R.Epoch = F.Epoch;
@@ -0,0 +1,12 @@
#pragma once
#include "CoreMinimal.h"
// Shared custom package version for idempotent VoxelForge asset migrations.
// Version de package partagee pour les migrations VoxelForge idempotentes.
namespace VoxelForgeAssetVersion
{
inline const FGuid GUID(0xA76D5E31, 0x4B2C4F9A, 0xB8C1D204, 0x6E9F7738);
inline constexpr int32 TunnelFloorSlopeDegrees = 1;
inline constexpr int32 MetreAuthoringV1 = 2;
}
File diff suppressed because it is too large. Load diff
@@ -15,9 +15,73 @@
#include "HAL/IConsoleManager.h" #include "HAL/IConsoleManager.h"
#include "Misc/CommandLine.h" #include "Misc/CommandLine.h"
#include <atomic> #include <atomic>
#include <array>
namespace namespace
{ {
struct FVoxelMesherThreadState
{
int32 OctaveBias=0,SampleStep=1,TileCells=0,TileReachBlocks=0,TileReachBlockIndex=INDEX_NONE;
FIntVector TileOrigin=FIntVector::ZeroValue;
uint8 TilePostReachFlags=VoxelGenLOD::AllTileReach;
bool bTilePostReachDebug=false,bTilePostReachBypass=false;
bool bTileReachDiagnosticTile=false,bTileCoreReachProofEnabled=false;
bool bTileCoreReachDecisionRecorded=false,bTileBlockReachValid=false;
float TileReachScale=1.0f;
std::array<uint8,VoxelGenLOD::TileReachMaxBlockCount> TileBlockReachFlags{};
static FVoxelMesherThreadState Capture()
{
FVoxelMesherThreadState State;
State.OctaveBias=VoxelGenLOD::OctaveBias;
State.SampleStep=VoxelGenLOD::SampleStep;
State.TileOrigin=VoxelGenLOD::TileOriginVoxels;
State.TileCells=VoxelGenLOD::TileCellsPerAxis;
State.TilePostReachFlags=VoxelGenLOD::TilePostReachFlags;
State.bTilePostReachDebug=VoxelGenLOD::bTilePostReachDebug;
State.bTilePostReachBypass=VoxelGenLOD::bTilePostReachBypass;
State.bTileReachDiagnosticTile=VoxelGenLOD::bTileReachDiagnosticTile;
State.bTileCoreReachProofEnabled=VoxelGenLOD::bTileCoreReachProofEnabled;
State.bTileCoreReachDecisionRecorded=VoxelGenLOD::bTileCoreReachDecisionRecorded;
State.bTileBlockReachValid=VoxelGenLOD::bTileBlockReachValid;
State.TileReachScale=VoxelGenLOD::TileReachScale;
State.TileReachBlocks=VoxelGenLOD::TileReachBlocksPerAxis;
State.TileReachBlockIndex=VoxelGenLOD::TileReachBlockIndex;
std::copy(std::begin(VoxelGenLOD::TileBlockReachFlags),
std::end(VoxelGenLOD::TileBlockReachFlags),State.TileBlockReachFlags.begin());
return State;
}
void Apply() const
{
VoxelGenLOD::OctaveBias=OctaveBias;
VoxelGenLOD::SampleStep=SampleStep;
VoxelGenLOD::TileOriginVoxels=TileOrigin;
VoxelGenLOD::TileCellsPerAxis=TileCells;
VoxelGenLOD::TilePostReachFlags=TilePostReachFlags;
VoxelGenLOD::bTilePostReachDebug=bTilePostReachDebug;
VoxelGenLOD::bTilePostReachBypass=bTilePostReachBypass;
VoxelGenLOD::bTileReachDiagnosticTile=bTileReachDiagnosticTile;
VoxelGenLOD::bTileCoreReachProofEnabled=bTileCoreReachProofEnabled;
VoxelGenLOD::bTileCoreReachDecisionRecorded=bTileCoreReachDecisionRecorded;
VoxelGenLOD::bTileBlockReachValid=bTileBlockReachValid;
VoxelGenLOD::TileReachScale=TileReachScale;
VoxelGenLOD::TileReachBlocksPerAxis=TileReachBlocks;
VoxelGenLOD::TileReachBlockIndex=TileReachBlockIndex;
std::copy(TileBlockReachFlags.begin(),TileBlockReachFlags.end(),
std::begin(VoxelGenLOD::TileBlockReachFlags));
}
};
struct FVoxelMesherThreadStateScope
{
explicit FVoxelMesherThreadStateScope(const FVoxelMesherThreadState& InTarget)
:Previous(FVoxelMesherThreadState::Capture())
{ InTarget.Apply(); }
~FVoxelMesherThreadStateScope(){Previous.Apply();}
FVoxelMesherThreadState Previous;
};
int32 GVoxelForgeUseOperatorBlock = 1; int32 GVoxelForgeUseOperatorBlock = 1;
FAutoConsoleVariableRef CVarVoxelForgeUseOperatorBlock( FAutoConsoleVariableRef CVarVoxelForgeUseOperatorBlock(
TEXT("voxel.UseOperatorBlock"), TEXT("voxel.UseOperatorBlock"),
@@ -692,6 +756,7 @@ FVoxelMeshData UVoxelMarchingCubesMesher::GenerateMesh(FIntVector OriginVoxels,
// capacité, donc plus de malloc/free de ~170 Ko (35³ floats) par tuile. // capacité, donc plus de malloc/free de ~170 Ko (35³ floats) par tuile.
static thread_local TArray<float> DensityGrid; static thread_local TArray<float> DensityGrid;
DensityGrid.SetNumUninitialized(MDim * MDim * MDim); DensityGrid.SetNumUninitialized(MDim * MDim * MDim);
float* const DensityGridData=DensityGrid.GetData();
const FVoxelSharedDensityGrid* ReuseGrid = InSharedDensityGrid != nullptr const FVoxelSharedDensityGrid* ReuseGrid = InSharedDensityGrid != nullptr
? InSharedDensityGrid : SharedDensityGrid; ? InSharedDensityGrid : SharedDensityGrid;
const int32 SharedDeltaX = ReuseGrid const int32 SharedDeltaX = ReuseGrid
@@ -739,7 +804,15 @@ FVoxelMeshData UVoxelMarchingCubesMesher::GenerateMesh(FIntVector OriginVoxels,
const bool bUseOperatorBlock = !bUseSharedDensityGrid const bool bUseOperatorBlock = !bUseSharedDensityGrid
&& !bUseParameterizedBrickEvaluator && !bUseParameterizedBrickEvaluator
&& GVoxelForgeUseOperatorBlock != 0; && GVoxelForgeUseOperatorBlock != 0;
if (bUseOperatorBlock) const int32 GridZSampleCount=GzHi-GzLo+1;
const std::size_t GridFillLaneCount=std::min<std::size_t>({
GridFillExecution.WorkerLimit,16,
static_cast<std::size_t>(FMath::Max(0,GridZSampleCount))});
const bool bUseParallelDensityGrid=GridFillExecution.ParallelFor!=nullptr
&&GridFillLaneCount>1&&GridFillExecution.BeginWorkerContext!=nullptr
&&GridFillExecution.EndWorkerContext!=nullptr&&!bUseSharedDensityGrid
&&!bUseParameterizedBrickEvaluator&&OutCaptureGrid==nullptr;
if (bUseOperatorBlock&&!bUseParallelDensityGrid)
{ {
// The grid includes one sample of halo on every side. The generator groups these exact // The grid includes one sample of halo on every side. The generator groups these exact
// lattice points by chunk key and lets the prepared op stack fill each group once. // lattice points by chunk key and lets the prepared op stack fill each group once.
@@ -889,6 +962,80 @@ FVoxelMeshData UVoxelMarchingCubesMesher::GenerateMesh(FIntVector OriginVoxels,
} }
#endif #endif
} }
else if(bUseParallelDensityGrid)
{
const FVoxelMesherThreadState TileThreadState=FVoxelMesherThreadState::Capture();
std::array<int64,16> LaneSampleCounts{};
std::atomic<bool> bAborted{false};
auto RunLane=[&](std::size_t Lane,std::size_t Worker)
{
void* WorkerState=GridFillExecution.BeginWorkerContext(
GridFillExecution.WorkerContext,Worker);
int64 LaneSamples=0;
{
FVoxelMesherThreadStateScope ThreadStateScope(TileThreadState);
const int32 FirstGz=GzLo+static_cast<int32>(
(static_cast<std::size_t>(GridZSampleCount)*Lane)/GridFillLaneCount);
const int32 EndGz=GzLo+static_cast<int32>(
(static_cast<std::size_t>(GridZSampleCount)*(Lane+1))/GridFillLaneCount);
if(bUseOperatorBlock)
{
Generator->BeginDensityBlock(
OriginVoxels+FIntVector(-Step,-Step,FirstGz*Step),Step,
MDim,MDim,EndGz-FirstGz);
}
for(int32 gz=FirstGz;gz<EndGz;++gz)
{
if(ShouldAbortWork())
{ bAborted.store(true,std::memory_order_relaxed);break; }
for(int32 gy=-1;gy<=GridDim;++gy)
{
if(ShouldAbortWork())
{ bAborted.store(true,std::memory_order_relaxed);break; }
for(int32 gx=-1;gx<=GridDim;++gx)
{
const int32 LocalIndex=((gz+1)*MDim+(gy+1))*MDim+(gx+1);
const int32 ReachBlockX=FMath::Clamp(gx,0,CellsPerAxis-1)
/VoxelGenLOD::TileReachBlockCells;
const int32 ReachBlockY=FMath::Clamp(gy,0,CellsPerAxis-1)
/VoxelGenLOD::TileReachBlockCells;
const int32 ReachBlockZ=FMath::Clamp(gz,0,CellsPerAxis-1)
/VoxelGenLOD::TileReachBlockCells;
VoxelGenLOD::TileReachBlockIndex=
((ReachBlockZ*ReachBlocksPerAxis)+ReachBlockY)
*ReachBlocksPerAxis+ReachBlockX;
float PreEditDensity=0.0f;
DensityGridData[LocalIndex]=Generator->GetDensityAt(
OriginVoxels.X+gx*Step,OriginVoxels.Y+gy*Step,
OriginVoxels.Z+gz*Step,
bCapturePreEditGrid?&PreEditDensity:nullptr);
if(bCapturePreEditGrid)
OutPreEditDensityGrid->Samples[LocalIndex]=PreEditDensity;
++LaneSamples;
}
}
if(bAborted.load(std::memory_order_relaxed))break;
}
if(bUseOperatorBlock)Generator->EndDensityBlock();
}
LaneSampleCounts[Lane]=LaneSamples;
GridFillExecution.EndWorkerContext(
GridFillExecution.WorkerContext,WorkerState,Worker);
};
struct FDispatchContext{decltype(RunLane)* Run=nullptr;};
FDispatchContext DispatchContext{&RunLane};
const auto DispatchLane=[](void* RawContext,std::size_t Lane,std::size_t Worker)
{
auto& Context=*static_cast<FDispatchContext*>(RawContext);
(*Context.Run)(Lane,Worker);
};
GridFillExecution.ParallelFor(GridFillExecution.SchedulerContext,
GridFillLaneCount,GridFillLaneCount,&DispatchContext,DispatchLane);
if(OutDensitySampleCount)
for(std::size_t Lane=0;Lane<GridFillLaneCount;++Lane)
*OutDensitySampleCount+=LaneSampleCounts[Lane];
if(bAborted.load(std::memory_order_relaxed))return FVoxelMeshData();
}
else for (int32 gz = GzLo; gz <= GzHi; gz++) else for (int32 gz = GzLo; gz <= GzHi; gz++)
{ {
if (ShouldAbortWork()) if (ShouldAbortWork())
@@ -959,7 +1106,7 @@ FVoxelMeshData UVoxelMarchingCubesMesher::GenerateMesh(FIntVector OriginVoxels,
GridSampleCount * sizeof(float)); GridSampleCount * sizeof(float));
} }
} }
if (bUseOperatorBlock) if (bUseOperatorBlock&&!bUseParallelDensityGrid)
{ {
Generator->EndDensityBlock(); Generator->EndDensityBlock();
} }
@@ -2590,8 +2590,8 @@ static float EvaluateInternal(const UVoxelGenerator& Generator,
{ {
EnsurePlan(Generator); EnsurePlan(Generator);
} }
const bool bChunkResolved = Context != nullptr && Context->bChunkResolved const bool bChunkResolved = (Context != nullptr && Context->bChunkResolved)
|| ParameterizedContext != nullptr && ParameterizedContext->bChunkResolved; || (ParameterizedContext != nullptr && ParameterizedContext->bChunkResolved);
const FIntVector Chunk = Context != nullptr && Context->bChunkResolved const FIntVector Chunk = Context != nullptr && Context->bChunkResolved
? Context->Chunk ? Context->Chunk
: ParameterizedContext != nullptr && ParameterizedContext->bChunkResolved : ParameterizedContext != nullptr && ParameterizedContext->bChunkResolved
@@ -1958,10 +1958,11 @@ namespace VoxelSeasonCompositionPrivate
} }
void CopyDefinitionParams(const UVoxelStrateDefinition& Definition, void CopyDefinitionParams(const UVoxelStrateDefinition& Definition,
FVoxelSeasonFixedStrate& OutFixed) double LayoutChunkMeters, FVoxelSeasonFixedStrate& OutFixed)
{ {
OutFixed = FVoxelSeasonFixedStrate(); OutFixed = FVoxelSeasonFixedStrate();
OutFixed.HeightInChunks = Definition.StrateHeightInChunks; OutFixed.HeightInChunks = FMath::Max(1, FMath::RoundToInt(
Definition.StrateHeightMeters / FMath::Max(0.001, LayoutChunkMeters)));
OutFixed.Archetype = Definition.GeneratorType; OutFixed.Archetype = Definition.GeneratorType;
OutFixed.SourceDefinitionPath = Definition.GetPathName(); OutFixed.SourceDefinitionPath = Definition.GetPathName();
OutFixed.bUsesRecipe = false; OutFixed.bUsesRecipe = false;
@@ -1999,7 +2000,9 @@ namespace VoxelSeasonCompositionPrivate
return false; return false;
} }
FVoxelSeasonFixedStrate Fixed; FVoxelSeasonFixedStrate Fixed;
CopyDefinitionParams(*Definition, Fixed); const double LayoutChunkMeters = Settings.WorldSettings != nullptr
? Settings.WorldSettings->StrateLayoutChunkSizeMeters : 8.0;
CopyDefinitionParams(*Definition, LayoutChunkMeters, Fixed);
Fixed.Seed = SeasonSeed; Fixed.Seed = SeasonSeed;
if (Fixed.SourceDefinitionPath.IsEmpty()) if (Fixed.SourceDefinitionPath.IsEmpty())
{ {
@@ -2974,7 +2977,9 @@ FVoxelSeasonManifest VF_ComposeSeason(int32 SeasonSeed, const UVoxelSettings* Wo
if (WorldSettings != nullptr) if (WorldSettings != nullptr)
{ {
Settings.SelectedStrateCount = WorldSettings->TotalStrates; Settings.SelectedStrateCount = WorldSettings->TotalStrates;
Settings.InterStrateGapChunks = WorldSettings->InterStrateGapChunks; Settings.InterStrateGapChunks = FMath::Max(0, FMath::RoundToInt(
WorldSettings->InterStrateGapMeters * 1000000.0
/ FMath::Max(1.0, static_cast<double>(WorldSettings->StrateLayoutChunkSizeMeters) * 1000000.0)));
Settings.OriginSpineRadius = WorldSettings->OriginSpineRadius; Settings.OriginSpineRadius = WorldSettings->OriginSpineRadius;
Settings.WorldRadiusVoxels = WorldSettings->WorldRadiusVoxels; Settings.WorldRadiusVoxels = WorldSettings->WorldRadiusVoxels;
Settings.SeasonNumber = WorldSettings->CurrentSeason; Settings.SeasonNumber = WorldSettings->CurrentSeason;
@@ -1,5 +1,7 @@
#include "VoxelSettings.h" #include "VoxelSettings.h"
#include "VoxelForgeAssetVersion.h"
#include "VoxelStrateDefinition.h"
#include "VoxelSeasonAsset.h" #include "VoxelSeasonAsset.h"
#if WITH_EDITOR #if WITH_EDITOR
@@ -9,6 +11,74 @@
#include <VoxelForgeCore/VoxelForgeCore.h> #include <VoxelForgeCore/VoxelForgeCore.h>
#include <string> #include <string>
void UVoxelSettings::Serialize(FArchive& Ar)
{
Ar.UsingCustomVersion(VoxelForgeAssetVersion::GUID);
Super::Serialize(Ar);
if (Ar.IsLoading() && Ar.CustomVer(VoxelForgeAssetVersion::GUID)
< VoxelForgeAssetVersion::MetreAuthoringV1)
{
const double LayoutChunkMeters = FMath::IsFinite(StrateLayoutChunkSizeMeters)
? FMath::Max(0.001, static_cast<double>(StrateLayoutChunkSizeMeters)) : 8.0;
InterStrateGapMeters = static_cast<double>(FMath::Max(0, InterStrateGapChunks))
* LayoutChunkMeters;
UE_LOG(LogTemp, Display,
TEXT("[VoxelForgeAssetUpgrade] type=Settings asset=%s gap_chunks=%d gap_m=%.6f layout_chunk_m=%.6f"),
*GetPathName(), InterStrateGapChunks, InterStrateGapMeters, LayoutChunkMeters);
}
}
void UVoxelSettings::PostLoad()
{
Super::PostLoad();
if (GetLinkerCustomVersion(VoxelForgeAssetVersion::GUID)
>= VoxelForgeAssetVersion::MetreAuthoringV1)
{
return;
}
// Resolve the legacy count against this settings asset's saved physical layout width.
// Convertit les anciens comptes avec la largeur physique sauvegardee dans ces reglages.
const double LayoutChunkMeters = FMath::IsFinite(StrateLayoutChunkSizeMeters)
? FMath::Max(0.001, static_cast<double>(StrateLayoutChunkSizeMeters)) : 8.0;
InterStrateGapMeters = static_cast<double>(FMath::Max(0, InterStrateGapChunks))
* LayoutChunkMeters;
TSet<UVoxelStrateDefinition*> Migrated;
const auto MigrateStrate = [this, LayoutChunkMeters, &Migrated](
const TSoftObjectPtr<UVoxelStrateDefinition>& SoftDefinition)
{
UVoxelStrateDefinition* Definition = SoftDefinition.LoadSynchronous();
if (Definition == nullptr || Migrated.Contains(Definition)
|| Definition->GetLinkerCustomVersion(VoxelForgeAssetVersion::GUID)
>= VoxelForgeAssetVersion::MetreAuthoringV1)
{
return;
}
Migrated.Add(Definition);
const int32 OldHeightChunks = Definition->StrateHeightInChunks;
const int32 OldTransitionChunks = Definition->TransitionBlendChunks;
Definition->StrateHeightMeters = static_cast<double>(FMath::Max(1, OldHeightChunks))
* LayoutChunkMeters;
Definition->TransitionWidthMeters = static_cast<double>(FMath::Max(0, OldTransitionChunks))
* LayoutChunkMeters;
Definition->MarkPackageDirty();
UE_LOG(LogTemp, Display,
TEXT("[VoxelForgeAssetUpgrade] type=Strate asset=%s height_chunks=%d height_m=%.6f transition_chunks=%d transition_m=%.6f effective_layout_chunk_m=%.6f"),
*Definition->GetPathName(), OldHeightChunks, Definition->StrateHeightMeters,
OldTransitionChunks, Definition->TransitionWidthMeters, LayoutChunkMeters);
};
for (const TSoftObjectPtr<UVoxelStrateDefinition>& Definition : StratePool)
{
MigrateStrate(Definition);
}
for (const TPair<int32, TSoftObjectPtr<UVoxelStrateDefinition>>& Definition : FixedStrates)
{
MigrateStrate(Definition.Value);
}
MarkPackageDirty();
}
int32 UVoxelSettings::GetEffectiveWorldSeed() const int32 UVoxelSettings::GetEffectiveWorldSeed() const
{ {
if (!Season.IsNull()) if (!Season.IsNull())
@@ -297,7 +297,11 @@ void RecordTile(const FTileSample& Sample)
"\"submitted_t_s\":%s,\"worker_start_t_s\":%s,\"worker_end_t_s\":%s,\"worker_thread_id\":%u," "\"submitted_t_s\":%s,\"worker_start_t_s\":%s,\"worker_end_t_s\":%s,\"worker_thread_id\":%u,"
"\"verdict\":%d,\"proof\":%d,\"empty\":%d,\"vertices\":%d,\"triangles\":%d,\"geometry_bytes\":%llu," "\"verdict\":%d,\"proof\":%d,\"empty\":%d,\"vertices\":%d,\"triangles\":%d,\"geometry_bytes\":%llu,"
"\"request_to_apply_s\":%s,\"queue_wait_s\":%s,\"worker_queue_s\":%s,\"result_queue_s\":%s,\"worker_task_s\":%s," "\"request_to_apply_s\":%s,\"queue_wait_s\":%s,\"worker_queue_s\":%s,\"result_queue_s\":%s,\"worker_task_s\":%s,"
"\"generation_s\":%s,\"classify_s\":%s,\"mesh_s\":%s,\"stream_s\":%s,\"apply_s\":%s"), "\"generation_s\":%s,"
#if PLATFORM_LINUX
"\"core_generate_s\":%s,\"mesh_copy_s\":%s,\"rmc_stream_build_s\":%s,"
#endif
"\"classify_s\":%s,\"mesh_s\":%s,\"stream_s\":%s,\"apply_s\":%s"),
Sample.TileX, Sample.TileY, Sample.TileZ, Sample.TileX, Sample.TileY, Sample.TileZ,
Sample.Level, Sample.WorkPriority, Sample.Level, Sample.WorkPriority,
static_cast<unsigned long long>(Sample.RequestOrdinal), static_cast<unsigned long long>(Sample.RequestOrdinal),
@@ -312,8 +316,12 @@ void RecordTile(const FTileSample& Sample)
static_cast<unsigned long long>(Sample.GeometryBytes), static_cast<unsigned long long>(Sample.GeometryBytes),
*Number(Sample.RequestToApplySeconds), *Number(Sample.QueueWaitSeconds), *Number(Sample.RequestToApplySeconds), *Number(Sample.QueueWaitSeconds),
*Number(Sample.WorkerQueueSeconds), *Number(Sample.ResultQueueSeconds), *Number(Sample.WorkerQueueSeconds), *Number(Sample.ResultQueueSeconds),
*Number(Sample.WorkerTaskSeconds), *Number(Sample.WorkerTaskSeconds), *Number(Sample.GenerationSeconds),
*Number(Sample.GenerationSeconds), *Number(Sample.ClassifySeconds), #if PLATFORM_LINUX
*Number(Sample.CoreGenerateSeconds), *Number(Sample.MeshCopySeconds),
*Number(Sample.StreamBuildSeconds),
#endif
*Number(Sample.ClassifySeconds),
*Number(Sample.MeshSeconds), *Number(Sample.StreamSeconds), *Number(Sample.ApplySeconds))); *Number(Sample.MeshSeconds), *Number(Sample.StreamSeconds), *Number(Sample.ApplySeconds)));
} }
@@ -1,20 +1,17 @@
// Serialized strate-definition migrations. // Serialized strate-definition migrations.
#include "VoxelStrateDefinition.h" #include "VoxelStrateDefinition.h"
#include "VoxelForgeAssetVersion.h"
#include "Serialization/CustomVersion.h" #include "Serialization/CustomVersion.h"
#include "VoxelPassageGeometry.h" #include "VoxelPassageGeometry.h"
namespace namespace
{ {
// The field name is retained for package compatibility, but version 1 changes its meaning constexpr int32 GVoxelForgeStrateGentleSlopeDegreesVersion = VoxelForgeAssetVersion::TunnelFloorSlopeDegrees;
// from a raw tangent/gradient to authored degrees. This GUID is local to the plugin.
const FGuid GVoxelForgeStrateSerializationVersion(
0xA76D5E31, 0x4B2C4F9A, 0xB8C1D204, 0x6E9F7738);
constexpr int32 GVoxelForgeStrateGentleSlopeDegreesVersion = 1;
FCustomVersionRegistration GVoxelForgeStrateSerializationRegistration( FCustomVersionRegistration GVoxelForgeStrateSerializationRegistration(
GVoxelForgeStrateSerializationVersion, VoxelForgeAssetVersion::GUID,
GVoxelForgeStrateGentleSlopeDegreesVersion, VoxelForgeAssetVersion::MetreAuthoringV1,
TEXT("VoxelForgeStrateSerialization")); TEXT("VoxelForgeStrateSerialization"));
float LegacyGradientToDegrees(float LegacyGradient) float LegacyGradientToDegrees(float LegacyGradient)
@@ -58,6 +55,31 @@ namespace
} }
} }
void UVoxelStrateDefinition::Serialize(FArchive& Ar)
{
Ar.UsingCustomVersion(VoxelForgeAssetVersion::GUID);
Super::Serialize(Ar);
if (Ar.IsLoading() && Ar.CustomVer(VoxelForgeAssetVersion::GUID)
< VoxelForgeAssetVersion::MetreAuthoringV1)
{
// A stand-alone strate has no owning settings object during Serialize. Convert using the
// current 8 m layout default here; UVoxelSettings corrects referenced old strates using
// their saved effective width during its own load upgrade.
// Une strate seule n'a pas ses reglages proprietaires ici; UVoxelSettings corrige ensuite
// les references avec leur largeur physique sauvegardee.
constexpr double LegacyDefaultLayoutChunkMeters = 8.0;
StrateHeightMeters = static_cast<double>(FMath::Max(1, StrateHeightInChunks))
* LegacyDefaultLayoutChunkMeters;
TransitionWidthMeters = static_cast<double>(FMath::Max(0, TransitionBlendChunks))
* LegacyDefaultLayoutChunkMeters;
UE_LOG(LogTemp, Display,
TEXT("[VoxelForgeAssetUpgrade] type=Strate asset=%s height_chunks=%d height_m=%.6f transition_chunks=%d transition_m=%.6f fallback_layout_chunk_m=%.6f"),
*GetPathName(), StrateHeightInChunks, StrateHeightMeters,
TransitionBlendChunks, TransitionWidthMeters, LegacyDefaultLayoutChunkMeters);
}
}
void UVoxelStrateDefinition::PostLoad() void UVoxelStrateDefinition::PostLoad()
{ {
Super::PostLoad(); Super::PostLoad();
@@ -67,7 +89,7 @@ void UVoxelStrateDefinition::PostLoad()
// is normalized to the ignored compatibility default before any runtime copy is made. // is normalized to the ignored compatibility default before any runtime copy is made.
GenerationParams.bTunnelFloorEnabled = true; GenerationParams.bTunnelFloorEnabled = true;
if (GetLinkerCustomVersion(GVoxelForgeStrateSerializationVersion) if (GetLinkerCustomVersion(VoxelForgeAssetVersion::GUID)
>= GVoxelForgeStrateGentleSlopeDegreesVersion) >= GVoxelForgeStrateGentleSlopeDegreesVersion)
{ {
return; return;
+228 -94
View File
@@ -13,6 +13,7 @@
#include "VoxelTerrainOpDefinition.h" // For UVoxelTerrainOpDefinition::ApplyTo #include "VoxelTerrainOpDefinition.h" // For UVoxelTerrainOpDefinition::ApplyTo
#include "VoxelBiomeDefinition.h" // For UVoxelBiomeDefinition (biome context flatten) #include "VoxelBiomeDefinition.h" // For UVoxelBiomeDefinition (biome context flatten)
#include "HAL/IConsoleManager.h" #include "HAL/IConsoleManager.h"
#include <cmath> // std::llround
#include "Misc/CommandLine.h" #include "Misc/CommandLine.h"
#include "Misc/Crc.h" #include "Misc/Crc.h"
#include "Misc/Parse.h" #include "Misc/Parse.h"
@@ -24,6 +25,27 @@ namespace
{ {
std::atomic<uint64> GNextStrateManagerLifetimeId { 0 }; std::atomic<uint64> GNextStrateManagerLifetimeId { 0 };
int64 VF_OwnerVoxelsToMicrometres(double OwnerVoxels)
{
return static_cast<int64>(std::llround(
OwnerVoxels * static_cast<double>(VOXEL_SIZE) * 10000.0));
}
float VF_ResolvedWorldMicrometresToOwnerVoxels(int64 WorldMicrometres)
{
return static_cast<float>(static_cast<double>(WorldMicrometres)
/ (static_cast<double>(VOXEL_SIZE) * 10000.0));
}
int64 VF_FloorDivide64(int64 Numerator, int64 Denominator)
{
if (Denominator <= 0) return 0;
int64 Quotient = Numerator / Denominator;
const int64 Remainder = Numerator % Denominator;
if (Remainder < 0) --Quotient;
return Quotient;
}
// Exact A/B switch for the repeated passage-floor projection item. The other field- // Exact A/B switch for the repeated passage-floor projection item. The other field-
// preserving rewrites in this round are deliberately unconditional; this switch isolates // preserving rewrites in this round are deliberately unconditional; this switch isolates
// the projection reuse without changing any density arithmetic. // the projection reuse without changing any density arithmetic.
@@ -1233,7 +1255,8 @@ bool UVoxelStrateManager::Initialize(UVoxelSettings* Settings, int32 WorldSeed)
? SeasonManifest.Strates.Num() : Settings->TotalStrates; ? SeasonManifest.Strates.Num() : Settings->TotalStrates;
const int32 LayoutGapChunks = bUseSeason const int32 LayoutGapChunks = bUseSeason
? SeasonManifest.InterStrateGapChunks ? SeasonManifest.InterStrateGapChunks
: FMath::Max(0, Settings->InterStrateGapChunks); : FMath::Max(0, FMath::RoundToInt(static_cast<double>(Settings->InterStrateGapMeters)
* 1000000.0 / std::max<uint32>(1, StrateLayoutChunkSizeMicrometres)));
//========================================================================= //=========================================================================
// STEP 1: Build shuffled pool (seed-based randomization) // STEP 1: Build shuffled pool (seed-based randomization)
@@ -1300,8 +1323,11 @@ bool UVoxelStrateManager::Initialize(UVoxelSettings* Settings, int32 WorldSeed)
} }
} }
// Current Z position (in chunks). Starts at 0 and goes downward (negative). // Resolve the stack in physical integer micrometres first. The historical chunk indices are
int32 CurrentTopZ = 0; // projected from these half-open bounds only after each slot is complete.
int64 CurrentTopWorldMicrometres = StrateLayoutChunkSizeMicrometres;
const int64 ResolvedGapMicrometres = static_cast<int64>(LayoutGapChunks)
* StrateLayoutChunkSizeMicrometres;
for (int32 i = 0; i < TotalStrates; i++) for (int32 i = 0; i < TotalStrates; i++)
{ {
@@ -1344,7 +1370,8 @@ bool UVoxelStrateManager::Initialize(UVoxelSettings* Settings, int32 WorldSeed)
} }
Slot.Definition->GeneratorType = SeasonStrate.Archetype; Slot.Definition->GeneratorType = SeasonStrate.Archetype;
Slot.Definition->StrateHeightInChunks = SeasonStrate.HeightInChunks; Slot.Definition->StrateHeightMeters = static_cast<double>(SeasonStrate.HeightInChunks)
* StrateLayoutChunkSizeMicrometres / 1000000.0;
Slot.Definition->GenerationParams = SeasonStrate.Params.TunnelNetworkParams; Slot.Definition->GenerationParams = SeasonStrate.Params.TunnelNetworkParams;
Slot.Definition->SlabParams = SeasonStrate.Params.SlabParams; Slot.Definition->SlabParams = SeasonStrate.Params.SlabParams;
Slot.Definition->MazeParams = SeasonStrate.Params.MazeParams; Slot.Definition->MazeParams = SeasonStrate.Params.MazeParams;
@@ -1356,16 +1383,28 @@ bool UVoxelStrateManager::Initialize(UVoxelSettings* Settings, int32 WorldSeed)
const int32 LayoutChunkVoxels=FMath::RoundToInt(StrateLayoutChunkWidthVoxels); const int32 LayoutChunkVoxels=FMath::RoundToInt(StrateLayoutChunkWidthVoxels);
Slot.TopChunkZ = SeasonStrate.TopWorldZ / LayoutChunkVoxels - 1; Slot.TopChunkZ = SeasonStrate.TopWorldZ / LayoutChunkVoxels - 1;
Slot.BottomChunkZ = SeasonStrate.BottomWorldZ / LayoutChunkVoxels; Slot.BottomChunkZ = SeasonStrate.BottomWorldZ / LayoutChunkVoxels;
Slot.TopWorldMicrometres = (static_cast<int64>(Slot.TopChunkZ) + 1)
* StrateLayoutChunkSizeMicrometres;
Slot.BottomWorldMicrometres = static_cast<int64>(Slot.BottomChunkZ)
* StrateLayoutChunkSizeMicrometres;
Slot.HeightMicrometres = Slot.TopWorldMicrometres - Slot.BottomWorldMicrometres;
const int64 ExpectedTopChunk = VF_FloorDivide64(
CurrentTopWorldMicrometres, StrateLayoutChunkSizeMicrometres) - 1;
const int64 ExpectedBottomChunk = ExpectedTopChunk - (Slot.HeightInChunks - 1);
if (SeasonStrate.TopWorldZ % LayoutChunkVoxels != 0 if (SeasonStrate.TopWorldZ % LayoutChunkVoxels != 0
|| SeasonStrate.BottomWorldZ % LayoutChunkVoxels != 0 || SeasonStrate.BottomWorldZ % LayoutChunkVoxels != 0
|| Slot.TopChunkZ != CurrentTopZ || Slot.TopChunkZ != ExpectedTopChunk
|| Slot.BottomChunkZ != CurrentTopZ - (Slot.HeightInChunks - 1)) || Slot.BottomChunkZ != ExpectedBottomChunk
|| Slot.TopWorldMicrometres != CurrentTopWorldMicrometres
|| Slot.HeightMicrometres != static_cast<int64>(Slot.HeightInChunks)
* StrateLayoutChunkSizeMicrometres)
{ {
UE_LOG(LogTemp, Error, UE_LOG(LogTemp, Error,
TEXT("[StrateManager] Season slot %d bounds do not describe the declared stacked layout."), i); TEXT("[StrateManager] Season slot %d bounds do not describe the declared stacked layout."), i);
RestorePreviousLayout(); RestorePreviousLayout();
return false; return false;
} }
CurrentTopWorldMicrometres = Slot.BottomWorldMicrometres - ResolvedGapMicrometres;
SeasonStrates.Add(SeasonStrate); SeasonStrates.Add(SeasonStrate);
} }
else else
@@ -1388,15 +1427,54 @@ bool UVoxelStrateManager::Initialize(UVoxelSettings* Settings, int32 WorldSeed)
continue; continue;
} }
// Compute Z range from definition's height // Resolve the authored chunk height into an exact physical interval.
Slot.HeightInChunks = Slot.Definition->StrateHeightInChunks; Slot.HeightInChunks = FMath::Max(1, FMath::RoundToInt(
Slot.TopChunkZ = CurrentTopZ; Slot.Definition->StrateHeightMeters * 1000000.0
Slot.BottomChunkZ = CurrentTopZ - (Slot.HeightInChunks - 1); / std::max<uint32>(1, StrateLayoutChunkSizeMicrometres)));
Slot.TopWorldMicrometres = CurrentTopWorldMicrometres;
Slot.HeightMicrometres = static_cast<int64>(Slot.HeightInChunks)
* StrateLayoutChunkSizeMicrometres;
Slot.BottomWorldMicrometres = Slot.TopWorldMicrometres - Slot.HeightMicrometres;
Slot.TopChunkZ = static_cast<int32>(VF_FloorDivide64(
Slot.TopWorldMicrometres, StrateLayoutChunkSizeMicrometres) - 1);
Slot.BottomChunkZ = static_cast<int32>(VF_FloorDivide64(
Slot.BottomWorldMicrometres, StrateLayoutChunkSizeMicrometres));
CurrentTopWorldMicrometres = Slot.BottomWorldMicrometres - ResolvedGapMicrometres;
} }
// Move the cursor down for the next strate, leaving a solid-bedrock gap of Slot.ResolvedTransitionType = Slot.Definition->TransitionType;
// InterStrateGapChunks chunks between this strate and the next. Slot.ResolvedTransitionBlendChunks = FMath::Max(0, FMath::RoundToInt(
CurrentTopZ = Slot.BottomChunkZ - 1 - LayoutGapChunks; Slot.Definition->TransitionWidthMeters * 1000000.0
/ std::max<uint32>(1, StrateLayoutChunkSizeMicrometres)));
Slot.TransitionWidthMicrometres = static_cast<int64>(Slot.ResolvedTransitionBlendChunks)
* StrateLayoutChunkSizeMicrometres;
Slot.ResolvedPassageConfig = Slot.Definition->PassageConfig;
Slot.PassageMouthRadiusMicrometres = VF_OwnerVoxelsToMicrometres(
Slot.ResolvedPassageConfig.MouthRadius);
Slot.PassageMidRadiusMicrometres = VF_OwnerVoxelsToMicrometres(
Slot.ResolvedPassageConfig.MidRadius);
Slot.PassageReachMinimumMicrometres = VF_OwnerVoxelsToMicrometres(
Slot.ResolvedPassageConfig.ReachMin);
Slot.PassageReachMaximumMicrometres = VF_OwnerVoxelsToMicrometres(
Slot.ResolvedPassageConfig.ReachMax);
Slot.PassageDistanceMinimumMicrometres = VF_OwnerVoxelsToMicrometres(
Slot.ResolvedPassageConfig.DistanceMin);
Slot.PassageDistanceMaximumMicrometres = VF_OwnerVoxelsToMicrometres(
Slot.ResolvedPassageConfig.DistanceMax);
Slot.PassageWanderMicrometres = VF_OwnerVoxelsToMicrometres(
Slot.ResolvedPassageConfig.Wander);
Slot.PassageVerticalWobbleMicrometres = VF_OwnerVoxelsToMicrometres(
Slot.ResolvedPassageConfig.VerticalWobble);
Slot.PassageSpiralRadiusMicrometres = VF_OwnerVoxelsToMicrometres(
Slot.ResolvedPassageConfig.SpiralRadius);
Slot.PassageCascadeLedgeMicrometres = VF_OwnerVoxelsToMicrometres(
Slot.ResolvedPassageConfig.CascadeLedge);
Slot.LegacyTopWorldZVoxels = VF_ResolvedWorldMicrometresToOwnerVoxels(
Slot.TopWorldMicrometres);
Slot.LegacyBottomWorldZVoxels = VF_ResolvedWorldMicrometresToOwnerVoxels(
Slot.BottomWorldMicrometres);
Slot.LegacyHeightVoxels = VF_ResolvedWorldMicrometresToOwnerVoxels(
Slot.HeightMicrometres);
StrateLayout.Add(Slot); StrateLayout.Add(Slot);
@@ -1429,6 +1507,7 @@ bool UVoxelStrateManager::Initialize(UVoxelSettings* Settings, int32 WorldSeed)
OriginSpineRadius = bUseSeason OriginSpineRadius = bUseSeason
? SeasonManifest.OriginSpineRadius : Settings->OriginSpineRadius; ? SeasonManifest.OriginSpineRadius : Settings->OriginSpineRadius;
InterStrateGapChunks = LayoutGapChunks; InterStrateGapChunks = LayoutGapChunks;
ResolvedInterStrateGapMicrometres = ResolvedGapMicrometres;
if (bUseSeason) if (bUseSeason)
{ {
ActiveSeasonContentHash = SeasonManifest.ContentHash; ActiveSeasonContentHash = SeasonManifest.ContentHash;
@@ -1537,8 +1616,8 @@ bool UVoxelStrateManager::SetComposerOverrideForStrate(
} }
VF_SetComposerRuntimeBounds( VF_SetComposerRuntimeBounds(
Override->Params, Override->Params,
(float)(TargetSlot->TopChunkZ + 1) * StrateLayoutChunkWidthVoxels, TargetSlot->LegacyTopWorldZVoxels,
(float)TargetSlot->BottomChunkZ * StrateLayoutChunkWidthVoxels); TargetSlot->LegacyBottomWorldZVoxels);
Override->bUseRecipe = bUseRecipe; Override->bUseRecipe = bUseRecipe;
if (Recipe != nullptr) if (Recipe != nullptr)
{ {
@@ -1557,8 +1636,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) * StrateLayoutChunkWidthVoxels; Override->Regions.StrateTopWorldZ = TargetSlot->LegacyTopWorldZVoxels;
Override->Regions.StrateBottomWorldZ = (float)TargetSlot->BottomChunkZ * StrateLayoutChunkWidthVoxels; Override->Regions.StrateBottomWorldZ = TargetSlot->LegacyBottomWorldZVoxels;
VF_SetStrateArchetypeRuntimeBounds(Override->Params, VF_SetStrateArchetypeRuntimeBounds(Override->Params,
Override->Regions.StrateTopWorldZ, Override->Regions.StrateTopWorldZ,
Override->Regions.StrateBottomWorldZ); Override->Regions.StrateBottomWorldZ);
@@ -1805,14 +1884,36 @@ void UVoxelStrateManager::GeneratePassages()
// that opens the next room rather than a second vertical spine. // that opens the next room rather than a second vertical spine.
const UVoxelStrateDefinition* UpperDef = Upper.Definition; const UVoxelStrateDefinition* UpperDef = Upper.Definition;
if (!UpperDef) continue; if (!UpperDef) continue;
const FStratePassageConfig& Cfg = UpperDef->PassageConfig; // GeneratePassages is the legacy owner-voxel route adapter. Its immutable source is the
// physical passage record resolved during Initialize, converted back to owner voxels here.
FStratePassageConfig Cfg = Upper.ResolvedPassageConfig;
Cfg.MouthRadius = VF_ResolvedWorldMicrometresToOwnerVoxels(
Upper.PassageMouthRadiusMicrometres);
Cfg.MidRadius = VF_ResolvedWorldMicrometresToOwnerVoxels(
Upper.PassageMidRadiusMicrometres);
Cfg.ReachMin = VF_ResolvedWorldMicrometresToOwnerVoxels(
Upper.PassageReachMinimumMicrometres);
Cfg.ReachMax = VF_ResolvedWorldMicrometresToOwnerVoxels(
Upper.PassageReachMaximumMicrometres);
Cfg.DistanceMin = VF_ResolvedWorldMicrometresToOwnerVoxels(
Upper.PassageDistanceMinimumMicrometres);
Cfg.DistanceMax = VF_ResolvedWorldMicrometresToOwnerVoxels(
Upper.PassageDistanceMaximumMicrometres);
Cfg.Wander = VF_ResolvedWorldMicrometresToOwnerVoxels(
Upper.PassageWanderMicrometres);
Cfg.VerticalWobble = VF_ResolvedWorldMicrometresToOwnerVoxels(
Upper.PassageVerticalWobbleMicrometres);
Cfg.SpiralRadius = VF_ResolvedWorldMicrometresToOwnerVoxels(
Upper.PassageSpiralRadiusMicrometres);
Cfg.CascadeLedge = VF_ResolvedWorldMicrometresToOwnerVoxels(
Upper.PassageCascadeLedgeMicrometres);
// 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) * StrateLayoutChunkWidthVoxels; const float UpperTopZ = Upper.LegacyTopWorldZVoxels;
const float UpperBottomZ = (float)(Upper.BottomChunkZ) * StrateLayoutChunkWidthVoxels; const float UpperBottomZ = Upper.LegacyBottomWorldZVoxels;
const float LowerTopZ = (float)(Lower.TopChunkZ + 1) * StrateLayoutChunkWidthVoxels; const float LowerTopZ = Lower.LegacyTopWorldZVoxels;
const float UpperMax = (float)Upper.HeightInChunks * StrateLayoutChunkWidthVoxels * 0.9f; const float UpperMax = Upper.LegacyHeightVoxels * 0.9f;
const float LowerMax = (float)Lower.HeightInChunks * StrateLayoutChunkWidthVoxels * 0.9f; const float LowerMax = Lower.LegacyHeightVoxels * 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);
@@ -1942,7 +2043,7 @@ void UVoxelStrateManager::GeneratePassages()
LowerDef->FloatingIslandParams, LowerDef->FloatingIslandParams,
LowerQuerySeed, LowerQuerySeed,
LowerTopZ, LowerTopZ,
(float)(Lower.BottomChunkZ) * StrateLayoutChunkWidthVoxels, Lower.LegacyBottomWorldZVoxels,
PX, PX,
PY, PY,
MaxLateralSnap, MaxLateralSnap,
@@ -2002,7 +2103,7 @@ void UVoxelStrateManager::GeneratePassages()
if (bAimedLowerAtPlayerFitPoint) if (bAimedLowerAtPlayerFitPoint)
{ {
const float LowerSealThickness = BoundarySealThicknessFor(*LowerDef); const float LowerSealThickness = BoundarySealThicknessFor(*LowerDef);
const float LowerBottomZ = (float)(Lower.BottomChunkZ) * StrateLayoutChunkWidthVoxels; const float LowerBottomZ = Lower.LegacyBottomWorldZVoxels;
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)
@@ -2170,7 +2271,7 @@ void UVoxelStrateManager::GeneratePassages()
Cfg.MouthRadius, Cfg.MouthRadius,
LowerDoorDirection, LowerDoorDirection,
LowerTopZ, LowerTopZ,
(float)(Lower.BottomChunkZ) * StrateLayoutChunkWidthVoxels, Lower.LegacyBottomWorldZVoxels,
LowerDef ? BoundarySealThicknessFor(*LowerDef) : 0.0f, LowerDef ? BoundarySealThicknessFor(*LowerDef) : 0.0f,
bAimedLowerAtPlayerFitPoint); bAimedLowerAtPlayerFitPoint);
Passage.UpperPoint = Passage.UpperLanding.StandingPoint; Passage.UpperPoint = Passage.UpperLanding.StandingPoint;
@@ -2595,8 +2696,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) * StrateLayoutChunkWidthVoxels; const float TopZ = Top.LegacyTopWorldZVoxels;
const float BottomZ = (float)Top.BottomChunkZ * StrateLayoutChunkWidthVoxels; const float BottomZ = Top.LegacyBottomWorldZVoxels;
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 =
@@ -5921,8 +6022,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) * StrateLayoutChunkWidthVoxels; const float TopZ = Slot.LegacyTopWorldZVoxels;
const float BottomZ = static_cast<float>(Slot.BottomChunkZ) * StrateLayoutChunkWidthVoxels; const float BottomZ = Slot.LegacyBottomWorldZVoxels;
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(
@@ -5964,8 +6065,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) * StrateLayoutChunkWidthVoxels; const float TopZ = Slot.LegacyTopWorldZVoxels;
const float BottomZ = static_cast<float>(Slot.BottomChunkZ) * StrateLayoutChunkWidthVoxels; const float BottomZ = Slot.LegacyBottomWorldZVoxels;
if (VoxelPassageGeometry::OriginLandingRoomTouchesBox( if (VoxelPassageGeometry::OriginLandingRoomTouchesBox(
VoxelBox, TopZ, BottomZ, VoxelBox, TopZ, BottomZ,
VF_BoundarySealThicknessForDefinition(*Slot.Definition), VF_BoundarySealThicknessForDefinition(*Slot.Definition),
@@ -5985,8 +6086,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) * StrateLayoutChunkWidthVoxels; const float TopZ = Slot.LegacyTopWorldZVoxels;
const float BottomZ = static_cast<float>(Slot.BottomChunkZ) * StrateLayoutChunkWidthVoxels; const float BottomZ = Slot.LegacyBottomWorldZVoxels;
if (VoxelPassageGeometry::OriginLandingFloorTouchesBox( if (VoxelPassageGeometry::OriginLandingFloorTouchesBox(
VoxelBox, TopZ, BottomZ, VoxelBox, TopZ, BottomZ,
VF_BoundarySealThicknessForDefinition(*Slot.Definition), VF_BoundarySealThicknessForDefinition(*Slot.Definition),
@@ -6010,8 +6111,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) * StrateLayoutChunkWidthVoxels; const float TopZ = Slot.LegacyTopWorldZVoxels;
const float BottomZ = static_cast<float>(Slot.BottomChunkZ) * StrateLayoutChunkWidthVoxels; const float BottomZ = Slot.LegacyBottomWorldZVoxels;
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,
@@ -6048,8 +6149,8 @@ bool UVoxelStrateManager::AnyOriginLandingAirNearLattice(
{ {
continue; continue;
} }
const float TopZ = (static_cast<float>(Slot.TopChunkZ) + 1.0f) * StrateLayoutChunkWidthVoxels; const float TopZ = Slot.LegacyTopWorldZVoxels;
const float BottomZ = static_cast<float>(Slot.BottomChunkZ) * StrateLayoutChunkWidthVoxels; const float BottomZ = Slot.LegacyBottomWorldZVoxels;
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(
@@ -6125,8 +6226,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) * StrateLayoutChunkWidthVoxels; const float TopZ = Slot.LegacyTopWorldZVoxels;
const float BottomZ = static_cast<float>(Slot.BottomChunkZ) * StrateLayoutChunkWidthVoxels; const float BottomZ = Slot.LegacyBottomWorldZVoxels;
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))
@@ -6143,15 +6244,36 @@ bool UVoxelStrateManager::AnyOriginLandingFloorNearLattice(
int32 UVoxelStrateManager::FindSlotIndexForChunkZ(int32 ChunkZ) const int32 UVoxelStrateManager::FindSlotIndexForChunkZ(int32 ChunkZ) const
{ {
// Linear search through strate layout. // Legacy chunk callers use the projected interval cached during Initialize. The source bounds
// With ~10-20 strates this is fine. If we ever have hundreds, // are the slot's physical micrometre interval; these indices do not define or stack strates.
// switch to binary search (layout is sorted by Z). for (int32 i = 0; i < StrateLayout.Num(); ++i)
for (int32 i = 0; i < StrateLayout.Num(); i++)
{ {
const FStrateSlot& Slot = StrateLayout[i]; const FStrateSlot& Slot = StrateLayout[i];
if (ChunkZ <= Slot.TopChunkZ && ChunkZ >= Slot.BottomChunkZ) if (ChunkZ <= Slot.TopChunkZ && ChunkZ >= Slot.BottomChunkZ) return i;
}
return -1;
}
int32 UVoxelStrateManager::FindSlotIndexForWorldZCentimetres(double WorldZCentimetres) const
{
const double WorldZMicrometres = WorldZCentimetres * 10000.0;
int32 Low = 0;
int32 High = StrateLayout.Num() - 1;
while (Low <= High)
{
const int32 Mid = Low + (High - Low) / 2;
const FStrateSlot& Slot = StrateLayout[Mid];
if (WorldZMicrometres >= static_cast<double>(Slot.TopWorldMicrometres))
{ {
return i; High = Mid - 1;
}
else if (WorldZMicrometres < static_cast<double>(Slot.BottomWorldMicrometres))
{
Low = Mid + 1;
}
else
{
return Mid;
} }
} }
return -1; return -1;
@@ -6159,9 +6281,8 @@ 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 if (!FMath::IsFinite(WorldZ)) return nullptr;
int32 ChunkZ = FMath::FloorToInt((WorldZ / VOXEL_SIZE) / StrateLayoutChunkWidthVoxels); const int32 SlotIdx = FindSlotIndexForWorldZCentimetres(WorldZ);
int32 SlotIdx = FindSlotIndexForChunkZ(ChunkZ);
if (SlotIdx >= 0) if (SlotIdx >= 0)
{ {
return StrateLayout[SlotIdx].Definition; return StrateLayout[SlotIdx].Definition;
@@ -6171,8 +6292,8 @@ 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) / StrateLayoutChunkWidthVoxels); if (!FMath::IsFinite(WorldZ)) return -1;
int32 SlotIdx = FindSlotIndexForChunkZ(ChunkZ); const int32 SlotIdx = FindSlotIndexForWorldZCentimetres(WorldZ);
if (SlotIdx >= 0) if (SlotIdx >= 0)
{ {
return StrateLayout[SlotIdx].StrateIndex; return StrateLayout[SlotIdx].StrateIndex;
@@ -6285,9 +6406,13 @@ bool UVoxelStrateManager::IsGapChunk(const FIntVector& ChunkCoord) const
if (StrateLayout.Num() == 0) return false; if (StrateLayout.Num() == 0) return false;
// Above the top strate or below the bottom strate = open air, NOT a gap. // Above the top strate or below the bottom strate = open air, NOT a gap.
const int32 StackTop = StrateLayout[0].TopChunkZ; const int64 ChunkCenterMicrometres = static_cast<int64>(ChunkCoord.Z)
const int32 StackBottom = StrateLayout.Last().BottomChunkZ; * StrateLayoutChunkSizeMicrometres + StrateLayoutChunkSizeMicrometres / 2;
if (ChunkCoord.Z > StackTop || ChunkCoord.Z < StackBottom) return false; if (ChunkCenterMicrometres >= StrateLayout[0].TopWorldMicrometres
|| ChunkCenterMicrometres < StrateLayout.Last().BottomWorldMicrometres)
{
return false;
}
// Inside the stack's Z span but not in any strate slot → it's a bedrock gap. // Inside the stack's Z span but not in any strate slot → it's a bedrock gap.
return FindSlotIndexForChunkZ(ChunkCoord.Z) < 0; return FindSlotIndexForChunkZ(ChunkCoord.Z) < 0;
@@ -6331,8 +6456,8 @@ 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)*StrateLayoutChunkWidthVoxels. // TopChunkZ+1 because the top chunk's CEILING is at (TopChunkZ+1)*StrateLayoutChunkWidthVoxels.
Result.StrateTopWorldZ = (float)(Slot.TopChunkZ + 1) * StrateLayoutChunkWidthVoxels; Result.StrateTopWorldZ = Slot.LegacyTopWorldZVoxels;
Result.StrateBottomWorldZ = (float)(Slot.BottomChunkZ) * StrateLayoutChunkWidthVoxels; Result.StrateBottomWorldZ = Slot.LegacyBottomWorldZVoxels;
return Result; return Result;
} }
@@ -6365,8 +6490,8 @@ FMazeGenerationParams UVoxelStrateManager::GetMazeParamsForChunk(const FIntVecto
} }
} }
#endif #endif
Result.StrateTopWorldZ = (float)(Slot.TopChunkZ + 1) * StrateLayoutChunkWidthVoxels; Result.StrateTopWorldZ = Slot.LegacyTopWorldZVoxels;
Result.StrateBottomWorldZ = (float)Slot.BottomChunkZ * StrateLayoutChunkWidthVoxels; Result.StrateBottomWorldZ = Slot.LegacyBottomWorldZVoxels;
return Result; return Result;
} }
@@ -6392,8 +6517,8 @@ FSurfaceGenerationParams UVoxelStrateManager::GetSurfaceParamsForChunk(const FIn
} }
} }
#endif #endif
Result.StrateTopWorldZ = (float)(Slot.TopChunkZ + 1) * StrateLayoutChunkWidthVoxels; Result.StrateTopWorldZ = Slot.LegacyTopWorldZVoxels;
Result.StrateBottomWorldZ = (float)Slot.BottomChunkZ * StrateLayoutChunkWidthVoxels; Result.StrateBottomWorldZ = Slot.LegacyBottomWorldZVoxels;
return Result; return Result;
} }
@@ -6419,8 +6544,8 @@ FVerticalShaftParams UVoxelStrateManager::GetVerticalShaftParamsForChunk(const F
} }
} }
#endif #endif
Result.StrateTopWorldZ = (float)(Slot.TopChunkZ + 1) * StrateLayoutChunkWidthVoxels; Result.StrateTopWorldZ = Slot.LegacyTopWorldZVoxels;
Result.StrateBottomWorldZ = (float)Slot.BottomChunkZ * StrateLayoutChunkWidthVoxels; Result.StrateBottomWorldZ = Slot.LegacyBottomWorldZVoxels;
return Result; return Result;
} }
@@ -6446,8 +6571,8 @@ FFloatingIslandParams UVoxelStrateManager::GetFloatingIslandParamsForChunk(const
} }
} }
#endif #endif
Result.StrateTopWorldZ = (float)(Slot.TopChunkZ + 1) * StrateLayoutChunkWidthVoxels; Result.StrateTopWorldZ = Slot.LegacyTopWorldZVoxels;
Result.StrateBottomWorldZ = (float)Slot.BottomChunkZ * StrateLayoutChunkWidthVoxels; Result.StrateBottomWorldZ = Slot.LegacyBottomWorldZVoxels;
return Result; return Result;
} }
@@ -6481,14 +6606,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) / StrateLayoutChunkWidthVoxels); if (!FMath::IsFinite(WorldZ)) return false;
const int32 SlotIdx = FindSlotIndexForChunkZ(ChunkZ); const int32 SlotIdx = FindSlotIndexForWorldZCentimetres(WorldZ);
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. // Return the resolved physical bounds in Unreal centimeters.
OutTopZ = (float)(Slot.TopChunkZ + 1) * StrateLayoutChunkWidthVoxels * VOXEL_SIZE; OutTopZ = static_cast<float>(static_cast<double>(Slot.TopWorldMicrometres) / 10000.0);
OutBottomZ = (float)(Slot.BottomChunkZ) * StrateLayoutChunkWidthVoxels * VOXEL_SIZE; OutBottomZ = static_cast<float>(static_cast<double>(Slot.BottomWorldMicrometres) / 10000.0);
return true; return true;
} }
@@ -6501,8 +6626,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) * StrateLayoutChunkWidthVoxels; Result.StrateTopWorldZ = Slot.LegacyTopWorldZVoxels;
Result.StrateBottomWorldZ = (float)(Slot.BottomChunkZ) * StrateLayoutChunkWidthVoxels; Result.StrateBottomWorldZ = Slot.LegacyBottomWorldZVoxels;
return Result; return Result;
} }
@@ -6534,8 +6659,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) * StrateLayoutChunkWidthVoxels; const float BottomZ = Slot.LegacyBottomWorldZVoxels;
const float TopZ = (float)(Slot.TopChunkZ + 1) * StrateLayoutChunkWidthVoxels; const float TopZ = Slot.LegacyTopWorldZVoxels;
return FMath::Lerp(BottomZ, TopZ, FMath::Clamp(Rel, 0.0f, 1.0f)); return FMath::Lerp(BottomZ, TopZ, FMath::Clamp(Rel, 0.0f, 1.0f));
} }
@@ -6579,8 +6704,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) * StrateLayoutChunkWidthVoxels; Result.StrateTopWorldZ = Slot.LegacyTopWorldZVoxels;
Result.StrateBottomWorldZ = (float)Slot.BottomChunkZ * StrateLayoutChunkWidthVoxels; Result.StrateBottomWorldZ = Slot.LegacyBottomWorldZVoxels;
// 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);
@@ -6590,8 +6715,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) * StrateLayoutChunkWidthVoxels; Result.StrateTopWorldZ = Slot.LegacyTopWorldZVoxels;
Result.StrateBottomWorldZ = (float)Slot.BottomChunkZ * StrateLayoutChunkWidthVoxels; Result.StrateBottomWorldZ = Slot.LegacyBottomWorldZVoxels;
// 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);
@@ -6608,8 +6733,8 @@ 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) * StrateLayoutChunkWidthVoxels; BaseParams.StrateTopWorldZ = Slot.LegacyTopWorldZVoxels;
BaseParams.StrateBottomWorldZ = (float)(Slot.BottomChunkZ) * StrateLayoutChunkWidthVoxels; BaseParams.StrateBottomWorldZ = Slot.LegacyBottomWorldZVoxels;
// Core currently dispatches one generator field per resolved strate. Gradient and // Core currently dispatches one generator field per resolved strate. Gradient and
// interleaved metadata therefore use the explicitly declared Hard fallback for every // interleaved metadata therefore use the explicitly declared Hard fallback for every
@@ -6656,18 +6781,23 @@ FStrateGenerationParams UVoxelStrateManager::GetGenerationParams(const FIntVecto
//--------------------------------------------------------------------- //---------------------------------------------------------------------
// CHECK BOTTOM BOUNDARY (transitioning to strate below) // CHECK BOTTOM BOUNDARY (transitioning to strate below)
//--------------------------------------------------------------------- //---------------------------------------------------------------------
// DistFromBottom = how many chunks above the bottom edge of this strate. // Legacy chunk callers project their sample to a layout interval; physical distance and
// transition width are both resolved in micrometres before projecting the blend fraction.
// When 0, we're right at the boundary. When == TransitionBlendChunks, we're at // When 0, we're right at the boundary. When == TransitionBlendChunks, we're at
// the outer edge of the transition zone. // the outer edge of the transition zone.
int32 DistFromBottom = ChunkCoord.Z - Slot.BottomChunkZ; const int64 DistFromBottomMicrometres = static_cast<int64>(ChunkCoord.Z)
* StrateLayoutChunkSizeMicrometres - Slot.BottomWorldMicrometres;
const int32 DistFromBottom = static_cast<int32>(VF_FloorDivide64(
DistFromBottomMicrometres, StrateLayoutChunkSizeMicrometres));
if (SlotIdx + 1 < StrateLayout.Num()) if (SlotIdx + 1 < StrateLayout.Num())
{ {
// The upper strate (this one) controls the transition type at its lower edge // The upper strate (this one) controls the transition type at its lower edge
const EVoxelStrateTransition TransType = Slot.Definition->TransitionType; const EVoxelStrateTransition TransType = Slot.ResolvedTransitionType;
// Per-definition blend distance. // Per-definition blend distance.
const int32 EffectiveBlend = Slot.Definition->TransitionBlendChunks; const int32 EffectiveBlend = static_cast<int32>(VF_FloorDivide64(
Slot.TransitionWidthMicrometres, StrateLayoutChunkSizeMicrometres));
// Prepare the neighbor's params (only used for Gradient and Interleaved) // Prepare the neighbor's params (only used for Gradient and Interleaved)
const FStrateSlot& BelowSlot = StrateLayout[SlotIdx + 1]; const FStrateSlot& BelowSlot = StrateLayout[SlotIdx + 1];
@@ -6691,8 +6821,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) * StrateLayoutChunkWidthVoxels; BelowParams.StrateTopWorldZ = BelowSlot.LegacyTopWorldZVoxels;
BelowParams.StrateBottomWorldZ = (float)(BelowSlot.BottomChunkZ) * StrateLayoutChunkWidthVoxels; BelowParams.StrateBottomWorldZ = BelowSlot.LegacyBottomWorldZVoxels;
// 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);
@@ -6729,8 +6859,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) * StrateLayoutChunkWidthVoxels; BelowParams.StrateTopWorldZ = BelowSlot.LegacyTopWorldZVoxels;
BelowParams.StrateBottomWorldZ = (float)(BelowSlot.BottomChunkZ) * StrateLayoutChunkWidthVoxels; BelowParams.StrateBottomWorldZ = BelowSlot.LegacyBottomWorldZVoxels;
// 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).
@@ -6768,14 +6898,18 @@ FStrateGenerationParams UVoxelStrateManager::GetGenerationParams(const FIntVecto
//--------------------------------------------------------------------- //---------------------------------------------------------------------
// Mirror logic: the ABOVE strate's TransitionType controls its lower edge, // Mirror logic: the ABOVE strate's TransitionType controls its lower edge,
// which is this strate's upper edge. So we read from StrateLayout[SlotIdx-1]. // which is this strate's upper edge. So we read from StrateLayout[SlotIdx-1].
int32 DistFromTop = Slot.TopChunkZ - ChunkCoord.Z; const int64 DistFromTopMicrometres = Slot.TopWorldMicrometres
- (static_cast<int64>(ChunkCoord.Z) + 1) * StrateLayoutChunkSizeMicrometres;
const int32 DistFromTop = static_cast<int32>(VF_FloorDivide64(
DistFromTopMicrometres, StrateLayoutChunkSizeMicrometres));
if (SlotIdx > 0) if (SlotIdx > 0)
{ {
// The strate ABOVE controls the transition at its lower edge (= our upper edge) // The strate ABOVE controls the transition at its lower edge (= our upper edge)
const FStrateSlot& AboveSlot = StrateLayout[SlotIdx - 1]; const FStrateSlot& AboveSlot = StrateLayout[SlotIdx - 1];
const EVoxelStrateTransition TransType = AboveSlot.Definition->TransitionType; const EVoxelStrateTransition TransType = AboveSlot.ResolvedTransitionType;
const int32 EffectiveBlend = AboveSlot.Definition->TransitionBlendChunks; const int32 EffectiveBlend = static_cast<int32>(VF_FloorDivide64(
AboveSlot.TransitionWidthMicrometres, StrateLayoutChunkSizeMicrometres));
switch (TransType) switch (TransType)
{ {
@@ -6790,8 +6924,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) * StrateLayoutChunkWidthVoxels; AboveParams.StrateTopWorldZ = AboveSlot.LegacyTopWorldZVoxels;
AboveParams.StrateBottomWorldZ = (float)(AboveSlot.BottomChunkZ) * StrateLayoutChunkWidthVoxels; AboveParams.StrateBottomWorldZ = AboveSlot.LegacyBottomWorldZVoxels;
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);
@@ -6812,8 +6946,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) * StrateLayoutChunkWidthVoxels; AboveParams.StrateTopWorldZ = AboveSlot.LegacyTopWorldZVoxels;
AboveParams.StrateBottomWorldZ = (float)(AboveSlot.BottomChunkZ) * StrateLayoutChunkWidthVoxels; AboveParams.StrateBottomWorldZ = AboveSlot.LegacyBottomWorldZVoxels;
// 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
File diff suppressed because it is too large. Load diff
+20 -9
View File
@@ -261,8 +261,12 @@ namespace VoxelHash
FORCEINLINE uint32 Cell(int32 CellX, int32 CellY, uint32 Seed) FORCEINLINE uint32 Cell(int32 CellX, int32 CellY, uint32 Seed)
{ {
uint32 H = Seed; uint32 H = Seed;
H ^= Mix((uint32)(CellX + 0x7FFFFFFF)); // Bias in unsigned arithmetic. Adding the signed cell coordinate first overflows for
H ^= Mix((uint32)(CellY + 0x7FFFFFFF) * 2654435761u); // positive cells and makes the world hash compiler-dependent.
const uint32 BiasedX = static_cast<uint32>(CellX) + 0x7FFFFFFFu;
const uint32 BiasedY = static_cast<uint32>(CellY) + 0x7FFFFFFFu;
H ^= Mix(BiasedX);
H ^= Mix(BiasedY * 2654435761u);
return Mix(H); return Mix(H);
} }
@@ -274,10 +278,14 @@ namespace VoxelHash
int32 MinX = FMath::Min(AX, BX), MinY = FMath::Min(AY, BY); int32 MinX = FMath::Min(AX, BX), MinY = FMath::Min(AY, BY);
int32 MaxX = FMath::Max(AX, BX), MaxY = FMath::Max(AY, BY); int32 MaxX = FMath::Max(AX, BX), MaxY = FMath::Max(AY, BY);
uint32 H = Seed ^ 0xDEADBEEF; uint32 H = Seed ^ 0xDEADBEEF;
H ^= Mix((uint32)(MinX + 0x7FFFFFFF)); const uint32 BiasedMinX = static_cast<uint32>(MinX) + 0x7FFFFFFFu;
H ^= Mix((uint32)(MinY + 0x7FFFFFFF) * 2654435761u); const uint32 BiasedMinY = static_cast<uint32>(MinY) + 0x7FFFFFFFu;
H ^= Mix((uint32)(MaxX + 0x7FFFFFFF) * 374761393u); const uint32 BiasedMaxX = static_cast<uint32>(MaxX) + 0x7FFFFFFFu;
H ^= Mix((uint32)(MaxY + 0x7FFFFFFF) * 668265263u); const uint32 BiasedMaxY = static_cast<uint32>(MaxY) + 0x7FFFFFFFu;
H ^= Mix(BiasedMinX);
H ^= Mix(BiasedMinY * 2654435761u);
H ^= Mix(BiasedMaxX * 374761393u);
H ^= Mix(BiasedMaxY * 668265263u);
return Mix(H); return Mix(H);
} }
@@ -477,10 +485,13 @@ namespace VoxelNoise
// Hash the neighbor cell to get a feature point position [0,1) // Hash the neighbor cell to get a feature point position [0,1)
// Using three different hash mixes for X, Y, Z offsets // Using three different hash mixes for X, Y, Z offsets
const uint32 BiasedX = static_cast<uint32>(NX) + 0x7FFFFFFFu;
const uint32 BiasedY = static_cast<uint32>(NY) + 0x7FFFFFFFu;
const uint32 BiasedZ = static_cast<uint32>(NZ) + 0x7FFFFFFFu;
uint32 H = VoxelHash::Mix( uint32 H = VoxelHash::Mix(
(uint32)(NX + 0x7FFFFFFF) BiasedX
^ VoxelHash::Mix((uint32)(NY + 0x7FFFFFFF) * 2654435761u) ^ VoxelHash::Mix(BiasedY * 2654435761u)
^ VoxelHash::Mix((uint32)(NZ + 0x7FFFFFFF) * 374761393u) ^ VoxelHash::Mix(BiasedZ * 374761393u)
); );
float FPX = (float)DX + VoxelHash::ToFloat01(H) - FracX; float FPX = (float)DX + VoxelHash::ToFloat01(H) - FracX;
@@ -340,6 +340,14 @@ private:
float SuppressRadiusWorld = 0.0f; float SuppressRadiusWorld = 0.0f;
}; };
// Game-thread lookup copied from the immutable resolved Core layout.
// Recherche game-thread copiee depuis la disposition Core resolue et immuable.
struct FResolvedCoreGeometryAnchor
{
int32 StrateIndex = INDEX_NONE;
FVector LocalPositionCm = FVector::ZeroVector;
};
/** WORKER-THREAD surface find → fills OutSpawns for one cell. SurfaceWorld uses the height oracle /** WORKER-THREAD surface find → fills OutSpawns for one cell. SurfaceWorld uses the height oracle
* (cheap, O(1)/column); other archetypes ray-march the density column. No UObject access except * (cheap, O(1)/column); other archetypes ray-march the density column. No UObject access except
* Generator (thread-safe). Determinism-critical. Resolves the dominant biome PER COLUMN * Generator (thread-safe). Determinism-critical. Resolves the dominant biome PER COLUMN
@@ -436,6 +444,7 @@ private:
// (kept until the cell leaves range so the surface-find isn't repeated). Strate-bounded. // (kept until the cell leaves range so the surface-find isn't repeated). Strate-bounded.
// Keyed by FIntVector(cellX|passageIdx, cellY|side, entryIndex) — lattice cell OR passage endpoint. // Keyed by FIntVector(cellX|passageIdx, cellY|side, entryIndex) — lattice cell OR passage endpoint.
TMap<FIntVector, FLandmarkInstance> LandmarkInstances; TMap<FIntVector, FLandmarkInstance> LandmarkInstances;
TMap<FString, FResolvedCoreGeometryAnchor> CoreGeometryAnchors;
int32 LastLandmarkStrate = INT32_MIN; // strate change → wipe + rebuild landmarks int32 LastLandmarkStrate = INT32_MIN; // strate change → wipe + rebuild landmarks
// Set in BeginDestroy; worker tasks check it before touching us. // Set in BeginDestroy; worker tasks check it before touching us.
@@ -13,6 +13,7 @@
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include <atomic> #include <atomic>
#include <cstddef>
#include "VoxelTypes.h" // Pour FVoxelMeshData, CHUNK_SIZE, VOXEL_SIZE, etc. #include "VoxelTypes.h" // Pour FVoxelMeshData, CHUNK_SIZE, VOXEL_SIZE, etc.
#include "VoxelGenerator.h" #include "VoxelGenerator.h"
#include "VoxelMarchingCubesMesher.generated.h" #include "VoxelMarchingCubesMesher.generated.h"
@@ -38,6 +39,24 @@ struct FVoxelSharedDensityGrid
} }
}; };
// Host-owned scheduling hooks for a predicted-heavy density-grid fill. Each task owns one
// deterministic Z slab and gets the source tile's worker-local sampling context.
struct FVoxelGridFillExecution
{
using FTask = void(*)(void* taskContext, std::size_t index, std::size_t workerIndex);
using FParallelFor = double(*)(void* schedulerContext, std::size_t count,
std::size_t workerLimit, void* taskContext, FTask task);
using FBeginWorkerContext = void*(*)(void* context, std::size_t workerIndex);
using FEndWorkerContext = void(*)(void* context, void* workerState,
std::size_t workerIndex);
void* SchedulerContext = nullptr;
FParallelFor ParallelFor = nullptr;
std::size_t WorkerLimit = 1;
void* WorkerContext = nullptr;
FBeginWorkerContext BeginWorkerContext = nullptr;
FEndWorkerContext EndWorkerContext = nullptr;
};
// Stable plan data copied onto one worker-owned mesher for hybrid LOD0 generation. // Stable plan data copied onto one worker-owned mesher for hybrid LOD0 generation.
// Donnees stables du plan copiees dans un mailleur de worker pour le mode hybride LOD0. // Donnees stables du plan copiees dans un mailleur de worker pour le mode hybride LOD0.
struct FVoxelHybridSharpFeatureBox struct FVoxelHybridSharpFeatureBox
@@ -111,6 +130,8 @@ public:
// GenerateMesh calls finish. A malformed/incomplete lattice is ignored and falls back to // GenerateMesh calls finish. A malformed/incomplete lattice is ignored and falls back to
// the canonical generator path rather than changing geometry. // the canonical generator path rather than changing geometry.
void SetSharedDensityGrid(const FVoxelSharedDensityGrid* InGrid) { SharedDensityGrid = InGrid; } void SetSharedDensityGrid(const FVoxelSharedDensityGrid* InGrid) { SharedDensityGrid = InGrid; }
void SetGridFillExecution(const FVoxelGridFillExecution& InExecution)
{ GridFillExecution = InExecution; }
// The caller owns this mesher instance for one tile task; no shared mutable feature state. // The caller owns this mesher instance for one tile task; no shared mutable feature state.
// L'appelant possede cette instance pour une tuile; aucune donnee partagee modifiable. // L'appelant possede cette instance pour une tuile; aucune donnee partagee modifiable.
@@ -137,6 +158,7 @@ private:
const std::atomic<bool>* ShutdownFlag = nullptr; const std::atomic<bool>* ShutdownFlag = nullptr;
const FVoxelSharedDensityGrid* SharedDensityGrid = nullptr; const FVoxelSharedDensityGrid* SharedDensityGrid = nullptr;
FVoxelGridFillExecution GridFillExecution;
TArray<FVoxelHybridSharpFeatureBox> HybridSharpFeatures; TArray<FVoxelHybridSharpFeatureBox> HybridSharpFeatures;
bool bUseHybridSharpMesher = false; bool bUseHybridSharpMesher = false;
bool bUseHybridSharpFeatureSnap = false; bool bUseHybridSharpFeatureSnap = false;
+10 -6
View File
@@ -21,6 +21,8 @@ class UVoxelSettings : public UPrimaryDataAsset
GENERATED_BODY() GENERATED_BODY()
public: public:
virtual void Serialize(FArchive& Ar) override;
virtual void PostLoad() override;
/** Season seed/radius replace the mutable authored values only when Season is assigned. */ /** Season seed/radius replace the mutable authored values only when Season is assigned. */
int32 GetEffectiveWorldSeed() const; int32 GetEffectiveWorldSeed() const;
@@ -411,14 +413,16 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Voxel|Strates", meta = (ClampMin = "1")) UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Voxel|Strates", meta = (ClampMin = "1"))
int32 TotalStrates = 10; int32 TotalStrates = 10;
// Vertical SEPARATION between consecutive strates, in chunks of solid bedrock. // Legacy count retained so pre-metre assets still deserialize during the upgrade.
// 0 = strates touch (just the seals between them). Higher = a thick rock layer // Ancien compte conserve pour lire les assets precedant les metres.
// between each biome that the player must dig through at (0,0), and that the UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Voxel|Strates", meta = (DeprecatedProperty, DeprecationMessage = "Use InterStrateGapMeters."))
// auto-carved passages tunnel across.
// 0 → adjacent layers (default) · 1-2 → a real bedrock band · 4+ → deep separation
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Voxel|Strates", meta = (ClampMin = "0", ClampMax = "16"))
int32 InterStrateGapChunks = 0; int32 InterStrateGapChunks = 0;
// Physical separation between strata; the layout remains aligned to whole layout chunks.
// Separation physique; la disposition reste alignee sur des chunks entiers.
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Voxel|Strates", meta = (Units = "m", ClampMin = "0", ClampMax = "1024"))
double InterStrateGapMeters = 0.0;
// Physical width of one vertical strate-layout chunk. This is independent of the // 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. // 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. // 8 m preserves the owner's current SurfaceWorld extent at 25 cm Core voxels.
@@ -35,6 +35,9 @@ namespace VoxelForgeStartupTrace
double ResultQueueSeconds = 0.0; double ResultQueueSeconds = 0.0;
double WorkerTaskSeconds = 0.0; double WorkerTaskSeconds = 0.0;
double GenerationSeconds = 0.0; double GenerationSeconds = 0.0;
double CoreGenerateSeconds = 0.0;
double MeshCopySeconds = 0.0;
double StreamBuildSeconds = 0.0;
double ClassifySeconds = 0.0; double ClassifySeconds = 0.0;
double MeshSeconds = 0.0; double MeshSeconds = 0.0;
double StreamSeconds = 0.0; double StreamSeconds = 0.0;
@@ -48,6 +48,7 @@ class VOXELFORGE_API UVoxelStrateDefinition : public UPrimaryDataAsset
GENERATED_BODY() GENERATED_BODY()
public: public:
virtual void Serialize(FArchive& Ar) override;
virtual void PostLoad() override; virtual void PostLoad() override;
//========================================================================= //=========================================================================
@@ -66,14 +67,14 @@ public:
// DIMENSIONS // DIMENSIONS
//========================================================================= //=========================================================================
// How many chunks tall this strate is. // Legacy serialized chunk count kept for Blueprint/package compatibility during the unit migration.
// Each strate can have a different height! // Ancien nombre de chunks conserve pour la compatibilite Blueprint/package pendant la migration.
// Human-scale defaults use 16 chunks = 64 m. This gives a 20 m+ vertical budget for UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Strate|Dimensions", meta = (DeprecatedProperty, DeprecationMessage = "Use StrateHeightMeters."))
// cathedral rooms, tall shafts, and the surface sky cap without changing the lateral gate.
// 1 chunk = 32 voxels x 12.5cm = 4 m; 16 chunks preserves the 64 m authored default.
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Strate|Dimensions", meta = (ClampMin = "1", ClampMax = "256"))
int32 StrateHeightInChunks = 16; int32 StrateHeightInChunks = 16;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Strate|Dimensions", meta = (Units = "m", ClampMin = "1", ClampMax = "2048"))
double StrateHeightMeters = 128.0;
//========================================================================= //=========================================================================
// BOUNDARY TRANSITION // BOUNDARY TRANSITION
//========================================================================= //=========================================================================
@@ -99,9 +100,13 @@ public:
// 2 → moderate (good default) // 2 → moderate (good default)
// 4 → wide, gentle blend across many chunks // 4 → wide, gentle blend across many chunks
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Strate|Boundary", UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Strate|Boundary",
meta = (ClampMin = "1", ClampMax = "8", EditCondition = "TransitionType != EVoxelStrateTransition::Hard")) meta = (DeprecatedProperty, DeprecationMessage = "Use TransitionWidthMeters."))
int32 TransitionBlendChunks = 2; int32 TransitionBlendChunks = 2;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Strate|Boundary",
meta = (Units = "m", ClampMin = "0", ClampMax = "512", EditCondition = "TransitionType != EVoxelStrateTransition::Hard"))
double TransitionWidthMeters = 16.0;
//========================================================================= //=========================================================================
// GENERATOR TYPE // GENERATOR TYPE
//========================================================================= //=========================================================================
@@ -115,6 +120,11 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Strate|Generation") UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Strate|Generation")
ECaveGeneratorType GeneratorType = ECaveGeneratorType::TunnelNetwork; ECaveGeneratorType GeneratorType = ECaveGeneratorType::TunnelNetwork;
// Optional native Core authoring; leaving it empty keeps the established generator path.
// Edition Core native facultative; laissez vide pour garder le generateur existant.
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Strate|Core Geometry")
FVoxelForgeCoreGeometry CoreGeometry;
/** /**
* Authoritative per-strate worm switch. Existing assets default to enabled. The manager * Authoritative per-strate worm switch. Existing assets default to enabled. The manager
* resolves a disabled strate to WormStrength == 0 before any fused, stack, composer, or * resolves a disabled strate to WormStrength == 0 before any fused, stack, composer, or
+39 -6
View File
@@ -121,8 +121,8 @@ struct FVoxelPassage
* FStrateSlot — Runtime info for one strate in the layout. * FStrateSlot — Runtime info for one strate in the layout.
* *
* Created during Initialize() and stored in the StrateLayout array. * Created during Initialize() and stored in the StrateLayout array.
* Each slot knows its definition, its Z-range in chunk coordinates, * Each slot owns its resolved half-open physical Z interval. Chunk coordinates and legacy
* and its index in the sequence. * authoring values below are projections kept for existing callers and assets.
*/ */
USTRUCT() USTRUCT()
struct FStrateSlot struct FStrateSlot
@@ -136,6 +136,33 @@ struct FStrateSlot
// Strate index (0 = topmost, increases downward) // Strate index (0 = topmost, increases downward)
int32 StrateIndex = 0; int32 StrateIndex = 0;
// Resolved physical bounds, in micrometres, with interval [bottom, top). These are computed
// once during Initialize from the configured metre chunk width and legacy asset dimensions.
int64 TopWorldMicrometres = 0;
int64 BottomWorldMicrometres = 0;
int64 HeightMicrometres = 0;
float LegacyTopWorldZVoxels = 0.0f;
float LegacyBottomWorldZVoxels = 0.0f;
float LegacyHeightVoxels = 0.0f;
// Immutable transition and passage inputs copied when this slot is resolved. The width is
// physical; chunk counts and raw owner-voxel values remain compatibility projections for
// legacy parameter and route adapters.
EVoxelStrateTransition ResolvedTransitionType = EVoxelStrateTransition::Gradient;
int32 ResolvedTransitionBlendChunks = 2;
int64 TransitionWidthMicrometres = 0;
FStratePassageConfig ResolvedPassageConfig;
int64 PassageMouthRadiusMicrometres = 0;
int64 PassageMidRadiusMicrometres = 0;
int64 PassageReachMinimumMicrometres = 0;
int64 PassageReachMaximumMicrometres = 0;
int64 PassageDistanceMinimumMicrometres = 0;
int64 PassageDistanceMaximumMicrometres = 0;
int64 PassageWanderMicrometres = 0;
int64 PassageVerticalWobbleMicrometres = 0;
int64 PassageSpiralRadiusMicrometres = 0;
int64 PassageCascadeLedgeMicrometres = 0;
// Z chunk range (inclusive). TopZ > BottomZ since Z decreases downward. // Z chunk range (inclusive). TopZ > BottomZ since Z decreases downward.
// Example: TopZ = 0, BottomZ = -3 means this strate spans chunks Z=0 to Z=-3 // Example: TopZ = 0, BottomZ = -3 means this strate spans chunks Z=0 to Z=-3
int32 TopChunkZ = 0; int32 TopChunkZ = 0;
@@ -248,7 +275,11 @@ public:
// This is independent of Core's 32^3 tile width. // This is independent of Core's 32^3 tile width.
float GetStrateLayoutChunkWidthVoxels() const { return StrateLayoutChunkWidthVoxels; } float GetStrateLayoutChunkWidthVoxels() const { return StrateLayoutChunkWidthVoxels; }
uint32 GetStrateLayoutChunkSizeMicrometres() const { return StrateLayoutChunkSizeMicrometres; } uint32 GetStrateLayoutChunkSizeMicrometres() const { return StrateLayoutChunkSizeMicrometres; }
void SetHardTransitionFallbackForAssembly(bool bEnabled) int64 GetResolvedInterStrateGapMicrometres() const
{ return ResolvedInterStrateGapMicrometres; }
// Called by the Core adapter through a const manager pointer; the flag is runtime routing
// state, not layout data, hence const + mutable.
void SetHardTransitionFallbackForAssembly(bool bEnabled) const
{ bHardTransitionFallbackForAssembly = bEnabled; } { bHardTransitionFallbackForAssembly = bEnabled; }
/** Layout/passage generation counter (bumped by every Initialize → GeneratePassages). /** Layout/passage generation counter (bumped by every Initialize → GeneratePassages).
@@ -528,14 +559,15 @@ protected:
// Copied from VoxelSettings::OriginSpineRadius. // Copied from VoxelSettings::OriginSpineRadius.
float OriginSpineRadius = 28.0f; float OriginSpineRadius = 28.0f;
// Solid-bedrock gap between consecutive strates, in chunks. Copied from // Compatibility gap projection, in layout chunks. Physical authority is the micrometre value
// VoxelSettings::InterStrateGapChunks during Initialize(). // resolved during Initialize below.
int32 InterStrateGapChunks = 0; int32 InterStrateGapChunks = 0;
int64 ResolvedInterStrateGapMicrometres = 0;
// Resolved once from VoxelSettings::StrateLayoutChunkSizeMeters during Initialize(). // Resolved once from VoxelSettings::StrateLayoutChunkSizeMeters during Initialize().
float StrateLayoutChunkWidthVoxels = 32.0f; float StrateLayoutChunkWidthVoxels = 32.0f;
uint32 StrateLayoutChunkSizeMicrometres = 8000000; uint32 StrateLayoutChunkSizeMicrometres = 8000000;
bool bHardTransitionFallbackForAssembly = false; mutable 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
@@ -552,6 +584,7 @@ protected:
// Find which slot a chunk Z coordinate falls into. // Find which slot a chunk Z coordinate falls into.
// Returns INDEX into StrateLayout, or -1 if not found. // Returns INDEX into StrateLayout, or -1 if not found.
int32 FindSlotIndexForChunkZ(int32 ChunkZ) const; int32 FindSlotIndexForChunkZ(int32 ChunkZ) const;
int32 FindSlotIndexForWorldZCentimetres(double WorldZCentimetres) const;
#if WITH_EDITOR #if WITH_EDITOR
const FVoxelStrateComposerSlotOverride* FindComposerOverride(int32 StrateIndex) const; const FVoxelStrateComposerSlotOverride* FindComposerOverride(int32 StrateIndex) const;
+220 -14
View File
@@ -200,16 +200,222 @@ enum class ECaveGeneratorType : uint8
Underwater UMETA(DisplayName = "Underwater (flooded cavern system)"), Underwater UMETA(DisplayName = "Underwater (flooded cavern system)"),
}; };
// Optional native-Core recipe selected independently for one strate.
// Recette Core native facultative, choisie independamment pour chaque strate.
UENUM(BlueprintType)
enum class EVoxelForgeCoreGeneratorRecipe : uint8
{
None UMETA(DisplayName = "Off (legacy recipe)"),
NativeCaves UMETA(DisplayName = "Native caves"),
NativeLattice UMETA(DisplayName = "Native lattice"),
ProfiledHeightfield UMETA(DisplayName = "Profiled heightfield")
};
UENUM(BlueprintType)
enum class EVoxelForgeCoreHeightfieldProfile : uint8
{
PeriodicHills,
MirroredRelief,
FlatField
};
UENUM(BlueprintType)
enum class EVoxelForgeCoreStampKind : uint8
{
CarveEllipsoid,
CarveArch,
FillPillar,
FillDais,
FillMonolith,
FillPlatform
};
// Stable authored volume stamp. All distances and positions are metres at the asset boundary.
// Volume stable, defini par son auteur. Toutes les positions et distances sont en metres.
USTRUCT(BlueprintType)
struct VOXELFORGE_API FVoxelForgeCoreStampDefinition
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry")
FString StableName;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry")
EVoxelForgeCoreStampKind Kind = EVoxelForgeCoreStampKind::CarveEllipsoid;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry", meta = (Units = "m"))
FVector AnchorPositionMeters = FVector::ZeroVector;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry", meta = (Units = "m", ClampMin = "0"))
double PlacementRadiusMeters = 0.0;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry", meta = (Units = "m", ClampMin = "0.5"))
FVector HalfExtentsMeters = FVector(2.0, 2.0, 2.0);
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry", meta = (Units = "m", ClampMin = "0"))
double SmoothWidthMeters = 0.0;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry", meta = (Units = "m", ClampMin = "0"))
double IrregularityAmplitudeMeters = 0.0;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry", meta = (Units = "m", ClampMin = "0"))
double IrregularityWavelengthMeters = 0.0;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry", meta = (Units = "m", ClampMin = "0"))
double RoundingRadiusMeters = 0.5;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry", meta = (Units = "m", ClampMin = "0"))
double MinimumSpacingMeters = 0.0;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry", meta = (ClampMin = "0", ClampMax = "3"))
uint8 YawQuarterTurns = 0;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry")
bool bAttachToFloor = false;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry", meta = (Units = "m"))
double FloorMeters = 0.0;
};
// Authored cavern chamber, in local world metres.
// Salle cavernicole authored, en metres locaux du monde.
USTRUCT(BlueprintType)
struct VOXELFORGE_API FVoxelForgeCoreRoomDefinition
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry")
FString StableName;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry", meta = (Units = "m"))
FVector CenterMeters = FVector::ZeroVector;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry", meta = (Units = "m", ClampMin = "0.5"))
FVector HalfExtentsMeters = FVector(8.0, 8.0, 4.0);
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry", meta = (Units = "m"))
double FloorMeters = 0.0;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry", meta = (Units = "m", ClampMin = "0"))
double SmoothWidthMeters = 0.0;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry", meta = (Units = "m", ClampMin = "0"))
double UnionWidthMeters = 0.0;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry", meta = (Units = "m", ClampMin = "0"))
double IrregularityAmplitudeMeters = 0.0;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry", meta = (Units = "m", ClampMin = "0"))
double IrregularityWavelengthMeters = 0.0;
};
// Authored cubic tunnel between a stable start anchor and a stable room name.
// Tunnel cubique authored entre une ancre stable et une salle nommee.
USTRUCT(BlueprintType)
struct VOXELFORGE_API FVoxelForgeCoreTunnelDefinition
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry")
FString StableName;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry")
FString StartAnchorStableName;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry")
FString EndRoomStableName;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry", meta = (Units = "m"))
FVector ControlPoint0Meters = FVector::ZeroVector;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry", meta = (Units = "m"))
FVector ControlPoint1Meters = FVector::ZeroVector;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry", meta = (Units = "m"))
FVector ControlPoint2Meters = FVector::ZeroVector;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry", meta = (Units = "m"))
FVector ControlPoint3Meters = FVector::ZeroVector;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry", meta = (Units = "m", ClampMin = "0.5"))
double BoreRadiusMeters = 2.0;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry", meta = (Units = "m", ClampMin = "1"))
double BoreHeightMeters = 4.0;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry", meta = (Units = "m", ClampMin = "0"))
double FloorSupportDepthMeters = 0.5;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry", meta = (Units = "m", ClampMin = "0"))
double SmoothWidthMeters = 0.0;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry", meta = (Units = "m", ClampMin = "0"))
double UnionWidthMeters = 0.0;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry", meta = (Units = "m", ClampMin = "0"))
double IrregularityAmplitudeMeters = 0.0;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry", meta = (Units = "m", ClampMin = "0"))
double IrregularityWavelengthMeters = 0.0;
// Lattice tunnels require an explicit bounded polyline; cave tunnels use the cubic curve.
// Les tunnels en treillis exigent une polyligne bornee; les tunnels caves utilisent la courbe cubique.
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry")
TArray<FVector> PolylineMeters;
};
// Optional Core authored recipe. Empty arrays and None preserve the prior asset output.
// Recette Core authored facultative. None et les tableaux vides conservent la sortie historique.
USTRUCT(BlueprintType)
struct VOXELFORGE_API FVoxelForgeCoreGeometry
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry")
EVoxelForgeCoreGeneratorRecipe GeneratorRecipe = EVoxelForgeCoreGeneratorRecipe::None;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry")
EVoxelForgeCoreHeightfieldProfile HeightfieldProfile = EVoxelForgeCoreHeightfieldProfile::PeriodicHills;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry|Heightfield", meta = (Units = "m"))
double HeightfieldBaseMeters = 0.0;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry|Heightfield", meta = (Units = "m"))
FVector2D HeightfieldAmplitudeMeters = FVector2D(20.0, 20.0);
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry|Heightfield", meta = (Units = "m", ClampMin = "0"))
FVector2D HeightfieldWavelengthMeters = FVector2D(256.0, 256.0);
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry|Heightfield", meta = (ClampMin = "0.01", ClampMax = "4.0"))
double MirrorLambda = 1.0;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry|Heightfield", meta = (Units = "m", ClampMin = "0"))
double MinimumArenaClearanceMeters = 0.0;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry")
TArray<FVoxelForgeCoreStampDefinition> Stamps;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry")
TArray<FVoxelForgeCoreRoomDefinition> Rooms;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Core Geometry")
TArray<FVoxelForgeCoreTunnelDefinition> Tunnels;
};
/** /**
* EVoxelStrateTransition — How two adjacent strates blend at their shared boundary. * EVoxelStrateTransition — How two adjacent strates meet at their shared boundary.
* *
* Each strate boundary can use a different transition style. The transition type * Each strate boundary can use a different transition style. The transition type
* is defined on the UPPER strate's definition and controls the boundary between * is defined on the UPPER strate's definition and controls the boundary between
* itself and the strate below it. * itself and the strate below it.
* *
* Gradient: Smooth linear interpolation of generation params across TransitionBlendChunks. * In the Core composition path, TransitionBlendChunks defines the full permitted
* This is the classic approach — no seam visible, but also no dramatic * crossing depth between the upper bedrock and lower ceiling bands. Each band keeps
* geological feature at the boundary. Best for similar-looking strates. * its authored thickness and the solid bands always overlap or touch. The legacy manager
* may also blend generation parameters for Gradient; Core does not blend unrelated fields.
*
* Gradient: A low-amplitude smooth height field moves the shared interface and both
* content-facing band surfaces. Best for gentle geological variation.
* *
* Hard: No blending at all. The strate's params apply right up to the boundary, * Hard: No blending at all. The strate's params apply right up to the boundary,
* then instantly switch to the neighbor's params. The abrupt change in * then instantly switch to the neighbor's params. The abrupt change in
@@ -217,26 +423,21 @@ enum class ECaveGeneratorType : uint8
* discontinuity at the boundary. Best for strates that should feel like * discontinuity at the boundary. Best for strates that should feel like
* distinct geological layers with a visible dividing line. * distinct geological layers with a visible dividing line.
* *
* Interleaved: The boundary position is warped by a 3D noise field, so "fingers" * Interleaved: A deterministic 3D domain-warped hash field sets the overlap depth per XY
* of one strate reach into the other. Some XY columns transition early, * column from zero to the declared width, creating irregular fingers.
* others late, creating an irregular, interlocking boundary. The warp * Best for strates that should feel grown together.
* amplitude is ~2 chunks, and Z frequency is lower than XY to produce
* horizontal finger-like intrusions. Best for strates that should feel
* like they grew into each other over geological time.
*/ */
UENUM(BlueprintType) UENUM(BlueprintType)
enum class EVoxelStrateTransition : uint8 enum class EVoxelStrateTransition : uint8
{ {
// Smooth linear interpolation of all generation params across the blend zone. // Smoothly undulates the shared bedrock/ceiling interface in the Core composition path.
// No visible boundary — params change gradually over TransitionBlendChunks distance.
Gradient UMETA(DisplayName = "Gradient (smooth blend)"), Gradient UMETA(DisplayName = "Gradient (smooth blend)"),
// No blending — params switch instantly at the boundary. // No blending — params switch instantly at the boundary.
// Creates natural cliffs, ledges, or material discontinuities. // Creates natural cliffs, ledges, or material discontinuities.
Hard UMETA(DisplayName = "Hard (sharp boundary with cliff)"), Hard UMETA(DisplayName = "Hard (sharp boundary with cliff)"),
// 3D noise warps the boundary position per XY column. // A 3D domain-warped hash field creates finger-like intrusions within the declared width.
// Creates finger-like intrusions of one strate into the other.
Interleaved UMETA(DisplayName = "Interleaved (domain-warped fingers)") Interleaved UMETA(DisplayName = "Interleaved (domain-warped fingers)")
}; };
@@ -2290,6 +2491,11 @@ struct VOXELFORGE_API FStrateLandmark
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Landmark") UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Landmark")
ELandmarkAnchor AnchorMode = ELandmarkAnchor::HashLattice; ELandmarkAnchor AnchorMode = ELandmarkAnchor::HashLattice;
// Optional stable Core feature binding; an empty value keeps lattice/mouth placement unchanged.
// Liaison facultative vers une ancre Core stable; vide, le placement existant reste identique.
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Landmark|Core Geometry")
FString CoreGeometryStableName;
// ----- Hash lattice (AnchorMode == HashLattice — scattered placement; cheap at any radius) ----- // ----- Hash lattice (AnchorMode == HashLattice — scattered placement; cheap at any radius) -----
// Average spacing between instances, IN CHUNKS = the lattice cell size (one candidate per cell, so cost // Average spacing between instances, IN CHUNKS = the lattice cell size (one candidate per cell, so cost
+21 -4
View File
@@ -332,16 +332,33 @@ struct FVoxelTileKey
FVoxelTileKey(const FIntVector& InCoord, int32 InLevel) : Coord(InCoord), Level(InLevel) {} FVoxelTileKey(const FIntVector& InCoord, int32 InLevel) : Coord(InCoord), Level(InLevel) {}
// Cell size (sampling step) in voxels, and tile extent in voxels per axis. // Cell size (sampling step) in voxels, and tile extent in voxels per axis.
int32 StepVoxels() const { return 1 << Level; } int32 StepVoxels() const
int32 ExtentVoxels() const { return CHUNK_SIZE << Level; } {
const uint32 SafeLevel = static_cast<uint32>(FMath::Clamp(Level, 0, 8));
return static_cast<int32>(uint32{1} << SafeLevel);
}
int32 ExtentVoxels() const
{
const uint32 SafeLevel = static_cast<uint32>(FMath::Clamp(Level, 0, 8));
return static_cast<int32>(static_cast<uint32>(CHUNK_SIZE) * (uint32{1} << SafeLevel));
}
// Min-corner of the tile in VOXEL coords (what the mesher takes). // Min-corner of the tile in VOXEL coords (what the mesher takes).
FIntVector OriginVoxels() const { return Coord * (CHUNK_SIZE << Level); } FIntVector OriginVoxels() const
{
const int64 Extent = ExtentVoxels();
const auto ScaleAxis = [Extent](int32 Axis)
{
return static_cast<int32>(FMath::Clamp<int64>(
static_cast<int64>(Axis) * Extent, MIN_int32, MAX_int32));
};
return FIntVector(ScaleAxis(Coord.X), ScaleAxis(Coord.Y), ScaleAxis(Coord.Z));
}
// Tile centre in world cm (for distance sorting / LOD selection). // Tile centre in world cm (for distance sorting / LOD selection).
FVector CenterCm() const FVector CenterCm() const
{ {
const double Ext = (double)(CHUNK_SIZE << Level) * (double)VOXEL_SIZE; const double Ext = static_cast<double>(ExtentVoxels()) * static_cast<double>(VOXEL_SIZE);
return FVector((Coord.X + 0.5) * Ext, (Coord.Y + 0.5) * Ext, (Coord.Z + 0.5) * Ext); return FVector((Coord.X + 0.5) * Ext, (Coord.Y + 0.5) * Ext, (Coord.Z + 0.5) * Ext);
} }
+18
View File
@@ -145,6 +145,10 @@ struct FChunkResult
// per-tile profiling remains opt-in. // per-tile profiling remains opt-in.
uint64 GenerationStartCycles = 0; uint64 GenerationStartCycles = 0;
uint64 GenerationEndCycles = 0; uint64 GenerationEndCycles = 0;
// Optional phase timings recorded only while the bounded startup trace is active.
double CoreGenerateSeconds = 0.0;
double MeshCopySeconds = 0.0;
double StreamBuildSeconds = 0.0;
uint64 ApplyStartCycles = 0; uint64 ApplyStartCycles = 0;
EVoxelTileWorkPriority WorkPriority = EVoxelTileWorkPriority::Horizon; EVoxelTileWorkPriority WorkPriority = EVoxelTileWorkPriority::Horizon;
// Ordinals make admitted order and actual worker start order auditable across MPSC results. // Ordinals make admitted order and actual worker start order auditable across MPSC results.
@@ -352,6 +356,10 @@ public:
* the first resolved collidable support tile. */ * the first resolved collidable support tile. */
TSet<FVoxelTileKey> CollisionNotRequiredTiles; TSet<FVoxelTileKey> CollisionNotRequiredTiles;
/** Known-empty collision classifications survive unload for the tile's current edit epoch. */
TMap<FVoxelTileKey, uint32> KnownEmptyCollisionTileEpoch;
TSet<FVoxelTileKey> KnownEmptyCollisionSolidTiles;
/** Subset of CollisionNotRequiredTiles proved all-solid. A support probe inside one of these /** Subset of CollisionNotRequiredTiles proved all-solid. A support probe inside one of these
* tiles searches upward for the boundary tile; all-air/empty tiles search downward. */ * tiles searches upward for the boundary tile; all-air/empty tiles search downward. */
TSet<FVoxelTileKey> CollisionSolidTiles; TSet<FVoxelTileKey> CollisionSolidTiles;
@@ -614,6 +622,7 @@ public:
FVector GetVoxelForgeCoreDefaultCenterWorld() const; FVector GetVoxelForgeCoreDefaultCenterWorld() const;
bool QueryVoxelForgeCoreDensityAt(FVector WorldLocation, float& OutDensity) const; bool QueryVoxelForgeCoreDensityAt(FVector WorldLocation, float& OutDensity) const;
bool GetVoxelForgeCoreWorldAssembly(FString& OutCanonicalJson, FString& OutContentHash) const; bool GetVoxelForgeCoreWorldAssembly(FString& OutCanonicalJson, FString& OutContentHash) const;
bool GetVoxelForgeCoreResolvedLayout(FString& OutCanonicalJson, FString& OutStableIdentity) const;
UFUNCTION(BlueprintPure, Category = "Voxel World|Strate") UFUNCTION(BlueprintPure, Category = "Voxel World|Strate")
int32 GetStrateAtPosition(FVector WorldPosition) const; int32 GetStrateAtPosition(FVector WorldPosition) const;
@@ -778,6 +787,8 @@ private:
TSharedPtr<FVoxelForgeCoreRuntimeState, ESPMode::ThreadSafe> VoxelForgeCoreState; TSharedPtr<FVoxelForgeCoreRuntimeState, ESPMode::ThreadSafe> VoxelForgeCoreState;
FString VoxelForgeCoreWorldAssemblyJson; FString VoxelForgeCoreWorldAssemblyJson;
FString VoxelForgeCoreWorldAssemblyHash; FString VoxelForgeCoreWorldAssemblyHash;
FString VoxelForgeCoreResolvedLayoutJson;
FString VoxelForgeCoreResolvedLayoutIdentity;
FVector CoreFallbackCenterLocalCm = FVector::ZeroVector; FVector CoreFallbackCenterLocalCm = FVector::ZeroVector;
bool bCoreRegionCompilePending = false; bool bCoreRegionCompilePending = false;
TArray<FVoxelTileKey> PendingCoreRegionTiles; TArray<FVoxelTileKey> PendingCoreRegionTiles;
@@ -1194,6 +1205,9 @@ public:
// and records the ones ONLY a CollisionOnly anchor wants in CollisionOnlyTiles. // and records the ones ONLY a CollisionOnly anchor wants in CollisionOnlyTiles.
void AddAnchorDesiredTiles(); void AddAnchorDesiredTiles();
void ReconcileCollisionDesiredTiles(); void ReconcileCollisionDesiredTiles();
void RestoreKnownEmptyCollisionTiles();
void RebaseKnownEmptyCollisionEpoch();
void InvalidateKnownEmptyCollisionTile(const FVoxelTileKey& Tile, const TCHAR* Reason);
// Forces a desired-set rebuild next Tick even if neither the player nor an anchor crossed a tile // Forces a desired-set rebuild next Tick even if neither the player nor an anchor crossed a tile
// boundary (set by UnregisterStreamingAnchor so a removed anchor's tiles get culled). // boundary (set by UnregisterStreamingAnchor so a removed anchor's tiles get culled).
bool bForceDesiredRebuild = false; bool bForceDesiredRebuild = false;
@@ -1229,10 +1243,13 @@ public:
bool bSampleStacksStarted = false; bool bSampleStacksStarted = false;
bool bStartupApplyBoostStarted = false; bool bStartupApplyBoostStarted = false;
bool bStartupApplyBoostEnded = false; bool bStartupApplyBoostEnded = false;
uint64 StartupApplyBoostStartCycles = 0;
// Trace the resolved startup budget once per world. / Tracer une fois le budget de demarrage resolu par monde. // Trace the resolved startup budget once per world. / Tracer une fois le budget de demarrage resolu par monde.
bool bStartupApplyConfigTraced = false; bool bStartupApplyConfigTraced = false;
uint64 LastApplyFrameCycles = 0; uint64 LastApplyFrameCycles = 0;
float StartupTraceSpeedCmPerSecond = 0.0f; float StartupTraceSpeedCmPerSecond = 0.0f;
bool bSpeedAwareTravelMode = false;
bool bSpeedAwareFastMode = false;
TArray<FVoxelTileKey> DesiredSorted; // critical floor prefix, then true-pawn distance-first TArray<FVoxelTileKey> DesiredSorted; // critical floor prefix, then true-pawn distance-first
TArray<FVoxelTileKey> CriticalDesiredTiles; // occupied/support tile, then heading tile TArray<FVoxelTileKey> CriticalDesiredTiles; // occupied/support tile, then heading tile
// Ancestor -> desired descendants, rebuilt with DesiredSorted. Reconciliation uses this // Ancestor -> desired descendants, rebuilt with DesiredSorted. Reconciliation uses this
@@ -1340,6 +1357,7 @@ public:
double HeadlessStreamingTestDistanceCm = 0.0; double HeadlessStreamingTestDistanceCm = 0.0;
float HeadlessStreamingTestSpeedCmPerSecond = 0.0f; float HeadlessStreamingTestSpeedCmPerSecond = 0.0f;
float HeadlessStreamingTestStartSeconds = 0.0f; float HeadlessStreamingTestStartSeconds = 0.0f;
float HeadlessStreamingTestMoveDurationSeconds = 0.0f;
float HeadlessStreamingTestExitSeconds = 0.0f; float HeadlessStreamingTestExitSeconds = 0.0f;
float HeadlessStreamingTestTeleportAtSeconds = 0.0f; float HeadlessStreamingTestTeleportAtSeconds = 0.0f;
float HeadlessStreamingTestTeleportDistanceCm = 0.0f; float HeadlessStreamingTestTeleportDistanceCm = 0.0f;
+7
View File
@@ -7,6 +7,13 @@ public class VoxelForge : ModuleRules
{ {
public VoxelForge(ReadOnlyTargetRules Target) : base(Target) public VoxelForge(ReadOnlyTargetRules Target) : base(Target)
{ {
if (Target.Platform == UnrealTargetPlatform.Linux)
{
// Test translation units have independent anonymous-namespace helpers that collide in
// Linux Unity batches. Keep Linux compilation one source per TU; Windows remains unchanged.
bUseUnity = false;
}
// PCH = Precompiled Headers - speeds up compilation // PCH = Precompiled Headers - speeds up compilation
// UseExplicitOrSharedPCHs is the modern recommended setting // UseExplicitOrSharedPCHs is the modern recommended setting
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
@@ -39,6 +39,13 @@ public class VoxelForgeCore : ModuleRules
PublicDependencyModuleNames.Add("Core"); PublicDependencyModuleNames.Add("Core");
CppStandard = CppStandardVersion.Cpp20; CppStandard = CppStandardVersion.Cpp20;
if (Target.Platform == UnrealTargetPlatform.Linux)
{
// The compatibility include directory contains Unreal-shaped placeholders. On Linux,
// let generated module TUs pass those names through to UE while Core shims opt in.
PrivateDefinitions.Add("VFCORE_COMPAT_FORWARD_HEADERS=1");
MinCpuArchX64 = MinimumCpuArchitectureX64.AVX2;
}
// Canonical Standalone code predates UE's stricter warning defaults; keep this narrow to legal local shadowing. // Canonical Standalone code predates UE's stricter warning defaults; keep this narrow to legal local shadowing.
CppCompileWarningSettings.ShadowVariableWarningLevel = WarningLevel.Off; CppCompileWarningSettings.ShadowVariableWarningLevel = WarningLevel.Off;
FPSemantics = FPSemanticsMode.Precise; FPSemantics = FPSemanticsMode.Precise;
@@ -878,6 +878,8 @@ struct FExploreArguments
bool bPassageFloorWritesOverride = false; bool bPassageFloorWritesOverride = false;
int32 PassageFloorWrites = 1; int32 PassageFloorWrites = 1;
bool bStandaloneWorldExport = false; bool bStandaloneWorldExport = false;
bool bOwnerFourStratePlan = false;
bool bSkipStandaloneCoreAdapterParity = false;
bool bCoreWorldTest = false; bool bCoreWorldTest = false;
bool bCoreWorldStreamTraceOnly = false; bool bCoreWorldStreamTraceOnly = false;
bool bRenderCameraOverride = false; bool bRenderCameraOverride = false;
@@ -922,6 +924,12 @@ bool ParseArguments(const FString& Params, FExploreArguments& OutArguments, FStr
int32 StandaloneWorldExport = 0; int32 StandaloneWorldExport = 0;
FParse::Value(*Params, TEXT("standaloneworldexport="), StandaloneWorldExport); FParse::Value(*Params, TEXT("standaloneworldexport="), StandaloneWorldExport);
OutArguments.bStandaloneWorldExport = StandaloneWorldExport != 0; OutArguments.bStandaloneWorldExport = StandaloneWorldExport != 0;
int32 OwnerFourStratePlan = 0;
FParse::Value(*Params, TEXT("ownerfourstrateplan="), OwnerFourStratePlan);
OutArguments.bOwnerFourStratePlan = OwnerFourStratePlan != 0;
int32 SkipStandaloneCoreAdapterParity = 0;
FParse::Value(*Params, TEXT("skipstandalonecoreadapterparity="), SkipStandaloneCoreAdapterParity);
OutArguments.bSkipStandaloneCoreAdapterParity = SkipStandaloneCoreAdapterParity != 0;
int32 CoreWorldTest = 0; int32 CoreWorldTest = 0;
FParse::Value(*Params, TEXT("coreworldtest="), CoreWorldTest); FParse::Value(*Params, TEXT("coreworldtest="), CoreWorldTest);
OutArguments.bCoreWorldTest = CoreWorldTest != 0; OutArguments.bCoreWorldTest = CoreWorldTest != 0;
@@ -1266,12 +1274,11 @@ bool ParseArguments(const FString& Params, FExploreArguments& OutArguments, FStr
return false; return false;
} }
// The historical explorer contract needs two adjacent mouths around an interior slot. A // Passage walks need both mouths; a render/export-only generation can inspect an end slot.
// parity export can instead target the game's authored single-strate layout, which has no // Parity exports also accept the game's authored single-strate layout.
// such mouths and is valid for export-only mode. Build() still validates the slot against const bool bRequiresInteriorSlot = OutArguments.bWalk;
// the loaded settings layout. const int32 MinimumSlot = OutArguments.bGameRuntimeConfig || !bRequiresInteriorSlot ? 0 : 1;
const int32 MinimumSlot = OutArguments.bGameRuntimeConfig ? 0 : 1; const int32 MaximumSlot = OutArguments.bGameRuntimeConfig || !bRequiresInteriorSlot
const int32 MaximumSlot = OutArguments.bGameRuntimeConfig
? MaxSyntheticStrates - 1 : MaxSyntheticStrates - 2; ? MaxSyntheticStrates - 1 : MaxSyntheticStrates - 2;
if (OutArguments.Slot < MinimumSlot || OutArguments.Slot > MaximumSlot) if (OutArguments.Slot < MinimumSlot || OutArguments.Slot > MaximumSlot)
{ {
@@ -1284,8 +1291,8 @@ bool ParseArguments(const FString& Params, FExploreArguments& OutArguments, FStr
else else
{ {
OutError = FString::Printf( OutError = FString::Printf(
TEXT("slot must be an interior slot in [1,%d] so arrival and departure mouths exist."), TEXT("slot must be in [0,%d]; walk mode requires an interior slot in [1,%d] for both passage mouths."),
MaxSyntheticStrates - 2); MaxSyntheticStrates - 1, MaxSyntheticStrates - 2);
} }
return false; return false;
} }
@@ -1498,6 +1505,17 @@ bool ParseArguments(const FString& Params, FExploreArguments& OutArguments, FStr
OutError = TEXT("standaloneworldexport requires modes=export and settingsref, and must omit strateref."); OutError = TEXT("standaloneworldexport requires modes=export and settingsref, and must omit strateref.");
return false; return false;
} }
if (OutArguments.bOwnerFourStratePlan
&& (OutArguments.SettingsReference.IsEmpty() || !OutArguments.StrateReference.IsEmpty()))
{
OutError = TEXT("ownerfourstrateplan requires settingsref and must omit strateref.");
return false;
}
if (OutArguments.bSkipStandaloneCoreAdapterParity && !OutArguments.bStandaloneWorldExport)
{
OutError = TEXT("skipstandalonecoreadapterparity requires standaloneworldexport.");
return false;
}
if (OutArguments.bCoreWorldTest if (OutArguments.bCoreWorldTest
&& (OutArguments.SettingsReference.IsEmpty() || !OutArguments.StrateReference.IsEmpty())) && (OutArguments.SettingsReference.IsEmpty() || !OutArguments.StrateReference.IsEmpty()))
{ {
@@ -1702,6 +1720,66 @@ struct FExploreMeshBvhNode
} }
}; };
bool ApplyOwnerFourStratePlan(UVoxelSettings* Settings,
TArray<TStrongObjectPtr<UVoxelStrateDefinition>>& OutDefinitions,
bool bDuplicateDefinitions, FString& OutError)
{
if (Settings == nullptr)
{
OutError = TEXT("The transient owner plan has no settings object.");
return false;
}
if (!Settings->Season.IsNull())
{
OutError = TEXT("The transient four-strate owner plan cannot replace an assigned season manifest.");
return false;
}
static const TCHAR* AssetPaths[] = {
TEXT("/Game/VoxelForge/DA_Strate1.DA_Strate1"),
TEXT("/Game/VoxelForge/DA_Strate2.DA_Strate2"),
TEXT("/Game/VoxelForge/DA_Strate3.DA_Strate3"),
TEXT("/Game/VoxelForge/DA_Strate4.DA_Strate4")
};
Settings->TotalStrates = UE_ARRAY_COUNT(AssetPaths);
Settings->StratePool.Reset();
Settings->FixedStrates.Reset();
OutDefinitions.Reset();
OutDefinitions.Reserve(UE_ARRAY_COUNT(AssetPaths));
for (int32 Index = 0; Index < UE_ARRAY_COUNT(AssetPaths); ++Index)
{
UVoxelStrateDefinition* AuthoredDefinition = LoadObject<UVoxelStrateDefinition>(
nullptr, AssetPaths[Index]);
if (AuthoredDefinition == nullptr)
{
OutError = FString::Printf(
TEXT("Could not load staged owner strate asset '%s'."), AssetPaths[Index]);
return false;
}
UVoxelStrateDefinition* Definition = AuthoredDefinition;
if (bDuplicateDefinitions)
{
Definition = DuplicateObject<UVoxelStrateDefinition>(
AuthoredDefinition, GetTransientPackage(),
FName(*FString::Printf(TEXT("VoxelForgeOwnerPlan_Strate_%d"), Index)));
if (Definition == nullptr)
{
OutError = FString::Printf(
TEXT("Could not make a transient copy of owner strate asset '%s'."), AssetPaths[Index]);
return false;
}
}
Settings->FixedStrates.Add(Index,
TSoftObjectPtr<UVoxelStrateDefinition>(Definition));
OutDefinitions.Add(TStrongObjectPtr<UVoxelStrateDefinition>(Definition));
}
UE_LOG(LogTemp, Display,
TEXT("[VoxelForgeOwnerPlan] transient fixed slots=4 assets=DA_Strate1,DA_Strate2,DA_Strate3,DA_Strate4 settings_asset_untouched=1"));
return true;
}
struct FExploreWorld struct FExploreWorld
{ {
TStrongObjectPtr<UVoxelSettings> Settings; TStrongObjectPtr<UVoxelSettings> Settings;
@@ -1834,7 +1912,7 @@ struct FExploreWorld
Settings->InterStrateGapChunks, Settings->SkirtCells); Settings->InterStrateGapChunks, Settings->SkirtCells);
} }
const int32 NumStrates = bUseAuthoredSettings const int32 NumStrates = Arguments.bOwnerFourStratePlan ? 4 : bUseAuthoredSettings
? (Arguments.bGameRuntimeConfig ? (Arguments.bGameRuntimeConfig
? FMath::Max(Settings->TotalStrates, 1) ? FMath::Max(Settings->TotalStrates, 1)
: FMath::Max(Settings->TotalStrates, Arguments.Slot + 2)) : FMath::Max(Settings->TotalStrates, Arguments.Slot + 2))
@@ -1864,64 +1942,73 @@ struct FExploreWorld
// loaded package remains untouched. // loaded package remains untouched.
Settings->TotalStrates = NumStrates; Settings->TotalStrates = NumStrates;
if (bUseAuthoredStrate) if (Arguments.bOwnerFourStratePlan)
{ {
// The owner’s snapshot states that every slot uses DA_Strate3. Clone it per slot so if (!ApplyOwnerFourStratePlan(Settings.Get(), Definitions, true, OutError))
// commandlet overrides never mutate a loaded package or leak between slots.
Settings->StratePool.Reset();
Settings->FixedStrates.Reset();
}
Definitions.Reserve(NumStrates);
for (int32 Index = 0; Index < NumStrates; ++Index)
{
UVoxelStrateDefinition* Definition = bUseAuthoredStrate
? DuplicateObject<UVoxelStrateDefinition>(
AuthoredDefinition, GetTransientPackage())
: NewObject<UVoxelStrateDefinition>(
GetTransientPackage(), NAME_None, RF_Transient);
if (Definition == nullptr)
{ {
OutError = FString::Printf(
TEXT("Could not create transient strate definition for slot %d."), Index);
return false; return false;
} }
if (!bUseAuthoredStrate) }
else
{
if (bUseAuthoredStrate)
{ {
Definition->StrateName = FText::FromString(FString::Printf( // Keep the historical single-asset interior probe isolated from loaded packages.
TEXT("VoxelForgeExplore_%s_slot%d"), Settings->StratePool.Reset();
ArchetypeName(Index == Arguments.Slot Settings->FixedStrates.Reset();
}
Definitions.Reserve(NumStrates);
for (int32 Index = 0; Index < NumStrates; ++Index)
{
UVoxelStrateDefinition* Definition = bUseAuthoredStrate
? DuplicateObject<UVoxelStrateDefinition>(
AuthoredDefinition, GetTransientPackage())
: NewObject<UVoxelStrateDefinition>(
GetTransientPackage(), NAME_None, RF_Transient);
if (Definition == nullptr)
{
OutError = FString::Printf(
TEXT("Could not create transient strate definition for slot %d."), Index);
return false;
}
if (!bUseAuthoredStrate)
{
Definition->StrateName = FText::FromString(FString::Printf(
TEXT("VoxelForgeExplore_%s_slot%d"),
ArchetypeName(Index == Arguments.Slot
? Arguments.Archetype
: ECaveGeneratorType::TunnelNetwork),
Index));
Definition->StrateDescription = FText::FromString(
TEXT("Transient, deterministic commandlet definition."));
// The commandlet's acceptance sweep uses the owner-facing base spacing:
// 8 chunks * 32 voxels * 0.125 m = 32 m per strate. Production assets may be taller;
// this keeps the measured tunnel arithmetic tied to the stated ~32 m descent.
Definition->StrateHeightInChunks = 8;
Definition->TransitionType = EVoxelStrateTransition::Hard;
Definition->GeneratorType = Index == Arguments.Slot
? Arguments.Archetype ? Arguments.Archetype
: ECaveGeneratorType::TunnelNetwork), : ECaveGeneratorType::TunnelNetwork;
Index)); if (Arguments.bWormsEnabledOverride)
Definition->StrateDescription = FText::FromString( {
TEXT("Transient, deterministic commandlet definition.")); Definition->bEnableWorms = Arguments.bWormsEnabled;
// The commandlet's acceptance sweep uses the owner-facing base spacing: }
// 8 chunks * 32 voxels * 0.125 m = 32 m per strate. Production assets may be taller; if (Arguments.bWormStrengthOverride
// this keeps the measured tunnel arithmetic tied to the stated ~32 m descent. && (Definition->GeneratorType == ECaveGeneratorType::TunnelNetwork
Definition->StrateHeightInChunks = 8; || Definition->GeneratorType == ECaveGeneratorType::Underwater))
Definition->TransitionType = EVoxelStrateTransition::Hard; {
Definition->GeneratorType = Index == Arguments.Slot Definition->GenerationParams.WormStrength = Arguments.WormStrength;
? Arguments.Archetype }
: ECaveGeneratorType::TunnelNetwork;
if (Arguments.bWormsEnabledOverride)
{
Definition->bEnableWorms = Arguments.bWormsEnabled;
} }
if (Arguments.bWormStrengthOverride
&& (Definition->GeneratorType == ECaveGeneratorType::TunnelNetwork
|| Definition->GeneratorType == ECaveGeneratorType::Underwater))
{
Definition->GenerationParams.WormStrength = Arguments.WormStrength;
}
}
const TSoftObjectPtr<UVoxelStrateDefinition> SoftDefinition(Definition); const TSoftObjectPtr<UVoxelStrateDefinition> SoftDefinition(Definition);
Settings->FixedStrates.Add(Index, SoftDefinition); Settings->FixedStrates.Add(Index, SoftDefinition);
if (!bUseAuthoredStrate) if (!bUseAuthoredStrate)
{ {
Settings->StratePool.Add(SoftDefinition); Settings->StratePool.Add(SoftDefinition);
}
Definitions.Add(TStrongObjectPtr<UVoxelStrateDefinition>(Definition));
} }
Definitions.Add(TStrongObjectPtr<UVoxelStrateDefinition>(Definition));
} }
auto ApplyTargetOverrides = [&Arguments](UVoxelStrateDefinition* Definition) -> bool auto ApplyTargetOverrides = [&Arguments](UVoxelStrateDefinition* Definition) -> bool
@@ -13472,14 +13559,16 @@ bool VerifyStandaloneCoreAdapter(const FString& Json, FString& OutError)
const std::array<std::uint64_t, 4> Actual = StandaloneCoreAggregateHashes(Rows); const std::array<std::uint64_t, 4> Actual = StandaloneCoreAggregateHashes(Rows);
const std::array<std::uint64_t, 4> Expected{ const std::array<std::uint64_t, 4> Expected{
0xdb2991c73215af4cull, 0x8236c5edd7fc8e4full, 0xde345030348f2c5dull, 0xcbf0888004618b87ull,
0x4c48fa75a543d58eull, 0xbea22e76b34a4dfcull}; 0x7a11e28e052d69a8ull, 0x52b88607e8dbcbfdull};
const VoxelForgeCore::ShapeBuildStats Stats = CoreWorld.buildStats(); const VoxelForgeCore::ShapeBuildStats Stats = CoreWorld.buildStats();
const bool bPassageWalkabilityPassed = Stats.walkSamples == 5642 && Stats.walkFailures == 0; constexpr std::uint64_t ExpectedWalkSamples = 21425;
if (Rows.size() != 2226 || Actual != Expected || !bPassageWalkabilityPassed) const bool bPassageWalkabilityPassed = Stats.walkSamples == ExpectedWalkSamples
&& Stats.walkFailures == 0;
if (Rows.size() != 2578 || Actual != Expected || !bPassageWalkabilityPassed)
{ {
OutError = FString::Printf( OutError = FString::Printf(
TEXT("Core adapter parity failed at workers=%llu: tiles=%llu density=0x%016llx mesh=0x%016llx payload=0x%016llx topology=0x%016llx walk=%llu/%llu expected=5642/5642"), TEXT("Core adapter parity failed at workers=%llu: tiles=%llu density=0x%016llx mesh=0x%016llx payload=0x%016llx topology=0x%016llx walk=%llu/%llu expected_walk=%llu"),
static_cast<unsigned long long>(WorkerLimit), static_cast<unsigned long long>(WorkerLimit),
static_cast<unsigned long long>(Rows.size()), static_cast<unsigned long long>(Rows.size()),
static_cast<unsigned long long>(Actual[0]), static_cast<unsigned long long>(Actual[0]),
@@ -13487,12 +13576,13 @@ bool VerifyStandaloneCoreAdapter(const FString& Json, FString& OutError)
static_cast<unsigned long long>(Actual[2]), static_cast<unsigned long long>(Actual[2]),
static_cast<unsigned long long>(Actual[3]), static_cast<unsigned long long>(Actual[3]),
static_cast<unsigned long long>(Stats.walkSamples - Stats.walkFailures), static_cast<unsigned long long>(Stats.walkSamples - Stats.walkFailures),
static_cast<unsigned long long>(Stats.walkSamples)); static_cast<unsigned long long>(Stats.walkSamples),
static_cast<unsigned long long>(ExpectedWalkSamples));
return false; return false;
} }
UE_LOG(LogTemp, Display, UE_LOG(LogTemp, Display,
TEXT("[VoxelForgeCoreAdapter] pass schema=1 workers=%llu asset_clip_radius=%d asset_max_level=%d reference_clip_radius=3 reference_max_level=8 tiles=%llu density=0x%016llx mesh=0x%016llx payload=0x%016llx topology=0x%016llx walk=5642/5642"), TEXT("[VoxelForgeCoreAdapter] pass schema=2 workers=%llu asset_clip_radius=%d asset_max_level=%d reference_clip_radius=3 reference_max_level=8 tiles=%llu density=0x%016llx mesh=0x%016llx payload=0x%016llx topology=0x%016llx walk=%llu/%llu"),
static_cast<unsigned long long>(WorkerLimit), static_cast<unsigned long long>(WorkerLimit),
OwnerClipRadius, OwnerClipRadius,
OwnerMaxLod, OwnerMaxLod,
@@ -13500,7 +13590,9 @@ bool VerifyStandaloneCoreAdapter(const FString& Json, FString& OutError)
static_cast<unsigned long long>(Actual[0]), static_cast<unsigned long long>(Actual[0]),
static_cast<unsigned long long>(Actual[1]), static_cast<unsigned long long>(Actual[1]),
static_cast<unsigned long long>(Actual[2]), static_cast<unsigned long long>(Actual[2]),
static_cast<unsigned long long>(Actual[3])); static_cast<unsigned long long>(Actual[3]),
static_cast<unsigned long long>(Stats.walkSamples - Stats.walkFailures),
static_cast<unsigned long long>(ExpectedWalkSamples));
} }
return true; return true;
} }
@@ -13515,6 +13607,24 @@ bool RunStandaloneWorldExport(const FExploreArguments& Arguments, FString& OutEr
*Arguments.SettingsReference); *Arguments.SettingsReference);
return false; return false;
} }
TStrongObjectPtr<UVoxelSettings> OwnerPlanSettings;
TArray<TStrongObjectPtr<UVoxelStrateDefinition>> OwnerPlanDefinitions;
UVoxelSettings* ExportSettings = AuthoredSettings;
if (Arguments.bOwnerFourStratePlan)
{
OwnerPlanSettings = TStrongObjectPtr<UVoxelSettings>(
DuplicateObject<UVoxelSettings>(AuthoredSettings, GetTransientPackage()));
if (!OwnerPlanSettings.IsValid())
{
OutError = TEXT("Could not make a transient copy of owner settings for the four-strate plan.");
return false;
}
ExportSettings = OwnerPlanSettings.Get();
if (!ApplyOwnerFourStratePlan(ExportSettings, OwnerPlanDefinitions, false, OutError))
{
return false;
}
}
UVoxelStrateManager* Manager = NewObject<UVoxelStrateManager>( UVoxelStrateManager* Manager = NewObject<UVoxelStrateManager>(
GetTransientPackage(), NAME_None, RF_Transient); GetTransientPackage(), NAME_None, RF_Transient);
int32 Seed = AuthoredSettings->Seed; int32 Seed = AuthoredSettings->Seed;
@@ -13526,7 +13636,7 @@ bool RunStandaloneWorldExport(const FExploreArguments& Arguments, FString& OutEr
OriginSpineRadius = Season->GetOriginSpineRadius(); OriginSpineRadius = Season->GetOriginSpineRadius();
WorldRadiusVoxels = Season->GetWorldRadiusVoxels(); WorldRadiusVoxels = Season->GetWorldRadiusVoxels();
} }
if (!Manager->Initialize(AuthoredSettings, Seed)) if (!Manager->Initialize(ExportSettings, Seed))
{ {
OutError = TEXT("Owner settings did not produce a valid resolved strate layout."); OutError = TEXT("Owner settings did not produce a valid resolved strate layout.");
return false; return false;
@@ -13534,7 +13644,7 @@ bool RunStandaloneWorldExport(const FExploreArguments& Arguments, FString& OutEr
Seed = Manager->GetWorldSeed(); Seed = Manager->GetWorldSeed();
UVoxelGenerator* Generator = NewObject<UVoxelGenerator>( UVoxelGenerator* Generator = NewObject<UVoxelGenerator>(
GetTransientPackage(), NAME_None, RF_Transient); GetTransientPackage(), NAME_None, RF_Transient);
Generator->InitializeSettings(AuthoredSettings); Generator->InitializeSettings(ExportSettings);
Generator->SetStrateManager(Manager); Generator->SetStrateManager(Manager);
TArray<FStandaloneExportSample> Samples; TArray<FStandaloneExportSample> Samples;
@@ -13668,25 +13778,25 @@ bool RunStandaloneWorldExport(const FExploreArguments& Arguments, FString& OutEr
Writer->WriteValue(TEXT("source"), TEXT("VoxelForgeExplore standalone base-world export")); Writer->WriteValue(TEXT("source"), TEXT("VoxelForgeExplore standalone base-world export"));
Writer->WriteValue(TEXT("voxel_size_cm"), StandaloneCoreVoxelSizeCm); Writer->WriteValue(TEXT("voxel_size_cm"), StandaloneCoreVoxelSizeCm);
Writer->WriteValue(TEXT("seed"), Seed); Writer->WriteValue(TEXT("seed"), Seed);
Writer->WriteValue(TEXT("open_surface_entry"), AuthoredSettings->bOpenSurfaceEntry); Writer->WriteValue(TEXT("open_surface_entry"), ExportSettings->bOpenSurfaceEntry);
Writer->WriteValue(TEXT("origin_spine_radius"), OriginSpineRadius); Writer->WriteValue(TEXT("origin_spine_radius"), OriginSpineRadius);
Writer->WriteValue(TEXT("world_radius_voxels"), WorldRadiusVoxels); Writer->WriteValue(TEXT("world_radius_voxels"), WorldRadiusVoxels);
Writer->WriteValue(TEXT("edge_seal_thickness"), AuthoredSettings->EdgeSealThickness); Writer->WriteValue(TEXT("edge_seal_thickness"), ExportSettings->EdgeSealThickness);
Writer->WriteValue(TEXT("total_strates"), Manager->GetNumStrates()); Writer->WriteValue(TEXT("total_strates"), Manager->GetNumStrates());
Writer->WriteValue(TEXT("inter_strate_gap_chunks"), AuthoredSettings->InterStrateGapChunks); Writer->WriteValue(TEXT("inter_strate_gap_chunks"), ExportSettings->InterStrateGapChunks);
Writer->WriteValue(TEXT("clip_radius"), AuthoredSettings->ClipRadius); Writer->WriteValue(TEXT("clip_radius"), ExportSettings->ClipRadius);
Writer->WriteValue(TEXT("max_clip_level"), AuthoredSettings->MaxClipLevel); Writer->WriteValue(TEXT("max_clip_level"), ExportSettings->MaxClipLevel);
Writer->WriteValue(TEXT("full_res_clip_levels"), AuthoredSettings->FullResClipLevels); Writer->WriteValue(TEXT("full_res_clip_levels"), ExportSettings->FullResClipLevels);
Writer->WriteValue(TEXT("coarse_tile_cells"), AuthoredSettings->CoarseTileCells); Writer->WriteValue(TEXT("coarse_tile_cells"), ExportSettings->CoarseTileCells);
Writer->WriteValue(TEXT("render_distance_chunks"), AuthoredSettings->RenderDistanceChunks); Writer->WriteValue(TEXT("render_distance_chunks"), ExportSettings->RenderDistanceChunks);
Writer->WriteValue(TEXT("generate_skirts"), AuthoredSettings->bGenerateSkirts); Writer->WriteValue(TEXT("generate_skirts"), ExportSettings->bGenerateSkirts);
Writer->WriteValue(TEXT("skirt_cells"), AuthoredSettings->SkirtCells); Writer->WriteValue(TEXT("skirt_cells"), ExportSettings->SkirtCells);
Writer->WriteValue(TEXT("lod_octave_drop"), AuthoredSettings->LODOctaveDrop); Writer->WriteValue(TEXT("lod_octave_drop"), ExportSettings->LODOctaveDrop);
Writer->WriteValue(TEXT("strate_content_cut_min_level"), AuthoredSettings->GetEffectiveStrateContentCutMinLevel()); Writer->WriteValue(TEXT("strate_content_cut_min_level"), ExportSettings->GetEffectiveStrateContentCutMinLevel());
TSet<const UObject*> ActiveObjects; TSet<const UObject*> ActiveObjects;
StandaloneWriteJsonValue(*Writer, TEXT("settings_asset"), StandaloneWriteJsonValue(*Writer, TEXT("settings_asset"),
StandaloneSerializeStruct(AuthoredSettings->GetClass(), AuthoredSettings, StandaloneSerializeStruct(ExportSettings->GetClass(), ExportSettings,
ActiveObjects, AuthoredSettings)); ActiveObjects, ExportSettings));
Writer->WriteArrayStart(TEXT("strates")); Writer->WriteArrayStart(TEXT("strates"));
for (const FStrateSlot& Slot : Manager->GetLayout()) for (const FStrateSlot& Slot : Manager->GetLayout())
@@ -13756,6 +13866,68 @@ bool RunStandaloneWorldExport(const FExploreArguments& Arguments, FString& OutEr
Writer->WriteObjectEnd(); Writer->WriteObjectEnd();
Writer->Close(); Writer->Close();
// Export the exact Core manifest and resolved layout that the Unreal adapter just
// generated from these live settings and slots. The standalone research tools consume
// these snapshots instead of maintaining a second copy of the planning rules.
FString RuntimeSnapshotJson;
if (!VoxelForgeCoreAdapter::SerializeResolvedWorld(
ExportSettings, Manager, 3, 8, StandaloneCoreVoxelSizeCm,
RuntimeSnapshotJson, OutError))
{
return false;
}
FTCHARToUTF8 RuntimeSnapshotUtf8(*RuntimeSnapshotJson);
std::string CoreSnapshotError;
const std::optional<VoxelForgeCore::ResolvedWorldSnapshot> CoreSnapshot =
VoxelForgeCore::ResolvedWorldSnapshot::FromJson(
std::string_view(RuntimeSnapshotUtf8.Get(),
static_cast<std::size_t>(RuntimeSnapshotUtf8.Length())), CoreSnapshotError);
if (!CoreSnapshot || CoreSnapshot->worldAssembly() == nullptr
|| CoreSnapshot->resolvedLayout() == nullptr)
{
OutError = FString::Printf(
TEXT("Core adapter export did not produce a complete manifest and resolved layout: %s"),
UTF8_TO_TCHAR(CoreSnapshotError.c_str()));
return false;
}
const std::string CoreAssemblyText = CoreSnapshot->worldAssembly()->ToJson();
const std::string CoreLayoutText = CoreSnapshot->resolvedLayout()->ToJson();
if (CoreAssemblyText.empty() || CoreLayoutText.empty())
{
OutError = TEXT("Core adapter export produced an empty canonical manifest or layout.");
return false;
}
const FString CanonicalAssemblyJson = UTF8_TO_TCHAR(CoreAssemblyText.c_str());
const FString CanonicalLayoutJson = UTF8_TO_TCHAR(CoreLayoutText.c_str());
TSharedPtr<FJsonObject> ExportRoot;
const TSharedRef<TJsonReader<>> ExportReader = TJsonReaderFactory<>::Create(Json);
if (!FJsonSerializer::Deserialize(ExportReader, ExportRoot) || !ExportRoot.IsValid())
{
OutError = TEXT("Could not reopen the owner export to attach the Core plan snapshots.");
return false;
}
TSharedPtr<FJsonObject> AssemblyObject;
const TSharedRef<TJsonReader<>> AssemblyReader =
TJsonReaderFactory<>::Create(CanonicalAssemblyJson);
if (!FJsonSerializer::Deserialize(AssemblyReader, AssemblyObject) || !AssemblyObject.IsValid())
{
OutError = TEXT("Could not parse the Core adapter's canonical manifest for export.");
return false;
}
ExportRoot->SetObjectField(TEXT("world_assembly"), AssemblyObject.ToSharedRef());
ExportRoot->SetStringField(TEXT("core_world_assembly_json"), CanonicalAssemblyJson);
ExportRoot->SetStringField(TEXT("resolved_layout_json"), CanonicalLayoutJson);
FString ExportedJson;
const TSharedRef<TJsonWriter<TCHAR, TCondensedJsonPrintPolicy<TCHAR>>> ExportWriter =
TJsonWriterFactory<TCHAR, TCondensedJsonPrintPolicy<TCHAR>>::Create(&ExportedJson);
if (!FJsonSerializer::Serialize(ExportRoot.ToSharedRef(), ExportWriter))
{
OutError = TEXT("Could not serialize the owner export with its canonical Core plan.");
return false;
}
Json = MoveTemp(ExportedJson);
const FString Path = FPaths::Combine(Arguments.OutDirectory, TEXT("owner_world.json")); const FString Path = FPaths::Combine(Arguments.OutDirectory, TEXT("owner_world.json"));
if (!FFileHelper::SaveStringToFile( if (!FFileHelper::SaveStringToFile(
Json, *Path, FFileHelper::EEncodingOptions::ForceUTF8WithoutBOM)) Json, *Path, FFileHelper::EEncodingOptions::ForceUTF8WithoutBOM))
@@ -13764,11 +13936,16 @@ bool RunStandaloneWorldExport(const FExploreArguments& Arguments, FString& OutEr
return false; return false;
} }
if (OutJson) *OutJson = Json; if (OutJson) *OutJson = Json;
if (!VerifyStandaloneCoreAdapter(Json, OutError)) if (!Arguments.bSkipStandaloneCoreAdapterParity && !VerifyStandaloneCoreAdapter(Json, OutError))
{ {
UE_LOG(LogTemp, Error, TEXT("[VoxelForgeCoreAdapter] %s"), *OutError); UE_LOG(LogTemp, Error, TEXT("[VoxelForgeCoreAdapter] %s"), *OutError);
return false; return false;
} }
if (Arguments.bSkipStandaloneCoreAdapterParity)
{
UE_LOG(LogTemp, Display,
TEXT("[VoxelForgeCoreAdapter] skipped legacy W1/W8/W16 fixture parity for this export-only update."));
}
UE_LOG(LogTemp, Display, UE_LOG(LogTemp, Display,
TEXT("[VoxelForgeStandaloneExport] seed=%d voxel_size_cm=%.3f strates=%d passages=%d samples=%d camera_found=%d file=%s"), TEXT("[VoxelForgeStandaloneExport] seed=%d voxel_size_cm=%.3f strates=%d passages=%d samples=%d camera_found=%d file=%s"),
Seed, StandaloneCoreVoxelSizeCm, Manager->GetNumStrates(), Manager->GetPassages().Num(), Seed, StandaloneCoreVoxelSizeCm, Manager->GetNumStrates(), Manager->GetPassages().Num(),
@@ -14808,7 +14985,7 @@ bool CreateLoggedOwnerSurfaceSettingsCopy(
UVoxelSettings* Source, int32 Seed, UVoxelSettings* Source, int32 Seed,
TStrongObjectPtr<UVoxelSettings>& OutSettings, TStrongObjectPtr<UVoxelSettings>& OutSettings,
TStrongObjectPtr<UVoxelStrateDefinition>& OutSurfaceDefinition, TStrongObjectPtr<UVoxelStrateDefinition>& OutSurfaceDefinition,
FString& OutError) FString& OutError, bool bCompactTracePlan = false)
{ {
if (Source == nullptr) if (Source == nullptr)
{ {
@@ -14824,11 +15001,10 @@ bool CreateLoggedOwnerSurfaceSettingsCopy(
nullptr, TEXT("/Game/VoxelForge/DA_Strate1.DA_Strate1")); nullptr, TEXT("/Game/VoxelForge/DA_Strate1.DA_Strate1"));
if (SurfaceDefinition == nullptr if (SurfaceDefinition == nullptr
|| SurfaceDefinition->GeneratorType != ECaveGeneratorType::SurfaceWorld || SurfaceDefinition->GeneratorType != ECaveGeneratorType::SurfaceWorld
|| SurfaceDefinition->StrateHeightInChunks <= 0 || SurfaceDefinition->StrateHeightInChunks <= 0)
|| Source->TotalStrates != 1)
{ {
OutError = FString::Printf( OutError = FString::Printf(
TEXT("The staged owner assets do not describe the logged single SurfaceWorld (definition_loaded=%d type=%d height=%d settings_strates=%d)."), TEXT("The staged owner assets do not contain a usable DA_Strate1 SurfaceWorld (definition_loaded=%d type=%d height=%d settings_strates=%d)."),
SurfaceDefinition != nullptr ? 1 : 0, SurfaceDefinition != nullptr ? 1 : 0,
SurfaceDefinition != nullptr ? static_cast<int32>(SurfaceDefinition->GeneratorType) : INDEX_NONE, SurfaceDefinition != nullptr ? static_cast<int32>(SurfaceDefinition->GeneratorType) : INDEX_NONE,
SurfaceDefinition != nullptr ? SurfaceDefinition->StrateHeightInChunks : INDEX_NONE, SurfaceDefinition != nullptr ? SurfaceDefinition->StrateHeightInChunks : INDEX_NONE,
@@ -14843,9 +15019,24 @@ bool CreateLoggedOwnerSurfaceSettingsCopy(
return false; return false;
} }
OutSettings = TStrongObjectPtr<UVoxelSettings>(SettingsCopy); OutSettings = TStrongObjectPtr<UVoxelSettings>(SettingsCopy);
if (bCompactTracePlan)
{
SurfaceDefinition = DuplicateObject<UVoxelStrateDefinition>(SurfaceDefinition,
GetTransientPackage(), TEXT("VoxelForgeCompactSurfaceTraceDefinition"));
if (SurfaceDefinition == nullptr)
{
OutError = TEXT("Could not make a transient DA_Strate1 copy for the compact common-plan trace.");
return false;
}
// L14's historical fixed-length SurfaceWorld route search cannot place the
// new trace fixture even at 16 chunks. Use the same simple, walkable FlatPlain
// plan in both host revisions so the streaming comparison reaches AVoxelWorld.
SurfaceDefinition->GeneratorType = ECaveGeneratorType::FlatPlain;
SurfaceDefinition->StrateHeightInChunks = 16;
}
OutSurfaceDefinition = TStrongObjectPtr<UVoxelStrateDefinition>(SurfaceDefinition); OutSurfaceDefinition = TStrongObjectPtr<UVoxelStrateDefinition>(SurfaceDefinition);
SettingsCopy->Seed = Seed; SettingsCopy->Seed = Seed;
SettingsCopy->TotalStrates = Source->TotalStrates; SettingsCopy->TotalStrates = 1;
SettingsCopy->StratePool.Reset(); SettingsCopy->StratePool.Reset();
SettingsCopy->FixedStrates.Reset(); SettingsCopy->FixedStrates.Reset();
SettingsCopy->FixedStrates.Add(0, SettingsCopy->FixedStrates.Add(0,
@@ -14855,8 +15046,10 @@ bool CreateLoggedOwnerSurfaceSettingsCopy(
SettingsCopy->bUseWorldAssemblyManifestOverride = false; SettingsCopy->bUseWorldAssemblyManifestOverride = false;
const int32 BottomChunkZ = 1 - SurfaceDefinition->StrateHeightInChunks; const int32 BottomChunkZ = 1 - SurfaceDefinition->StrateHeightInChunks;
UE_LOG(LogTemp, Display, UE_LOG(LogTemp, Display,
TEXT("[VoxelForgeCoreTestLayout] source=owner_asset_transient_copy definition=DA_Strate1 seed=%d strata=1 bounds=[0,%d] height_chunks=%d gap=%d imported_override=cleared"), TEXT("[VoxelForgeCoreTestLayout] source=owner_asset_transient_copy definition=DA_Strate1 generator=%d seed=%d strata=1 bounds=[0,%d] height_chunks=%d compact_trace=%d gap=%d imported_override=cleared"),
Seed, BottomChunkZ, SurfaceDefinition->StrateHeightInChunks, SettingsCopy->InterStrateGapChunks); static_cast<int32>(SurfaceDefinition->GeneratorType), Seed, BottomChunkZ,
SurfaceDefinition->StrateHeightInChunks,
bCompactTracePlan ? 1 : 0, SettingsCopy->InterStrateGapChunks);
return true; return true;
} }
@@ -16432,7 +16625,15 @@ bool RunCoreFloatingIslandActorIntegrationTest(
} }
float StagedWalkSpeedCmPerSecond = 0.0f; float StagedWalkSpeedCmPerSecond = 0.0f;
float StagedSprintSpeedCmPerSecond = 0.0f; float StagedSprintSpeedCmPerSecond = 0.0f;
if (!ReadStagedPlayerSpeeds( if (Arguments.bCoreWorldStreamTraceOnly)
{
StagedWalkSpeedCmPerSecond = 600.0f;
StagedSprintSpeedCmPerSecond = 6000.0f;
UE_LOG(LogTemp, Display,
TEXT("[VoxelForgePawnSpeedFixture] source=trace_fixture_defaults walk_cm_s=%.3f sprint_cm_s=%.3f"),
StagedWalkSpeedCmPerSecond, StagedSprintSpeedCmPerSecond);
}
else if (!ReadStagedPlayerSpeeds(
StagedWalkSpeedCmPerSecond, StagedSprintSpeedCmPerSecond, OutError)) StagedWalkSpeedCmPerSecond, StagedSprintSpeedCmPerSecond, OutError))
{ {
return false; return false;
@@ -17065,7 +17266,8 @@ bool RunCoreFloatingIslandActorIntegrationTest(
{ {
if (World == nullptr || World->DesiredSorted.IsEmpty()) return false; if (World == nullptr || World->DesiredSorted.IsEmpty()) return false;
for (const FVoxelTileKey& Key : World->DesiredSorted) for (const FVoxelTileKey& Key : World->DesiredSorted)
if (!World->LoadedTiles.Contains(Key)) return false; if (!World->LoadedTiles.Contains(Key)
&& !World->CollisionNotRequiredTiles.Contains(Key)) return false;
return true; return true;
}; };
const auto CollisionSetSettled = [](const AVoxelWorld* World) const auto CollisionSetSettled = [](const AVoxelWorld* World)
@@ -17654,8 +17856,16 @@ bool RunCoreWorldActorIntegrationTest(const FExploreArguments& Arguments, FStrin
float StagedWalkSpeedCmPerSecond = 0.0f; float StagedWalkSpeedCmPerSecond = 0.0f;
float StagedSprintSpeedCmPerSecond = 0.0f; float StagedSprintSpeedCmPerSecond = 0.0f;
if (!ReadStagedPlayerSpeeds( if (Arguments.bCoreWorldStreamTraceOnly)
StagedWalkSpeedCmPerSecond, StagedSprintSpeedCmPerSecond, OutError)) {
StagedWalkSpeedCmPerSecond = 600.0f;
StagedSprintSpeedCmPerSecond = 6000.0f;
UE_LOG(LogTemp, Display,
TEXT("[VoxelForgePawnSpeedFixture] source=trace_fixture_defaults walk_cm_s=%.3f sprint_cm_s=%.3f"),
StagedWalkSpeedCmPerSecond, StagedSprintSpeedCmPerSecond);
}
else if (!ReadStagedPlayerSpeeds(
StagedWalkSpeedCmPerSecond, StagedSprintSpeedCmPerSecond, OutError))
{ {
return false; return false;
} }
@@ -17663,8 +17873,26 @@ bool RunCoreWorldActorIntegrationTest(const FExploreArguments& Arguments, FStrin
const int32 OwnerSeed = ResolveCoreTestWorldSeed(AuthoredSettings); const int32 OwnerSeed = ResolveCoreTestWorldSeed(AuthoredSettings);
TStrongObjectPtr<UVoxelSettings> OwnerSurfaceSettings; TStrongObjectPtr<UVoxelSettings> OwnerSurfaceSettings;
TStrongObjectPtr<UVoxelStrateDefinition> OwnerSurfaceDefinition; TStrongObjectPtr<UVoxelStrateDefinition> OwnerSurfaceDefinition;
if (!CreateLoggedOwnerSurfaceSettingsCopy(AuthoredSettings, OwnerSeed, TArray<TStrongObjectPtr<UVoxelStrateDefinition>> OwnerPlanDefinitions;
OwnerSurfaceSettings, OwnerSurfaceDefinition, OutError)) if (Arguments.bOwnerFourStratePlan)
{
UVoxelSettings* PlanSettings = DuplicateObject<UVoxelSettings>(
AuthoredSettings, GetTransientPackage(), TEXT("VoxelForgeOwnerFourStrateTraceSettings"));
if (PlanSettings == nullptr)
{
OutError = TEXT("Could not duplicate owner settings for the transient four-strate Core trace.");
return false;
}
PlanSettings->Seed = OwnerSeed;
if (!ApplyOwnerFourStratePlan(PlanSettings, OwnerPlanDefinitions, true, OutError))
{
return false;
}
OwnerSurfaceSettings = TStrongObjectPtr<UVoxelSettings>(PlanSettings);
}
else if (!CreateLoggedOwnerSurfaceSettingsCopy(AuthoredSettings, OwnerSeed,
OwnerSurfaceSettings, OwnerSurfaceDefinition, OutError,
Arguments.bCoreWorldStreamTraceOnly))
{ {
return false; return false;
} }
@@ -17822,6 +18050,25 @@ bool RunCoreWorldActorIntegrationTest(const FExploreArguments& Arguments, FStrin
OutError = TEXT("Could not create the BuildHost stream-trace pawn."); OutError = TEXT("Could not create the BuildHost stream-trace pawn.");
return false; return false;
} }
FVector StartupTraceSpawnCm = FVector::ZeroVector;
FString StartupTraceSpawnText;
if (FParse::Value(FCommandLine::Get(), TEXT("voxel.StartupTraceSpawnCm="),
StartupTraceSpawnText, false))
{
TArray<FString> Components;
StartupTraceSpawnText.ParseIntoArray(Components, TEXT(","), true);
if (Components.Num() != 3
|| !LexTryParseString(StartupTraceSpawnCm.X, *Components[0])
|| !LexTryParseString(StartupTraceSpawnCm.Y, *Components[1])
|| !LexTryParseString(StartupTraceSpawnCm.Z, *Components[2])
|| !FMath::IsFinite(StartupTraceSpawnCm.X)
|| !FMath::IsFinite(StartupTraceSpawnCm.Y)
|| !FMath::IsFinite(StartupTraceSpawnCm.Z))
{
OutError = TEXT("voxel.StartupTraceSpawnCm must be finite X,Y,Z centimetres.");
return false;
}
}
USceneComponent* PawnRoot = NewObject<USceneComponent>(PlayerPawn, NAME_None, RF_Transient); USceneComponent* PawnRoot = NewObject<USceneComponent>(PlayerPawn, NAME_None, RF_Transient);
if (PawnRoot == nullptr) if (PawnRoot == nullptr)
{ {
@@ -17830,7 +18077,7 @@ bool RunCoreWorldActorIntegrationTest(const FExploreArguments& Arguments, FStrin
} }
PlayerPawn->SetRootComponent(PawnRoot); PlayerPawn->SetRootComponent(PawnRoot);
PawnRoot->RegisterComponent(); PawnRoot->RegisterComponent();
PlayerPawn->SetActorLocation(FVector::ZeroVector, false, nullptr, ETeleportType::TeleportPhysics); PlayerPawn->SetActorLocation(StartupTraceSpawnCm, false, nullptr, ETeleportType::TeleportPhysics);
PlayerController->Possess(PlayerPawn); PlayerController->Possess(PlayerPawn);
if (TestWorld->GetFirstPlayerController() != PlayerController if (TestWorld->GetFirstPlayerController() != PlayerController
|| PlayerController->GetPawn() != PlayerPawn) || PlayerController->GetPawn() != PlayerPawn)
@@ -17859,7 +18106,10 @@ bool RunCoreWorldActorIntegrationTest(const FExploreArguments& Arguments, FStrin
: EVoxelForgeCoreMesherRecipe::MarchingCubesV1); : EVoxelForgeCoreMesherRecipe::MarchingCubesV1);
Actor->CoreClipRadius = 3; Actor->CoreClipRadius = 3;
Actor->CoreMaxClipLevel = 8; Actor->CoreMaxClipLevel = 8;
Actor->bCaptureVoxelForgeCoreHashesForValidation = true; // A timing trace must use the production tile path. Core density hashing disables the
// native heightfield band shortcut and measures a different workload; hash validation
// remains enabled in the dedicated parity tests below.
Actor->bCaptureVoxelForgeCoreHashesForValidation = false;
Actor->FinishSpawning(ActorTransform); Actor->FinishSpawning(ActorTransform);
TestWorld->InitializeActorsForPlay(FURL()); TestWorld->InitializeActorsForPlay(FURL());
TestWorld->BeginPlay(); TestWorld->BeginPlay();
@@ -17869,13 +18119,19 @@ bool RunCoreWorldActorIntegrationTest(const FExploreArguments& Arguments, FStrin
return false; return false;
} }
Actor->SetActorTickEnabled(true); Actor->SetActorTickEnabled(true);
VoxelForgeStartupTrace::RecordEvent(TEXT("trace_spawn_location"), FString::Printf(
TEXT("\"location_cm\":[%s,%s,%s]"),
*FString::SanitizeFloat(StartupTraceSpawnCm.X),
*FString::SanitizeFloat(StartupTraceSpawnCm.Y),
*FString::SanitizeFloat(StartupTraceSpawnCm.Z)));
auto DesiredTilesLoaded = [](const AVoxelWorld* World) auto DesiredTilesLoaded = [](const AVoxelWorld* World)
{ {
if (World == nullptr || World->DesiredSorted.IsEmpty()) return false; if (World == nullptr || World->DesiredSorted.IsEmpty()) return false;
for (const FVoxelTileKey& Key : World->DesiredSorted) for (const FVoxelTileKey& Key : World->DesiredSorted)
{ {
if (!World->LoadedTiles.Contains(Key)) return false; if (!World->LoadedTiles.Contains(Key)
&& !World->CollisionNotRequiredTiles.Contains(Key)) return false;
} }
return true; return true;
}; };
@@ -18023,6 +18279,7 @@ bool RunCoreWorldActorIntegrationTest(const FExploreArguments& Arguments, FStrin
const double CarveBrushRadiusCoreVoxels = const double CarveBrushRadiusCoreVoxels =
CarveBrushRadiusLegacyVoxels * static_cast<double>(VOXEL_SIZE) / CoreVoxelSizeCm; CarveBrushRadiusLegacyVoxels * static_cast<double>(VOXEL_SIZE) / CoreVoxelSizeCm;
const int32 CollisionRadius = FMath::Clamp(AuthoredSettings->PawnCollisionRadiusChunks, 1, 4); const int32 CollisionRadius = FMath::Clamp(AuthoredSettings->PawnCollisionRadiusChunks, 1, 4);
FIntVector ColdStartCollisionCenter = FIntVector::ZeroValue;
uint64 ExpectedEditDigest = 0; uint64 ExpectedEditDigest = 0;
std::array<std::uint64_t, 4> InitialAggregates{}; std::array<std::uint64_t, 4> InitialAggregates{};
std::array<std::uint64_t, 4> TravelAggregates{}; std::array<std::uint64_t, 4> TravelAggregates{};
@@ -18208,10 +18465,17 @@ bool RunCoreWorldActorIntegrationTest(const FExploreArguments& Arguments, FStrin
BiomeProbeSpanVoxels); BiomeProbeSpanVoxels);
VoxelForgeCore::World ReferenceWorld(std::move(*Snapshot)); VoxelForgeCore::World ReferenceWorld(std::move(*Snapshot));
const std::vector<VoxelForgeCore::TileKey> Desired = ReferenceWorld.desiredTiles({}); // Match the actor's cold-start fallback camera when the transient world has no pawn.
// Aligner la reference sur la camera de repli de l'acteur sans pawn au demarrage.
const VoxelForgeCore::WorldConfiguration& ReferenceConfiguration =
ReferenceWorld.configuration();
const VoxelForgeCore::Vec3d InitialCameraVoxels = ReferenceConfiguration.viewerStartFound
? ReferenceConfiguration.viewerStartVoxels : VoxelForgeCore::Vec3d{};
const std::vector<VoxelForgeCore::TileKey> Desired =
ReferenceWorld.desiredTiles(InitialCameraVoxels);
if (Desired.empty()) if (Desired.empty())
{ {
OutError = TEXT("Standalone Core returned an empty reference clipmap at the origin."); OutError = TEXT("Standalone Core returned an empty reference clipmap at the cold-start camera.");
return false; return false;
} }
ExpectedInitialTileCount = Desired.size(); ExpectedInitialTileCount = Desired.size();
@@ -18258,7 +18522,23 @@ bool RunCoreWorldActorIntegrationTest(const FExploreArguments& Arguments, FStrin
UTF8_TO_TCHAR(CoreError.c_str())); UTF8_TO_TCHAR(CoreError.c_str()));
return false; return false;
} }
ReferenceWorld.retainTileRegions(Desired); // Match the runtime collision probe around the same cold-start viewer tile.
// Reproduire la sonde de collision autour de la meme tuile de depart a froid.
ColdStartCollisionCenter = FIntVector(
FMath::FloorToInt(InitialCameraVoxels.x / 32.0),
FMath::FloorToInt(InitialCameraVoxels.y / 32.0),
FMath::FloorToInt(InitialCameraVoxels.z / 32.0));
std::vector<VoxelForgeCore::TileKey> ColdStartCollisionTiles;
ColdStartCollisionTiles.reserve(static_cast<std::size_t>(2 * CollisionRadius + 1)
* static_cast<std::size_t>(2 * CollisionRadius + 1)
* static_cast<std::size_t>(2 * CollisionRadius + 1));
for (int32 Z = -CollisionRadius; Z <= CollisionRadius; ++Z)
for (int32 Y = -CollisionRadius; Y <= CollisionRadius; ++Y)
for (int32 X = -CollisionRadius; X <= CollisionRadius; ++X)
ColdStartCollisionTiles.push_back({
{ColdStartCollisionCenter.X + X,
ColdStartCollisionCenter.Y + Y,
ColdStartCollisionCenter.Z + Z}, 0});
if (Arguments.bCoreHybridCliffOnly) if (Arguments.bCoreHybridCliffOnly)
{ {
@@ -18332,6 +18612,47 @@ bool RunCoreWorldActorIntegrationTest(const FExploreArguments& Arguments, FStrin
Options.mesherRecipe = VoxelForgeCore::MesherRecipe::worldAssemblerHybridV1; Options.mesherRecipe = VoxelForgeCore::MesherRecipe::worldAssemblerHybridV1;
else else
Options.mesherRecipe = VoxelForgeCore::MesherRecipe::marchingCubesV1; Options.mesherRecipe = VoxelForgeCore::MesherRecipe::marchingCubesV1;
// Keep collision hashes outside ExpectedInitialDesiredSet; the collision cube is an
// additional runtime request even where it overlaps the visual clipmap.
// Garder les hachages de collision hors de l'ensemble visuel initial, meme s'ils se
// recoupent avec le clipmap.
std::vector<VoxelForgeCore::TileKey> RetainedReferenceTiles = Desired;
RetainedReferenceTiles.insert(RetainedReferenceTiles.end(),
ColdStartCollisionTiles.begin(), ColdStartCollisionTiles.end());
ReferenceWorld.retainTileRegions(RetainedReferenceTiles);
if (!ReferenceWorld.compileTileRegion(ColdStartCollisionTiles, 16, Scheduler, CoreError))
{
OutError = FString::Printf(TEXT("Standalone collision reference compile failed: %s"),
UTF8_TO_TCHAR(CoreError.c_str()));
return false;
}
std::size_t CollisionBodyTiles = 0;
for (const VoxelForgeCore::TileKey& Key : ColdStartCollisionTiles)
{
const std::optional<VoxelForgeCore::TileMesh> Mesh =
ReferenceWorld.generateTile(Key, Options, CoreError);
if (!Mesh)
{
OutError = FString::Printf(TEXT("Standalone collision tile generation failed: %s"),
UTF8_TO_TCHAR(CoreError.c_str()));
return false;
}
FVoxelForgeCoreTileHashRecord Record;
Record.bEmpty = Mesh->indices.empty();
Record.bHasHashes = Mesh->hasDensityHash && Mesh->hasMeshHash
&& Mesh->hasPayloadHash && Mesh->hasTopologyHash;
if (!Record.bEmpty) ++CollisionBodyTiles;
ExpectedHashes.Add(FVoxelTileKey(
FIntVector(Key.coordinate.x, Key.coordinate.y, Key.coordinate.z), Key.lod), Record);
}
UE_LOG(LogTemp, Display,
TEXT("[VoxelForgeCoreWorldTest] standalone_collision_reference=1 center=(%d,%d,%d) tiles=%d body=%llu no_body=%llu"),
ColdStartCollisionCenter.X, ColdStartCollisionCenter.Y, ColdStartCollisionCenter.Z,
static_cast<int32>(ColdStartCollisionTiles.size()),
static_cast<unsigned long long>(CollisionBodyTiles),
static_cast<unsigned long long>(ColdStartCollisionTiles.size() - CollisionBodyTiles));
std::vector<FStandaloneCoreAdapterTileHashes> AggregateRows; std::vector<FStandaloneCoreAdapterTileHashes> AggregateRows;
AggregateRows.reserve(Desired.size()); AggregateRows.reserve(Desired.size());
bool bFoundCarveVertex = false; bool bFoundCarveVertex = false;
@@ -19264,7 +19585,8 @@ bool RunCoreWorldActorIntegrationTest(const FExploreArguments& Arguments, FStrin
if (World == nullptr || World->DesiredSorted.IsEmpty()) return false; if (World == nullptr || World->DesiredSorted.IsEmpty()) return false;
for (const FVoxelTileKey& Key : World->DesiredSorted) for (const FVoxelTileKey& Key : World->DesiredSorted)
{ {
if (!World->LoadedTiles.Contains(Key)) return false; if (!World->LoadedTiles.Contains(Key)
&& !World->CollisionNotRequiredTiles.Contains(Key)) return false;
} }
return true; return true;
}; };
@@ -19367,7 +19689,7 @@ bool RunCoreWorldActorIntegrationTest(const FExploreArguments& Arguments, FStrin
for (int32 Y = -CollisionRadius; Y <= CollisionRadius; ++Y) for (int32 Y = -CollisionRadius; Y <= CollisionRadius; ++Y)
for (int32 X = -CollisionRadius; X <= CollisionRadius; ++X) for (int32 X = -CollisionRadius; X <= CollisionRadius; ++X)
{ {
const FVoxelTileKey Key(FIntVector(X, Y, Z), 0); const FVoxelTileKey Key(ColdStartCollisionCenter + FIntVector(X, Y, Z), 0);
ExpectedCollisionSet.Add(Key); ExpectedCollisionSet.Add(Key);
const FVoxelForgeCoreTileHashRecord* Record = ExpectedHashes.Find(Key); const FVoxelForgeCoreTileHashRecord* Record = ExpectedHashes.Find(Key);
if (Record == nullptr) if (Record == nullptr)
@@ -21361,6 +21683,44 @@ int32 RunBatch(const FString& Params)
int32 UVoxelForgeExploreCommandlet::Main(const FString& Params) int32 UVoxelForgeExploreCommandlet::Main(const FString& Params)
{ {
if (FParse::Param(*Params, TEXT("coreassetupgradeaudit")))
{
// Load the untouched BuildHost copies and emit their in-memory conversions; never save a package.
// Charge les copies BuildHost intactes et affiche les conversions en memoire, sans sauver de package.
UVoxelSettings* SettingsAsset = LoadObject<UVoxelSettings>(nullptr,
TEXT("/Game/VoxelForge/DA_Settings.DA_Settings"));
if (SettingsAsset == nullptr)
{
UE_LOG(LogTemp, Error, TEXT("[VoxelForgeAssetMigrationAudit] missing DA_Settings copy"));
return 2;
}
UE_LOG(LogTemp, Display,
TEXT("[VoxelForgeAssetMigrationAudit] asset=%s old_gap_chunks=%d new_gap_m=%.6f layout_chunk_m=%.6f"),
*SettingsAsset->GetPathName(), SettingsAsset->InterStrateGapChunks,
SettingsAsset->InterStrateGapMeters, SettingsAsset->StrateLayoutChunkSizeMeters);
const TCHAR* StratePaths[] = {
TEXT("/Game/VoxelForge/DA_Strate1.DA_Strate1"),
TEXT("/Game/VoxelForge/DA_Strate2.DA_Strate2"),
TEXT("/Game/VoxelForge/DA_Strate3.DA_Strate3"),
TEXT("/Game/VoxelForge/DA_Strate4.DA_Strate4")
};
for (const TCHAR* Path : StratePaths)
{
UVoxelStrateDefinition* Definition = LoadObject<UVoxelStrateDefinition>(nullptr, Path);
if (Definition == nullptr)
{
UE_LOG(LogTemp, Error, TEXT("[VoxelForgeAssetMigrationAudit] missing strate copy %s"), Path);
return 2;
}
UE_LOG(LogTemp, Display,
TEXT("[VoxelForgeAssetMigrationAudit] asset=%s old_height_chunks=%d new_height_m=%.6f old_transition_chunks=%d new_transition_m=%.6f"),
*Definition->GetPathName(), Definition->StrateHeightInChunks,
Definition->StrateHeightMeters, Definition->TransitionBlendChunks,
Definition->TransitionWidthMeters);
}
return 0;
}
if (FParse::Param(*Params, TEXT("step2f"))) if (FParse::Param(*Params, TEXT("step2f")))
{ {
return RunStep2f(Params); return RunStep2f(Params);
+53 -5
View File
@@ -7,10 +7,14 @@ fi
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
ROOT="$SCRIPT_DIR" ROOT="$SCRIPT_DIR"
PROJECT_ROOT="$(cd -- "$ROOT/.." && pwd)"
VERIFY_DIR="$ROOT/Tools/verify"
COMPILER="clang++-19" COMPILER="clang++-19"
VARIANT="clang19" VARIANT="clang19"
FP_CONTRACT="off" FP_CONTRACT="off"
JOBS=12 JOBS=12
SANITIZERS=""
EXCLUDE_UNSIGNED_OVERFLOW=0
while (($#)); do while (($#)); do
case "$1" in case "$1" in
@@ -18,6 +22,8 @@ while (($#)); do
--variant=*) VARIANT="${1#*=}" ;; --variant=*) VARIANT="${1#*=}" ;;
--fp-contract=*) FP_CONTRACT="${1#*=}" ;; --fp-contract=*) FP_CONTRACT="${1#*=}" ;;
--jobs=*) JOBS="${1#*=}" ;; --jobs=*) JOBS="${1#*=}" ;;
--sanitize=*) SANITIZERS="${1#*=}" ;;
--exclude-unsigned-integer-overflow) EXCLUDE_UNSIGNED_OVERFLOW=1 ;;
*) printf 'Unknown build option: %s\n' "$1" >&2; exit 2 ;; *) printf 'Unknown build option: %s\n' "$1" >&2; exit 2 ;;
esac esac
shift shift
@@ -36,10 +42,20 @@ 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; } 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; } 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"
STAMP_HELPER="$VERIFY_DIR/source_stamp.py"
STAMP_ARGS=()
if [[ "${VOXELFORGE_INCLUDE_UNREAL_ADAPTER:-0}" == "1" ]]; then
STAMP_ARGS+=(--include-unreal-adapter)
fi
SOURCE_STAMP="$(python3 -B "$STAMP_HELPER" stamp --root "$PROJECT_ROOT" "${STAMP_ARGS[@]}")"
python3 -B "$STAMP_HELPER" write-manifest --root "$PROJECT_ROOT" --output "$BUILD_DIR/source-manifest.txt" "${STAMP_ARGS[@]}" >/dev/null
printf 'Source stamp: %s\n' "$SOURCE_STAMP"
INCLUDES=( INCLUDES=(
"-I$ROOT/Core/include" "-I$ROOT/Core/include"
"-I$ROOT/Core/src" "-I$ROOT/Core/src"
@@ -48,13 +64,32 @@ INCLUDES=(
"-I$ROOT/Source/VoxelForge/Public" "-I$ROOT/Source/VoxelForge/Public"
"-I$ROOT/Source/VoxelForge/Private" "-I$ROOT/Source/VoxelForge/Private"
) )
OPT_LEVEL=-O2
LINK_FLAGS=()
if [[ -n "$SANITIZERS" ]]; then
OPT_LEVEL=-O1
LINK_FLAGS+=("-fsanitize=$SANITIZERS" -fno-sanitize-recover=undefined)
if ((EXCLUDE_UNSIGNED_OVERFLOW)); then
LINK_FLAGS+=(-fno-sanitize=unsigned-integer-overflow)
fi
fi
FLAGS=( FLAGS=(
-std=c++20 -O2 -mavx2 -mfma -fno-fast-math -std=c++20 "$OPT_LEVEL" -mavx2 -mfma -fno-fast-math
-fexceptions -pthread "${INCLUDES[@]}" -fexceptions -pthread "${INCLUDES[@]}"
"-DVOXELFORGE_SOURCE_STAMP=\"$SOURCE_STAMP\""
) )
FLAGS+=("${LINK_FLAGS[@]}")
if [[ "$FP_CONTRACT" != "default" ]]; then if [[ "$FP_CONTRACT" != "default" ]]; then
FLAGS+=("-ffp-contract=$FP_CONTRACT") FLAGS+=("-ffp-contract=$FP_CONTRACT")
fi fi
if [[ "${VOXELFORGE_PROFILE_LEGACY_TERMS:-0}" == "1" ]]; then
FLAGS+=(-DVF_L76_PROFILE_LEGACY_TERMS=1)
fi
if [[ "${VOXELFORGE_PROFILE_L77:-0}" == "1" ]]; then
FLAGS+=(-DVF_L77_PROFILE=1 -g)
LINK_FLAGS+=(-no-pie)
fi
if [[ "$($COMPILER --version | head -n 1)" == *clang* ]]; then if [[ "$($COMPILER --version | head -n 1)" == *clang* ]]; then
FLAGS+=(-Wno-c++11-narrowing) FLAGS+=(-Wno-c++11-narrowing)
else else
@@ -111,6 +146,11 @@ done < "$ROOT/Core/core_sources.txt"
headless_object="$BUILD_DIR/objects/StreamBenchmarkHeadless.o" headless_object="$BUILD_DIR/objects/StreamBenchmarkHeadless.o"
compile_background "$ROOT/Source/StreamBenchmarkHeadless.cpp" "$headless_object" compile_background "$ROOT/Source/StreamBenchmarkHeadless.cpp" "$headless_object"
LEGACY_OBJECTS+=("$headless_object") LEGACY_OBJECTS+=("$headless_object")
if [[ "${VOXELFORGE_PROFILE_L77:-0}" == "1" ]]; then
l77_profiler_object="$BUILD_DIR/objects/Linux77Profiler.o"
compile_background "$ROOT/Source/Linux77Profiler.cpp" "$l77_profiler_object"
LEGACY_OBJECTS+=("$l77_profiler_object")
fi
for pid in "${PIDS[@]}"; do wait "$pid"; done for pid in "${PIDS[@]}"; do wait "$pid"; done
PIDS=() PIDS=()
@@ -118,11 +158,19 @@ PIDS=()
CORE_LIBRARY="$BUILD_DIR/libVoxelForgeCore.a" 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 "${LINK_FLAGS[@]}" "${LEGACY_OBJECTS[@]}" "$CORE_LIBRARY" -o "$OUTPUT"
CAPTURE_OUTPUT="$BIN_DIR/VoxelForgeOffscreenCapture-$VARIANT" CAPTURE_OUTPUT="$BIN_DIR/VoxelForgeOffscreenCapture-$VARIANT"
"$COMPILER" -std=c++20 -O2 -fno-fast-math -pthread \ "$COMPILER" -std=c++20 -O2 -fno-fast-math -pthread \
"-DVOXELFORGE_SOURCE_STAMP=\"$SOURCE_STAMP\"" -I"$ROOT/Source" \
"$ROOT/Source/LinuxOffscreenCapture.cpp" -o "$CAPTURE_OUTPUT" \ "$ROOT/Source/LinuxOffscreenCapture.cpp" -o "$CAPTURE_OUTPUT" \
$(pkg-config --cflags --libs egl glesv2 libpng) $(pkg-config --cflags --libs egl glesv2 libpng)
POST_BUILD_STAMP="$(python3 -B "$STAMP_HELPER" stamp --root "$PROJECT_ROOT" "${STAMP_ARGS[@]}")"
if [[ "$POST_BUILD_STAMP" != "$SOURCE_STAMP" ]]; then
printf 'Source changed during build: before=%s after=%s\n' "$SOURCE_STAMP" "$POST_BUILD_STAMP" >&2
exit 1
fi
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 '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 | sanitizers: %s | jobs: %s\n' \
"$COMPILER" "$VARIANT" "$FP_CONTRACT" "${SANITIZERS:-off}" "$JOBS"
+6 -1
View File
@@ -1 +1,6 @@
#pragma once #pragma once
#if defined(VFCORE_COMPAT_FORWARD_HEADERS) && !defined(VFCORE_USE_COMPAT) \
&& (defined(__clang__) || defined(__GNUC__))
#include_next <AssetRegistry/AssetData.h>
#endif
@@ -1 +1,6 @@
#pragma once #pragma once
#if defined(VFCORE_COMPAT_FORWARD_HEADERS) && !defined(VFCORE_USE_COMPAT) \
&& (defined(__clang__) || defined(__GNUC__))
#include_next <AssetRegistry/AssetRegistryModule.h>
#endif
+6 -1
View File
@@ -1 +1,6 @@
#pragma once #pragma once
#if defined(VFCORE_COMPAT_FORWARD_HEADERS) && !defined(VFCORE_USE_COMPAT) \
&& (defined(__clang__) || defined(__GNUC__))
#include_next <Async/ParallelFor.h>
#endif
+9
View File
@@ -1,5 +1,10 @@
#pragma once #pragma once
#if defined(VFCORE_COMPAT_FORWARD_HEADERS) && !defined(VFCORE_USE_COMPAT) \
&& (defined(__clang__) || defined(__GNUC__))
#include_next <CoreMinimal.h>
#else
// Deliberately small UE-style surface used by the copied VoxelForge CPU sources. // Deliberately small UE-style surface used by the copied VoxelForge CPU sources.
// This is a value/container compatibility layer; it does not start or link Unreal. // This is a value/container compatibility layer; it does not start or link Unreal.
#include <algorithm> #include <algorithm>
@@ -45,6 +50,9 @@
#define GENERATED_UCLASS_BODY() #define GENERATED_UCLASS_BODY()
#define VOXELFORGE_API #define VOXELFORGE_API
#define FORCEINLINE inline #define FORCEINLINE inline
#ifdef WITH_EDITOR
#undef WITH_EDITOR
#endif
#define WITH_EDITOR 0 #define WITH_EDITOR 0
#define TRACE_CPUPROFILER_EVENT_SCOPE(...) #define TRACE_CPUPROFILER_EVENT_SCOPE(...)
#define PRAGMA_DISABLE_SHADOW_VARIABLE_WARNINGS #define PRAGMA_DISABLE_SHADOW_VARIABLE_WARNINGS
@@ -705,3 +713,4 @@ struct FParse
struct FCrc { static uint32 MemCrc32(const void*Data,int32 Length,uint32 Crc=0){const auto*P=static_cast<const uint8*>(Data);uint32 V=~Crc;for(int32 I=0;I<Length;++I){V^=P[I];for(int J=0;J<8;++J)V=(V>>1)^(0xEDB88320u&static_cast<uint32>(-static_cast<int32>(V&1)));}return ~V;} static uint32 StrCrc32(const char*S,uint32 Crc=0){return MemCrc32(S,static_cast<int32>(std::strlen(S)),Crc);} }; struct FCrc { static uint32 MemCrc32(const void*Data,int32 Length,uint32 Crc=0){const auto*P=static_cast<const uint8*>(Data);uint32 V=~Crc;for(int32 I=0;I<Length;++I){V^=P[I];for(int J=0;J<8;++J)V=(V>>1)^(0xEDB88320u&static_cast<uint32>(-static_cast<int32>(V&1)));}return ~V;} static uint32 StrCrc32(const char*S,uint32 Crc=0){return MemCrc32(S,static_cast<int32>(std::strlen(S)),Crc);} };
template<class T> using TAtomic = std::atomic<T>; template<class T> using TAtomic = std::atomic<T>;
class FThreadSafeCounter { public:int32 Increment(){return ++Value;}int32 Decrement(){return --Value;}int32 GetValue()const{return Value.load();}void Reset(){Value.store(0);}private:std::atomic<int32>Value{0};}; class FThreadSafeCounter { public:int32 Increment(){return ++Value;}int32 Decrement(){return --Value;}int32 GetValue()const{return Value.load();}void Reset(){Value.store(0);}private:std::atomic<int32>Value{0};};
#endif
+6 -1
View File
@@ -1 +1,6 @@
#pragma once #pragma once
#if defined(VFCORE_COMPAT_FORWARD_HEADERS) && !defined(VFCORE_USE_COMPAT) \
&& (defined(__clang__) || defined(__GNUC__))
#include_next <Dom/JsonObject.h>
#endif
+6 -1
View File
@@ -1 +1,6 @@
#pragma once #pragma once
#if defined(VFCORE_COMPAT_FORWARD_HEADERS) && !defined(VFCORE_USE_COMPAT) \
&& (defined(__clang__) || defined(__GNUC__))
#include_next <Dom/JsonValue.h>
#endif
+6 -1
View File
@@ -1 +1,6 @@
#pragma once #pragma once
#if defined(VFCORE_COMPAT_FORWARD_HEADERS) && !defined(VFCORE_USE_COMPAT) \
&& (defined(__clang__) || defined(__GNUC__))
#include_next <Engine/DataAsset.h>
#endif
+6 -1
View File
@@ -1 +1,6 @@
#pragma once #pragma once
#if defined(VFCORE_COMPAT_FORWARD_HEADERS) && !defined(VFCORE_USE_COMPAT) \
&& (defined(__clang__) || defined(__GNUC__))
#include_next <GameplayTagContainer.h>
#endif
+6 -1
View File
@@ -1 +1,6 @@
#pragma once #pragma once
#if defined(VFCORE_COMPAT_FORWARD_HEADERS) && !defined(VFCORE_USE_COMPAT) \
&& (defined(__clang__) || defined(__GNUC__))
#include_next <HAL/CriticalSection.h>
#endif
+6 -1
View File
@@ -1 +1,6 @@
#pragma once #pragma once
#if defined(VFCORE_COMPAT_FORWARD_HEADERS) && !defined(VFCORE_USE_COMPAT) \
&& (defined(__clang__) || defined(__GNUC__))
#include_next <HAL/Event.h>
#endif
+6 -1
View File
@@ -1 +1,6 @@
#pragma once #pragma once
#if defined(VFCORE_COMPAT_FORWARD_HEADERS) && !defined(VFCORE_USE_COMPAT) \
&& (defined(__clang__) || defined(__GNUC__))
#include_next <HAL/FileManager.h>
#endif
+6 -1
View File
@@ -1 +1,6 @@
#pragma once #pragma once
#if defined(VFCORE_COMPAT_FORWARD_HEADERS) && !defined(VFCORE_USE_COMPAT) \
&& (defined(__clang__) || defined(__GNUC__))
#include_next <HAL/IConsoleManager.h>
#endif
+6 -1
View File
@@ -1 +1,6 @@
#pragma once #pragma once
#if defined(VFCORE_COMPAT_FORWARD_HEADERS) && !defined(VFCORE_USE_COMPAT) \
&& (defined(__clang__) || defined(__GNUC__))
#include_next <HAL/PlatformProcess.h>
#endif
+6 -1
View File
@@ -1 +1,6 @@
#pragma once #pragma once
#if defined(VFCORE_COMPAT_FORWARD_HEADERS) && !defined(VFCORE_USE_COMPAT) \
&& (defined(__clang__) || defined(__GNUC__))
#include_next <HAL/PlatformTime.h>
#endif
+6
View File
@@ -1,5 +1,10 @@
#pragma once #pragma once
#if defined(VFCORE_COMPAT_FORWARD_HEADERS) && !defined(VFCORE_USE_COMPAT) \
&& (defined(__clang__) || defined(__GNUC__))
#include_next <Json.h>
#else
#include <charconv> #include <charconv>
#include <cmath> #include <cmath>
#include <cstddef> #include <cstddef>
@@ -162,3 +167,4 @@ namespace VFJson
return Parser(std::move(Text)).Parse(Out, Error); return Parser(std::move(Text)).Parse(Out, Error);
} }
} }
#endif
+6 -1
View File
@@ -1 +1,6 @@
#pragma once #pragma once
#if defined(VFCORE_COMPAT_FORWARD_HEADERS) && !defined(VFCORE_USE_COMPAT) \
&& (defined(__clang__) || defined(__GNUC__))
#include_next <Math/RandomStream.h>
#endif
+6 -1
View File
@@ -1 +1,6 @@
#pragma once #pragma once
#if defined(VFCORE_COMPAT_FORWARD_HEADERS) && !defined(VFCORE_USE_COMPAT) \
&& (defined(__clang__) || defined(__GNUC__))
#include_next <Misc/CommandLine.h>
#endif
+6 -1
View File
@@ -1 +1,6 @@
#pragma once #pragma once
#if defined(VFCORE_COMPAT_FORWARD_HEADERS) && !defined(VFCORE_USE_COMPAT) \
&& (defined(__clang__) || defined(__GNUC__))
#include_next <Misc/Crc.h>
#endif
+6 -1
View File
@@ -1 +1,6 @@
#pragma once #pragma once
#if defined(VFCORE_COMPAT_FORWARD_HEADERS) && !defined(VFCORE_USE_COMPAT) \
&& (defined(__clang__) || defined(__GNUC__))
#include_next <Misc/FileHelper.h>
#endif
+6 -1
View File
@@ -1 +1,6 @@
#pragma once #pragma once
#if defined(VFCORE_COMPAT_FORWARD_HEADERS) && !defined(VFCORE_USE_COMPAT) \
&& (defined(__clang__) || defined(__GNUC__))
#include_next <Misc/Parse.h>
#endif
+6 -1
View File
@@ -1 +1,6 @@
#pragma once #pragma once
#if defined(VFCORE_COMPAT_FORWARD_HEADERS) && !defined(VFCORE_USE_COMPAT) \
&& (defined(__clang__) || defined(__GNUC__))
#include_next <Misc/Paths.h>
#endif
+6 -1
View File
@@ -1 +1,6 @@
#pragma once #pragma once
#if defined(VFCORE_COMPAT_FORWARD_HEADERS) && !defined(VFCORE_USE_COMPAT) \
&& (defined(__clang__) || defined(__GNUC__))
#include_next <Misc/ScopeLock.h>
#endif
+6 -1
View File
@@ -1 +1,6 @@
#pragma once #pragma once
#if defined(VFCORE_COMPAT_FORWARD_HEADERS) && !defined(VFCORE_USE_COMPAT) \
&& (defined(__clang__) || defined(__GNUC__))
#include_next <Misc/ScopeRWLock.h>
#endif
+6 -1
View File
@@ -1 +1,6 @@
#pragma once #pragma once
#if defined(VFCORE_COMPAT_FORWARD_HEADERS) && !defined(VFCORE_USE_COMPAT) \
&& (defined(__clang__) || defined(__GNUC__))
#include_next <Misc/SecureHash.h>
#endif
+6 -1
View File
@@ -1 +1,6 @@
#pragma once #pragma once
#if defined(VFCORE_COMPAT_FORWARD_HEADERS) && !defined(VFCORE_USE_COMPAT) \
&& (defined(__clang__) || defined(__GNUC__))
#include_next <Modules/ModuleManager.h>
#endif
@@ -1 +1,6 @@
#pragma once #pragma once
#if defined(VFCORE_COMPAT_FORWARD_HEADERS) && !defined(VFCORE_USE_COMPAT) \
&& (defined(__clang__) || defined(__GNUC__))
#include_next <ProfilingDebugging/CpuProfilerTrace.h>
#endif
@@ -1 +1,6 @@
#pragma once #pragma once
#if defined(VFCORE_COMPAT_FORWARD_HEADERS) && !defined(VFCORE_USE_COMPAT) \
&& (defined(__clang__) || defined(__GNUC__))
#include_next <Serialization/CustomVersion.h>
#endif
@@ -1 +1,6 @@
#pragma once #pragma once
#if defined(VFCORE_COMPAT_FORWARD_HEADERS) && !defined(VFCORE_USE_COMPAT) \
&& (defined(__clang__) || defined(__GNUC__))
#include_next <Serialization/JsonSerializer.h>
#endif
+6 -1
View File
@@ -1 +1,6 @@
#pragma once #pragma once
#if defined(VFCORE_COMPAT_FORWARD_HEADERS) && !defined(VFCORE_USE_COMPAT) \
&& (defined(__clang__) || defined(__GNUC__))
#include_next <Serialization/JsonWriter.h>
#endif
+6
View File
@@ -1,4 +1,9 @@
#pragma once #pragma once
#if defined(VFCORE_COMPAT_FORWARD_HEADERS) && !defined(VFCORE_USE_COMPAT) \
&& (defined(__clang__) || defined(__GNUC__))
#include_next <Stats/Stats.h>
#else
#define STATCAT_Advanced 0 #define STATCAT_Advanced 0
#define DECLARE_STATS_GROUP(Name,Group,Category) constexpr int32 Group=0 #define DECLARE_STATS_GROUP(Name,Group,Category) constexpr int32 Group=0
#define DECLARE_DWORD_COUNTER_STAT_EXTERN(Name,Stat,Group,Api) constexpr int32 Stat=0 #define DECLARE_DWORD_COUNTER_STAT_EXTERN(Name,Stat,Group,Api) constexpr int32 Stat=0
@@ -8,3 +13,4 @@
#define SET_DWORD_STAT(Stat,Value) ((void)0) #define SET_DWORD_STAT(Stat,Value) ((void)0)
#define SCOPE_CYCLE_COUNTER(Stat) ((void)0) #define SCOPE_CYCLE_COUNTER(Stat) ((void)0)
#define QUICK_SCOPE_CYCLE_COUNTER(Stat) ((void)0) #define QUICK_SCOPE_CYCLE_COUNTER(Stat) ((void)0)
#endif
+6 -1
View File
@@ -1 +1,6 @@
#pragma once #pragma once
#if defined(VFCORE_COMPAT_FORWARD_HEADERS) && !defined(VFCORE_USE_COMPAT) \
&& (defined(__clang__) || defined(__GNUC__))
#include_next <Templates/SubclassOf.h>
#endif
+6 -1
View File
@@ -1 +1,6 @@
#pragma once #pragma once
#if defined(VFCORE_COMPAT_FORWARD_HEADERS) && !defined(VFCORE_USE_COMPAT) \
&& (defined(__clang__) || defined(__GNUC__))
#include_next <Templates/UniquePtr.h>
#endif
+6 -1
View File
@@ -1 +1,6 @@
#pragma once #pragma once
#if defined(VFCORE_COMPAT_FORWARD_HEADERS) && !defined(VFCORE_USE_COMPAT) \
&& (defined(__clang__) || defined(__GNUC__))
#include_next <UObject/EnumProperty.h>
#endif
+6 -1
View File
@@ -1 +1,6 @@
#pragma once #pragma once
#if defined(VFCORE_COMPAT_FORWARD_HEADERS) && !defined(VFCORE_USE_COMPAT) \
&& (defined(__clang__) || defined(__GNUC__))
#include_next <UObject/FieldIterator.h>
#endif
+6 -1
View File
@@ -1 +1,6 @@
#pragma once #pragma once
#if defined(VFCORE_COMPAT_FORWARD_HEADERS) && !defined(VFCORE_USE_COMPAT) \
&& (defined(__clang__) || defined(__GNUC__))
#include_next <UObject/Object.h>
#endif
+6 -1
View File
@@ -1 +1,6 @@
#pragma once #pragma once
#if defined(VFCORE_COMPAT_FORWARD_HEADERS) && !defined(VFCORE_USE_COMPAT) \
&& (defined(__clang__) || defined(__GNUC__))
#include_next <UObject/UObjectGlobals.h>
#endif
+6 -1
View File
@@ -1 +1,6 @@
#pragma once #pragma once
#if defined(VFCORE_COMPAT_FORWARD_HEADERS) && !defined(VFCORE_USE_COMPAT) \
&& (defined(__clang__) || defined(__GNUC__))
#include_next <UObject/UnrealType.h>
#endif
@@ -0,0 +1,55 @@
#pragma once
#include <cstdint>
#include <algorithm>
#include <limits>
#if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
#include <intrin.h>
#elif defined(__i386__) || defined(__x86_64__)
#include <immintrin.h>
#endif
namespace VoxelForgeCoreShared
{
inline std::uint64_t ReadCpuCycles() noexcept
{
#if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
_mm_lfence();
const std::uint64_t value=__rdtsc();
_mm_lfence();
return value;
#elif defined(__i386__) || defined(__x86_64__)
_mm_lfence();
const std::uint64_t value=__rdtsc();
_mm_lfence();
return value;
#else
return 0;
#endif
}
inline std::uint64_t CpuCycleReadPairOverhead() noexcept
{
static const std::uint64_t overhead=[]()
{
std::uint64_t minimum=std::numeric_limits<std::uint64_t>::max();
for(unsigned i=0;i<64;++i)
{
const std::uint64_t start=ReadCpuCycles();
const std::uint64_t end=ReadCpuCycles();
minimum=std::min(minimum,end-start);
}
return minimum==std::numeric_limits<std::uint64_t>::max()?0:minimum;
}();
return overhead;
}
inline std::uint64_t AdjustedCpuCycleDelta(std::uint64_t start,
std::uint64_t end) noexcept
{
const std::uint64_t delta=end-start;
const std::uint64_t overhead=CpuCycleReadPairOverhead();
return delta>overhead?delta-overhead:0;
}
}
@@ -0,0 +1,201 @@
#pragma once
#include "VoxelForgeCore/CpuCycleCounter.h"
#include <array>
#include <chrono>
#include <cstddef>
#include <cstdint>
namespace VoxelForgeCore::floating_island_detail
{
enum class EIslandFieldCaller : std::uint8_t
{
GridFill=0,Skirt=1,Boundary=2,PassageFilter=3,Other=4,Count=5
};
enum class EIslandAttributionBucket : std::uint8_t
{
Field=0,Island=1,Root=2,Connector=3,Helix=4,Column=5,
LocalProbe=6,SharedCache=7,MouthFilter=8,Boundary=9,CallerGrid=10,
CallerSkirt=11,CallerBoundary=12,CallerPassageFilter=13,CallerOther=14,
Count=15
};
struct FIslandFieldAttributionInstrumentation
{
static constexpr std::uint64_t SampleMask=255;
std::array<std::uint64_t,static_cast<std::size_t>(EIslandFieldCaller::Count)> sampledFieldCalls{};
std::array<std::uint64_t,static_cast<std::size_t>(EIslandFieldCaller::Count)> fieldCycles{};
std::array<std::uint64_t,static_cast<std::size_t>(EIslandFieldCaller::Count)> fieldNanoseconds{};
std::array<std::uint64_t,static_cast<std::size_t>(EIslandFieldCaller::Count)> sampledNativeCalls{};
std::array<std::uint64_t,static_cast<std::size_t>(EIslandFieldCaller::Count)> nativeCycles{};
std::array<std::uint64_t,static_cast<std::size_t>(EIslandFieldCaller::Count)> nativeNanoseconds{};
std::array<std::uint64_t,static_cast<std::size_t>(EIslandAttributionBucket::Count)> exclusiveCycles{};
std::array<std::uint64_t,static_cast<std::size_t>(EIslandAttributionBucket::Count)> exclusiveNanoseconds{};
std::array<std::uint64_t,static_cast<std::size_t>(EIslandAttributionBucket::Count)> scopeSamples{};
std::uint64_t traceSampledMisses=0,traceSeenBefore=0,traceEvictions=0,
traceReusedEvictions=0;
std::array<std::uint64_t,8> traceSet{};
std::array<std::int64_t,8> traceX{},traceY{},traceEvictedX{},traceEvictedY{};
std::array<std::uint64_t,8> traceIsland{},traceEvictedIsland{};
std::array<std::uint8_t,8> traceFlags{};
std::size_t traceCount=0;
};
inline FIslandFieldAttributionInstrumentation*& ActiveIslandFieldAttribution() noexcept
{
static thread_local FIslandFieldAttributionInstrumentation* active=nullptr;
return active;
}
inline FIslandFieldAttributionInstrumentation* SetActiveIslandFieldAttribution(
FIslandFieldAttributionInstrumentation* value) noexcept
{
auto* previous=ActiveIslandFieldAttribution();
ActiveIslandFieldAttribution()=value;
return previous;
}
inline EIslandFieldCaller& ActiveIslandFieldCaller() noexcept
{
static thread_local EIslandFieldCaller caller=EIslandFieldCaller::Other;
return caller;
}
struct FScopedIslandFieldCaller
{
explicit FScopedIslandFieldCaller(EIslandFieldCaller value) noexcept
:previous(ActiveIslandFieldCaller()),enabled(ActiveIslandFieldAttribution()!=nullptr)
{if(enabled)ActiveIslandFieldCaller()=value;}
~FScopedIslandFieldCaller(){if(enabled)ActiveIslandFieldCaller()=previous;}
EIslandFieldCaller previous;
bool enabled=false;
};
inline std::array<std::uint64_t,
static_cast<std::size_t>(EIslandAttributionBucket::Count)>&
IslandComponentSampleSequence() noexcept
{
static thread_local std::array<std::uint64_t,
static_cast<std::size_t>(EIslandAttributionBucket::Count)> sequence{};
return sequence;
}
inline std::array<std::uint64_t,
static_cast<std::size_t>(EIslandFieldCaller::Count)>&
IslandFieldSampleSequence() noexcept
{
static thread_local std::array<std::uint64_t,
static_cast<std::size_t>(EIslandFieldCaller::Count)> sequence{};
return sequence;
}
inline std::array<std::uint64_t,
static_cast<std::size_t>(EIslandFieldCaller::Count)>&
IslandNativeSampleSequence() noexcept
{
static thread_local std::array<std::uint64_t,
static_cast<std::size_t>(EIslandFieldCaller::Count)> sequence{};
return sequence;
}
struct FScopedIslandAttributionTimer
{
explicit FScopedIslandAttributionTimer(EIslandAttributionBucket bucket) noexcept
:metrics(ActiveIslandFieldAttribution()),bucketIndex(static_cast<std::size_t>(bucket))
{
if(!metrics)return;
if(bucketIndex==static_cast<std::size_t>(EIslandAttributionBucket::Field))
{
const auto callerIndex=static_cast<std::size_t>(ActiveIslandFieldCaller());
const auto calls=++IslandFieldSampleSequence()[callerIndex];
const std::uint64_t phase=(callerIndex*43u+17u)
&FIslandFieldAttributionInstrumentation::SampleMask;
sampled=(((calls+phase)&FIslandFieldAttributionInstrumentation::SampleMask)==0);
}
else
{
auto& calls=IslandComponentSampleSequence()[bucketIndex];
++calls;
const std::uint64_t phase=(static_cast<std::uint64_t>(bucketIndex)*29u+17u)
&FIslandFieldAttributionInstrumentation::SampleMask;
sampled=(((calls+phase)&FIslandFieldAttributionInstrumentation::SampleMask)==0);
}
if(sampled)
{
start=VoxelForgeCoreShared::ReadCpuCycles();
wallStart=std::chrono::steady_clock::now();
}
}
~FScopedIslandAttributionTimer(){Stop();}
std::uint64_t Stop() noexcept
{
if(!sampled)return 0;
sampled=false;
const std::uint64_t raw=VoxelForgeCoreShared::ReadCpuCycles()-start;
const std::uint64_t overhead=VoxelForgeCoreShared::CpuCycleReadPairOverhead();
const std::uint64_t cycles=raw>overhead?raw-overhead:0;
const auto elapsed=std::chrono::duration_cast<std::chrono::nanoseconds>(
std::chrono::steady_clock::now()-wallStart).count();
metrics->exclusiveCycles[bucketIndex]+=cycles;
metrics->exclusiveNanoseconds[bucketIndex]+=elapsed>0
?static_cast<std::uint64_t>(elapsed):0;
++metrics->scopeSamples[bucketIndex];
if(bucketIndex==static_cast<std::size_t>(EIslandAttributionBucket::Field))
{
const std::size_t callerIndex=static_cast<std::size_t>(ActiveIslandFieldCaller());
metrics->fieldCycles[callerIndex]+=cycles;
metrics->fieldNanoseconds[callerIndex]+=elapsed>0
?static_cast<std::uint64_t>(elapsed):0;
++metrics->sampledFieldCalls[callerIndex];
}
return cycles;
}
FIslandFieldAttributionInstrumentation* metrics=nullptr;
std::size_t bucketIndex=0;
std::uint64_t start=0;
std::chrono::steady_clock::time_point wallStart{};
bool sampled=false;
};
struct FScopedIslandAttributionSample
{
explicit FScopedIslandAttributionSample() noexcept
{
auto* attribution=ActiveIslandFieldAttribution();
if(!attribution)return;
const auto caller=ActiveIslandFieldCaller();
const std::size_t callerIndex=static_cast<std::size_t>(caller);
const std::uint64_t sequence=++IslandNativeSampleSequence()[callerIndex];
const std::uint64_t phase=(callerIndex*43u+93u)
&FIslandFieldAttributionInstrumentation::SampleMask;
if(((sequence+phase)&FIslandFieldAttributionInstrumentation::SampleMask)!=0)return;
sampledAttribution=attribution;
sampledCaller=caller;
sampled=true;
start=VoxelForgeCoreShared::ReadCpuCycles();
wallStart=std::chrono::steady_clock::now();
++attribution->sampledNativeCalls[callerIndex];
}
~FScopedIslandAttributionSample()
{
if(!sampled)return;
const std::uint64_t raw=VoxelForgeCoreShared::ReadCpuCycles()-start;
const std::uint64_t overhead=VoxelForgeCoreShared::CpuCycleReadPairOverhead();
const std::uint64_t duration=raw>overhead?raw-overhead:0;
const auto elapsed=std::chrono::duration_cast<std::chrono::nanoseconds>(
std::chrono::steady_clock::now()-wallStart).count();
const std::size_t callerIndex=static_cast<std::size_t>(sampledCaller);
sampledAttribution->nativeCycles[callerIndex]+=duration;
sampledAttribution->nativeNanoseconds[callerIndex]+=elapsed>0
?static_cast<std::uint64_t>(elapsed):0;
}
FIslandFieldAttributionInstrumentation* sampledAttribution=nullptr;
EIslandFieldCaller sampledCaller=EIslandFieldCaller::Other;
std::uint64_t start=0;
std::chrono::steady_clock::time_point wallStart{};
bool sampled=false;
};
}
@@ -0,0 +1,159 @@
#pragma once
#include <array>
#include <cstddef>
#include <cstdint>
namespace VoxelForgeCore::Linux77Profiler
{
enum class ERoute : std::uint8_t
{
Dispatch=0,PackedScalar=1,PackedX8=2,AnalyticScalar=3,
AnalyticBatch=4,Native=5,LegacySurface=6,SharedSource=7,Count=8
};
enum class EStage : std::uint8_t
{
Other=0,GridFill=1,MarchingCubes=2,Skirt=3,Refine=4,Count=5
};
enum class EPhase : std::uint8_t
{
Dispatch=0,BaseField=1,CompositionGraph=2,Bands=3,Passage=4,
Support=5,Caps=6,Stamps=7,Edit=8,Other=9,Count=10
};
inline constexpr std::size_t RouteCount=static_cast<std::size_t>(ERoute::Count);
inline constexpr std::size_t StageCount=static_cast<std::size_t>(EStage::Count);
inline constexpr std::size_t PhaseCount=static_cast<std::size_t>(EPhase::Count);
inline thread_local bool ThreadContextActive=false;
struct FThreadContext
{
std::uint8_t lod=0xff;
ERoute route=ERoute::Count;
EStage stage=EStage::Other;
EPhase phase=EPhase::Other;
bool halo=false;
};
#if defined(VF_L77_PROFILE)
bool IsEnabled() noexcept;
void SetEnabled(bool enabled) noexcept;
void RegisterThread();
void Start(std::uint32_t periodMicroseconds=1000);
void StopAndPrint();
inline thread_local FThreadContext CurrentContext{};
struct FScopedRoute
{
explicit FScopedRoute(ERoute value) noexcept
:active(ThreadContextActive),previous(CurrentContext.route)
{if(active)CurrentContext.route=value;}
~FScopedRoute(){if(active)CurrentContext.route=previous;}
bool active=false;ERoute previous=ERoute::Dispatch;
};
struct FScopedStage
{
explicit FScopedStage(EStage value) noexcept
:active(ThreadContextActive),previous(CurrentContext.stage)
{if(active)CurrentContext.stage=value;}
~FScopedStage(){Restore();}
void Restore() noexcept
{if(active){CurrentContext.stage=previous;active=false;}}
bool active=false;EStage previous=EStage::Other;
};
struct FScopedPhase
{
explicit FScopedPhase(EPhase value) noexcept
:active(ThreadContextActive),previous(CurrentContext.phase)
{if(active)CurrentContext.phase=value;}
~FScopedPhase(){if(active)CurrentContext.phase=previous;}
bool active=false;EPhase previous=EPhase::Dispatch;
};
struct FScopedLod
{
explicit FScopedLod(int value) noexcept
:active(IsEnabled()),previous(CurrentContext.lod),previousContextActive(ThreadContextActive)
{
if(active)
{
ThreadContextActive=true;
RegisterThread();
CurrentContext.lod=static_cast<std::uint8_t>(value<0||value>8?0xff:value);
}
}
~FScopedLod()
{if(active){CurrentContext.lod=previous;ThreadContextActive=previousContextActive;}}
bool active=false;std::uint8_t previous=0xff;
bool previousContextActive=false;
};
struct FScopedHalo
{
explicit FScopedHalo(bool value) noexcept
:active(ThreadContextActive),previous(CurrentContext.halo)
{if(active)CurrentContext.halo=value;}
~FScopedHalo(){if(active)CurrentContext.halo=previous;}
bool active=false;bool previous=false;
};
#else
inline bool IsEnabled() noexcept{return false;}
inline void SetEnabled(bool) noexcept{}
inline void RegisterThread(){}
inline void Start(std::uint32_t=1000){}
inline void StopAndPrint(){}
struct FScopedRoute{explicit FScopedRoute(ERoute) noexcept{}};
struct FScopedStage
{explicit FScopedStage(EStage) noexcept{}void Restore() noexcept{}};
struct FScopedPhase{explicit FScopedPhase(EPhase) noexcept{}};
struct FScopedLod{explicit FScopedLod(int) noexcept{}};
struct FScopedHalo{explicit FScopedHalo(bool) noexcept{}};
#endif
struct FDispatchCounter
{
std::uint64_t calls=0;
std::uint64_t points=0;
};
using FDispatchCounters=std::array<std::array<FDispatchCounter,RouteCount>,StageCount>;
inline const char* RouteName(ERoute value) noexcept
{
switch(value)
{
case ERoute::Dispatch:return "dispatch_lookup";
case ERoute::PackedScalar:return "packed_scalar";
case ERoute::PackedX8:return "packed_x8";
case ERoute::AnalyticScalar:return "analytic_scalar";
case ERoute::AnalyticBatch:return "analytic_batch";
case ERoute::Native:return "native";
case ERoute::LegacySurface:return "legacy_surface";
case ERoute::SharedSource:return "shared_source";
default:return "unknown";
}
}
inline const char* StageName(EStage value) noexcept
{
switch(value)
{
case EStage::GridFill:return "grid_fill";
case EStage::MarchingCubes:return "marching_cubes";
case EStage::Skirt:return "skirt";
case EStage::Refine:return "refine";
default:return "other";
}
}
inline const char* PhaseName(EPhase value) noexcept
{
switch(value)
{
case EPhase::Dispatch:return "dispatch_lookup";
case EPhase::BaseField:return "base_field";
case EPhase::CompositionGraph:return "composition_graph";
case EPhase::Bands:return "composition_bands";
case EPhase::Passage:return "passages";
case EPhase::Support:return "support";
case EPhase::Caps:return "caps";
case EPhase::Stamps:return "stamps";
case EPhase::Edit:return "edits";
default:return "other";
}
}
}
@@ -1,9 +1,12 @@
#pragma once #pragma once
#include "VoxelForgeCore/CpuCycleCounter.h"
#include <array> #include <array>
#include <atomic> #include <atomic>
#include <cstddef> #include <cstddef>
#include <cstdint> #include <cstdint>
#include <chrono>
#include <cstring> #include <cstring>
#include <memory> #include <memory>
#include <thread> #include <thread>
@@ -12,6 +15,23 @@
namespace VoxelForgeCoreShared namespace VoxelForgeCoreShared
{ {
struct FColumnCacheMetrics
{
std::uint64_t hits = 0;
std::uint64_t misses = 0;
std::uint64_t computes = 0;
std::uint64_t conflictReplacements = 0;
std::uint64_t lockWaitNanoseconds = 0;
std::uint64_t sampledInitialReadCycles = 0;
std::uint64_t sampledInitialReads = 0;
std::uint64_t sampledLockedReadCycles = 0;
std::uint64_t sampledLockedReads = 0;
std::uint64_t sampledLockCycles = 0;
std::uint64_t sampledLocks = 0;
std::uint64_t sampledBuildCycles = 0;
std::uint64_t sampledBuilds = 0;
};
// Exact input identity for a pure XY column value. LOD is deliberately not part of this key: // 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. // the same recipe/plan column has the same bits at every sampling step.
struct FColumnCacheKey struct FColumnCacheKey
@@ -69,13 +89,28 @@ namespace VoxelForgeCoreShared
struct FSpinGuard struct FSpinGuard
{ {
explicit FSpinGuard(std::atomic_flag& value) : Flag(value) explicit FSpinGuard(std::atomic_flag& value, FColumnCacheMetrics* metrics,
bool sampleCycles)
: Flag(value), Metrics(metrics)
{ {
const auto started = Metrics ? std::chrono::steady_clock::now()
: std::chrono::steady_clock::time_point{};
const std::uint64_t cycleStart=sampleCycles?ReadCpuCycles():0;
while (Flag.test_and_set(std::memory_order_acquire)) while (Flag.test_and_set(std::memory_order_acquire))
std::this_thread::yield(); std::this_thread::yield();
if (Metrics)
Metrics->lockWaitNanoseconds += static_cast<std::uint64_t>(
std::chrono::duration_cast<std::chrono::nanoseconds>(
std::chrono::steady_clock::now() - started).count());
if(sampleCycles)
{
Metrics->sampledLockCycles+=AdjustedCpuCycleDelta(cycleStart,ReadCpuCycles());
++Metrics->sampledLocks;
}
} }
~FSpinGuard() { Flag.clear(std::memory_order_release); } ~FSpinGuard() { Flag.clear(std::memory_order_release); }
std::atomic_flag& Flag; std::atomic_flag& Flag;
FColumnCacheMetrics* Metrics;
}; };
public: public:
@@ -94,7 +129,7 @@ namespace VoxelForgeCoreShared
template <typename TFactory> template <typename TFactory>
TValue getOrCompute(const FColumnCacheKey& key, TFactory&& factory, TValue getOrCompute(const FColumnCacheKey& key, TFactory&& factory,
bool& computed) bool& computed, FColumnCacheMetrics* metrics = nullptr)
{ {
computed = false; computed = false;
const FKeyWords keyWords = key.words(); const FKeyWords keyWords = key.words();
@@ -102,13 +137,47 @@ namespace VoxelForgeCoreShared
const std::size_t setIndex = static_cast<std::size_t>(tag) & (SetCount - 1); const std::size_t setIndex = static_cast<std::size_t>(tag) & (SetCount - 1);
FSet& set = Sets[setIndex]; FSet& set = Sets[setIndex];
TValue value{}; TValue value{};
if (TryReadSet(set, keyWords, tag, value)) return value; static thread_local std::uint64_t timingSequence=0;
const bool sampleCycles=metrics&&((++timingSequence&127u)==0);
const std::uint64_t initialReadStart=sampleCycles?ReadCpuCycles():0;
const bool initialHit=TryReadSet(set, keyWords, tag, value);
if(sampleCycles)
{
metrics->sampledInitialReadCycles+=AdjustedCpuCycleDelta(
initialReadStart,ReadCpuCycles());
++metrics->sampledInitialReads;
}
if (initialHit)
{
if (metrics) ++metrics->hits;
return value;
}
if (metrics) ++metrics->misses;
FSpinGuard lock(set.Writer); FSpinGuard lock(set.Writer, metrics,sampleCycles);
if (TryReadSet(set, keyWords, tag, value)) return value; const std::uint64_t lockedReadStart=sampleCycles?ReadCpuCycles():0;
const bool lockedHit=TryReadSet(set, keyWords, tag, value);
if(sampleCycles)
{
metrics->sampledLockedReadCycles+=AdjustedCpuCycleDelta(
lockedReadStart,ReadCpuCycles());
++metrics->sampledLockedReads;
}
if (lockedHit)
{
if (metrics) ++metrics->hits;
return value;
}
const std::uint64_t buildStart=sampleCycles?ReadCpuCycles():0;
value = std::forward<TFactory>(factory)(); value = std::forward<TFactory>(factory)();
if(sampleCycles)
{
metrics->sampledBuildCycles+=AdjustedCpuCycleDelta(buildStart,ReadCpuCycles());
++metrics->sampledBuilds;
}
computed = true; computed = true;
if (metrics) ++metrics->computes;
FValueWords valueWords{}; FValueWords valueWords{};
std::memcpy(valueWords.data(), &value, sizeof(TValue)); std::memcpy(valueWords.data(), &value, sizeof(TValue));
@@ -118,6 +187,7 @@ namespace VoxelForgeCoreShared
{ replacement = way; break; } { replacement = way; break; }
if (replacement == Ways) if (replacement == Ways)
{ {
if (metrics) ++metrics->conflictReplacements;
replacement = set.NextWay; replacement = set.NextWay;
set.NextWay = static_cast<std::uint8_t>((set.NextWay + 1) % Ways); set.NextWay = static_cast<std::uint8_t>((set.NextWay + 1) % Ways);
} }
@@ -11,6 +11,8 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "VoxelForgeCore/Linux77Profiler.h"
// UBT supplies this export/import macro for the runtime module. The standalone target has no // UBT supplies this export/import macro for the runtime module. The standalone target has no
// module boundary, so leave it empty there. UBT fournit la macro; le viewer autonome reste neutre. // module boundary, so leave it empty there. UBT fournit la macro; le viewer autonome reste neutre.
#ifndef VOXELFORGECORE_API #ifndef VOXELFORGECORE_API
@@ -81,6 +83,9 @@ namespace VoxelForgeCore
Vec3d normal; Vec3d normal;
Vec2f uv; Vec2f uv;
ColorRgba8 color; ColorRgba8 color;
std::uint16_t hostMaterialId = 1;
std::array<std::uint16_t, 2> resourceMaterialIds{};
std::array<std::uint16_t, 2> resourceWeightsQ16{};
}; };
struct MeshGroups struct MeshGroups
@@ -128,14 +133,74 @@ namespace VoxelForgeCore
std::uint64_t mixedBoxes = 0; std::uint64_t mixedBoxes = 0;
std::uint64_t unknownBoxes = 0; std::uint64_t unknownBoxes = 0;
std::uint64_t fieldCalls = 0; std::uint64_t fieldCalls = 0;
// Opt-in composer diagnostics. These stay zero during ordinary generation.
bool passageComposerProfiled = false;
std::uint64_t passageTileFeatureCount = 0;
std::uint64_t passageTileRouteSegmentCandidates = 0;
std::uint64_t passageTileMouthSegmentCandidates = 0;
std::uint64_t resolvedBoundaryBandQueries = 0;
std::uint64_t passageComposerQueries = 0;
std::uint64_t passageIterations = 0;
std::uint64_t passageTileBoundChecks = 0;
std::uint64_t passageTileBoundRejects = 0;
std::uint64_t passageTileBoundSkippedIterations = 0;
std::uint64_t passageUpperMouthFilterChecks = 0;
std::uint64_t passageColumnCandidates = 0;
std::uint64_t passageColumnDistanceCalls = 0;
std::uint64_t passageNegativeBoundChecks = 0;
std::uint64_t passageNegativeBoundRejects = 0;
std::uint64_t passagePositiveBoundChecks = 0;
std::uint64_t passagePositiveBoundRejects = 0;
std::uint64_t passageCarveSegmentVisits = 0;
std::uint64_t passageSmoothCarveJoins = 0;
std::uint64_t passageSupportSegmentVisits = 0;
std::uint64_t passageSmoothSupportJoins = 0;
std::uint64_t passageSupportCapsuleChecks = 0;
std::uint64_t passageLaterBoreChecks = 0;
std::uint64_t passageOtherCapsuleChecks = 0;
std::uint64_t passageMouthSupportCalls = 0;
std::uint64_t passageMouthRouteSegmentChecks = 0;
std::uint64_t passageReliefFieldCalls = 0;
std::uint64_t passageSmoothstepEvaluations = 0;
std::uint64_t floatFieldCalls = 0; std::uint64_t floatFieldCalls = 0;
std::uint64_t latticeFieldCalls = 0; std::uint64_t latticeFieldCalls = 0;
std::uint64_t unclampedFieldCalls = 0; std::uint64_t unclampedFieldCalls = 0;
std::uint64_t densityPointCalls = 0;
std::uint64_t densityFloatPointCalls = 0;
std::uint64_t densityLatticePointCalls = 0;
std::uint64_t densityUnclampedPointCalls = 0;
std::uint64_t densityX8PointCalls = 0;
std::uint64_t densityFieldEvalNanoseconds = 0;
std::uint64_t densityFieldEvalSamplePoints = 0;
std::uint64_t legacyFieldEvalCalls = 0;
std::array<std::uint64_t,9> legacyFieldTermCalls{};
std::array<std::uint64_t,9> legacyFieldTermNanoseconds{};
std::array<std::uint64_t,9> legacyFieldTermTimedCalls{};
// Linux77-only mutually-exclusive route counts, flattened as
// (stage * route_count + route) * 2 + {calls,points}.
std::array<std::uint64_t,
VoxelForgeCore::Linux77Profiler::StageCount
*VoxelForgeCore::Linux77Profiler::RouteCount*2> linux77DispatchCounters{};
std::uint64_t linux77GridInteriorSamples = 0;
std::uint64_t linux77GridHaloSamples = 0;
std::uint64_t legacyPrimitiveCandidateVisits = 0;
std::uint64_t legacyPrimitiveDistanceEvaluations = 0;
std::uint64_t legacySmoothMinCalls = 0;
std::uint64_t legacySmoothMinNanoseconds = 0;
std::uint64_t legacySmoothMinTimedCalls = 0;
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 sharedColumnCacheHits = 0;
std::uint64_t columnEvaluations = 0; std::uint64_t columnEvaluations = 0;
std::uint64_t islandLocalCacheHits = 0;
std::uint64_t islandLocalCacheMisses = 0;
std::uint64_t islandLocalCacheConflictReplacements = 0;
std::uint64_t islandSharedCacheHits = 0;
std::uint64_t islandSharedCacheMisses = 0;
std::uint64_t islandSharedCacheComputes = 0;
std::uint64_t islandSharedCacheConflictReplacements = 0;
std::uint64_t islandSharedCacheLockWaitNanoseconds = 0;
std::uint64_t uniformBlockProofsChecked = 0; std::uint64_t uniformBlockProofsChecked = 0;
std::uint64_t uniformBlockProofSamplesChecked = 0; std::uint64_t uniformBlockProofSamplesChecked = 0;
std::uint64_t uniformBlockProofFallbackBlocks = 0; std::uint64_t uniformBlockProofFallbackBlocks = 0;
@@ -150,6 +215,7 @@ namespace VoxelForgeCore
double classificationExclusiveMilliseconds = 0.0; double classificationExclusiveMilliseconds = 0.0;
double marchingCubesExclusiveMilliseconds = 0.0; double marchingCubesExclusiveMilliseconds = 0.0;
double marchingCubesDensityGridMilliseconds = 0.0; double marchingCubesDensityGridMilliseconds = 0.0;
std::uint32_t marchingCubesGridFillWorkers = 1;
double marchingCubesCellClassificationMilliseconds = 0.0; double marchingCubesCellClassificationMilliseconds = 0.0;
double marchingCubesGradientNormalsMilliseconds = 0.0; double marchingCubesGradientNormalsMilliseconds = 0.0;
double marchingCubesEdgeInterpolationMilliseconds = 0.0; double marchingCubesEdgeInterpolationMilliseconds = 0.0;
@@ -157,12 +223,30 @@ namespace VoxelForgeCore
double marchingCubesSkirtMilliseconds = 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 marchingCubesGradientCalls = 0;
std::uint64_t marchingCubesEdgeMidpointDensityCalls = 0; std::uint64_t marchingCubesEdgeMidpointDensityCalls = 0;
std::uint64_t marchingCubesEdgeMidpointDensityMemoHits = 0;
std::uint64_t marchingCubesGradientMemoHits = 0; std::uint64_t marchingCubesGradientMemoHits = 0;
std::uint64_t marchingCubesX8DensityCalls = 0;
std::uint64_t marchingCubesX8ActiveLanes = 0;
std::uint64_t marchingCubesCandidateCells = 0;
std::uint64_t marchingCubesZBandRejectedCells = 0;
std::uint64_t marchingCubesCellClassificationCalls = 0;
std::uint64_t marchingCubesSurfaceCellCalls = 0;
std::uint64_t marchingCubesProofSkippedSolidCells = 0;
std::uint64_t marchingCubesProofSkippedAirCells = 0;
std::uint64_t marchingCubesProofSkippedDensitySamples = 0;
std::uint64_t marchingCubesSkirtEdgeCandidates = 0;
std::uint64_t marchingCubesSkirtBoundaryCandidates = 0;
std::uint64_t marchingCubesSkirtDensityProbes = 0;
double groundRefinementExclusiveMilliseconds = 0.0; double groundRefinementExclusiveMilliseconds = 0.0;
double capRefinementExclusiveMilliseconds = 0.0; double capRefinementExclusiveMilliseconds = 0.0;
double meshAssemblyMilliseconds = 0.0; double meshAssemblyMilliseconds = 0.0;
double meshingMilliseconds = 0.0; double meshingMilliseconds = 0.0;
double materialQueryMilliseconds = 0.0;
std::uint64_t materialQueries = 0;
std::uint64_t materialCandidateChecks = 0;
bool materialTileOutsideEveryVein = true;
double featureListMilliseconds = 0.0; double featureListMilliseconds = 0.0;
double farShellMilliseconds = 0.0; double farShellMilliseconds = 0.0;
double farStratumShellMilliseconds = 0.0; double farStratumShellMilliseconds = 0.0;
@@ -191,6 +275,9 @@ namespace VoxelForgeCore
std::uint32_t farHorizonVersion = 0; std::uint32_t farHorizonVersion = 0;
bool farShellRepairSkipped = false; bool farShellRepairSkipped = false;
bool tileWasClassified = false; bool tileWasClassified = false;
std::uint8_t tileProofVetoReason = 0;
bool tileProofSafe = false;
bool tileLegacyBlockProofRelevant = false;
bool meshingSkipped = false; bool meshingSkipped = false;
bool featureRefinedResolution = false; bool featureRefinedResolution = false;
bool heightfieldBandLimited = false; bool heightfieldBandLimited = false;
@@ -216,7 +303,9 @@ namespace VoxelForgeCore
std::uint64_t densitySampleCount = 0; std::uint64_t densitySampleCount = 0;
std::uint64_t meshPayloadAllocatedBytes = 0; std::uint64_t meshPayloadAllocatedBytes = 0;
std::uint64_t densityHash = 0, meshHash = 0, payloadHash = 0, topologyHash = 0; std::uint64_t densityHash = 0, meshHash = 0, payloadHash = 0, topologyHash = 0;
bool hasDensityHash = false, hasMeshHash = false, hasPayloadHash = false, hasTopologyHash = false; std::uint64_t materialHash = 0;
bool hasDensityHash = false, hasMeshHash = false, hasPayloadHash = false,
hasTopologyHash = false, hasMaterialHash = false;
}; };
struct WorldConfiguration struct WorldConfiguration
@@ -249,8 +338,130 @@ namespace VoxelForgeCore
// 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 = 2; inline constexpr std::uint32_t WorldAssemblySchemaVersion = 2;
// Version 10 adds per-strate passage styles and rough wall relief to resolved passages. // Version 14 adds shared passage columns; version 16 smooths owner Gradient faces;
inline constexpr std::uint32_t WorldAssemblyEvaluatorVersion = 10; // version 20 restores full Gradient amplitude and uses a continuous signed-distance band union;
// version 22 overlaps tread sections and smooths FloatingIslands passage-mouth features;
// version 23 uses signed-distance support for sparse SurfaceWorld-to-TunnelNetwork treads;
// version 24 narrows passage-mouth support and filters native ground detail;
// version 25 joins open-mouth treads to native terrain relief before flattening inward;
// version 26 tapers mouth width and bounds the support to the native terrain surface;
// version 27 keeps the native blend through the entrance ramp and narrows its filter;
// version 28 tapers the open end to a worn path and blends it into walkable support;
// version 29 curves the supported and carved path through both mouth shoulders;
// version 30 narrows the flat core and blends support through a noisy natural shoulder;
// version 31 adds shared, capsule-safe field relief to both open-mouth walking surfaces;
// version 32 lowers the mouth core into the bore and removes thin filtered-field remnants;
// version 33 fades relief before small detached field remnants;
// version 34 keeps the open-mouth tread within native terrain curvature and noise;
// version 35 follows the native heightfield farther into the mouth ramp;
// version 36 protects the walking line with a gradual filter fade;
// version 37 lengthens that fade and restores the last capsule margin;
// version 38 keeps native ground at the lip and blends the tread in below it;
// version 39 bends the mouth tread across the native field and restores the open bore;
// version 40 uses broad route-only filtering and smooth, low-frequency tread relief;
// version 41 rounds the mouth tread and removes filter route masks;
// version 42 clips the mouth bore at the native walking surface;
// version 43 localizes the mouth field filter without masking the surface route;
// version 44 widens the natural shoulder blend and follows lower-frequency terrain;
// version 45 tests the passage tread independently of route-anchor support;
// version 46 fades the native filter broadly along the authored surface path;
// version 47 carries the full winding route with a narrow native-height tread;
// version 48 fades route support out before the surface mouth;
// version 49 keeps the mouth filtered and restores detail on the outer route;
// version 50 limits route-field restoration to 65% of the convolution weight;
// version 51 narrows the route fade to 8 m horizontal and 6 m vertical;
// version 52 evaluates mouth support in positive-density route tiles;
// version 53 fades the supported passage tread in from native ground at both mouths;
// version 54 tapers mouth-support width and depth;
// version 55 blends that tread from native ground and applies route support after carving;
// version 56 seats route support at the audited floor;
// version 57's raised lip overfilled the mouth;
// version 58 restores the native-height lip and explicitly covers route-support queries;
// version 59 fixes route-support distance units and lengthens the worn-mouth taper;
// version 60 brings the narrow terrain-following route tread in before the outer mouth lip;
// version 61 finishes that tread by five metres and preserves its exact walking boundary;
// version 62 fades the route tread along the authored path and seats it below the capsule;
// version 63 only adds that tread through native-air gaps and fades it over two path metres;
// version 64 rounds the path-to-ground join while keeping its top below the capsule;
// version 65 tests rounded tread cross-sections and softer native-height following;
// version 66 fades the mouth carve and support together so native crater ground forms the lip;
// version 67 follows the native route height more closely and completes the entrance fade sooner;
// version 68 narrows the flat walk core and eases a shallow worn ramp into the cave floor;
// version 69 lets capsule-cleared mouth treads bridge positive-density floor gaps;
// version 70 lowers the mouth tread enough to clear the capsule's toe margin;
// version 71 keeps its rounded top inside the route's shallow support-probe band;
// version 72 adds mouth support only below its signed floor, avoiding capsule-space fill;
// version 73 carries the terrain-following route tread to the actual passage mouth;
// version 74 seats that short connection in the audited shallow support band;
// version 75 keeps the rounded path edge outside the capsule's shallow floor probes;
// version 76 carries the endpoint tread through the passage's first support-probe depth;
// version 77 joins the mouth floor to native ground through a noisy walk ramp;
// version 78 rounds the ramp shoulder and clears its initial capsule envelope;
// version 79 tested the unbuilt native-ground mouth;
// version 80 narrows the walk tread;
// version 81 adds bounded path relief and a wavering, worn shoulder;
// version 82 lowers the relief into the tread to keep its capsule clearance;
// version 83 increases the natural edge warp and recessed surface variation;
// version 84 moves that variation to the actual mouth and restores support width;
// version 85 keeps the established lower-mouth capsule profile while shaping entry mouths;
// version 86 restricts route reinforcement to native solid and recesses the worn top;
// version 87 restores its pre-carve route placement.
// version 88 removes the independent mouth cap; the native crater surface forms the entry ramp.
// version 89 removes the one-sided entry tread band as well.
// version 90 lengthens the entrance floor-carve fade to retain native ground beneath the route.
// version 91 lets a narrow mouth support follow the full native surface relief.
// version 92 derives mouth floor alignment from the entrance path for first-segment samples too.
// version 93 blends the carve against native density so a zero fade really preserves ground.
// version 94 applies the mouth floor fade only beneath the walking surface.
// version 95 seats retained native ground just below the capsule's foot clearance.
// version 96 limits that preservation to the shallow support band, away from inner coils.
// version 97 extends the native support band down to the sampled rock envelope.
// version 98 raises the support band back to the route floor while keeping it below the capsule.
// version 99 restores native-solid route support after the passage carve;
// version 100 restores a shallow, noise-shaped entrance tread under its capsule gate;
// version 101 preserves the native FI field around the resolved walking line;
// version 102 tapers the mouth filter from its 1.5 m core to the same 12.5 m edge;
// version 103 blends route protection over a metre-scale shoulder;
// version 104 composes overlapping route masks once, by maximum influence;
// version 105 widens the route blend to soften the native/filter seam;
// version 106 preserves raw negative rock under the route without unfiltering its crown;
// version 107 softens that restore and broadens the narrow upper-coil walk core;
// version 108 deepens relief and lowers route restoration to soften the remaining crease;
// version 109 blended 60% of the two-metre mouth field convolution;
// version 110 restores the full filtered contour and widens the upper walk core;
// version 111 permits the capsule-cleared signed tread to bridge the upper mouth gap;
// version 112 adds a tenth-metre margin to the rounded upper tread edge.
// version 139 keeps native ground only in a capsule-scale mouth lane and carries
// the seeded terrain contour through the full upper-mouth support;
// versions 140-145 tested short-span decks, mouth fade length, route phase and tread SDF;
// versions 146-148 tested a sunk chord, near-side phase and all-style FI spiral.
// version 149 routes non-spiral FI mouths into a tight near-side ring.
// version 150 widened that ring but left a central pillar.
// version 151 keeps the ring half a metre outside the passage bore.
// version 152 fills capsule-clear positive-density gaps under the narrow mouth tread.
// version 153 tested a one-metre entry-turn sink; it left the raised route visible and rippled the floor.
// version 154 tightens the FI ring and uses a steeper, still walkable descent to separate hidden coils.
// version 155's tighter coil removed the fin but made sharp fragments and route collisions.
// version 156 keeps the 3 m ring, overlaps the bore by 0.25 m, and seats the native tread below the capsule.
// version 157 joins the near-side FI ring at a tangent so its entrance does not kink across the crater.
// version 158 tested a descending entry coil; its exposed canopy is rejected.
// version 159 keeps the tangent and uses a steeper sub-15-degree FI descent to separate its coils.
// version 160 removed the mouth walk lane; it left the bridge and lost one support sample.
// version 161 tapered the anchored entry radius to 3 m; a fin remained at the crater lip.
// version 162 disabled native-tread restoration alone; the carve fade still preserved the ridge.
// version 163 disabled both passage restorations; it removed the path support.
// version 164 narrowed the first two inner FI route points; it enlarged the lip fin.
// version 165 disabled native-rock blending around the FI stratum route; the ridge remained.
// version 166 disabled the FI mouth support handoff; route support failed on the island approach.
// version 167 tested centerline footing on the FI approach; its bridge remained and floor ripple rose.
// version 168 removed the connector's 1 m lift; the crater crossing remained exposed.
// version 169 sank every connector 2 m; it left four FI route support probes low.
// version 170 sinks only connectors touching the anchored root by 1 m.
// Version 208 keeps the crater tread scoped to style-zero FI mouths.
// Version 210 keeps bulk native-cave sampling on the scalar field path at strata edges.
// Version 211 makes coordinate biasing in the shared cell hash unsigned, removing signed-overflow UB.
// Version 212 balances generated entry routes against existing walk lanes and preserves their shared treads.
inline constexpr std::uint32_t WorldAssemblyEvaluatorVersion = 214;
enum class FieldChannel : std::uint32_t enum class FieldChannel : std::uint32_t
{ {
@@ -297,6 +508,59 @@ namespace VoxelForgeCore
std::int64_t capRidgeWavelengthSubvoxels = 256 * 64; std::int64_t capRidgeWavelengthSubvoxels = 256 * 64;
}; };
enum class WorldAssemblySurfaceProfileKindV1 : std::uint32_t
{
natural = 0,
periodicHills = 1,
mirroredRelief = 2,
flatField = 3
};
// Version zero is the historical noise terrain and is intentionally omitted from
// canonical JSON and hashes. Version one uses metre-derived fixed-scale dimensions;
// phases are Q0.32 turns generated from the recipe seed during plan construction.
struct WorldAssemblySurfaceProfileV1
{
std::uint32_t version = 0;
WorldAssemblySurfaceProfileKindV1 kind = WorldAssemblySurfaceProfileKindV1::natural;
std::int64_t h0Subvoxels = 0;
std::int64_t amplitudeXSubvoxels = 0;
std::int64_t amplitudeYSubvoxels = 0;
std::int64_t wavelengthXSubvoxels = 0;
std::int64_t wavelengthYSubvoxels = 0;
std::uint32_t phaseXTurnsQ32 = 0;
std::uint32_t phaseYTurnsQ32 = 0;
std::int64_t mirrorLambdaQ16 = 0;
std::int64_t minimumArenaClearanceSubvoxels = 0;
friend bool operator==(const WorldAssemblySurfaceProfileV1&,
const WorldAssemblySurfaceProfileV1&) = default;
};
inline std::uint32_t WorldAssemblySurfaceProfileSeededPhaseQ32(
std::uint32_t seed, std::uint32_t axis) noexcept
{
std::uint64_t value = static_cast<std::uint64_t>(seed)
^ (axis == 0 ? 0x706572696f645831ull : 0x706572696f645931ull);
value += 0x9E3779B97F4A7C15ull;
value = (value ^ (value >> 30)) * 0xBF58476D1CE4E5B9ull;
value = (value ^ (value >> 27)) * 0x94D049BB133111EBull;
value ^= value >> 31;
return static_cast<std::uint32_t>(value >> 32);
}
inline void ResolveWorldAssemblySurfaceProfilePhasesV1(
WorldAssemblySurfaceProfileV1& profile, std::uint32_t seed) noexcept
{
if (profile.version == 1
&& (profile.kind == WorldAssemblySurfaceProfileKindV1::periodicHills
|| profile.kind == WorldAssemblySurfaceProfileKindV1::mirroredRelief))
{
profile.phaseXTurnsQ32 = WorldAssemblySurfaceProfileSeededPhaseQ32(seed, 0);
profile.phaseYTurnsQ32 = WorldAssemblySurfaceProfileSeededPhaseQ32(seed, 1);
}
}
struct WorldAssemblyRecipeV1 struct WorldAssemblyRecipeV1
{ {
std::uint32_t schemaVersion = WorldAssemblySchemaVersion; std::uint32_t schemaVersion = WorldAssemblySchemaVersion;
@@ -314,6 +578,7 @@ namespace VoxelForgeCore
std::int64_t biomeClimateReliefWavelengthSubvoxels = 256 * 3333; std::int64_t biomeClimateReliefWavelengthSubvoxels = 256 * 3333;
std::int64_t biomeClimateMoistureWavelengthSubvoxels = 256 * 2500; std::int64_t biomeClimateMoistureWavelengthSubvoxels = 256 * 2500;
std::int64_t biomeClimateReliefContrastQ16 = 2ll << 16; std::int64_t biomeClimateReliefContrastQ16 = 2ll << 16;
WorldAssemblySurfaceProfileV1 surfaceProfile;
std::vector<WorldAssemblyBiomeProfileV1> biomes; std::vector<WorldAssemblyBiomeProfileV1> biomes;
std::uint64_t contentHash = 0; std::uint64_t contentHash = 0;
}; };
@@ -373,6 +638,7 @@ namespace VoxelForgeCore
std::int64_t capRidgeWavelengthSubvoxels = 256 * 64; std::int64_t capRidgeWavelengthSubvoxels = 256 * 64;
std::int64_t waterSurfaceSubvoxels = 0; std::int64_t waterSurfaceSubvoxels = 0;
bool waterEnabled = false; bool waterEnabled = false;
WorldAssemblySurfaceProfileV1 surfaceProfile;
std::vector<WorldAssemblyFeatureV1> features; std::vector<WorldAssemblyFeatureV1> features;
WorldAssemblyRouteConstraintsV1 routeConstraints; WorldAssemblyRouteConstraintsV1 routeConstraints;
std::vector<WorldAssemblyRoutePointV1> route; std::vector<WorldAssemblyRoutePointV1> route;
@@ -444,6 +710,8 @@ namespace VoxelForgeCore
std::int64_t anchorIslandMinimumRadiusSubvoxels = 0; std::int64_t anchorIslandMinimumRadiusSubvoxels = 0;
std::int64_t anchorRootBottomZSubvoxels = 0; std::int64_t anchorRootBottomZSubvoxels = 0;
std::int64_t anchorMouthOffsetSubvoxels = 0; std::int64_t anchorMouthOffsetSubvoxels = 0;
// Style-zero mouths follow the sampled island surface into the passage lip.
bool terrainFollowingRoute = false;
WorldAssemblyRouteConstraintsV1 routeConstraints; WorldAssemblyRouteConstraintsV1 routeConstraints;
std::uint64_t contentHash = 0; std::uint64_t contentHash = 0;
}; };
@@ -584,8 +852,139 @@ namespace VoxelForgeCore
// Core adapter. Coordinates are half-open micrometre intervals; recipe anchors retain their // Core adapter. Coordinates are half-open micrometre intervals; recipe anchors retain their
// source fixed-point units so this record never rounds the recipe itself. // source fixed-point units so this record never rounds the recipe itself.
inline constexpr std::uint32_t ResolvedLayoutSchemaVersionV3 = 3; inline constexpr std::uint32_t ResolvedLayoutSchemaVersionV3 = 3;
inline constexpr std::uint32_t ResolvedLayoutStampVocabularyVersionV1 = 1;
inline constexpr std::uint32_t ResolvedLayoutStampVocabularyVersionV2 = 2;
inline constexpr std::uint32_t ResolvedLayoutStampVocabularyVersionV3 = 3;
inline constexpr std::uint32_t ResolvedLayoutCavernGraphVocabularyVersionV1 = 1;
inline constexpr std::uint32_t ResolvedLayoutOreVeinVocabularyVersionV1 = 1;
enum class ResolvedLayoutValidationModeV3 : std::uint8_t { compatibility, strict }; enum class ResolvedLayoutValidationModeV3 : std::uint8_t { compatibility, strict };
// Stable, bounded geometry edits composed into every Core field after the shared
// strate boundaries and passages. Coordinates and extents use integer micrometres.
enum class ResolvedSdfStampKindV1 : std::uint8_t
{
carveEllipsoid = 1,
carveArch = 2,
fillPillar = 3,
fillDais = 4,
fillMonolith = 5,
fillPlatform = 6
};
struct ResolvedLayoutStampRequestV1
{
std::string stableId;
std::int32_t strateIndex = -1;
ResolvedSdfStampKindV1 kind = ResolvedSdfStampKindV1::carveEllipsoid;
// A preferred center and a bounded deterministic search radius.
std::array<std::int64_t, 3> anchorPositionMicrometres{};
std::int64_t placementRadiusMicrometres = 0;
std::array<std::int64_t, 3> halfExtentsMicrometres{};
std::int64_t smoothWidthMicrometres = 0;
std::int64_t irregularityAmplitudeMicrometres = 0;
std::int64_t irregularityWavelengthMicrometres = 0;
std::int64_t roundingRadiusMicrometres = 0;
std::int64_t minimumSpacingMicrometres = 0;
// 0 = free placement, 1 = seated on the authored flat profile floor.
std::uint8_t attachmentPolicy = 0;
std::int64_t floorMicrometres = 0;
std::uint8_t yawQuarterTurns = 0;
};
struct ResolvedLayoutStampV1
{
std::string stableId;
std::int32_t strateIndex = -1;
ResolvedSdfStampKindV1 kind = ResolvedSdfStampKindV1::carveEllipsoid;
std::array<std::int64_t, 3> positionMicrometres{};
std::array<std::int64_t, 3> boundsMinimumMicrometres{};
std::array<std::int64_t, 3> boundsMaximumMicrometres{};
std::array<std::int64_t, 3> halfExtentsMicrometres{};
std::int64_t smoothWidthMicrometres = 0;
std::int64_t irregularityAmplitudeMicrometres = 0;
std::int64_t irregularityWavelengthMicrometres = 0;
std::int64_t roundingRadiusMicrometres = 0;
std::int64_t minimumSpacingMicrometres = 0;
std::uint8_t attachmentPolicy = 0;
std::int64_t floorMicrometres = 0;
std::uint64_t irregularitySeed = 0;
std::uint8_t yawQuarterTurns = 0;
};
// Optional room and swept-edge records for a resolved cavern graph. Geometry is stored
// in integer micrometres; bounds include smooth blending, relief, and floor support.
struct ResolvedCavernRoomV1
{
std::string stableId;
std::int32_t strateIndex = -1;
std::array<std::int64_t, 3> centerMicrometres{};
std::array<std::int64_t, 3> halfExtentsMicrometres{};
std::int64_t floorMicrometres = 0;
std::int64_t smoothWidthMicrometres = 0;
// Optional feature-to-feature union width. Zero preserves the historical
// behavior where smoothWidthMicrometres also controls the graph union.
std::int64_t unionWidthMicrometres = 0;
std::int64_t irregularityAmplitudeMicrometres = 0;
std::int64_t irregularityWavelengthMicrometres = 0;
std::uint64_t irregularitySeed = 0;
std::array<std::int64_t, 3> boundsMinimumMicrometres{};
std::array<std::int64_t, 3> boundsMaximumMicrometres{};
};
struct ResolvedCavernEdgeV1
{
std::string stableId;
std::string startAnchorStableId;
std::string endRoomStableId;
std::int32_t strateIndex = -1;
// A single cubic Bezier in XY. Its four Z values are the cubic floor profile.
std::array<std::array<std::int64_t, 3>, 4> controlPointsMicrometres{};
// Resolve-time, error-bounded approximation of the cubic centerline. Each
// consecutive pair is a physical segment used by the native cave field.
std::vector<std::array<std::int64_t, 3>> polylineMicrometres;
std::int64_t boreRadiusMicrometres = 0;
std::int64_t boreHeightMicrometres = 0;
std::int64_t floorSupportDepthMicrometres = 0;
std::int64_t smoothWidthMicrometres = 0;
// Optional feature-to-feature union width; floor fillets still use smoothWidth.
std::int64_t unionWidthMicrometres = 0;
std::int64_t irregularityAmplitudeMicrometres = 0;
std::int64_t irregularityWavelengthMicrometres = 0;
std::uint64_t irregularitySeed = 0;
std::array<std::int64_t, 3> boundsMinimumMicrometres{};
std::array<std::int64_t, 3> boundsMaximumMicrometres{};
};
// Immutable material-only deposits. The capsule and its conservative bounds are in
// micrometres; bounds include irregularity and the blend envelope.
struct ResolvedLayoutOreVeinRequestV1
{
std::string stableId;
std::int32_t strateIndex = -1;
std::uint16_t resourceMaterialId = 0;
std::array<std::array<std::int64_t, 3>, 2> anchorEndpointsMicrometres{};
std::int64_t placementRadiusMicrometres = 0;
std::int64_t radiusMicrometres = 0;
std::int64_t irregularityAmplitudeMicrometres = 0;
std::int64_t irregularityWavelengthMicrometres = 0;
std::int64_t blendWidthMicrometres = 0;
};
struct ResolvedLayoutOreVeinV1
{
std::string stableId;
std::int32_t strateIndex = -1;
std::uint16_t resourceMaterialId = 0;
std::array<std::array<std::int64_t, 3>, 2> endpointsMicrometres{};
std::array<std::int64_t, 3> boundsMinimumMicrometres{};
std::array<std::int64_t, 3> boundsMaximumMicrometres{};
std::int64_t radiusMicrometres = 0;
std::int64_t irregularityAmplitudeMicrometres = 0;
std::int64_t irregularityWavelengthMicrometres = 0;
std::int64_t blendWidthMicrometres = 0;
std::uint64_t irregularitySeed = 0;
};
struct ResolvedLayoutAnchorV2 struct ResolvedLayoutAnchorV2
{ {
std::string kind; std::string kind;
@@ -608,6 +1007,24 @@ namespace VoxelForgeCore
std::int64_t solidDensityQ16 = 1ll << 16; std::int64_t solidDensityQ16 = 1ll << 16;
}; };
// Runtime policy resolved once from the director's immutable strate/interface
// description. These derived capabilities are deliberately omitted from canonical
// JSON: their source fields are already hashed and the records preserve that identity.
struct ResolvedLayoutStratePassageCapabilitiesV1
{
bool hasSurfaceLanding = false;
bool hasFloatingIslandLanding = false;
bool usePassageAnchorForColumns = false;
bool hasNativeCaveField = false;
bool hasNativeLatticeField = false;
};
struct ResolvedLayoutInterfaceCapabilitiesV1
{
bool preserveUpperBedrockAirGap = false;
bool surfaceToTunnelLandingSupport = false;
};
struct ResolvedLayoutStratumV2 struct ResolvedLayoutStratumV2
{ {
std::string stableId; std::string stableId;
@@ -637,6 +1054,39 @@ namespace VoxelForgeCore
std::int64_t managerChunkWidthMicrometres = 0; std::int64_t managerChunkWidthMicrometres = 0;
std::int64_t dispatchChunkWidthMicrometres = 0; std::int64_t dispatchChunkWidthMicrometres = 0;
std::vector<ResolvedLayoutAnchorV2> anchors; std::vector<ResolvedLayoutAnchorV2> anchors;
ResolvedLayoutStratePassageCapabilitiesV1 passageCapabilities;
ResolvedLayoutInterfaceCapabilitiesV1 lowerInterfaceCapabilities;
};
inline bool IsNativeCaveFieldStratum(const ResolvedLayoutStratumV2& stratum) noexcept
{
return stratum.generatorKind=="Caves"
&&stratum.recipeId=="Core.Caves.PrimitiveField"
&&stratum.recipeVersion==1;
}
inline bool IsNativeLatticeFieldStratum(const ResolvedLayoutStratumV2& stratum) noexcept
{
return (stratum.generatorKind=="Maze"||stratum.generatorKind=="VerticalShafts")
&&stratum.recipeId=="Core.Lattice.PrimitiveField"
&&stratum.recipeVersion==1;
}
inline bool HasNativeGraphField(const ResolvedLayoutStratumV2& stratum) noexcept
{
return IsNativeCaveFieldStratum(stratum)||IsNativeLatticeFieldStratum(stratum);
}
/** Per-column resolved bands for one adjacent bedrock/ceiling interface.
* crossingDepthMicrometres is the actual overlap depth between the two facing bands.
*/
struct ResolvedLayoutTransitionBandsV1
{
std::int64_t crossingDepthMicrometres = 0;
std::int64_t upperBedrockBottomMicrometres = 0;
std::int64_t upperBedrockTopMicrometres = 0;
std::int64_t lowerCeilingBottomMicrometres = 0;
std::int64_t lowerCeilingTopMicrometres = 0;
}; };
struct ResolvedLayoutIssueV2 struct ResolvedLayoutIssueV2
@@ -656,6 +1106,8 @@ namespace VoxelForgeCore
std::string stableId; std::string stableId;
std::int32_t upperStrateIndex = -1; std::int32_t upperStrateIndex = -1;
std::int32_t lowerStrateIndex = -1; std::int32_t lowerStrateIndex = -1;
// EVoxelPassageStyle numeric value used by style-specific passage support.
std::uint32_t style = 1;
std::int64_t placementRadiusSubvoxels = 0; std::int64_t placementRadiusSubvoxels = 0;
std::array<std::int64_t, 3> upperMouthSubvoxels{}; std::array<std::int64_t, 3> upperMouthSubvoxels{};
std::array<std::int64_t, 3> lowerMouthSubvoxels{}; std::array<std::int64_t, 3> lowerMouthSubvoxels{};
@@ -666,6 +1118,28 @@ namespace VoxelForgeCore
std::vector<ResolvedLayoutPassagePointV1> controlPoints; 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 struct ResolvedLayoutPassageConfigV1
{ {
std::int32_t upperStrateIndex = -1; std::int32_t upperStrateIndex = -1;
@@ -697,6 +1171,16 @@ namespace VoxelForgeCore
std::int64_t strateLayoutChunkWidthSubvoxels = 8192; std::int64_t strateLayoutChunkWidthSubvoxels = 8192;
std::vector<ResolvedLayoutStratumV2> strates; std::vector<ResolvedLayoutStratumV2> strates;
std::vector<ResolvedLayoutPassageV1> passages; std::vector<ResolvedLayoutPassageV1> passages;
// Kept absent from canonical layout identity when no feature requests stamps.
std::uint32_t stampVocabularyVersion = 0;
std::vector<ResolvedLayoutStampV1> stamps;
// Kept absent from canonical identity when there are no graph records.
std::uint32_t cavernGraphVocabularyVersion = 0;
std::vector<ResolvedCavernRoomV1> cavernRooms;
std::vector<ResolvedCavernEdgeV1> cavernEdges;
// Omitted from canonical identity when no records are present.
std::uint32_t oreVeinVocabularyVersion = 0;
std::vector<ResolvedLayoutOreVeinV1> oreVeins;
std::string stableIdentity; std::string stableIdentity;
bool finalize(std::string& error); bool finalize(std::string& error);
@@ -708,6 +1192,17 @@ namespace VoxelForgeCore
std::string_view json, std::string& error); std::string_view json, std::string& error);
}; };
/**
* Resolve the deterministic band faces at one XY column. Gradient shares one smooth
* displaced face; Interleaved moves the faces inward by a total crossing no larger than
* the declared width. Both bands retain authored thickness and touch or overlap, so no
* air gap can form.
*/
VFCORE_API ResolvedLayoutTransitionBandsV1 EvaluateResolvedLayoutTransitionBandsV1(
const ResolvedLayoutStratumV2& upper, const ResolvedLayoutStratumV2& lower,
std::int32_t worldSeed, std::int64_t layoutChunkSizeMicrometres,
std::int64_t xMicrometres, std::int64_t yMicrometres);
struct ResolvedLayoutValidatorAuditV3 struct ResolvedLayoutValidatorAuditV3
{ {
std::uint32_t controlsRun = 0; std::uint32_t controlsRun = 0;
@@ -721,6 +1216,68 @@ namespace VoxelForgeCore
const std::vector<ResolvedLayoutPassageConfigV1>& configs, const std::vector<ResolvedLayoutPassageConfigV1>& configs,
std::string& error); std::string& error);
struct ResolvedLayoutStampPlacementAuditV1
{
std::uint32_t negativeControlsRun = 0;
std::uint32_t negativeControlsRejected = 0;
bool passed = false;
};
VFCORE_API bool ResolveResolvedLayoutStampsV1(
ResolvedLayoutSnapshotV3& layout, std::int32_t seed,
std::span<const ResolvedLayoutStampRequestV1> requests,
std::string& error);
VFCORE_API bool ResolveResolvedLayoutStampsV2(
ResolvedLayoutSnapshotV3& layout, std::int32_t seed,
std::span<const ResolvedLayoutStampRequestV1> requests,
std::string& error);
// Vocabulary 3 adds explicit rounded capped-cylinder monoliths and rounded-box platforms.
VFCORE_API bool ResolveResolvedLayoutStampsV3(
ResolvedLayoutSnapshotV3& layout, std::int32_t seed,
std::span<const ResolvedLayoutStampRequestV1> requests,
std::string& error);
VFCORE_API ResolvedLayoutStampPlacementAuditV1 AuditResolvedLayoutStampPlacementV1(
const ResolvedLayoutSnapshotV3& layout);
VFCORE_API bool ResolveResolvedCavernGraphV1(
ResolvedLayoutSnapshotV3& layout, std::int32_t seed,
std::span<const ResolvedCavernRoomV1> rooms,
std::span<const ResolvedCavernEdgeV1> edges,
std::string& error);
VFCORE_API bool ResolveResolvedLayoutOreVeinsV1(
ResolvedLayoutSnapshotV3& layout, std::int32_t seed,
std::span<const ResolvedLayoutOreVeinRequestV1> requests,
std::string& error);
struct ResolvedLayoutOreVeinPlacementAuditV1
{
std::uint32_t negativeControlsRun = 0;
std::uint32_t negativeControlsRejected = 0;
bool passed = false;
};
VFCORE_API ResolvedLayoutOreVeinPlacementAuditV1 AuditResolvedLayoutOreVeinPlacementV1(
const ResolvedLayoutSnapshotV3& layout);
struct MaterialSampleV1
{
std::uint16_t hostMaterialId = 1;
std::array<std::uint16_t, 2> resourceMaterialIds{};
std::array<std::uint16_t, 2> resourceWeightsQ16{};
};
struct ResourceVolumeV1
{
std::uint16_t resourceMaterialId = 0;
std::uint64_t weightedSamplesQ16 = 0;
double volumeCubicMetres = 0.0;
};
struct OreMiningYieldV1
{
std::uint64_t solidSamplesRemoved = 0;
double sampleSpacingMetres = 0.0;
std::vector<ResourceVolumeV1> resources;
};
struct FloatingIslandBoundsAuditResult struct FloatingIslandBoundsAuditResult
{ {
std::uint64_t boxesTested = 0; std::uint64_t boxesTested = 0;
@@ -907,6 +1464,7 @@ namespace VoxelForgeCore
static void setThreadColumnInterpolationStrideSubvoxels(std::int64_t stride) noexcept; static void setThreadColumnInterpolationStrideSubvoxels(std::int64_t stride) noexcept;
static std::int64_t threadColumnInterpolationStrideSubvoxels() noexcept; static std::int64_t threadColumnInterpolationStrideSubvoxels() noexcept;
static void setThreadColumnCacheLegacyDirectMapped(bool enabled) noexcept; static void setThreadColumnCacheLegacyDirectMapped(bool enabled) noexcept;
static bool threadColumnCacheLegacyDirectMapped() noexcept;
static const HeightfieldColumnCacheStats& threadColumnCacheStats() noexcept; static const HeightfieldColumnCacheStats& threadColumnCacheStats() noexcept;
FieldInterval interval(std::int64_t minimumXSubvoxels, FieldInterval interval(std::int64_t minimumXSubvoxels,
std::int64_t minimumYSubvoxels, std::int64_t minimumYSubvoxels,
@@ -999,6 +1557,7 @@ namespace VoxelForgeCore
const WorldConfiguration& configuration() const; const WorldConfiguration& configuration() const;
const WorldAssemblyManifest* worldAssembly() const noexcept; const WorldAssemblyManifest* worldAssembly() const noexcept;
const ResolvedLayoutSnapshotV3* resolvedLayout() const noexcept; const ResolvedLayoutSnapshotV3* resolvedLayout() const noexcept;
ResolvedWorldSnapshot withResolvedLayout(const ResolvedLayoutSnapshotV3& layout) const;
ResolvedWorldSnapshot withoutResolvedLayoutPassages() const; ResolvedWorldSnapshot withoutResolvedLayoutPassages() const;
private: private:
@@ -1042,6 +1601,7 @@ namespace VoxelForgeCore
bool roundTunnels = false; bool roundTunnels = false;
bool enhancedTunnelWalls = true; bool enhancedTunnelWalls = true;
bool profileDetailBand = false; bool profileDetailBand = false;
bool parallelSignEdgeRepair = false;
// World-wide walkability is a validation pass, not an input to the compiled field. // World-wide walkability is a validation pass, not an input to the compiled field.
// Keep it enabled for benchmarks/audits; the interactive viewer can defer it. // Keep it enabled for benchmarks/audits; the interactive viewer can defer it.
bool validatePassageRoutes = true; bool validatePassageRoutes = true;
@@ -1226,6 +1786,9 @@ namespace VoxelForgeCore
std::int32_t bandMinZVoxel = -2147483647 - 1; std::int32_t bandMinZVoxel = -2147483647 - 1;
std::int32_t bandMaxZVoxel = 2147483647; std::int32_t bandMaxZVoxel = 2147483647;
bool hashDensity = false; bool hashDensity = false;
// Falsifier mode: retain mesh/topology hashes while permitting proven empty tiles
// to skip their density lattice. The density hash of such a skipped tile is empty.
bool allowUniformSkipsWhenHashing = false;
bool captureDensitySamples = false; bool captureDensitySamples = false;
// Diagnostic only; materialize the full density lattice even when block proofs // Diagnostic only; materialize the full density lattice even when block proofs
// establish that the tile has no surface. // establish that the tile has no surface.
@@ -1244,6 +1807,20 @@ namespace VoxelForgeCore
// 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;
// Research-only: count passage-composer work per generated tile.
bool profilePassageComposer = false;
// Research-only field comparison. A nonnegative value clamps the source density
// entering passage composition to at least -N voxel units for this tile.
// A negative value leaves the process-level diagnostic override in control.
double diagnosticPassageSourceFloorVoxels = -1.0;
// Research-only: collect tile-drain kernel counters and floating-island cache metrics.
// Inactive on ordinary generation so the hot path only pays the option check.
bool instrumentTileDrain = false;
// Linux headless measurement only. Compiled out of ordinary builds.
bool linux77Profile = false;
bool exactMidpointDensityMemo = false;
bool activeLaneBatching = false;
std::uint32_t proofBlockCells = 8;
// Diagnostic only; fills and checks every lattice sample in blocks certified uniform. // Diagnostic only; fills and checks every lattice sample in blocks certified uniform.
// Diagnostic seulement; evalue et verifie tous les echantillons des blocs uniformes. // Diagnostic seulement; evalue et verifie tous les echantillons des blocs uniformes.
bool auditUniformBlockProofs = false; bool auditUniformBlockProofs = false;
@@ -1253,6 +1830,10 @@ namespace VoxelForgeCore
// Diagnostic/performance control; memoizes exact MC lattice gradients at LOD0. // Diagnostic/performance control; memoizes exact MC lattice gradients at LOD0.
// Controle de mesure/performance; memorise les gradients MC exacts au LOD0. // Controle de mesure/performance; memorise les gradients MC exacts au LOD0.
bool memoizeMcGradients = true; bool memoizeMcGradients = true;
// Optional host-owned executor for predicted-heavy density-grid fills.
// Hosts leave this null for ordinary tiles and set a small limit for heavy tiles.
const JobScheduler* gridFillScheduler = nullptr;
std::uint32_t gridFillWorkerLimit = 1;
// 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;
@@ -1260,7 +1841,7 @@ namespace VoxelForgeCore
// LOD4-8 mesh hashes are salted; density and LOD0-3 keep their direct identities. // LOD4-8 mesh hashes are salted; density and LOD0-3 keep their direct identities.
// Incremente quand les plafonds partages ou l'horizon lointain changent. // Incremente quand les plafonds partages ou l'horizon lointain changent.
// Les hashes de maillage LOD4-8 incluent cette version; LOD0-3 gardent leur identite directe. // Les hashes de maillage LOD4-8 incluent cette version; LOD0-3 gardent leur identite directe.
std::uint32_t farHorizonVersion = 4; std::uint32_t farHorizonVersion = 5;
// Linux research controls for reproducing L5 negative controls. Defaults preserve output. // Linux research controls for reproducing L5 negative controls. Defaults preserve output.
std::uint32_t diagnosticGlobalOctaveDrop = 0; std::uint32_t diagnosticGlobalOctaveDrop = 0;
std::uint32_t diagnosticCellStride = 1; std::uint32_t diagnosticCellStride = 1;
@@ -1308,16 +1889,30 @@ namespace VoxelForgeCore
bool analyticOnly = true, bool analyticOnly = true,
bool diagnosticIncludeBaseCoveredTiles = false); bool diagnosticIncludeBaseCoveredTiles = false);
void retainTileRegions(std::span<const TileKey> desiredTiles); void retainTileRegions(std::span<const TileKey> desiredTiles);
void buildFarWorld(); bool buildFarWorld();
bool isCompiled() const noexcept; bool isCompiled() const noexcept;
bool hasFarWorld() const noexcept; bool hasFarWorld() const noexcept;
ShapeBuildStats buildStats() const; ShapeBuildStats buildStats() const;
float densityAt(Vec3d voxelPosition) const; float densityAt(Vec3d voxelPosition) const;
// Companion material query for the bound strate evaluator; coordinates use Core voxels.
MaterialSampleV1 materialAt(Vec3d voxelPosition) const;
// Measure-only carve estimate. This does not apply an edit or grant inventory.
OreMiningYieldV1 measureOreMiningYieldForSphere(
Vec3d centerVoxel, double radiusMetres,
double sampleSpacingMetres = 0.25) 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. // Audit-only selector provenance for the same point evaluator; never used by meshing.
std::string densityDispatchPathAt(Vec3d voxelPosition) const; 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;
// Research-only source field entering passage composition, with passage carving omitted.
float passageSourceDensityAt(Vec3d voxelPosition) const;
DetailFieldSample detailSampleAt(Vec3d voxelPosition) const; DetailFieldSample detailSampleAt(Vec3d voxelPosition) const;
float densityAtLattice(Vec3i voxelPosition) const; float densityAtLattice(Vec3i voxelPosition) const;
bool isSolidAt(Vec3d voxelPosition) const; bool isSolidAt(Vec3d voxelPosition) const;
@@ -1327,6 +1922,9 @@ namespace VoxelForgeCore
std::vector<TileKey> desiredTiles(Vec3d cameraPositionVoxels) const; std::vector<TileKey> desiredTiles(Vec3d cameraPositionVoxels) const;
static std::vector<TileKey> prioritizeTiles(std::span<const TileKey> tiles, static std::vector<TileKey> prioritizeTiles(std::span<const TileKey> tiles,
Vec3i centerChunk); Vec3i centerChunk);
// Count expanded resolved-passage route bounds intersecting the full tile bounds.
// Hosts use this stable estimate to prioritize and split expensive near tiles.
std::uint32_t passageOverlapScore(const TileKey& key) const noexcept;
std::optional<TileMesh> generateTile(const TileKey& key, std::optional<TileMesh> generateTile(const TileKey& key,
const TileGenerationOptions& options, const TileGenerationOptions& options,
std::string& error) const; std::string& error) const;
@@ -1,5 +1,9 @@
#pragma once #pragma once
// Core implementation TUs opt into the standalone Unreal-shaped compatibility headers. UE's
// Linux-generated module TUs leave this unset so those same header names forward to the engine.
#define VFCORE_USE_COMPAT 1
// Every standard or platform header used by the copied implementation must be included before // Every standard or platform header used by the copied implementation must be included before
// its wrapper opens vfcore::detail. This prevents system declarations from being nested in the // its wrapper opens vfcore::detail. This prevents system declarations from being nested in the
// private namespace when the implementation includes its Unreal-shaped compatibility headers. // private namespace when the implementation includes its Unreal-shaped compatibility headers.
@@ -56,6 +60,7 @@
#include "VoxelForgeCore/VoxelForgeCore.h" #include "VoxelForgeCore/VoxelForgeCore.h"
#include "VoxelForgeCore/ThreadLocalStorage.h" #include "VoxelForgeCore/ThreadLocalStorage.h"
#include "VoxelForgeCore/SharedColumnCache.h" #include "VoxelForgeCore/SharedColumnCache.h"
#include "VoxelForgeCore/FloatingIslandInstrumentation.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.
+240 -25
View File
@@ -1217,6 +1217,82 @@ inline void AppendFarStratumShells(const FStandaloneOwnerWorld& World,const FSta
Mesh.NumSurfaceVertices=OldSurfaceVertices+AddedVertices; Mesh.NumSurfaceVertices=OldSurfaceVertices+AddedVertices;
} }
// Fill only underside cells that marching cubes missed. Active transitions use the
// same displaced face and passage-mouth fade as the signed-distance field.
struct FTransitionFaceReplacement
{
double BaseZVoxels=0.0;
double MaximumDisplacementVoxels=0.0;
std::vector<uint8> Cells;
};
inline int32 RemoveCoarseTransitionFaceTriangles(FVoxelMeshData& Mesh,
const FIntVector& Origin,int32 Step,int32 GridSide,double VoxelSizeCm,
const std::vector<FTransitionFaceReplacement>& Replacements,bool bUpward)
{
if(Step<=0||GridSide<2||VoxelSizeCm<=0.0||Replacements.empty())return 0;
const int32 TriangleCount=Mesh.Triangles.Num()/3;
const int32 OldCeilingStart=std::max(0,TriangleCount-Mesh.NumCeilingTriangles);
TArray<uint8> OldMasks=Mesh.TriangleSkirtFaceMasks;
OldMasks.SetNum(TriangleCount);
TArray<int32> KeptTriangles;
TArray<uint8> KeptMasks;
KeptTriangles.Reserve(Mesh.Triangles.Num());
KeptMasks.Reserve(TriangleCount);
int32 Removed=0,RemovedCeiling=0;
const int32 CellSide=GridSide-1;
for(int32 Triangle=0;Triangle<TriangleCount;++Triangle)
{
const int32 IA=Mesh.Triangles[Triangle*3];
const int32 IB=Mesh.Triangles[Triangle*3+1];
const int32 IC=Mesh.Triangles[Triangle*3+2];
bool bRemove=false;
if(OldMasks[Triangle]==0&&IA>=0&&IB>=0&&IC>=0
&&IA<Mesh.Vertices.Num()&&IB<Mesh.Vertices.Num()&&IC<Mesh.Vertices.Num())
{
const FVector& A=Mesh.Vertices[IA];
const FVector& B=Mesh.Vertices[IB];
const FVector& C=Mesh.Vertices[IC];
const FVector GeometricNormal=FVector::CrossProduct(B-A,C-A);
const double NormalLength=GeometricNormal.Size();
const double Facing=NormalLength>1.0e-12?GeometricNormal.Z/NormalLength:0.0;
if((bUpward&&Facing>0.35)||(!bUpward&&Facing< -0.35))
{
const double X=(A.X+B.X+C.X)/(3.0*VoxelSizeCm);
const double Y=(A.Y+B.Y+C.Y)/(3.0*VoxelSizeCm);
const double Z=(A.Z+B.Z+C.Z)/(3.0*VoxelSizeCm);
const int32 CellX=static_cast<int32>(std::floor((X-Origin.X)/Step));
const int32 CellY=static_cast<int32>(std::floor((Y-Origin.Y)/Step));
if(CellX>=0&&CellX<CellSide&&CellY>=0&&CellY<CellSide)
{
const std::size_t Cell=static_cast<std::size_t>(CellY)*CellSide+CellX;
for(const auto& Replacement:Replacements)
{
if(Cell>=Replacement.Cells.size()||!Replacement.Cells[Cell])continue;
const double Margin=Replacement.MaximumDisplacementVoxels+4.0;
if(Z>=Replacement.BaseZVoxels-Margin
&&Z<=Replacement.BaseZVoxels+Margin)
{bRemove=true;break;}
}
}
}
}
if(bRemove)
{
++Removed;
if(Triangle>=OldCeilingStart)++RemovedCeiling;
continue;
}
KeptTriangles.Add(IA);KeptTriangles.Add(IB);KeptTriangles.Add(IC);
KeptMasks.Add(OldMasks[Triangle]);
}
if(Removed==0)return 0;
Mesh.Triangles=std::move(KeptTriangles);
Mesh.TriangleSkirtFaceMasks=std::move(KeptMasks);
Mesh.NumCeilingTriangles=std::max(0,Mesh.NumCeilingTriangles-RemovedCeiling);
return Removed;
}
inline void AppendStratumBoundaryCeilings(const FStandaloneOwnerWorld& World, inline void AppendStratumBoundaryCeilings(const FStandaloneOwnerWorld& World,
const FStandaloneShapeWorld& Shape,const FVoxelTileKey& Key,int32 Step,FVoxelMeshData& Mesh) const FStandaloneShapeWorld& Shape,const FVoxelTileKey& Key,int32 Step,FVoxelMeshData& Mesh)
{ {
@@ -1230,9 +1306,14 @@ inline void AppendStratumBoundaryCeilings(const FStandaloneOwnerWorld& World,
{ {
double FaceZ=0.0; double FaceZ=0.0;
double Thickness=0.0; double Thickness=0.0;
double MaximumDisplacementVoxels=0.0;
std::vector<double> FaceHeights;
std::vector<uint8> SolidAbove; std::vector<uint8> SolidAbove;
const VoxelForgeCore::ResolvedLayoutStratumV2* Stratum=nullptr;
bool bTransition=false;
}; };
std::vector<FCandidate> Candidates; std::vector<FCandidate> Candidates;
std::vector<FTransitionFaceReplacement> Replacements;
const double CoreMicrons=std::max<std::uint32_t>(1,World.CoreVoxelSizeMicrons); const double CoreMicrons=std::max<std::uint32_t>(1,World.CoreVoxelSizeMicrons);
for(const FStrateSlot& Slot:World.Manager->GetLayout()) for(const FStrateSlot& Slot:World.Manager->GetLayout())
{ {
@@ -1243,19 +1324,34 @@ inline void AppendStratumBoundaryCeilings(const FStandaloneOwnerWorld& World,
Candidate.FaceZ=static_cast<double>(Stratum->ceiling.bottomMicrometres)/CoreMicrons; Candidate.FaceZ=static_cast<double>(Stratum->ceiling.bottomMicrometres)/CoreMicrons;
Candidate.Thickness=static_cast<double>(Stratum->ceiling.topMicrometres Candidate.Thickness=static_cast<double>(Stratum->ceiling.topMicrometres
-Stratum->ceiling.bottomMicrometres)/CoreMicrons; -Stratum->ceiling.bottomMicrometres)/CoreMicrons;
if(Candidate.FaceZ<Origin.Z-1.0e-6||Candidate.FaceZ>Origin.Z+Extent+1.0e-6)continue; Candidate.Stratum=Stratum;
const auto* transitionUpper=Shape.FindResolvedLayoutStratumByOrder(Stratum->order-1);
const bool bTransition=transitionUpper
&&Shape.IsResolvedLayoutTransitionActive(*transitionUpper);
const double displacement=bTransition?static_cast<double>(
Shape.ResolvedTransitionMaximumFaceDisplacementMicrometres(*transitionUpper,*Stratum))
/CoreMicrons:0.0;
if(Candidate.FaceZ<Origin.Z-displacement-1.0e-6
||Candidate.FaceZ>Origin.Z+Extent+displacement+1.0e-6)continue;
Candidate.bTransition=bTransition;
Candidate.MaximumDisplacementVoxels=displacement;
const double Epsilon=std::min(0.5,Candidate.Thickness*0.25); const double Epsilon=std::min(0.5,Candidate.Thickness*0.25);
if(Epsilon<=0.0)continue; if(Epsilon<=0.0)continue;
Candidate.SolidAbove.resize(static_cast<std::size_t>(GridSide)*GridSide,0); const std::size_t GridCount=static_cast<std::size_t>(GridSide)*GridSide;
Candidate.FaceHeights.resize(GridCount,Candidate.FaceZ);
Candidate.SolidAbove.resize(GridCount,0);
bool AnySolidAbove=false; bool AnySolidAbove=false;
for(int32 Y=0;Y<GridSide;++Y)for(int32 X=0;X<GridSide;++X) for(int32 Y=0;Y<GridSide;++Y)for(int32 X=0;X<GridSide;++X)
{ {
const double WorldX=Origin.X+X*GridStep; const double WorldX=Origin.X+X*GridStep;
const double WorldY=Origin.Y+Y*GridStep; const double WorldY=Origin.Y+Y*GridStep;
const std::size_t GridIndex=static_cast<std::size_t>(Y*GridSide+X);
Candidate.bTransition=Shape.ResolvedCeilingBottomAt(*Candidate.Stratum,
WorldX,WorldY,Candidate.FaceHeights[GridIndex])||Candidate.bTransition;
const float Above=Shape.DensityAt(static_cast<float>(WorldX),static_cast<float>(WorldY), const float Above=Shape.DensityAt(static_cast<float>(WorldX),static_cast<float>(WorldY),
static_cast<float>(Candidate.FaceZ+Epsilon)); static_cast<float>(Candidate.FaceHeights[GridIndex]+Epsilon));
const bool bSolidAbove=std::isfinite(Above)&&Above<0.0f; const bool bSolidAbove=std::isfinite(Above)&&Above<0.0f;
Candidate.SolidAbove[static_cast<std::size_t>(Y*GridSide+X)]=bSolidAbove?1:0; Candidate.SolidAbove[GridIndex]=bSolidAbove?1:0;
AnySolidAbove=AnySolidAbove||bSolidAbove; AnySolidAbove=AnySolidAbove||bSolidAbove;
} }
if(AnySolidAbove)Candidates.push_back(std::move(Candidate)); if(AnySolidAbove)Candidates.push_back(std::move(Candidate));
@@ -1277,8 +1373,19 @@ inline void AppendStratumBoundaryCeilings(const FStandaloneOwnerWorld& World,
std::vector<int32> NewTriangles; std::vector<int32> NewTriangles;
for(const FCandidate& Candidate:Candidates) for(const FCandidate& Candidate:Candidates)
{ {
std::vector<int32> VertexMap(static_cast<std::size_t>(GridSide)*GridSide,INDEX_NONE); const std::size_t GridCount=static_cast<std::size_t>(GridSide)*GridSide;
const double CeilingZ=Candidate.FaceZ; std::vector<int32> VertexMap(GridCount,INDEX_NONE);
FTransitionFaceReplacement Replacement;
Replacement.BaseZVoxels=Candidate.FaceZ;
Replacement.MaximumDisplacementVoxels=Candidate.MaximumDisplacementVoxels;
Replacement.Cells.resize(static_cast<std::size_t>(GridSide-1)*(GridSide-1),0);
const auto heightAt=[&](double X,double Y)
{
if(!Candidate.bTransition)return Candidate.FaceZ;
double height=Candidate.FaceZ;
Shape.ResolvedCeilingBottomAt(*Candidate.Stratum,X,Y,height);
return height;
};
const auto AddVertex=[&](int32 X,int32 Y) const auto AddVertex=[&](int32 X,int32 Y)
{ {
const std::size_t GridIndex=static_cast<std::size_t>(Y*GridSide+X); const std::size_t GridIndex=static_cast<std::size_t>(Y*GridSide+X);
@@ -1286,8 +1393,20 @@ inline void AppendStratumBoundaryCeilings(const FStandaloneOwnerWorld& World,
if(Mapped!=INDEX_NONE)return Mapped; if(Mapped!=INDEX_NONE)return Mapped;
Mapped=static_cast<int32>(NewVertices.size()); Mapped=static_cast<int32>(NewVertices.size());
const double WorldX=Origin.X+X*GridStep,WorldY=Origin.Y+Y*GridStep; const double WorldX=Origin.X+X*GridStep,WorldY=Origin.Y+Y*GridStep;
NewVertices.emplace_back(WorldX*VoxelSizeCm,WorldY*VoxelSizeCm,CeilingZ*VoxelSizeCm); const double FaceZ=Candidate.FaceHeights[GridIndex];
NewNormals.emplace_back(0.0,0.0,-1.0); FVector Normal(0.0,0.0,-1.0);
if(Candidate.bTransition)
{
const double Delta=std::max(1.0,std::min<double>(GridStep,4.0));
const double DX=(heightAt(WorldX+Delta,WorldY)-heightAt(WorldX-Delta,WorldY))
/(2.0*Delta);
const double DY=(heightAt(WorldX,WorldY+Delta)-heightAt(WorldX,WorldY-Delta))
/(2.0*Delta);
Normal=FVector(DX,DY,-1.0);
Normal.Normalize();
}
NewVertices.emplace_back(WorldX*VoxelSizeCm,WorldY*VoxelSizeCm,FaceZ*VoxelSizeCm);
NewNormals.push_back(Normal);
if(bHasUVs)NewUVs.emplace_back(static_cast<float>(WorldX),static_cast<float>(WorldY)); if(bHasUVs)NewUVs.emplace_back(static_cast<float>(WorldX),static_cast<float>(WorldY));
if(bHasColors)NewColors.push_back(Color); if(bHasColors)NewColors.push_back(Color);
return Mapped; return Mapped;
@@ -1300,15 +1419,40 @@ inline void AppendStratumBoundaryCeilings(const FStandaloneOwnerWorld& World,
||!Candidate.SolidAbove[I01]||!Candidate.SolidAbove[I11])continue; ||!Candidate.SolidAbove[I01]||!Candidate.SolidAbove[I11])continue;
const double CellX0=Origin.X+X*GridStep,CellY0=Origin.Y+Y*GridStep; const double CellX0=Origin.X+X*GridStep,CellY0=Origin.Y+Y*GridStep;
const double CellX1=CellX0+GridStep,CellY1=CellY0+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 bool fullyCovered=false;
// center of a curved shell triangle is not enough to leave the rest of this cap cell open. if(!Candidate.bTransition)
if(MeshIndex.HasDownwardCellCoverage(CellX0,CellY0,CellX1,CellY1,CeilingZ,0.001))continue; fullyCovered=MeshIndex.HasDownwardCellCoverage(
CellX0,CellY0,CellX1,CellY1,Candidate.FaceZ,0.001);
else
{
fullyCovered=true;
constexpr double CoverageSamples[5][2]={
{0.0,0.0},{1.0,0.0},{0.0,1.0},{1.0,1.0},{0.5,0.5}};
for(const auto& Sample:CoverageSamples)
{
const double U=Sample[0],V=Sample[1];
const double SampleX=CellX0+(CellX1-CellX0)*U;
const double SampleY=CellY0+(CellY1-CellY0)*V;
const double SampleZ=heightAt(SampleX,SampleY);
if(!MeshIndex.HasDownwardHit(SampleX,SampleY,SampleZ,0.25))
fullyCovered=false;
}
}
if(fullyCovered)continue;
if(Key.Level>=4&&Candidate.bTransition)
Replacement.Cells[static_cast<std::size_t>(Y)*(GridSide-1)+X]=1;
const int32 A=AddVertex(X,Y),B=AddVertex(X+1,Y); const int32 A=AddVertex(X,Y),B=AddVertex(X+1,Y);
const int32 C=AddVertex(X+1,Y+1),D=AddVertex(X,Y+1); const int32 C=AddVertex(X+1,Y+1),D=AddVertex(X,Y+1);
NewTriangles.insert(NewTriangles.end(),{A,C,B,A,D,C}); NewTriangles.insert(NewTriangles.end(),{A,C,B,A,D,C});
} }
if(Key.Level>=4&&Candidate.bTransition
&&std::any_of(Replacement.Cells.begin(),Replacement.Cells.end(),
[](uint8 Value){return Value!=0;}))
Replacements.push_back(std::move(Replacement));
} }
if(NewTriangles.empty())return; if(NewTriangles.empty())return;
const int32 removedCoarse=RemoveCoarseTransitionFaceTriangles(Mesh,Origin,GridStep,
GridSide,VoxelSizeCm,Replacements,false);
const int32 AddedVertices=static_cast<int32>(NewVertices.size()); const int32 AddedVertices=static_cast<int32>(NewVertices.size());
auto InsertVertices=[&](auto& Existing,const auto& Added) auto InsertVertices=[&](auto& Existing,const auto& Added)
@@ -1347,9 +1491,8 @@ inline void AppendStratumBoundaryCeilings(const FStandaloneOwnerWorld& World,
Mesh.NumCeilingTriangles+=static_cast<int32>(NewTriangles.size()/3); Mesh.NumCeilingTriangles+=static_cast<int32>(NewTriangles.size()/3);
} }
// Add the interior-facing top of each bedrock band. The density composition already // Fill only top cells that marching cubes missed. Active transitions use the same
// makes this band solid and editable; this planar closure keeps its visible floor // displaced face and passage-mouth fade as the signed-distance field.
// continuous when a coarse marching-cubes step would otherwise skip a sub-voxel band.
inline void AppendStratumBoundaryFloors(const FStandaloneOwnerWorld& World, inline void AppendStratumBoundaryFloors(const FStandaloneOwnerWorld& World,
const FStandaloneShapeWorld& Shape,const FVoxelTileKey& Key,int32 Step,FVoxelMeshData& Mesh) const FStandaloneShapeWorld& Shape,const FVoxelTileKey& Key,int32 Step,FVoxelMeshData& Mesh)
{ {
@@ -1358,8 +1501,16 @@ inline void AppendStratumBoundaryFloors(const FStandaloneOwnerWorld& World,
const int32 Extent=Key.ExtentVoxels(); const int32 Extent=Key.ExtentVoxels();
if(Extent<=0||Extent%Step!=0)return; if(Extent<=0||Extent%Step!=0)return;
const int32 GridSide=Extent/Step+1; const int32 GridSide=Extent/Step+1;
struct FCandidate { double FloorZ=0.0; double Thickness=0.0; }; struct FCandidate
{
double FloorZ=0.0;
double Thickness=0.0;
double MaximumDisplacementVoxels=0.0;
const VoxelForgeCore::ResolvedLayoutStratumV2* Stratum=nullptr;
bool bTransition=false;
};
std::vector<FCandidate> Candidates; std::vector<FCandidate> Candidates;
std::vector<FTransitionFaceReplacement> Replacements;
const double CoreMicrons=std::max<std::uint32_t>(1,World.CoreVoxelSizeMicrons); const double CoreMicrons=std::max<std::uint32_t>(1,World.CoreVoxelSizeMicrons);
for(const FStrateSlot& Slot:World.Manager->GetLayout()) for(const FStrateSlot& Slot:World.Manager->GetLayout())
{ {
@@ -1367,9 +1518,17 @@ inline void AppendStratumBoundaryFloors(const FStandaloneOwnerWorld& World,
if(!Stratum||!Stratum->bedrock.presentInCurrentField if(!Stratum||!Stratum->bedrock.presentInCurrentField
||Stratum->bedrock.topMicrometres<=Stratum->bedrock.bottomMicrometres)continue; ||Stratum->bedrock.topMicrometres<=Stratum->bedrock.bottomMicrometres)continue;
const double FloorZ=static_cast<double>(Stratum->bedrock.topMicrometres)/CoreMicrons; 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; const auto* transitionLower=Shape.FindResolvedLayoutStratumByOrder(Stratum->order+1);
const bool bTransition=transitionLower
&&Shape.IsResolvedLayoutTransitionActive(*Stratum);
const double displacement=bTransition
?static_cast<double>(Shape.ResolvedTransitionMaximumFaceDisplacementMicrometres(
*Stratum,*transitionLower))/CoreMicrons
:0.0;
if(FloorZ<Origin.Z-displacement-1.0e-6
||FloorZ>Origin.Z+Extent+displacement+1.0e-6)continue;
Candidates.push_back({FloorZ,static_cast<double>(Stratum->bedrock.topMicrometres Candidates.push_back({FloorZ,static_cast<double>(Stratum->bedrock.topMicrometres
-Stratum->bedrock.bottomMicrometres)/CoreMicrons}); -Stratum->bedrock.bottomMicrometres)/CoreMicrons,displacement,Stratum,bTransition});
} }
if(Candidates.empty())return; if(Candidates.empty())return;
@@ -1390,16 +1549,34 @@ inline void AppendStratumBoundaryFloors(const FStandaloneOwnerWorld& World,
{ {
const double Epsilon=std::min(0.5,Candidate.Thickness*0.25); const double Epsilon=std::min(0.5,Candidate.Thickness*0.25);
if(Epsilon<=0.0)continue; if(Epsilon<=0.0)continue;
std::vector<uint8> SolidBelow(static_cast<std::size_t>(GridSide)*GridSide,0); const std::size_t GridCount=static_cast<std::size_t>(GridSide)*GridSide;
std::vector<double> faceHeights(GridCount,Candidate.FloorZ);
std::vector<uint8> solidBelow(GridCount,0);
FTransitionFaceReplacement Replacement;
Replacement.BaseZVoxels=Candidate.FloorZ;
Replacement.MaximumDisplacementVoxels=Candidate.MaximumDisplacementVoxels;
Replacement.Cells.resize(static_cast<std::size_t>(GridSide-1)*(GridSide-1),0);
for(int32 Y=0;Y<GridSide;++Y)for(int32 X=0;X<GridSide;++X) 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 double WorldX=Origin.X+X*Step,WorldY=Origin.Y+Y*Step;
const std::size_t GridIndex=static_cast<std::size_t>(Y*GridSide+X);
if(Candidate.bTransition)
Shape.ResolvedBedrockTopAt(*Candidate.Stratum,WorldX,WorldY,
faceHeights[GridIndex]);
const float Density=Shape.DensityAt(static_cast<float>(WorldX),static_cast<float>(WorldY), const float Density=Shape.DensityAt(static_cast<float>(WorldX),static_cast<float>(WorldY),
static_cast<float>(Candidate.FloorZ-Epsilon)); static_cast<float>(faceHeights[GridIndex]-Epsilon));
SolidBelow[static_cast<std::size_t>(Y*GridSide+X)]= solidBelow[GridIndex]=
std::isfinite(Density)&&Density<0.0f?1:0; std::isfinite(Density)&&Density<0.0f?1:0;
} }
std::vector<int32> VertexMap(static_cast<std::size_t>(GridSide)*GridSide,INDEX_NONE); const auto heightAt=[&](double X,double Y)
{
if(!Candidate.bTransition)return Candidate.FloorZ;
double height=Candidate.FloorZ;
if(Candidate.bTransition)
Shape.ResolvedBedrockTopAt(*Candidate.Stratum,X,Y,height);
return height;
};
std::vector<int32> VertexMap(GridCount,INDEX_NONE);
const auto AddVertex=[&](int32 X,int32 Y) const auto AddVertex=[&](int32 X,int32 Y)
{ {
const std::size_t GridIndex=static_cast<std::size_t>(Y*GridSide+X); const std::size_t GridIndex=static_cast<std::size_t>(Y*GridSide+X);
@@ -1407,9 +1584,20 @@ inline void AppendStratumBoundaryFloors(const FStandaloneOwnerWorld& World,
if(Mapped!=INDEX_NONE)return Mapped; if(Mapped!=INDEX_NONE)return Mapped;
Mapped=static_cast<int32>(NewVertices.size()); Mapped=static_cast<int32>(NewVertices.size());
const double WorldX=Origin.X+X*Step,WorldY=Origin.Y+Y*Step; const double WorldX=Origin.X+X*Step,WorldY=Origin.Y+Y*Step;
FVector Normal(0.0,0.0,1.0);
if(Candidate.bTransition)
{
const double Delta=std::max(1.0,std::min<double>(Step,4.0));
const double DX=(heightAt(WorldX+Delta,WorldY)-heightAt(WorldX-Delta,WorldY))
/(2.0*Delta);
const double DY=(heightAt(WorldX,WorldY+Delta)-heightAt(WorldX,WorldY-Delta))
/(2.0*Delta);
Normal=FVector(-DX,-DY,1.0);
Normal.Normalize();
}
NewVertices.emplace_back(WorldX*VoxelSizeCm,WorldY*VoxelSizeCm, NewVertices.emplace_back(WorldX*VoxelSizeCm,WorldY*VoxelSizeCm,
Candidate.FloorZ*VoxelSizeCm); faceHeights[GridIndex]*VoxelSizeCm);
NewNormals.emplace_back(0.0,0.0,1.0); NewNormals.push_back(Normal);
if(bHasUVs)NewUVs.emplace_back(static_cast<float>(WorldX),static_cast<float>(WorldY)); if(bHasUVs)NewUVs.emplace_back(static_cast<float>(WorldX),static_cast<float>(WorldY));
if(bHasColors)NewColors.push_back(Color); if(bHasColors)NewColors.push_back(Color);
return Mapped; return Mapped;
@@ -1418,16 +1606,43 @@ inline void AppendStratumBoundaryFloors(const FStandaloneOwnerWorld& World,
{ {
const std::size_t I00=static_cast<std::size_t>(Y*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; const std::size_t I10=I00+1,I01=I00+GridSide,I11=I01+1;
if(!SolidBelow[I00]||!SolidBelow[I10]||!SolidBelow[I01]||!SolidBelow[I11])continue; if(!solidBelow[I00]||!solidBelow[I10]||!solidBelow[I01]||!solidBelow[I11])continue;
const double X0=Origin.X+X*Step,Y0=Origin.Y+Y*Step; const double X0=Origin.X+X*Step,Y0=Origin.Y+Y*Step;
const double X1=X0+Step,Y1=Y0+Step; const double X1=X0+Step,Y1=Y0+Step;
if(MeshIndex.HasUpwardCellCoverage(X0,Y0,X1,Y1,Candidate.FloorZ,0.001))continue; bool fullyCovered=false;
if(!Candidate.bTransition)
fullyCovered=MeshIndex.HasUpwardCellCoverage(
X0,Y0,X1,Y1,Candidate.FloorZ,0.001);
else
{
fullyCovered=true;
constexpr double CoverageSamples[5][2]={
{0.0,0.0},{1.0,0.0},{0.0,1.0},{1.0,1.0},{0.5,0.5}};
for(const auto& Sample:CoverageSamples)
{
const double U=Sample[0],V=Sample[1];
const double SampleX=X0+(X1-X0)*U;
const double SampleY=Y0+(Y1-Y0)*V;
const double SampleZ=heightAt(SampleX,SampleY);
if(!MeshIndex.HasUpwardHit(SampleX,SampleY,SampleZ,0.25))
fullyCovered=false;
}
}
if(fullyCovered)continue;
if(Key.Level>=4&&Candidate.bTransition)
Replacement.Cells[static_cast<std::size_t>(Y)*(GridSide-1)+X]=1;
const int32 A=AddVertex(X,Y),B=AddVertex(X+1,Y); const int32 A=AddVertex(X,Y),B=AddVertex(X+1,Y);
const int32 C=AddVertex(X+1,Y+1),D=AddVertex(X,Y+1); const int32 C=AddVertex(X+1,Y+1),D=AddVertex(X,Y+1);
NewTriangles.insert(NewTriangles.end(),{A,B,C,A,C,D}); NewTriangles.insert(NewTriangles.end(),{A,B,C,A,C,D});
} }
if(Key.Level>=4&&Candidate.bTransition
&&std::any_of(Replacement.Cells.begin(),Replacement.Cells.end(),
[](uint8 Value){return Value!=0;}))
Replacements.push_back(std::move(Replacement));
} }
if(NewTriangles.empty())return; if(NewTriangles.empty())return;
const int32 removedCoarse=RemoveCoarseTransitionFaceTriangles(Mesh,Origin,Step,
GridSide,VoxelSizeCm,Replacements,true);
const int32 AddedVertices=static_cast<int32>(NewVertices.size()); const int32 AddedVertices=static_cast<int32>(NewVertices.size());
auto InsertVertices=[&](auto& Existing,const auto& Added) auto InsertVertices=[&](auto& Existing,const auto& Added)
+531 -39
View File
@@ -1,6 +1,9 @@
#pragma once #pragma once
#include "VoxelForgeCore/ThreadLocalStorage.h" #include "VoxelForgeCore/ThreadLocalStorage.h"
#include "VoxelForgeCore/CpuCycleCounter.h"
#include "VoxelForgeCore/FloatingIslandInstrumentation.h"
#include "VoxelForgeCore/SharedColumnCache.h"
#include "Json.h" #include "Json.h"
#include "VoxelForgeCore/VoxelForgeCore.h" #include "VoxelForgeCore/VoxelForgeCore.h"
@@ -203,6 +206,7 @@ namespace floating_island_detail
HashWord(hash, static_cast<std::uint64_t>(recipe.boundarySealSubvoxels), 8); HashWord(hash, static_cast<std::uint64_t>(recipe.boundarySealSubvoxels), 8);
HashWord(hash, static_cast<std::uint64_t>(recipe.bridgeHalfWidthSubvoxels), 8); HashWord(hash, static_cast<std::uint64_t>(recipe.bridgeHalfWidthSubvoxels), 8);
HashWord(hash, static_cast<std::uint64_t>(recipe.bridgeThicknessSubvoxels), 8); HashWord(hash, static_cast<std::uint64_t>(recipe.bridgeThicknessSubvoxels), 8);
if(recipe.terrainFollowingRoute)HashWord(hash,1,1);
HashWord(hash, HashRouteConstraints(recipe.routeConstraints), 8); HashWord(hash, HashRouteConstraints(recipe.routeConstraints), 8);
return hash; return hash;
} }
@@ -281,7 +285,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 > 5 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
@@ -470,13 +474,69 @@ 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;
}; };
struct FIslandColumnCacheInstrumentation
{
std::uint64_t localHits=0,localMisses=0,localConflictReplacements=0;
std::uint64_t localProbeCycles=0,localProbeSamples=0;
std::uint64_t tileStartCycles=0,tileCycles=0;
VoxelForgeCoreShared::FColumnCacheMetrics shared;
FIslandFieldAttributionInstrumentation attribution;
};
inline FIslandColumnCacheInstrumentation*& ActiveIslandColumnCacheInstrumentation() noexcept
{
static thread_local FIslandColumnCacheInstrumentation* active=nullptr;
return active;
}
inline FIslandColumnCacheInstrumentation* SetIslandColumnCacheInstrumentation(
FIslandColumnCacheInstrumentation* value) noexcept
{
FIslandColumnCacheInstrumentation* previous=ActiveIslandColumnCacheInstrumentation();
ActiveIslandColumnCacheInstrumentation()=value;
SetActiveIslandFieldAttribution(value?&value->attribution:nullptr);
return previous;
}
using FSharedIslandColumnCache = using FSharedIslandColumnCache =
VoxelForgeCoreShared::TSharedColumnValueCache<FIslandColumnCacheEntry,16384,4>; VoxelForgeCoreShared::TSharedColumnValueCache<FIslandColumnCacheEntry,16384,4>;
struct FIslandColumnTraceKey
{
bool valid=false;
std::uint64_t recipeHash=0,planHash=0,island=0;
std::int64_t x=0,y=0;
};
struct FIslandColumnReuseTrace
{
std::array<FIslandColumnTraceKey,128> recentMisses{};
std::array<FIslandColumnTraceKey,128> recentEvictions{};
std::uint64_t missSequence=0,printedEvents=0;
};
inline bool SameTraceKey(const FIslandColumnTraceKey& left,
const FIslandColumnTraceKey& right) noexcept
{
return left.valid&&right.valid&&left.recipeHash==right.recipeHash
&&left.planHash==right.planHash&&left.island==right.island
&&left.x==right.x&&left.y==right.y;
}
inline std::size_t TraceKeyIndex(const FIslandColumnTraceKey& key) noexcept
{
std::uint64_t hash=key.island^static_cast<std::uint64_t>(key.x)*0x9e3779b97f4a7c15ull
^static_cast<std::uint64_t>(key.y)*0xc2b2ae3d27d4eb4full
^key.recipeHash^std::rotl(key.planHash,17);
hash^=hash>>33;hash*=0xff51afd7ed558ccdull;hash^=hash>>33;
return static_cast<std::size_t>(hash&127u);
}
inline const FIslandColumnCacheEntry& IslandColumnCache( inline const FIslandColumnCacheEntry& IslandColumnCache(
const FloatingIslandRecipeV1& recipe,const FloatingIslandPlanV1& plan, const FloatingIslandRecipeV1& recipe,const FloatingIslandPlanV1& plan,
const FloatingIslandAnchorV1& island,double x,double y) const FloatingIslandAnchorV1& island,double x,double y)
{ {
FScopedIslandAttributionTimer columnTimer(EIslandAttributionBucket::Column);
// 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.
// Les echantillons suivent les colonnes Core entieres; reutiliser les memes metriques XY. // Les echantillons suivent les colonnes Core entieres; reutiliser les memes metriques XY.
@@ -486,6 +546,7 @@ namespace floating_island_detail
static thread_local VoxelForgeCoreThreadLocal::FLazy< static thread_local VoxelForgeCoreThreadLocal::FLazy<
std::array<FIslandColumnCacheEntry,SetCount*Ways>> Cache; std::array<FIslandColumnCacheEntry,SetCount*Ways>> Cache;
auto& cache=Cache.Get(); auto& cache=Cache.Get();
FScopedIslandAttributionTimer localProbeTimer(EIslandAttributionBucket::LocalProbe);
const std::int64_t SampleX=static_cast<std::int64_t>(x); const std::int64_t SampleX=static_cast<std::int64_t>(x);
const std::int64_t SampleY=static_cast<std::int64_t>(y); const std::int64_t SampleY=static_cast<std::int64_t>(y);
std::uint64_t IndexKey=island.stableId std::uint64_t IndexKey=island.stableId
@@ -500,6 +561,7 @@ namespace floating_island_detail
IndexKey^=IndexKey>>33; IndexKey^=IndexKey>>33;
const std::size_t Base=static_cast<std::size_t>(IndexKey&(SetCount-1))*Ways; const std::size_t Base=static_cast<std::size_t>(IndexKey&(SetCount-1))*Ways;
FIslandColumnCacheEntry* Replacement=&cache[Base+((IndexKey>>11)&(Ways-1))]; FIslandColumnCacheEntry* Replacement=&cache[Base+((IndexKey>>11)&(Ways-1))];
bool bFoundInvalid=false;
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];
@@ -515,8 +577,64 @@ namespace floating_island_detail
&&Entry.TopHalf==island.topHalfSubvoxels &&Entry.TopHalf==island.topHalfSubvoxels
&&Entry.TopFlattenQ16==recipe.topFlattenQ16 &&Entry.TopFlattenQ16==recipe.topFlattenQ16
&&Entry.ContourWarp==recipe.contourWarpSubvoxels; &&Entry.ContourWarp==recipe.contourWarpSubvoxels;
if(bKeyMatches)return Entry; if(bKeyMatches)
if(!Entry.bValid)Replacement=&Entry; {
if(auto* stats=ActiveIslandColumnCacheInstrumentation())++stats->localHits;
return Entry;
}
if(!Entry.bValid&&!bFoundInvalid)
{Replacement=&Entry;bFoundInvalid=true;}
}
localProbeTimer.Stop();
if(auto* stats=ActiveIslandColumnCacheInstrumentation())
{
++stats->localMisses;
if(!bFoundInvalid)++stats->localConflictReplacements;
static thread_local FIslandColumnReuseTrace trace;
if((++trace.missSequence&1023u)==0)
{
auto& a=stats->attribution;
++a.traceSampledMisses;
const FIslandColumnTraceKey requested{true,recipe.contentHash,
plan.contentHash,island.stableId,SampleX,SampleY};
const std::size_t requestSlot=TraceKeyIndex(requested);
const bool seenBefore=SameTraceKey(trace.recentMisses[requestSlot],requested);
const bool reusedEviction=SameTraceKey(
trace.recentEvictions[requestSlot],requested);
if(seenBefore)++a.traceSeenBefore;
if(reusedEviction)
{
++a.traceReusedEvictions;
trace.recentEvictions[requestSlot].valid=false;
}
FIslandColumnTraceKey evicted{};
std::size_t replacementWay=0;
if(!bFoundInvalid&&Replacement)
{
evicted={Replacement->bValid,Replacement->RecipeContentHash,
Replacement->PlanContentHash,Replacement->StableId,
Replacement->SampleX,Replacement->SampleY};
replacementWay=static_cast<std::size_t>(Replacement-&cache[Base]);
++a.traceEvictions;
if(evicted.valid)
trace.recentEvictions[TraceKeyIndex(evicted)]=evicted;
}
trace.recentMisses[requestSlot]=requested;
if(trace.printedEvents<16&&a.traceCount<a.traceSet.size())
{
const std::size_t event=a.traceCount++;
++trace.printedEvents;
a.traceSet[event]=Base/Ways;
a.traceX[event]=SampleX;a.traceY[event]=SampleY;
a.traceIsland[event]=island.stableId;
a.traceEvictedX[event]=evicted.valid?evicted.x:0;
a.traceEvictedY[event]=evicted.valid?evicted.y:0;
a.traceEvictedIsland[event]=evicted.valid?evicted.island:0;
a.traceFlags[event]=static_cast<std::uint8_t>(
(!bFoundInvalid?1u:0u)|(seenBefore?2u:0u)|(reusedEviction?4u:0u)
|(replacementWay<<3));
}
}
} }
const auto build=[&]() const auto build=[&]()
@@ -543,9 +661,14 @@ namespace floating_island_detail
Entry.Radial=std::hypot(Entry.DeltaX,Entry.DeltaY); Entry.Radial=std::hypot(Entry.DeltaX,Entry.DeltaY);
Entry.Angle=std::atan2(Entry.DeltaY,Entry.DeltaX); Entry.Angle=std::atan2(Entry.DeltaY,Entry.DeltaX);
Entry.LobePhase=LobePhase(recipe,island); Entry.LobePhase=LobePhase(recipe,island);
double contourOffset=0.0;
{
FScopedIslandAttributionTimer helixTimer(EIslandAttributionBucket::Helix);
contourOffset=LobeOffsetWithPhase(recipe,Entry.Angle,
static_cast<double>(island.topZSubvoxels),Entry.LobePhase);
}
const double EffectiveRadius=std::max(1.0,static_cast<double>(island.radiusSubvoxels) const double EffectiveRadius=std::max(1.0,static_cast<double>(island.radiusSubvoxels)
+LobeOffsetWithPhase(recipe,Entry.Angle,static_cast<double>(island.topZSubvoxels), +contourOffset);
Entry.LobePhase));
const double Edge=std::clamp(Entry.Radial/EffectiveRadius,0.0,1.0); const double Edge=std::clamp(Entry.Radial/EffectiveRadius,0.0,1.0);
const double Drop=(1.0-Q16ToDouble(recipe.topFlattenQ16)) const double Drop=(1.0-Q16ToDouble(recipe.topFlattenQ16))
*static_cast<double>(island.topHalfSubvoxels)*2.0*Edge*Edge; *static_cast<double>(island.topHalfSubvoxels)*2.0*Edge*Edge;
@@ -561,7 +684,12 @@ namespace floating_island_detail
static_cast<std::uint64_t>(reinterpret_cast<std::uintptr_t>(&plan)), static_cast<std::uint64_t>(reinterpret_cast<std::uintptr_t>(&plan)),
plan.contentHash,SampleX,SampleY,island.stableId}; plan.contentHash,SampleX,SampleY,island.stableId};
bool computed=false; bool computed=false;
Entry=shared->getOrCompute(key,build,computed); auto* stats=ActiveIslandColumnCacheInstrumentation();
{
FScopedIslandAttributionTimer sharedCacheTimer(EIslandAttributionBucket::SharedCache);
Entry=shared->getOrCompute(key,build,computed,
stats?&stats->shared:nullptr);
}
} }
else Entry=build(); else Entry=build();
*Replacement=Entry; *Replacement=Entry;
@@ -624,6 +752,7 @@ namespace floating_island_detail
const FloatingIslandAnchorV1& island, const FloatingIslandAnchorV1& island,
std::int32_t rootIndex, double x, double y, double z) std::int32_t rootIndex, double x, double y, double z)
{ {
FScopedIslandAttributionTimer attributionTimer(EIslandAttributionBucket::Root);
// Cache derived root constants per worker. The complete immutable input key keeps this // Cache derived root constants per worker. The complete immutable input key keeps this
// value-only cache safe across worlds, epochs and worker schedules. // value-only cache safe across worlds, epochs and worker schedules.
// Mettre en cache les constantes par worker; la cle complete evite tout partage d'etat. // Mettre en cache les constantes par worker; la cle complete evite tout partage d'etat.
@@ -694,6 +823,38 @@ namespace floating_island_detail
return (std::sqrt(std::max(q, 0.0)) - 1.0) * Parameters.MinimumRadius; return (std::sqrt(std::max(q, 0.0)) - 1.0) * Parameters.MinimumRadius;
} }
inline FRootLobeParameters RootLobeParametersForBounds(
const FloatingIslandRecipeV1& recipe,const FloatingIslandAnchorV1& island,
std::int32_t rootIndex)
{
constexpr std::array<std::array<double,2>,4> pattern{{
{{-0.92,-0.12}},{{0.28,0.98}},{{0.83,-0.42}},{{-0.16,-0.94}}}};
const std::uint64_t salt=0x524f4f540000ull+static_cast<std::uint64_t>(rootIndex);
const std::uint64_t roll=Roll(recipe.seed,island.stableId,salt);
const double radius=static_cast<double>(island.radiusSubvoxels);
const double rootDepth=radius*Q16ToDouble(recipe.rootDepthRatioQ16);
const double crustBottom=static_cast<double>(IslandCrustBottom(recipe,island));
const bool centralButtress=rootIndex==4;
const double orbit=centralButtress?0.0:radius*(0.17+0.07*UnitHash(roll));
const double rootX=static_cast<double>(island.centerSubvoxels[0])
+(centralButtress?0.0:pattern[static_cast<std::size_t>(rootIndex)][0]*orbit);
const double rootY=static_cast<double>(island.centerSubvoxels[1])
+(centralButtress?0.0:pattern[static_cast<std::size_t>(rootIndex)][1]*orbit);
const double shortRootVariation=UnitHash(Roll(recipe.seed,island.stableId,salt^0x4c454eull));
const double lengthRatio=centralButtress?1.0:(rootIndex==0?1.0
:Q16ToDouble(island.taperEndQ16)*(0.82+0.18*shortRootVariation));
const double lowerDepth=rootDepth*lengthRatio;
const double embedDepth=rootDepth*(centralButtress?0.22:(rootIndex==0?0.30:0.22));
const double verticalRadius=0.5*(lowerDepth+embedDepth);
const double centerZ=crustBottom+0.5*(embedDepth-lowerDepth);
const double rx=radius*(centralButtress?0.25
:0.15+0.055*UnitHash(Roll(recipe.seed,island.stableId,salt^0x5258ull)));
const double ry=radius*(centralButtress?0.25
:0.15+0.065*UnitHash(Roll(recipe.seed,island.stableId,salt^0x5259ull)));
return {rootX,rootY,centerZ,rx*rx,ry*ry,verticalRadius*verticalRadius,
std::min({rx,ry,verticalRadius})};
}
inline double ApplySurfaceDetail(const FloatingIslandRecipeV1& recipe, inline double ApplySurfaceDetail(const FloatingIslandRecipeV1& recipe,
std::uint64_t featureId, double structural, std::uint64_t featureId, double structural,
double x, double y, double z, double detailScale = 1.0) double x, double y, double z, double detailScale = 1.0)
@@ -712,6 +873,7 @@ namespace floating_island_detail
const FloatingIslandAnchorV1& island, const FloatingIslandAnchorV1& island,
double x, double y, double z) double x, double y, double z)
{ {
FScopedIslandAttributionTimer islandTimer(EIslandAttributionBucket::Island);
if (recipe.geometryVersion < 2) if (recipe.geometryVersion < 2)
{ {
const double dx = x - static_cast<double>(island.centerSubvoxels[0]); const double dx = x - static_cast<double>(island.centerSubvoxels[0]);
@@ -739,8 +901,13 @@ namespace floating_island_detail
const double radial=Column.Radial; const double radial=Column.Radial;
const double topZ = static_cast<double>(island.topZSubvoxels); const double topZ = static_cast<double>(island.topZSubvoxels);
const double radius = static_cast<double>(island.radiusSubvoxels); const double radius = static_cast<double>(island.radiusSubvoxels);
double contourOffset=0.0;
{
FScopedIslandAttributionTimer helixTimer(EIslandAttributionBucket::Helix);
contourOffset=LobeOffsetWithPhase(recipe,Column.Angle,z,Column.LobePhase);
}
const double effectiveRadius = std::max(0.0, const double effectiveRadius = std::max(0.0,
radius + LobeOffsetWithPhase(recipe,Column.Angle,z,Column.LobePhase)); radius + contourOffset);
const double edge = std::clamp(radial / std::max(effectiveRadius, 1.0), 0.0, 1.0); const double edge = std::clamp(radial / std::max(effectiveRadius, 1.0), 0.0, 1.0);
const double lowerSurface = static_cast<double>(IslandCrustBottom(recipe, island)) const double lowerSurface = static_cast<double>(IslandCrustBottom(recipe, island))
+ radius * 0.16 * edge * edge; + radius * 0.16 * edge * edge;
@@ -753,10 +920,13 @@ 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 && island.ordinal == recipe.anchorIslandOrdinal if (recipe.geometryVersion >= 5 && recipe.geometryVersion < 8
&& island.ordinal == recipe.anchorIslandOrdinal
&& recipe.anchorRootBottomZSubvoxels < island.bottomZSubvoxels) && recipe.anchorRootBottomZSubvoxels < island.bottomZSubvoxels)
{ {
const double rootTop = static_cast<double>(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 rootBottom = static_cast<double>(recipe.anchorRootBottomZSubvoxels);
const double depth = std::max(1.0, rootTop - rootBottom); const double depth = std::max(1.0, rootTop - rootBottom);
const double blend = std::clamp(static_cast<double>(recipe.anchorRootRadiusSubvoxels) const double blend = std::clamp(static_cast<double>(recipe.anchorRootRadiusSubvoxels)
@@ -784,6 +954,7 @@ namespace floating_island_detail
bool* topSurface = nullptr, bool* topSurface = nullptr,
double* alongFraction = nullptr) double* alongFraction = nullptr)
{ {
FScopedIslandAttributionTimer connectorTimer(EIslandAttributionBucket::Connector);
const double ax = static_cast<double>(edge.startSubvoxels[0]); const double ax = static_cast<double>(edge.startSubvoxels[0]);
const double ay = static_cast<double>(edge.startSubvoxels[1]); const double ay = static_cast<double>(edge.startSubvoxels[1]);
const double az = static_cast<double>(edge.startSubvoxels[2]); const double az = static_cast<double>(edge.startSubvoxels[2]);
@@ -802,15 +973,266 @@ namespace floating_island_detail
const double t = std::clamp(along / length, 0.0, 1.0); const double t = std::clamp(along / length, 0.0, 1.0);
if (alongFraction) *alongFraction = t; if (alongFraction) *alongFraction = t;
const double deck = az + (static_cast<double>(edge.endSubvoxels[2]) - az) * t; const double deck = az + (static_cast<double>(edge.endSubvoxels[2]) - az) * t;
const std::uint64_t westernEdgeId = StableId(recipe.seed, 0x200000000ull,
0x425249444745ull);
const bool westernSupportConnector=edge.stableId==westernEdgeId;
if(recipe.geometryVersion>=2&&WorldAssemblyEvaluatorVersion>=183
&&westernSupportConnector)
{
const double phase=static_cast<double>(Roll(recipe.seed,edge.stableId,0x5749445448ull)
&0xffffffffull)*(2.0*Pi/4294967296.0);
const double localHalfWidth=std::max(
static_cast<double>(recipe.routeConstraints.capsuleRadiusSubvoxels+Q),
static_cast<double>(edge.halfWidthSubvoxels)
+0.48*static_cast<double>(Q)*std::sin(6.0*Pi*t+phase));
const double localThickness=static_cast<double>(edge.thicknessSubvoxels);
const double rounding=std::min({1.5*static_cast<double>(Q),
localHalfWidth*0.6,localThickness*0.45});
const double roundedX=side-(localHalfWidth-rounding);
const double roundedY=std::abs(along-0.5*length)-(0.5*length-rounding);
const double roundedZ=std::abs(z-(deck-0.5*localThickness))
-(0.5*localThickness-rounding);
const double roundedOutside=std::sqrt(
std::pow(std::max(roundedX,0.0),2)
+std::pow(std::max(roundedY,0.0),2)
+std::pow(std::max(roundedZ,0.0),2));
const double roundedInside=std::min(std::max(roundedX,
std::max(roundedY,roundedZ)),0.0);
if(topSurface)*topSurface=z-deck>=std::max(horizontal,
deck-localThickness-z);
return roundedOutside+roundedInside-rounding;
}
const double arch = recipe.geometryVersion >= 2 const double arch = recipe.geometryVersion >= 2
? 2.0 * static_cast<double>(edge.thicknessSubvoxels) * (4.0 * t * (1.0 - t)) && WorldAssemblyEvaluatorVersion < 172
: 0.0; ? 2.0 * static_cast<double>(edge.thicknessSubvoxels) * (4.0 * t * (1.0 - t))
: 0.0;
const double upper = z - deck; const double upper = z - deck;
const double lower = deck - static_cast<double>(edge.thicknessSubvoxels) - arch - z; const double lower = deck - static_cast<double>(edge.thicknessSubvoxels) - arch - z;
if (topSurface) *topSurface = upper >= std::max(horizontal, lower); if (topSurface) *topSurface = upper >= std::max(horizontal, lower);
return std::max({horizontal, upper, lower}); return std::max({horizontal, upper, lower});
} }
struct FScalarRange
{
double minimum=0.0,maximum=0.0;
};
struct FDensityRange
{
double minimum=0.0,maximum=0.0;
};
inline double DistanceToRange(double minimum,double maximum,double value)
{
if(value<minimum)return minimum-value;
if(value>maximum)return value-maximum;
return 0.0;
}
inline double MaximumDistanceToRange(double minimum,double maximum,double value)
{
return std::max(std::abs(minimum-value),std::abs(maximum-value));
}
inline FScalarRange AffineRange(double xMinimum,double xMaximum,double xOffset,
double xScale,double yMinimum,double yMaximum,double yOffset,double yScale)
{
const double xa=(xMinimum-xOffset)*xScale,xb=(xMaximum-xOffset)*xScale;
const double ya=(yMinimum-yOffset)*yScale,yb=(yMaximum-yOffset)*yScale;
return {std::min(xa,xb)+std::min(ya,yb),
std::max(xa,xb)+std::max(ya,yb)};
}
inline FScalarRange AbsoluteRange(double minimum,double maximum)
{
const double minimumAbsolute=minimum<=0.0&&maximum>=0.0
?0.0:std::min(std::abs(minimum),std::abs(maximum));
return {minimumAbsolute,std::max(std::abs(minimum),std::abs(maximum))};
}
inline double RectangleSdf(double x,double y)
{
return std::hypot(std::max(x,0.0),std::max(y,0.0))
+std::min(std::max(x,y),0.0);
}
inline double RoundedBoxSdf(double x,double y,double z)
{
return std::sqrt(std::max(x,0.0)*std::max(x,0.0)
+std::max(y,0.0)*std::max(y,0.0)
+std::max(z,0.0)*std::max(z,0.0))
+std::min(std::max(x,std::max(y,z)),0.0);
}
inline FDensityRange RootLobeRange(const FloatingIslandRecipeV1& recipe,
const FloatingIslandAnchorV1& island,std::int32_t rootIndex,
const std::array<double,3>& minimum,const std::array<double,3>& maximum)
{
const FRootLobeParameters root=RootLobeParametersForBounds(recipe,island,rootIndex);
const double dxMinimum=DistanceToRange(minimum[0],maximum[0],root.RootX);
const double dyMinimum=DistanceToRange(minimum[1],maximum[1],root.RootY);
const double dzMinimum=DistanceToRange(minimum[2],maximum[2],root.CenterZ);
const double dxMaximum=MaximumDistanceToRange(minimum[0],maximum[0],root.RootX);
const double dyMaximum=MaximumDistanceToRange(minimum[1],maximum[1],root.RootY);
const double dzMaximum=MaximumDistanceToRange(minimum[2],maximum[2],root.CenterZ);
const double qMinimum=dxMinimum*dxMinimum/root.RadiusXSquared
+dyMinimum*dyMinimum/root.RadiusYSquared
+dzMinimum*dzMinimum/root.VerticalRadiusSquared;
const double qMaximum=dxMaximum*dxMaximum/root.RadiusXSquared
+dyMaximum*dyMaximum/root.RadiusYSquared
+dzMaximum*dzMaximum/root.VerticalRadiusSquared;
return {(std::sqrt(std::max(qMinimum,0.0))-1.0)*root.MinimumRadius,
(std::sqrt(std::max(qMaximum,0.0))-1.0)*root.MinimumRadius};
}
inline FDensityRange IslandDensityRange(const FloatingIslandRecipeV1& recipe,
const FloatingIslandAnchorV1& island,const std::array<double,3>& minimum,
const std::array<double,3>& maximum)
{
const double radius=static_cast<double>(island.radiusSubvoxels);
const double contour=static_cast<double>(recipe.contourWarpSubvoxels);
const double radialMinimum=std::hypot(
DistanceToRange(minimum[0],maximum[0],
static_cast<double>(island.centerSubvoxels[0])),
DistanceToRange(minimum[1],maximum[1],
static_cast<double>(island.centerSubvoxels[1])));
const double radialMaximum=std::max({
std::hypot(minimum[0]-island.centerSubvoxels[0],minimum[1]-island.centerSubvoxels[1]),
std::hypot(minimum[0]-island.centerSubvoxels[0],maximum[1]-island.centerSubvoxels[1]),
std::hypot(maximum[0]-island.centerSubvoxels[0],minimum[1]-island.centerSubvoxels[1]),
std::hypot(maximum[0]-island.centerSubvoxels[0],maximum[1]-island.centerSubvoxels[1])});
const double top=static_cast<double>(island.topZSubvoxels);
const double topDrop=std::max(0.0,(1.0-Q16ToDouble(recipe.topFlattenQ16))
*static_cast<double>(island.topHalfSubvoxels)*2.0);
const double topDistanceMinimum=minimum[2]-top;
const double topDistanceMaximum=maximum[2]-(top-topDrop);
const double sideDistanceMinimum=radialMinimum-std::max(0.0,radius+contour);
const double sideDistanceMaximum=recipe.geometryVersion<2
?radialMaximum:radialMaximum-std::max(0.0,radius-contour);
double lowerMinimum=0.0,lowerMaximum=0.0;
if(recipe.geometryVersion<2)
{
const double bottom=static_cast<double>(island.bottomZSubvoxels);
lowerMinimum=bottom-maximum[2];
lowerMaximum=bottom-minimum[2];
}
else
{
const double crust=static_cast<double>(IslandCrustBottom(recipe,island));
lowerMinimum=crust-maximum[2];
lowerMaximum=crust+radius*0.16-minimum[2];
}
double structuralMinimum=std::max({topDistanceMinimum,
sideDistanceMinimum,lowerMinimum});
double structuralMaximum=std::max({topDistanceMaximum,
sideDistanceMaximum,lowerMaximum});
if(recipe.geometryVersion>=2)
{
const double rootBlend=std::clamp(radius*0.12,2.0*Q,5.0*Q);
for(std::int32_t root=0;root<RootCount(recipe,island);++root)
{
const FDensityRange rootRange=RootLobeRange(recipe,island,root,minimum,maximum);
structuralMinimum=std::min(structuralMinimum,rootRange.minimum)-rootBlend*0.25;
structuralMaximum=std::min(structuralMaximum,rootRange.maximum);
}
if(recipe.geometryVersion>=5&&recipe.geometryVersion<8
&&island.ordinal==recipe.anchorIslandOrdinal
&&recipe.anchorRootBottomZSubvoxels<island.bottomZSubvoxels)
{
const double rootTop=static_cast<double>(IslandCrustBottom(recipe,island));
const double rootBottom=static_cast<double>(recipe.anchorRootBottomZSubvoxels);
const double rootRadius=static_cast<double>(recipe.anchorRootRadiusSubvoxels);
const double anchorMinimum=std::max({radialMinimum-rootRadius,
rootBottom-maximum[2],minimum[2]-rootTop});
const double anchorMaximum=std::max({radialMaximum-0.92*rootRadius,
rootBottom-minimum[2],maximum[2]-rootTop});
const double anchorDetail=0.75*static_cast<double>(recipe.roughnessSubvoxels);
const double anchorBlend=std::clamp(rootRadius*0.12,3.0*Q,6.0*Q);
structuralMinimum=std::min(structuralMinimum,anchorMinimum-anchorDetail)
-anchorBlend*0.25;
structuralMaximum=std::min(structuralMaximum,anchorMaximum+anchorDetail);
}
}
const double finalDetail=static_cast<double>(recipe.roughnessSubvoxels);
return {structuralMinimum-finalDetail,structuralMaximum+finalDetail};
}
inline FDensityRange ConnectorDensityRange(const FloatingIslandRecipeV1& recipe,
const FloatingIslandConnectorV1& edge,const std::array<double,3>& minimum,
const std::array<double,3>& maximum)
{
const double ax=static_cast<double>(edge.startSubvoxels[0]);
const double ay=static_cast<double>(edge.startSubvoxels[1]);
const double az=static_cast<double>(edge.startSubvoxels[2]);
const double dx=static_cast<double>(edge.endSubvoxels[0])-ax;
const double dy=static_cast<double>(edge.endSubvoxels[1])-ay;
const double dz=static_cast<double>(edge.endSubvoxels[2])-az;
const double length=std::hypot(dx,dy);
if(!(length>0.0))return {static_cast<double>(MaxDensity),static_cast<double>(MaxDensity)};
const double ux=dx/length,uy=dy/length;
const FScalarRange along=AffineRange(minimum[0],maximum[0],ax,ux,
minimum[1],maximum[1],ay,uy);
const FScalarRange signedSide=AffineRange(minimum[0],maximum[0],ax,-uy,
minimum[1],maximum[1],ay,ux);
const FScalarRange side=AbsoluteRange(signedSide.minimum,signedSide.maximum);
const double qxMinimum=side.minimum-static_cast<double>(edge.halfWidthSubvoxels);
const double qxMaximum=side.maximum-static_cast<double>(edge.halfWidthSubvoxels);
const FScalarRange alongCenter=AbsoluteRange(along.minimum-0.5*length,
along.maximum-0.5*length);
const double qyMinimum=alongCenter.minimum-0.5*length;
const double qyMaximum=alongCenter.maximum-0.5*length;
const double horizontalMinimum=RectangleSdf(qxMinimum,qyMinimum);
const double horizontalMaximum=RectangleSdf(qxMaximum,qyMaximum);
const double tMinimum=std::clamp(along.minimum/length,0.0,1.0);
const double tMaximum=std::clamp(along.maximum/length,0.0,1.0);
const double deckAtMinimum=az+dz*tMinimum;
const double deckAtMaximum=az+dz*tMaximum;
const double deckMinimum=std::min(deckAtMinimum,deckAtMaximum);
const double deckMaximum=std::max(deckAtMinimum,deckAtMaximum);
const std::uint64_t westernEdgeId=StableId(recipe.seed,0x200000000ull,
0x425249444745ull);
const bool westernSupportConnector=edge.stableId==westernEdgeId;
if(recipe.geometryVersion>=2&&WorldAssemblyEvaluatorVersion>=183
&&westernSupportConnector)
{
const double minimumHalfWidth=static_cast<double>(recipe.routeConstraints.capsuleRadiusSubvoxels+Q);
const double baseHalfWidth=static_cast<double>(edge.halfWidthSubvoxels);
const double halfWidthMinimum=std::max(minimumHalfWidth,baseHalfWidth-0.48*Q);
const double halfWidthMaximum=std::max(minimumHalfWidth,baseHalfWidth+0.48*Q);
const double roundingMinimum=std::min({1.5*Q,halfWidthMinimum*0.6,
static_cast<double>(edge.thicknessSubvoxels)*0.45});
const double roundingMaximum=std::min({1.5*Q,halfWidthMaximum*0.6,
static_cast<double>(edge.thicknessSubvoxels)*0.45});
const double roundedXMinimum=side.minimum-halfWidthMaximum+roundingMinimum;
const double roundedXMaximum=side.maximum-halfWidthMinimum+roundingMaximum;
const double roundedYMinimum=alongCenter.minimum-0.5*length+roundingMinimum;
const double roundedYMaximum=alongCenter.maximum-0.5*length+roundingMaximum;
const double halfThickness=0.5*static_cast<double>(edge.thicknessSubvoxels);
const double centerMinimum=deckMinimum-halfThickness;
const double centerMaximum=deckMaximum-halfThickness;
const double differenceMinimum=minimum[2]-centerMaximum;
const double differenceMaximum=maximum[2]-centerMinimum;
const FScalarRange absoluteDifference=AbsoluteRange(differenceMinimum,differenceMaximum);
const double roundedZMinimum=absoluteDifference.minimum-halfThickness+roundingMinimum;
const double roundedZMaximum=absoluteDifference.maximum-halfThickness+roundingMaximum;
return {RoundedBoxSdf(roundedXMinimum,roundedYMinimum,roundedZMinimum),
RoundedBoxSdf(roundedXMaximum,roundedYMaximum,roundedZMaximum)};
}
const double thickness=static_cast<double>(edge.thicknessSubvoxels);
const double maximumArch=recipe.geometryVersion>=2&&WorldAssemblyEvaluatorVersion<172
?2.0*thickness:0.0;
const double upperMinimum=minimum[2]-deckMaximum;
const double upperMaximum=maximum[2]-deckMinimum;
const double lowerMinimum=deckMinimum-thickness-maximumArch-maximum[2];
const double lowerMaximum=deckMaximum-thickness-minimum[2];
return {std::max({horizontalMinimum,upperMinimum,lowerMinimum}),
std::max({horizontalMaximum,upperMaximum,lowerMaximum})};
}
inline std::int64_t FieldDensity(const FloatingIslandRecipeV1& recipe, inline std::int64_t FieldDensity(const FloatingIslandRecipeV1& recipe,
const FloatingIslandPlanV1& plan, const FloatingIslandPlanV1& plan,
std::int64_t x, std::int64_t y, std::int64_t z) std::int64_t x, std::int64_t y, std::int64_t z)
@@ -942,14 +1364,14 @@ 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 bool isAnchor=recipe.geometryVersion>=5 const bool isAnchorRoot=recipe.geometryVersion>=5&&recipe.geometryVersion<8
&&island.ordinal==recipe.anchorIslandOrdinal; &&island.ordinal==recipe.anchorIslandOrdinal;
const std::int64_t reach = std::max(island.radiusSubvoxels, const std::int64_t reach = std::max(island.radiusSubvoxels,
isAnchor?recipe.anchorRootRadiusSubvoxels:std::int64_t{0}) isAnchorRoot?recipe.anchorRootRadiusSubvoxels:std::int64_t{0})
+ recipe.contourWarpSubvoxels + pad; + recipe.contourWarpSubvoxels + pad;
island.influenceMinimumSubvoxels = {island.centerSubvoxels[0] - reach, island.influenceMinimumSubvoxels = {island.centerSubvoxels[0] - reach,
island.centerSubvoxels[1] - reach, island.centerSubvoxels[1] - reach,
(isAnchor?std::min(island.bottomZSubvoxels,recipe.anchorRootBottomZSubvoxels) (isAnchorRoot?std::min(island.bottomZSubvoxels,recipe.anchorRootBottomZSubvoxels)
:island.bottomZSubvoxels)-pad}; :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};
@@ -1024,14 +1446,15 @@ 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 bool hasAnchorRoot=recipe.geometryVersion>=5&&recipe.geometryVersion<8&&isAnchor;
const std::int64_t reach = std::max(island.radiusSubvoxels, const std::int64_t reach = std::max(island.radiusSubvoxels,
isAnchor?recipe.anchorRootRadiusSubvoxels:std::int64_t{0}) hasAnchorRoot?recipe.anchorRootRadiusSubvoxels:std::int64_t{0})
+ recipe.contourWarpSubvoxels + pad; + 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] > (isAnchor || island.influenceMinimumSubvoxels[2] > (hasAnchorRoot
?std::min(island.bottomZSubvoxels,recipe.anchorRootBottomZSubvoxels) ?std::min(island.bottomZSubvoxels,recipe.anchorRootBottomZSubvoxels)
:island.bottomZSubvoxels) - pad :island.bottomZSubvoxels) - pad
|| island.influenceMaximumSubvoxels[2] < island.topZSubvoxels + pad || island.influenceMaximumSubvoxels[2] < island.topZSubvoxels + pad
@@ -1170,8 +1593,8 @@ namespace floating_island_detail
// Land each connector well inside the broad top so the full capsule footprint remains // Land each connector well inside the broad top so the full capsule footprint remains
// supported across the bridge-to-island transition, including bounded surface roughness. // supported across the bridge-to-island transition, including bounded surface roughness.
// Les connecteurs recouvrent le plateau pour soutenir toute la capsule au raccord. // Les connecteurs recouvrent le plateau pour soutenir toute la capsule au raccord.
// Keep the narrow span exposed to open sky; a smaller fraction buries most of it in the island tops. // Keep the capsule footprint supported while seating L37 connectors just below the native island tops.
// Garder la passerelle etroite visible dans le vide ; une fraction plus faible l'enfouit dans les plateaux. // Garder l'appui de la capsule tout en enfouissant les connecteurs L37 juste sous les plateaux.
const double landingFraction = recipe.geometryVersion >= 2 ? 0.52 : 0.62; const double landingFraction = recipe.geometryVersion >= 2 ? 0.52 : 0.62;
const double fromReach = static_cast<double>(from.radiusSubvoxels) * landingFraction; const double fromReach = static_cast<double>(from.radiusSubvoxels) * landingFraction;
const double toReach = static_cast<double>(to.radiusSubvoxels) * landingFraction; const double toReach = static_cast<double>(to.radiusSubvoxels) * landingFraction;
@@ -1179,7 +1602,19 @@ namespace floating_island_detail
const double sy = from.centerSubvoxels[1] + uy * fromReach; const double sy = from.centerSubvoxels[1] + uy * fromReach;
const double ex = to.centerSubvoxels[0] - ux * toReach; const double ex = to.centerSubvoxels[0] - ux * toReach;
const double ey = to.centerSubvoxels[1] - uy * toReach; const double ey = to.centerSubvoxels[1] - uy * toReach;
const double routeDeckLift = recipe.geometryVersion >= 2 ? 1.0 * Q : 0.0; const bool craterMouthConnector=WorldAssemblyEvaluatorVersion>=174
&&(from.ordinal==recipe.anchorIslandOrdinal
||to.ordinal==recipe.anchorIslandOrdinal);
const bool westernSupportConnector=WorldAssemblyEvaluatorVersion>=178
&&((from.ordinal==0&&to.ordinal==1)||(from.ordinal==1&&to.ordinal==0));
const double routeDeckLift=recipe.geometryVersion>=2
?(WorldAssemblyEvaluatorVersion>=178
?(westernSupportConnector
?(WorldAssemblyEvaluatorVersion>=181?-1.0
:(WorldAssemblyEvaluatorVersion>=180?-1.25
:(WorldAssemblyEvaluatorVersion>=179?-1.5:-1.0))):-2.0)
:(craterMouthConnector?-2.0
:(WorldAssemblyEvaluatorVersion>=172?-1.0:1.0)))*Q:0.0;
const double sz = IslandTopSurface(recipe, from, sx, sy) + routeDeckLift; const double sz = IslandTopSurface(recipe, from, sx, sy) + routeDeckLift;
const double ez = IslandTopSurface(recipe, to, ex, ey) + routeDeckLift; const double ez = IslandTopSurface(recipe, to, ex, ey) + routeDeckLift;
edge.startSubvoxels = {RoundQ(sx), RoundQ(sy), RoundQ(sz)}; edge.startSubvoxels = {RoundQ(sx), RoundQ(sy), RoundQ(sz)};
@@ -1330,8 +1765,9 @@ std::optional<FloatingIslandManifestV1> FloatingIslandManifestV1::FromJson(
manifest.recipe.anchorRootBottomZSubvoxels) manifest.recipe.anchorRootBottomZSubvoxels)
||!floating_island_detail::ReadInteger(recipeValue.Get("anchor_mouth_offset_q"), ||!floating_island_detail::ReadInteger(recipeValue.Get("anchor_mouth_offset_q"),
manifest.recipe.anchorMouthOffsetSubvoxels)) manifest.recipe.anchorMouthOffsetSubvoxels))
{error="floating-island geometry version 5 is missing a passage-rooted anchor field";return std::nullopt;} {error="floating-island geometry version 7 is missing a passage-rooted anchor field";return std::nullopt;}
} }
manifest.recipe.terrainFollowingRoute=recipeValue.Get("terrain_following_route").Boolean(false);
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)
@@ -1491,6 +1927,7 @@ std::string FloatingIslandManifestV1::ToJson() const
<< ",\"anchor_island_minimum_radius_q\":" << recipe.anchorIslandMinimumRadiusSubvoxels << ",\"anchor_island_minimum_radius_q\":" << recipe.anchorIslandMinimumRadiusSubvoxels
<< ",\"anchor_root_bottom_z_q\":" << recipe.anchorRootBottomZSubvoxels << ",\"anchor_root_bottom_z_q\":" << recipe.anchorRootBottomZSubvoxels
<< ",\"anchor_mouth_offset_q\":" << recipe.anchorMouthOffsetSubvoxels; << ",\"anchor_mouth_offset_q\":" << recipe.anchorMouthOffsetSubvoxels;
if(recipe.terrainFollowingRoute)out << ",\"terrain_following_route\":true";
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
@@ -1742,6 +2179,26 @@ std::optional<FloatingIslandManifestV1> PlanFloatingIslandCluster(
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; std::int64_t routeX=x,routeY=y;
if(WorldAssemblyEvaluatorVersion>=192&&recipe.terrainFollowingRoute
&&recipe.geometryVersion>=5
&&segment+2==count&&pieces>1)
{
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 length=std::hypot(dx,dy);
const double bend=10.0*floating_island_detail::Q
*std::pow(std::sin(floating_island_detail::Pi*t),2.0);
const double sign=side?-1.0:1.0;
if(length>0.0)
{
routeX=floating_island_detail::RoundQ(
static_cast<double>(routeX)+sign*(-dy/length)*bend);
routeY=floating_island_detail::RoundQ(
static_cast<double>(routeY)+sign*(dx/length)*bend);
}
}
if(recipe.geometryVersion>=5&&segment+2==count&&piece==pieces) if(recipe.geometryVersion>=5&&segment+2==count&&piece==pieces)
{ {
const auto& anchor=islands[recipe.anchorIslandOrdinal]; const auto& anchor=islands[recipe.anchorIslandOrdinal];
@@ -1758,8 +2215,11 @@ std::optional<FloatingIslandManifestV1> PlanFloatingIslandCluster(
routeX=floating_island_detail::RoundQ(mouthX); routeX=floating_island_detail::RoundQ(mouthX);
routeY=floating_island_detail::RoundQ(mouthY); routeY=floating_island_detail::RoundQ(mouthY);
} }
const auto surface = floating_island_detail::FindCapsuleFootingTopZ( const auto surface = WorldAssemblyEvaluatorVersion>=199
recipe, manifest.plan, routeX, routeY); &&recipe.terrainFollowingRoute
?floating_island_detail::FindSurfaceZ(recipe,manifest.plan,routeX,routeY)
:floating_island_detail::FindCapsuleFootingTopZ(
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;
@@ -1826,14 +2286,19 @@ bool FloatingIslandFieldV1::isValid() const noexcept
std::int64_t FloatingIslandFieldV1::densitySubvoxels(std::int64_t x, std::int64_t FloatingIslandFieldV1::densitySubvoxels(std::int64_t x,
std::int64_t y, std::int64_t z) const noexcept std::int64_t y, std::int64_t z) const noexcept
{ {
floating_island_detail::FScopedIslandAttributionTimer fieldTimer(
floating_island_detail::EIslandAttributionBucket::Field);
// The selected evaluator validates once; do not scan the plan twice per scoped sample. // The selected evaluator validates once; do not scan the plan twice per scoped sample.
// L'evaluateur choisi valide une seule fois; ne pas reparcourir le plan a chaque echantillon. // L'evaluateur choisi valide une seule fois; ne pas reparcourir le plan a chaque echantillon.
std::int64_t density=floating_island_detail::MaxDensity;
if (const auto* list = ScopedWorldAssemblyFeatureQueriesV1::find(recipe_, plan_, x, y, z)) if (const auto* list = ScopedWorldAssemblyFeatureQueriesV1::find(recipe_, plan_, x, y, z))
return densitySubvoxelsForTile(x, y, z, *list); density=densitySubvoxelsForTile(x, y, z, *list);
if (!isValid() || !floating_island_detail::ValidScalar(x) else if (!isValid() || !floating_island_detail::ValidScalar(x)
|| !floating_island_detail::ValidScalar(y) || !floating_island_detail::ValidScalar(z)) || !floating_island_detail::ValidScalar(y) || !floating_island_detail::ValidScalar(z))
return floating_island_detail::MaxDensity; density=floating_island_detail::MaxDensity;
return floating_island_detail::FieldDensity(*recipe_, *plan_, x, y, z); else density=floating_island_detail::FieldDensity(*recipe_, *plan_, x, y, z);
fieldTimer.Stop();
return density;
} }
std::vector<WorldAssemblyFeatureBoundsV1> FloatingIslandFieldV1::solidSupportBounds() const std::vector<WorldAssemblyFeatureBoundsV1> FloatingIslandFieldV1::solidSupportBounds() const
@@ -2032,19 +2497,46 @@ FieldInterval FloatingIslandFieldV1::interval(std::int64_t minX, std::int64_t mi
|| !floating_island_detail::ValidScalar(minX) || !floating_island_detail::ValidScalar(minY) || !floating_island_detail::ValidScalar(minX) || !floating_island_detail::ValidScalar(minY)
|| !floating_island_detail::ValidScalar(minZ) || !floating_island_detail::ValidScalar(maxX) || !floating_island_detail::ValidScalar(minZ) || !floating_island_detail::ValidScalar(maxX)
|| !floating_island_detail::ValidScalar(maxY) || !floating_island_detail::ValidScalar(maxZ)) return result; || !floating_island_detail::ValidScalar(maxY) || !floating_island_detail::ValidScalar(maxZ)) return result;
const std::array<std::int64_t, 3> minimum{minX, minY, minZ}; using namespace floating_island_detail;
const std::array<std::int64_t, 3> maximum{maxX, maxY, maxZ}; if (plan_->islands.empty())
for (const auto& island : plan_->islands) return {true,MaxDensity,MaxDensity};
if (floating_island_detail::Intersects(minimum, maximum,
island.influenceMinimumSubvoxels, island.influenceMaximumSubvoxels)) return result; const std::array<double,3> minimum{static_cast<double>(minX),
for (const auto& edge : plan_->clusterEdges) static_cast<double>(minY),static_cast<double>(minZ)};
if (floating_island_detail::Intersects(minimum, maximum, const std::array<double,3> maximum{static_cast<double>(maxX),
edge.influenceMinimumSubvoxels, edge.influenceMaximumSubvoxels)) return result; static_cast<double>(maxY),static_cast<double>(maxZ)};
// Root is void. A box outside every lobe/taper/blend/connector influence bound proves air. double fieldMinimum=static_cast<double>(MaxDensity);
// La racine est le vide : une boite hors des influences bornees prouve l'air. double fieldMaximum=static_cast<double>(MaxDensity);
result.known = true; for(const auto& island:plan_->islands)
result.minimumDensitySubvoxels = 0; {
result.maximumDensitySubvoxels = floating_island_detail::MaxDensity; FDensityRange group=IslandDensityRange(*recipe_,island,minimum,maximum);
for(const auto& edge:plan_->clusterEdges)
{
if(edge.fromIslandId!=island.stableId)continue;
const FDensityRange connector=ConnectorDensityRange(*recipe_,edge,minimum,maximum);
const double detail=recipe_->geometryVersion>=2
?static_cast<double>(recipe_->roughnessSubvoxels):0.0;
group.minimum=std::min(group.minimum,connector.minimum-detail)
-static_cast<double>(recipe_->blendRadiusSubvoxels)*0.25;
group.maximum=std::min(group.maximum,connector.maximum+detail);
}
fieldMinimum=std::min(fieldMinimum,group.minimum);
fieldMaximum=std::min(fieldMaximum,group.maximum);
}
if(!std::isfinite(fieldMinimum)||!std::isfinite(fieldMaximum))return result;
// These interval operations are shared by native and future generator classifiers: SDF
// intersections take max, unions take min, and smooth unions subtract at most k/4.
// Keep two subvoxels of slack for floating bounds followed by the field's integer rounding.
// Ces bornes servent les generateurs actuels et futurs : intersections=max, unions=min.
const double minimumRounded=std::clamp(std::floor(fieldMinimum)-2.0,
-static_cast<double>(MaxDensity),static_cast<double>(MaxDensity));
const double maximumRounded=std::clamp(std::ceil(fieldMaximum)+2.0,
-static_cast<double>(MaxDensity),static_cast<double>(MaxDensity));
if(minimumRounded>maximumRounded)return result;
result.known=true;
result.minimumDensitySubvoxels=static_cast<std::int64_t>(minimumRounded);
result.maximumDensitySubvoxels=static_cast<std::int64_t>(maximumRounded);
return result; return result;
} }
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -11,5 +11,6 @@ namespace VoxelForgeCore
// the same command-line overrides as the viewer's reference loader. // the same command-line overrides as the viewer's reference loader.
ResolvedWorldSnapshot MakeStandaloneSnapshotFromParsedJson(const VFJson::Value& jsonRoot, ResolvedWorldSnapshot MakeStandaloneSnapshotFromParsedJson(const VFJson::Value& jsonRoot,
std::int32_t seed,std::int32_t clipRadius,std::int32_t maxLodOverride, std::int32_t seed,std::int32_t clipRadius,std::int32_t maxLodOverride,
bool roundTunnels,bool enhancedTunnelWalls,std::string& error); bool roundTunnels,bool enhancedTunnelWalls,std::string& error,
bool hasUnrealResolvedCorePlan=false);
} }
File diff suppressed because it is too large. Load diff
+94 -3
View File
@@ -20,6 +20,7 @@
#define VF_FIELD_CLAMP(v,a,b) clamp(v,a,b) #define VF_FIELD_CLAMP(v,a,b) clamp(v,a,b)
#define VF_FIELD_LERP(a,b,t) lerp(a,b,t) #define VF_FIELD_LERP(a,b,t) lerp(a,b,t)
#else #else
#include <array>
#include <algorithm> #include <algorithm>
#include <cmath> #include <cmath>
#include <cstdint> #include <cstdint>
@@ -244,11 +245,70 @@ VF_FIELD_INLINE float VF_FieldValueNoise(float x, float y, float z,
return VF_FieldLerp(VF_FieldLerp(z00, z10, ty), VF_FieldLerp(z01, z11, ty), tz); return VF_FieldLerp(VF_FieldLerp(z00, z10, ty), VF_FieldLerp(z01, z11, ty), tz);
} }
#if !defined(VF_FIELD_HLSL)
struct VF_FieldValueNoiseCacheEntry
{
VF_FieldI32 x=0,y=0,z=0,wavelength=0;
VF_FieldU32 seed=0;
bool valid=false;
std::array<float,8> corners{};
};
// Reuse the eight lattice values while adjacent voxel samples remain in the same
// value-noise cell. Only the integer hash lookups are shared; interpolation keeps
// the same inputs and operation order as VF_FieldValueNoise.
VF_FIELD_INLINE float VF_FieldCachedValueNoise(float x,float y,float z,
VF_FieldI32 wavelength,VF_FieldU32 seed)
{
static thread_local std::array<VF_FieldValueNoiseCacheEntry,64> cache{};
const float inv=1.0f/VF_FIELD_CAST_F32(wavelength);
const float fx=x*inv,fy=y*inv,fz=z*inv;
const VF_FieldI32 x0=VF_FIELD_CAST_I32(VF_FIELD_FLOOR(fx));
const VF_FieldI32 y0=VF_FIELD_CAST_I32(VF_FIELD_FLOOR(fy));
const VF_FieldI32 z0=VF_FIELD_CAST_I32(VF_FIELD_FLOOR(fz));
const VF_FieldU32 cellHash=VF_FieldMix(seed
^VF_FIELD_CAST_U32(x0)*0x68E31DA4u
^VF_FIELD_CAST_U32(y0)*0x1B56C4E9u
^VF_FIELD_CAST_U32(z0)*0x9E3779B9u
^VF_FIELD_CAST_U32(wavelength)*0x85EBCA77u);
auto& entry=cache[cellHash&(cache.size()-1)];
if(!entry.valid||entry.x!=x0||entry.y!=y0||entry.z!=z0
||entry.wavelength!=wavelength||entry.seed!=seed)
{
entry.x=x0;entry.y=y0;entry.z=z0;entry.wavelength=wavelength;
entry.seed=seed;entry.valid=true;
entry.corners={
VF_FieldNoiseValue(x0,y0,z0,seed),
VF_FieldNoiseValue(x0+1,y0,z0,seed),
VF_FieldNoiseValue(x0,y0+1,z0,seed),
VF_FieldNoiseValue(x0+1,y0+1,z0,seed),
VF_FieldNoiseValue(x0,y0,z0+1,seed),
VF_FieldNoiseValue(x0+1,y0,z0+1,seed),
VF_FieldNoiseValue(x0,y0+1,z0+1,seed),
VF_FieldNoiseValue(x0+1,y0+1,z0+1,seed)};
}
const float tx=VF_FieldFade(fx-VF_FIELD_CAST_F32(x0));
const float ty=VF_FieldFade(fy-VF_FIELD_CAST_F32(y0));
const float tz=VF_FieldFade(fz-VF_FIELD_CAST_F32(z0));
const float z00=VF_FieldLerp(entry.corners[0],entry.corners[1],tx);
const float z10=VF_FieldLerp(entry.corners[2],entry.corners[3],tx);
const float z01=VF_FieldLerp(entry.corners[4],entry.corners[5],tx);
const float z11=VF_FieldLerp(entry.corners[6],entry.corners[7],tx);
return VF_FieldLerp(VF_FieldLerp(z00,z10,ty),VF_FieldLerp(z01,z11,ty),tz);
}
#endif
VF_FIELD_INLINE float VF_FieldSurfaceRelief(float x, float y, float z, VF_FieldU32 seed) VF_FIELD_INLINE float VF_FieldSurfaceRelief(float x, float y, float z, VF_FieldU32 seed)
{ {
#if defined(VF_FIELD_HLSL)
const float macro = VF_FieldValueNoise(x, y, z, 32, seed ^ 0xB5297A4Du); const float macro = VF_FieldValueNoise(x, y, z, 32, seed ^ 0xB5297A4Du);
const float mid = VF_FieldValueNoise(x, y, z, 16, seed ^ 0x63D83595u); const float mid = VF_FieldValueNoise(x, y, z, 16, seed ^ 0x63D83595u);
const float fine = VF_FieldValueNoise(x, y, z, 4, seed ^ 0xA511E9B3u); const float fine = VF_FieldValueNoise(x, y, z, 4, seed ^ 0xA511E9B3u);
#else
const float macro=VF_FieldCachedValueNoise(x,y,z,32,seed^0xB5297A4Du);
const float mid=VF_FieldCachedValueNoise(x,y,z,16,seed^0x63D83595u);
const float fine=VF_FieldCachedValueNoise(x,y,z,4,seed^0xA511E9B3u);
#endif
return 1.20f * macro + (0.80f + 0.25f * macro) * (0.40f * mid + 0.60f * fine); return 1.20f * macro + (0.80f + 0.25f * macro) * (0.40f * mid + 0.60f * fine);
} }
@@ -331,6 +391,37 @@ VF_FIELD_INLINE float VF_FieldPerlin3D(float x,float y,float z)
return VF_FieldPerlinLerp(y0,y1,sw); return VF_FieldPerlinLerp(y0,y1,sw);
} }
VF_FIELD_INLINE float VF_FieldPassageWallRelief(float x,float y,float z,VF_FieldU32 seed)
{
// Use long, non-commensurate rotated scales. The shared passage wall keeps broad,
// uneven rock relief without a short wavelength that can read as repeated rings.
#if defined(VF_FIELD_HLSL)
const float broad=VF_FieldValueNoise(x+17.0f,y-23.0f,z+11.0f,43,
seed^0xB5297A4Du);
const float mid=VF_FieldValueNoise(y-7.0f,z+19.0f,x-31.0f,29,
seed^0x63D83595u);
const float fine=VF_FieldValueNoise(z+5.0f,x+29.0f,y-13.0f,19,
seed^0xA511E9B3u);
#else
const float broad=VF_FieldCachedValueNoise(x+17.0f,y-23.0f,z+11.0f,43,
seed^0xB5297A4Du);
const float mid=VF_FieldCachedValueNoise(y-7.0f,z+19.0f,x-31.0f,29,
seed^0x63D83595u);
const float fine=VF_FieldCachedValueNoise(z+5.0f,x+29.0f,y-13.0f,19,
seed^0xA511E9B3u);
#endif
return 0.50f*broad+0.35f*mid+0.15f*fine;
}
VF_FIELD_INLINE float VF_FieldPassageGroundGrain(float x,float y,VF_FieldU32 seed)
{
const float broad=VF_FieldValueNoise(x+3.25f,y-7.5f,0.0f,8,
seed^0xC2B2AE35u);
const float fine=VF_FieldValueNoise(y+11.75f,x-5.0f,0.0f,5,
seed^0x27D4EB2Fu);
return 0.65f*broad+0.35f*fine;
}
VF_FIELD_INLINE float VF_FieldOwnerFractal(float x,float y,float z,VF_FieldI32 octaves, VF_FIELD_INLINE float VF_FieldOwnerFractal(float x,float y,float z,VF_FieldI32 octaves,
VF_FieldI32 mode) VF_FieldI32 mode)
{ {
@@ -372,9 +463,9 @@ VF_FIELD_INLINE float VF_FieldOwnerCellular(float x,float y,float z)
{ {
const VF_FieldI32 nx=cellX+dx,ny=cellY+dy,nz=cellZ+dz; const VF_FieldI32 nx=cellX+dx,ny=cellY+dy,nz=cellZ+dz;
const VF_FieldU32 h=VF_FieldVoxelHashMix( const VF_FieldU32 h=VF_FieldVoxelHashMix(
VF_FIELD_CAST_U32(nx+0x7FFFFFFF) (VF_FIELD_CAST_U32(nx)+0x7FFFFFFFu)
^VF_FieldVoxelHashMix(VF_FIELD_CAST_U32(ny+0x7FFFFFFF)*2654435761u) ^VF_FieldVoxelHashMix((VF_FIELD_CAST_U32(ny)+0x7FFFFFFFu)*2654435761u)
^VF_FieldVoxelHashMix(VF_FIELD_CAST_U32(nz+0x7FFFFFFF)*374761393u)); ^VF_FieldVoxelHashMix((VF_FIELD_CAST_U32(nz)+0x7FFFFFFFu)*374761393u));
const float fpx=VF_FIELD_CAST_F32(dx) const float fpx=VF_FIELD_CAST_F32(dx)
+VF_FIELD_CAST_F32(h&0xFFFFFFu)*(1.0f/16777216.0f)-fracX; +VF_FIELD_CAST_F32(h&0xFFFFFFu)*(1.0f/16777216.0f)-fracX;
const VF_FieldU32 hy=VF_FieldVoxelHashMix(h^0x12345678u); const VF_FieldU32 hy=VF_FieldVoxelHashMix(h^0x12345678u);
+567 -5
View File
@@ -145,6 +145,12 @@ namespace world_assembly_detail
}; };
constexpr std::int64_t Q16 = 1ll << 16; constexpr std::int64_t Q16 = 1ll << 16;
constexpr std::int64_t Q32 = 1ll << 32;
constexpr std::int64_t SurfaceProfileSubvoxelsPerMetre =
WorldAssemblySubvoxelsPerVoxel * 4;
constexpr std::int64_t SurfaceProfileMinimumClearanceSubvoxels = 2253;
constexpr std::int64_t SurfaceProfileFightClearanceSubvoxels =
8 * SurfaceProfileSubvoxelsPerMetre;
constexpr std::int64_t MinimumCliffShelfThicknessSubvoxels = 2 * WorldAssemblySubvoxelsPerVoxel; constexpr std::int64_t MinimumCliffShelfThicknessSubvoxels = 2 * WorldAssemblySubvoxelsPerVoxel;
constexpr std::int64_t MaxSerializedMagnitude = 1000000000000ll; constexpr std::int64_t MaxSerializedMagnitude = 1000000000000ll;
constexpr std::size_t MaxBiomeCount = 8; constexpr std::size_t MaxBiomeCount = 8;
@@ -228,6 +234,114 @@ namespace world_assembly_detail
inline bool OutsideRange(std::int64_t value) inline bool OutsideRange(std::int64_t value)
{ return value < -MaxSerializedMagnitude || value > MaxSerializedMagnitude; } { return value < -MaxSerializedMagnitude || value > MaxSerializedMagnitude; }
inline bool IsNaturalSurfaceProfile(const WorldAssemblySurfaceProfileV1& profile)
{ return profile.version == 0 && profile == WorldAssemblySurfaceProfileV1{}; }
inline bool ValidateSurfaceProfile(const WorldAssemblySurfaceProfileV1& profile,
std::uint32_t seed, std::string& error)
{
if (profile.version == 0)
{
if (!IsNaturalSurfaceProfile(profile))
{ error = "natural SurfaceWorld profile must use the all-zero default payload"; return false; }
return true;
}
if (profile.version != 1
|| !ValidScalar(profile.h0Subvoxels)
|| !ValidScalar(profile.amplitudeXSubvoxels)
|| !ValidScalar(profile.amplitudeYSubvoxels)
|| !ValidScalar(profile.wavelengthXSubvoxels)
|| !ValidScalar(profile.wavelengthYSubvoxels)
|| !ValidScalar(profile.mirrorLambdaQ16)
|| !ValidScalar(profile.minimumArenaClearanceSubvoxels)
|| profile.minimumArenaClearanceSubvoxels < 0
|| profile.minimumArenaClearanceSubvoxels > 32 * SurfaceProfileSubvoxelsPerMetre)
{ error = "SurfaceWorld profile version or fixed-scale value is outside its supported range"; return false; }
constexpr std::int64_t MinimumPeriodAmplitude = SurfaceProfileSubvoxelsPerMetre / 2;
constexpr std::int64_t MaximumPeriodicAmplitude = 3 * SurfaceProfileSubvoxelsPerMetre;
constexpr std::int64_t MaximumMirrorAmplitude = 2 * SurfaceProfileSubvoxelsPerMetre;
constexpr std::int64_t MinimumWavelength = 80 * SurfaceProfileSubvoxelsPerMetre;
constexpr std::int64_t MaximumWavelength = 160 * SurfaceProfileSubvoxelsPerMetre;
const bool hasArenaClearance = profile.minimumArenaClearanceSubvoxels == 0
|| profile.minimumArenaClearanceSubvoxels >= SurfaceProfileFightClearanceSubvoxels;
if (!hasArenaClearance)
{ error = "SurfaceWorld arena clearance must be omitted or at least eight metres"; return false; }
if (profile.kind == WorldAssemblySurfaceProfileKindV1::periodicHills
|| profile.kind == WorldAssemblySurfaceProfileKindV1::mirroredRelief)
{
const std::int64_t maximumAmplitude =
profile.kind == WorldAssemblySurfaceProfileKindV1::periodicHills
? MaximumPeriodicAmplitude : MaximumMirrorAmplitude;
if (profile.amplitudeXSubvoxels < MinimumPeriodAmplitude
|| profile.amplitudeYSubvoxels < MinimumPeriodAmplitude
|| profile.amplitudeXSubvoxels > maximumAmplitude
|| profile.amplitudeYSubvoxels > maximumAmplitude
|| profile.wavelengthXSubvoxels < MinimumWavelength
|| profile.wavelengthYSubvoxels < MinimumWavelength
|| profile.wavelengthXSubvoxels > MaximumWavelength
|| profile.wavelengthYSubvoxels > MaximumWavelength)
{ error = "periodic SurfaceWorld amplitudes or wavelengths are outside the R20 metre ranges"; return false; }
// Round every gradient component upward before applying the 15-degree bound.
// This makes the integer plan-time check conservative around division boundaries.
constexpr std::int64_t TwoPiQ16Ceiling = 411775;
constexpr std::int64_t Tan15Q16Floor = 17560;
const auto component = [](std::int64_t amplitude, std::int64_t wavelength)
{
const std::int64_t numerator = TwoPiQ16Ceiling * amplitude;
return (numerator + wavelength - 1) / wavelength;
};
const std::int64_t gx = component(profile.amplitudeXSubvoxels,
profile.wavelengthXSubvoxels);
const std::int64_t gy = component(profile.amplitudeYSubvoxels,
profile.wavelengthYSubvoxels);
if (gx * gx + gy * gy > Tan15Q16Floor * Tan15Q16Floor)
{ error = "periodic SurfaceWorld maximum walk grade exceeds tan(15 degrees)"; return false; }
if (profile.kind == WorldAssemblySurfaceProfileKindV1::periodicHills)
{
if (profile.mirrorLambdaQ16 != 0
|| profile.phaseXTurnsQ32 != WorldAssemblySurfaceProfileSeededPhaseQ32(seed, 0)
|| profile.phaseYTurnsQ32 != WorldAssemblySurfaceProfileSeededPhaseQ32(seed, 1))
{ error = "periodic-hill phases must be the stable seed-derived Q0.32 phases"; return false; }
}
else if (profile.mirrorLambdaQ16 < 49152 || profile.mirrorLambdaQ16 > Q16
|| profile.phaseXTurnsQ32 != WorldAssemblySurfaceProfileSeededPhaseQ32(seed, 0)
|| profile.phaseYTurnsQ32 != WorldAssemblySurfaceProfileSeededPhaseQ32(seed, 1))
{ error = "mirrored-relief lambda or seeded phases are outside their supported range"; return false; }
}
else if (profile.kind == WorldAssemblySurfaceProfileKindV1::flatField)
{
if (profile.amplitudeXSubvoxels != 0 || profile.amplitudeYSubvoxels != 0
|| profile.wavelengthXSubvoxels != 0 || profile.wavelengthYSubvoxels != 0
|| profile.phaseXTurnsQ32 != 0 || profile.phaseYTurnsQ32 != 0
|| profile.mirrorLambdaQ16 != 0)
{ error = "flatField must not carry periodic or mirrored relief parameters"; return false; }
}
else
{ error = "SurfaceWorld profile kind is unsupported"; return false; }
return true;
}
inline void HashSurfaceProfile(std::uint64_t& hash,
const WorldAssemblySurfaceProfileV1& profile)
{
HashWord(hash, 0x5355524650524f31ull, 8);
HashWord(hash, profile.version, 4);
HashWord(hash, static_cast<std::uint32_t>(profile.kind), 4);
HashWord(hash, static_cast<std::uint64_t>(profile.h0Subvoxels), 8);
HashWord(hash, static_cast<std::uint64_t>(profile.amplitudeXSubvoxels), 8);
HashWord(hash, static_cast<std::uint64_t>(profile.amplitudeYSubvoxels), 8);
HashWord(hash, static_cast<std::uint64_t>(profile.wavelengthXSubvoxels), 8);
HashWord(hash, static_cast<std::uint64_t>(profile.wavelengthYSubvoxels), 8);
HashWord(hash, profile.phaseXTurnsQ32, 4);
HashWord(hash, profile.phaseYTurnsQ32, 4);
HashWord(hash, static_cast<std::uint64_t>(profile.mirrorLambdaQ16), 8);
HashWord(hash, static_cast<std::uint64_t>(profile.minimumArenaClearanceSubvoxels), 8);
}
inline bool ValidateRecipe(const WorldAssemblyRecipeV1& recipe, std::string& error) inline bool ValidateRecipe(const WorldAssemblyRecipeV1& recipe, std::string& error)
{ {
if (recipe.schemaVersion != WorldAssemblySchemaVersion if (recipe.schemaVersion != WorldAssemblySchemaVersion
@@ -296,16 +410,57 @@ namespace world_assembly_detail
|| recipe.biomeClimateMoistureWavelengthSubvoxels <= 0 || recipe.biomeClimateMoistureWavelengthSubvoxels <= 0
|| recipe.biomeClimateReliefContrastQ16 < 0)) || recipe.biomeClimateReliefContrastQ16 < 0))
{ error = "world assembly climate parameters are outside the supported fixed-scale range"; return false; } { error = "world assembly climate parameters are outside the supported fixed-scale range"; return false; }
if (!ValidateSurfaceProfile(recipe.surfaceProfile, recipe.seed, error)) return false;
return true;
}
inline bool ValidateSurfaceProfileGeometry(const WorldAssemblySurfaceProfileV1& profile,
const WorldAssemblyStratumPlanV1& stratum, std::int64_t layoutChunkWidthSubvoxels,
std::string& error)
{
if (profile.version == 0) return true;
const std::int64_t relief = profile.amplitudeXSubvoxels + profile.amplitudeYSubvoxels;
const std::int64_t groundMinimum = profile.h0Subvoxels - relief - 2;
const std::int64_t groundMaximum = profile.h0Subvoxels + relief + 2;
std::int64_t capSwing = 0;
if (profile.kind == WorldAssemblySurfaceProfileKindV1::mirroredRelief)
{
const std::int64_t product = relief * profile.mirrorLambdaQ16;
capSwing = (product + Q16 - 1) / Q16 + 2;
}
const std::int64_t capMinimum = stratum.capHeightSubvoxels - capSwing;
const std::int64_t capMaximum = stratum.capHeightSubvoxels + capSwing;
const std::int64_t clearance = capMinimum - groundMaximum;
const std::int64_t requiredClearance = std::max(
SurfaceProfileMinimumClearanceSubvoxels,
profile.minimumArenaClearanceSubvoxels);
if (clearance < requiredClearance)
{ error = "SurfaceWorld profile does not preserve its required floor-to-cap clearance"; return false; }
const std::int64_t stratumMinimum = static_cast<std::int64_t>(stratum.bottomChunkZ)
* layoutChunkWidthSubvoxels;
const std::int64_t stratumMaximum = (static_cast<std::int64_t>(stratum.topChunkZ) + 1)
* layoutChunkWidthSubvoxels;
if (groundMinimum <= stratumMinimum || capMaximum >= stratumMaximum)
{ error = "SurfaceWorld profile escapes its finite stratum Z bounds"; return false; }
return true; return true;
} }
inline bool ValidateStratum(const WorldAssemblyStratumPlanV1& stratum, inline bool ValidateStratum(const WorldAssemblyStratumPlanV1& stratum,
std::int64_t layoutChunkWidthSubvoxels, std::string& error) const WorldAssemblyRecipeV1& recipe, std::string& error)
{ {
const std::int64_t layoutChunkWidthSubvoxels = recipe.layoutChunkWidthSubvoxels;
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
|| stratum.features.size() > MaxFeatureCount || stratum.route.size() > MaxRoutePointCount) || stratum.features.size() > MaxFeatureCount || stratum.route.size() > MaxRoutePointCount)
{ error = "world assembly stratum plan has an invalid extent or exceeds its bounded payload"; return false; } { error = "world assembly stratum plan has an invalid extent or exceeds its bounded payload"; return false; }
const WorldAssemblyRecipeV1& effectiveRecipe = stratum.hasRecipeOverride
? stratum.recipeOverride : recipe;
if (!ValidateSurfaceProfile(stratum.surfaceProfile, effectiveRecipe.seed, error)) return false;
if (stratum.surfaceProfile != effectiveRecipe.surfaceProfile)
{ error = "SurfaceWorld recipe and stratum plan profile payloads do not match"; return false; }
if (!ValidateSurfaceProfileGeometry(stratum.surfaceProfile, stratum,
layoutChunkWidthSubvoxels, error)) return false;
if (!ValidScalar(stratum.capHeightSubvoxels) || !ValidScalar(stratum.capUndulationSubvoxels) if (!ValidScalar(stratum.capHeightSubvoxels) || !ValidScalar(stratum.capUndulationSubvoxels)
|| !ValidScalar(stratum.capWavelengthSubvoxels) || !ValidScalar(stratum.capWavelengthSubvoxels)
|| !ValidScalar(stratum.capDetailAmplitudeSubvoxels) || !ValidScalar(stratum.capDetailAmplitudeSubvoxels)
@@ -466,6 +621,8 @@ namespace world_assembly_detail
HashWord(hash, static_cast<std::uint64_t>(value), 8); HashWord(hash, static_cast<std::uint64_t>(value), 8);
} }
} }
if (recipe.surfaceProfile.version != 0)
HashSurfaceProfile(hash, recipe.surfaceProfile);
return hash; return hash;
} }
@@ -525,6 +682,8 @@ namespace world_assembly_detail
for (const auto value : point.positionSubvoxels) HashWord(hash, static_cast<std::uint64_t>(value), 8); for (const auto value : point.positionSubvoxels) HashWord(hash, static_cast<std::uint64_t>(value), 8);
HashWord(hash, static_cast<std::uint64_t>(point.radiusSubvoxels), 8); HashWord(hash, static_cast<std::uint64_t>(point.radiusSubvoxels), 8);
} }
if (stratum.surfaceProfile.version != 0)
HashSurfaceProfile(hash, stratum.surfaceProfile);
return hash; return hash;
} }
@@ -627,6 +786,59 @@ namespace world_assembly_detail
return out.str(); return out.str();
} }
inline const char* SurfaceProfileKindName(WorldAssemblySurfaceProfileKindV1 kind)
{
switch (kind)
{
case WorldAssemblySurfaceProfileKindV1::natural: return "natural";
case WorldAssemblySurfaceProfileKindV1::periodicHills: return "periodicHills";
case WorldAssemblySurfaceProfileKindV1::mirroredRelief: return "mirroredRelief";
case WorldAssemblySurfaceProfileKindV1::flatField: return "flatField";
}
return "unsupported";
}
inline bool ParseSurfaceProfile(const VFJson::Value& value,
WorldAssemblySurfaceProfileV1& profile)
{
if (!value.IsObject() || !ReadU32(value.Get("version"), profile.version)) return false;
const auto* kind = std::get_if<std::string>(&value.Get("kind").Data);
if (kind == nullptr) return false;
if (*kind == "periodicHills") profile.kind = WorldAssemblySurfaceProfileKindV1::periodicHills;
else if (*kind == "mirroredRelief") profile.kind = WorldAssemblySurfaceProfileKindV1::mirroredRelief;
else if (*kind == "flatField") profile.kind = WorldAssemblySurfaceProfileKindV1::flatField;
else if (*kind == "natural") profile.kind = WorldAssemblySurfaceProfileKindV1::natural;
else return false;
return ReadInteger(value.Get("h0_q"), profile.h0Subvoxels)
&& ReadInteger(value.Get("amplitude_x_q"), profile.amplitudeXSubvoxels)
&& ReadInteger(value.Get("amplitude_y_q"), profile.amplitudeYSubvoxels)
&& ReadInteger(value.Get("wavelength_x_q"), profile.wavelengthXSubvoxels)
&& ReadInteger(value.Get("wavelength_y_q"), profile.wavelengthYSubvoxels)
&& ReadU32(value.Get("phase_x_turns_q32"), profile.phaseXTurnsQ32)
&& ReadU32(value.Get("phase_y_turns_q32"), profile.phaseYTurnsQ32)
&& ReadInteger(value.Get("mirror_lambda_q16"), profile.mirrorLambdaQ16)
&& ReadInteger(value.Get("minimum_arena_clearance_q"),
profile.minimumArenaClearanceSubvoxels);
}
inline std::string SurfaceProfileJson(const WorldAssemblySurfaceProfileV1& profile)
{
std::ostringstream out;
out << "{\"version\":" << profile.version
<< ",\"kind\":\"" << SurfaceProfileKindName(profile.kind) << "\""
<< ",\"h0_q\":" << profile.h0Subvoxels
<< ",\"amplitude_x_q\":" << profile.amplitudeXSubvoxels
<< ",\"amplitude_y_q\":" << profile.amplitudeYSubvoxels
<< ",\"wavelength_x_q\":" << profile.wavelengthXSubvoxels
<< ",\"wavelength_y_q\":" << profile.wavelengthYSubvoxels
<< ",\"phase_x_turns_q32\":" << profile.phaseXTurnsQ32
<< ",\"phase_y_turns_q32\":" << profile.phaseYTurnsQ32
<< ",\"mirror_lambda_q16\":" << profile.mirrorLambdaQ16
<< ",\"minimum_arena_clearance_q\":"
<< profile.minimumArenaClearanceSubvoxels << '}';
return out.str();
}
inline bool ParseRecipe(const VFJson::Value& value, WorldAssemblyRecipeV1& recipe, inline bool ParseRecipe(const VFJson::Value& value, WorldAssemblyRecipeV1& recipe,
std::string& error) std::string& error)
{ {
@@ -647,6 +859,10 @@ namespace world_assembly_detail
|| !ReadInteger(value.Get("climate_moisture_wavelength_q"), recipe.biomeClimateMoistureWavelengthSubvoxels) || !ReadInteger(value.Get("climate_moisture_wavelength_q"), recipe.biomeClimateMoistureWavelengthSubvoxels)
|| !ReadInteger(value.Get("climate_relief_contrast_q16"), recipe.biomeClimateReliefContrastQ16))) || !ReadInteger(value.Get("climate_relief_contrast_q16"), recipe.biomeClimateReliefContrastQ16)))
{ error = "world assembly recipe is missing evaluator-2 climate parameters"; return false; } { error = "world assembly recipe is missing evaluator-2 climate parameters"; return false; }
const VFJson::Value& surfaceProfileValue = value.Get("surface_profile");
if (!std::holds_alternative<std::nullptr_t>(surfaceProfileValue.Data)
&& !ParseSurfaceProfile(surfaceProfileValue, recipe.surfaceProfile))
{ error = "world assembly recipe has a malformed versioned SurfaceWorld profile"; return false; }
for (const auto& item : value.Get("biomes").AsArray()) for (const auto& item : value.Get("biomes").AsArray())
{ {
WorldAssemblyBiomeProfileV1 biome; WorldAssemblyBiomeProfileV1 biome;
@@ -709,6 +925,8 @@ namespace world_assembly_detail
out << ",\"climate_relief_wavelength_q\":" << recipe.biomeClimateReliefWavelengthSubvoxels out << ",\"climate_relief_wavelength_q\":" << recipe.biomeClimateReliefWavelengthSubvoxels
<< ",\"climate_moisture_wavelength_q\":" << recipe.biomeClimateMoistureWavelengthSubvoxels << ",\"climate_moisture_wavelength_q\":" << recipe.biomeClimateMoistureWavelengthSubvoxels
<< ",\"climate_relief_contrast_q16\":" << recipe.biomeClimateReliefContrastQ16; << ",\"climate_relief_contrast_q16\":" << recipe.biomeClimateReliefContrastQ16;
if (recipe.surfaceProfile.version != 0)
out << ",\"surface_profile\":" << SurfaceProfileJson(recipe.surfaceProfile);
out << ",\"content_hash\":\"" << HashText(recipe.contentHash) << "\",\"biomes\":["; out << ",\"content_hash\":\"" << HashText(recipe.contentHash) << "\",\"biomes\":[";
for (std::size_t i = 0; i < recipe.biomes.size(); ++i) for (std::size_t i = 0; i < recipe.biomes.size(); ++i)
{ {
@@ -797,6 +1015,10 @@ namespace world_assembly_detail
{ error = "world assembly stratum has malformed optional evaluator-2 fields"; return false; } { error = "world assembly stratum has malformed optional evaluator-2 fields"; return false; }
if(hasWaterBoolean)stratum.waterEnabled=waterEnabled.Boolean(false); if(hasWaterBoolean)stratum.waterEnabled=waterEnabled.Boolean(false);
if(hasWaterNumber)stratum.waterEnabled=waterEnabled.Number()!=0.0; if(hasWaterNumber)stratum.waterEnabled=waterEnabled.Number()!=0.0;
const VFJson::Value& surfaceProfileValue = item.Get("surface_profile");
if (!std::holds_alternative<std::nullptr_t>(surfaceProfileValue.Data)
&& !ParseSurfaceProfile(surfaceProfileValue, stratum.surfaceProfile))
{ error = "world assembly stratum has a malformed versioned SurfaceWorld profile"; return false; }
const VFJson::Value& routeConstraintsValue = item.Get("route_constraints"); const VFJson::Value& routeConstraintsValue = item.Get("route_constraints");
if (!std::holds_alternative<std::nullptr_t>(routeConstraintsValue.Data)) if (!std::holds_alternative<std::nullptr_t>(routeConstraintsValue.Data))
{ {
@@ -1367,6 +1589,196 @@ namespace world_assembly_detail
return SmoothQ16(static_cast<std::uint32_t>(std::clamp<std::int64_t>(edge*Q16/feather,0,Q16))); return SmoothQ16(static_cast<std::uint32_t>(std::clamp<std::int64_t>(edge*Q16/feather,0,Q16)));
} }
constexpr std::int64_t Q30 = 1ll << 30;
constexpr std::array<std::int64_t, 30> CordicAtanTurnsQ32{{
536870912,316933406,167458907,85004756,42667331,21354465,10679838,5340245,
2670163,1335087,667544,333772,166886,83443,41722,20861,10430,5215,2608,
1304,652,326,163,81,41,20,10,5,3,1}};
inline std::array<std::int64_t, 2> CordicSinCosQuarterQ30(std::uint32_t angleQ32)
{
if (angleQ32 == 0) return {Q30, 0};
std::int64_t x = 652032874, y = 0;
std::int64_t z = angleQ32;
for (std::size_t i = 0; i < CordicAtanTurnsQ32.size(); ++i)
{
const std::int64_t oldX = x;
if (z >= 0)
{
x -= y >> i;
y += oldX >> i;
z -= CordicAtanTurnsQ32[i];
}
else
{
x += y >> i;
y -= oldX >> i;
z += CordicAtanTurnsQ32[i];
}
}
return {std::clamp<std::int64_t>(x, -Q30, Q30),
std::clamp<std::int64_t>(y, -Q30, Q30)};
}
inline std::int64_t CosineQ30(std::uint32_t phaseTurnsQ32)
{
constexpr std::uint32_t Quarter = 1u << 30;
if (phaseTurnsQ32 == 0) return Q30;
if (phaseTurnsQ32 == Quarter) return 0;
if (phaseTurnsQ32 == 2u * Quarter) return -Q30;
if (phaseTurnsQ32 == 3u * Quarter) return 0;
constexpr std::uint32_t TableBits = 16;
constexpr std::uint32_t TableSize = 1u << TableBits;
constexpr std::uint32_t FractionMask = (1u << (32 - TableBits)) - 1u;
static const std::array<std::int32_t, TableSize> table = []
{
std::array<std::int32_t, TableSize> values{};
constexpr std::uint32_t QuarterTableSize = TableSize / 4;
constexpr std::uint32_t QuarterStepQ32 = 1u << (30 - (TableBits - 2));
std::array<std::int32_t, QuarterTableSize + 1> quarter{};
for (std::uint32_t offset = 0; offset <= QuarterTableSize; ++offset)
{
const std::int64_t cosine = CordicSinCosQuarterQ30(
offset * QuarterStepQ32)[0];
const std::int64_t monotone = offset == 0 ? cosine
: std::min<std::int64_t>(quarter[offset - 1], cosine);
quarter[offset] = static_cast<std::int32_t>(monotone);
}
for (std::uint32_t index = 0; index < TableSize; ++index)
{
const std::uint32_t quadrant = index / QuarterTableSize;
const std::uint32_t offset = index % QuarterTableSize;
const std::uint32_t mirroredOffset = QuarterTableSize - offset;
const std::int32_t value = quadrant == 0 ? quarter[offset]
: quadrant == 1 ? -quarter[mirroredOffset]
: quadrant == 2 ? -quarter[offset] : quarter[mirroredOffset];
values[index] = value;
}
return values;
}();
const std::uint32_t index = phaseTurnsQ32 >> (32 - TableBits);
const std::uint32_t fraction = phaseTurnsQ32 & FractionMask;
const std::int64_t first = table[index];
const std::int64_t second = table[(index + 1u) & (TableSize - 1u)];
const std::int64_t numerator = (second - first) * fraction;
const std::int64_t rounded = numerator >= 0
? numerator + (1ll << (31 - TableBits))
: numerator - (1ll << (31 - TableBits));
// The fixed-point table interpolation is monotone within each quadrant;
// cosine interval bounds therefore still attain extrema at their endpoints
// or at the exact quarter-turn extrema checked below.
return first + rounded / (1ll << (32 - TableBits));
}
inline std::uint32_t SurfaceProfileTurnAtCoordinate(std::int64_t coordinate,
std::int64_t wavelength, std::uint32_t phaseTurnsQ32)
{
const std::uint64_t coordinateTurns = static_cast<std::uint64_t>(
FloorMod(coordinate, wavelength)) * static_cast<std::uint64_t>(Q32)
/ static_cast<std::uint64_t>(wavelength);
return phaseTurnsQ32 + static_cast<std::uint32_t>(coordinateTurns);
}
struct CosineRangeQ30
{
std::int64_t minimum = -Q30;
std::int64_t maximum = Q30;
};
inline CosineRangeQ30 SurfaceProfileCosineRangeQ30(std::int64_t minimumCoordinate,
std::int64_t maximumCoordinate, std::int64_t wavelength,
std::uint32_t phaseTurnsQ32)
{
if (wavelength <= 0 || minimumCoordinate > maximumCoordinate
|| maximumCoordinate - minimumCoordinate >= wavelength)
return {};
CosineRangeQ30 range;
const std::int64_t cosineAtMinimum = CosineQ30(
SurfaceProfileTurnAtCoordinate(minimumCoordinate, wavelength, phaseTurnsQ32));
const std::int64_t cosineAtMaximum = CosineQ30(
SurfaceProfileTurnAtCoordinate(maximumCoordinate, wavelength, phaseTurnsQ32));
range.minimum = std::min(cosineAtMinimum, cosineAtMaximum);
range.maximum = std::max(cosineAtMinimum, cosineAtMaximum);
// Coordinate turns are Q0.32. Test the exact analytic extrema in a common
// rational numerator domain; one Q0.32 unit of endpoint slack accounts for
// the fixed phase conversion used by point().
const std::uint64_t periodNumerator = static_cast<std::uint64_t>(wavelength)
* static_cast<std::uint64_t>(Q32);
const std::uint64_t startNumerator = (
static_cast<std::uint64_t>(FloorMod(minimumCoordinate, wavelength))
* static_cast<std::uint64_t>(Q32)
+ static_cast<std::uint64_t>(phaseTurnsQ32)
* static_cast<std::uint64_t>(wavelength)) % periodNumerator;
const std::uint64_t spanNumerator = static_cast<std::uint64_t>(
maximumCoordinate - minimumCoordinate) * static_cast<std::uint64_t>(Q32);
const auto includesExtremum = [&](std::uint64_t target)
{
const std::uint64_t forward = target >= startNumerator
? target - startNumerator : periodNumerator - startNumerator + target;
const std::uint64_t backward = periodNumerator - forward;
return forward <= spanNumerator + wavelength
|| backward <= wavelength;
};
if (includesExtremum(0)) range.maximum = Q30;
if (includesExtremum(periodNumerator / 2)) range.minimum = -Q30;
return range;
}
inline std::int64_t MulQ30(std::int64_t value, std::int64_t cosineQ30)
{ return (value * cosineQ30) / Q30; }
struct SurfaceProfileColumnBounds
{
std::int64_t groundMinimum = 0;
std::int64_t groundMaximum = 0;
std::int64_t capMinimum = 0;
std::int64_t capMaximum = 0;
};
inline SurfaceProfileColumnBounds ProfileColumnBounds(
const WorldAssemblySurfaceProfileV1& profile,
const WorldAssemblyStratumPlanV1& plan,
std::int64_t minimumX, std::int64_t minimumY,
std::int64_t maximumX, std::int64_t maximumY)
{
SurfaceProfileColumnBounds bounds;
if (profile.kind == WorldAssemblySurfaceProfileKindV1::flatField)
{
bounds.groundMinimum = profile.h0Subvoxels;
bounds.groundMaximum = profile.h0Subvoxels;
bounds.capMinimum = plan.capHeightSubvoxels;
bounds.capMaximum = plan.capHeightSubvoxels;
return bounds;
}
const CosineRangeQ30 x = SurfaceProfileCosineRangeQ30(minimumX, maximumX,
profile.wavelengthXSubvoxels, profile.phaseXTurnsQ32);
const CosineRangeQ30 y = SurfaceProfileCosineRangeQ30(minimumY, maximumY,
profile.wavelengthYSubvoxels, profile.phaseYTurnsQ32);
const std::int64_t groundXMinimum = MulQ30(profile.amplitudeXSubvoxels, x.minimum);
const std::int64_t groundXMaximum = MulQ30(profile.amplitudeXSubvoxels, x.maximum);
const std::int64_t groundYMinimum = MulQ30(profile.amplitudeYSubvoxels, y.minimum);
const std::int64_t groundYMaximum = MulQ30(profile.amplitudeYSubvoxels, y.maximum);
bounds.groundMinimum = profile.h0Subvoxels + groundXMinimum + groundYMinimum - 2;
bounds.groundMaximum = profile.h0Subvoxels + groundXMaximum + groundYMaximum + 2;
if (profile.kind == WorldAssemblySurfaceProfileKindV1::mirroredRelief)
{
const std::int64_t reliefMinimum = groundXMinimum + groundYMinimum;
const std::int64_t reliefMaximum = groundXMaximum + groundYMaximum;
bounds.capMinimum = plan.capHeightSubvoxels
- MulQ16(reliefMaximum, profile.mirrorLambdaQ16) - 2;
bounds.capMaximum = plan.capHeightSubvoxels
- MulQ16(reliefMinimum, profile.mirrorLambdaQ16) + 2;
}
else
{
bounds.capMinimum = plan.capHeightSubvoxels;
bounds.capMaximum = plan.capHeightSubvoxels;
}
return bounds;
}
struct HeightfieldColumnCacheEntry struct HeightfieldColumnCacheEntry
{ {
const WorldAssemblyRecipeV1* recipe = nullptr; const WorldAssemblyRecipeV1* recipe = nullptr;
@@ -1415,6 +1827,61 @@ namespace world_assembly_detail
HeightfieldPointSample out; HeightfieldPointSample out;
if(recipe.evaluatorVersion>=2) if(recipe.evaluatorVersion>=2)
{ {
if (recipe.surfaceProfile.version == 1)
{
const auto& profile = recipe.surfaceProfile;
std::int64_t relief = 0;
if (profile.kind != WorldAssemblySurfaceProfileKindV1::flatField)
{
const std::int64_t cosineX = CosineQ30(SurfaceProfileTurnAtCoordinate(
x, profile.wavelengthXSubvoxels, profile.phaseXTurnsQ32));
const std::int64_t cosineY = CosineQ30(SurfaceProfileTurnAtCoordinate(
y, profile.wavelengthYSubvoxels, profile.phaseYTurnsQ32));
relief = MulQ30(profile.amplitudeXSubvoxels, cosineX)
+ MulQ30(profile.amplitudeYSubvoxels, cosineY);
}
out.groundHeightSubvoxels = profile.h0Subvoxels + relief;
out.capHeightSubvoxels = profile.kind
== WorldAssemblySurfaceProfileKindV1::mirroredRelief
? plan.capHeightSubvoxels - MulQ16(relief, profile.mirrorLambdaQ16)
: plan.capHeightSubvoxels;
out.biomeId = recipe.biomes.front().stableId;
out.neighborBiomeId = out.biomeId;
out.biomeWeightQ16 = static_cast<std::uint32_t>(Q16);
const auto* list = ScopedWorldAssemblyFeatureQueriesV1::find(
&recipe, &plan, x, y, 0, true);
for (const auto& feature : FeatureRange{plan.features, list})
{
if (feature.type == 1)
{
const std::uint32_t fade = FeatureFadeQ16(feature, x, y,
feature.parametersSubvoxels[1]);
if (fade) out.groundHeightSubvoxels += MulQ16(
feature.parametersSubvoxels[0], fade);
}
else if (feature.type == 3)
{
const std::uint32_t fade = FeatureFadeQ16(feature, x, y,
feature.parametersSubvoxels[2]);
const std::int64_t wave = std::max<std::int64_t>(
1, feature.parametersSubvoxels[1]);
if (fade)
{
const std::uint32_t featureSeed = static_cast<std::uint32_t>(feature.stableId);
const std::int64_t nx = NoiseCoordinateQ16(x, wave)
+ SeedOffsetQ16(featureSeed, 1700);
const std::int64_t ny = NoiseCoordinateQ16(y, wave)
+ SeedOffsetQ16(featureSeed, 2900);
const std::int32_t noise = FractalNoiseQ16(nx, ny,
SeedOffsetQ16(featureSeed, 4100), 3);
out.capHeightSubvoxels += MulQ16(MulQ16(noise,
feature.parametersSubvoxels[0]), fade);
}
}
}
out.waterSurfaceSubvoxels = plan.waterSurfaceSubvoxels;
return out;
}
const BiomeSelectionV2 selection=SelectBiomeV2(recipe,x,y); const BiomeSelectionV2 selection=SelectBiomeV2(recipe,x,y);
const auto& primary=recipe.biomes[selection.primary]; const auto& primary=recipe.biomes[selection.primary];
const auto& neighbor=recipe.biomes[selection.neighbor]; const auto& neighbor=recipe.biomes[selection.neighbor];
@@ -1742,6 +2209,16 @@ std::optional<WorldAssemblyManifest> WorldAssemblyManifest::FromJson(
bool WorldAssemblyManifest::finalize(std::string& error) bool WorldAssemblyManifest::finalize(std::string& error)
{ {
ResolveWorldAssemblySurfaceProfilePhasesV1(recipe.surfaceProfile, recipe.seed);
for (auto& stratum : plan.strates)
{
WorldAssemblyRecipeV1& effectiveRecipe = stratum.hasRecipeOverride
? stratum.recipeOverride : recipe;
ResolveWorldAssemblySurfaceProfilePhasesV1(effectiveRecipe.surfaceProfile,
effectiveRecipe.seed);
ResolveWorldAssemblySurfaceProfilePhasesV1(stratum.surfaceProfile,
effectiveRecipe.seed);
}
if (schemaVersion != WorldAssemblySchemaVersion || plan.schemaVersion != WorldAssemblySchemaVersion if (schemaVersion != WorldAssemblySchemaVersion || plan.schemaVersion != WorldAssemblySchemaVersion
|| !world_assembly_detail::ValidateRecipe(recipe, error)) || !world_assembly_detail::ValidateRecipe(recipe, error))
{ if (error.empty()) error = "world assembly manifest or plan version is unsupported"; return false; } { if (error.empty()) error = "world assembly manifest or plan version is unsupported"; return false; }
@@ -1759,7 +2236,7 @@ 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, recipe.layoutChunkWidthSubvoxels, error)) return false; if (!world_assembly_detail::ValidateStratum(stratum, recipe, 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)
@@ -1882,6 +2359,9 @@ std::string WorldAssemblyManifest::ToJson() const
if (stratum.hasRecipeOverride) if (stratum.hasRecipeOverride)
out << ",\"recipe_override\":" out << ",\"recipe_override\":"
<< world_assembly_detail::RecipeJson(stratum.recipeOverride); << world_assembly_detail::RecipeJson(stratum.recipeOverride);
if (stratum.surfaceProfile.version != 0)
out << ",\"surface_profile\":"
<< world_assembly_detail::SurfaceProfileJson(stratum.surfaceProfile);
out out
<< ",\"content_hash\":\"" << world_assembly_detail::HashText(stratum.contentHash) << ",\"content_hash\":\"" << world_assembly_detail::HashText(stratum.contentHash)
<< "\",\"features\":["; << "\",\"features\":[";
@@ -1957,6 +2437,8 @@ bool Heightfield2D::isValid() const noexcept
|| recipe_->biomes.empty() || recipe_->biomes.size() > world_assembly_detail::MaxBiomeCount || recipe_->biomes.empty() || recipe_->biomes.size() > world_assembly_detail::MaxBiomeCount
|| recipe_->biomeCellSizeSubvoxels <= 0 || recipe_->biomeWarpWavelengthSubvoxels <= 0 || recipe_->biomeCellSizeSubvoxels <= 0 || recipe_->biomeWarpWavelengthSubvoxels <= 0
|| recipe_->biomeWarpSubvoxels < 0 || recipe_->biomeBorderBlendSubvoxels < 0 || recipe_->biomeWarpSubvoxels < 0 || recipe_->biomeBorderBlendSubvoxels < 0
|| recipe_->surfaceProfile != plan_->surfaceProfile
|| recipe_->surfaceProfile.version > 1
|| plan_->strateIndex < 0 || plan_->topChunkZ < plan_->bottomChunkZ || plan_->strateIndex < 0 || plan_->topChunkZ < plan_->bottomChunkZ
|| plan_->capWavelengthSubvoxels <= 0 || plan_->capUndulationSubvoxels < 0) || plan_->capWavelengthSubvoxels <= 0 || plan_->capUndulationSubvoxels < 0)
return false; return false;
@@ -1973,6 +2455,32 @@ bool Heightfield2D::isValid() const noexcept
std::array<std::int64_t,2> Heightfield2D::capHeightBounds() const noexcept std::array<std::int64_t,2> Heightfield2D::capHeightBounds() const noexcept
{ {
if(!isValid())return {0,0}; if(!isValid())return {0,0};
if (recipe_->surfaceProfile.version == 1)
{
const auto& profile = recipe_->surfaceProfile;
std::int64_t swing = 0;
if (profile.kind == WorldAssemblySurfaceProfileKindV1::mirroredRelief)
{
const std::int64_t relief = profile.amplitudeXSubvoxels
+ profile.amplitudeYSubvoxels;
swing = (relief * profile.mirrorLambdaQ16 + world_assembly_detail::Q16 - 1)
/ world_assembly_detail::Q16 + 2;
}
std::int64_t featureAmplitude = 0;
for (const auto& feature : plan_->features)
if (feature.type == 3)
featureAmplitude += std::abs(feature.parametersSubvoxels[0]);
std::int64_t minimum = plan_->capHeightSubvoxels - swing - featureAmplitude;
std::int64_t maximum = plan_->capHeightSubvoxels + swing + featureAmplitude;
if (recipe_->evaluatorVersion >= 5)
{
const std::int64_t upperBoundary = (static_cast<std::int64_t>(plan_->topChunkZ) + 1)
* recipe_->layoutChunkWidthSubvoxels;
minimum = std::min(minimum, upperBoundary);
maximum = std::min(maximum, upperBoundary);
}
return {minimum, maximum};
}
long double Minimum=std::numeric_limits<long double>::infinity(); long double Minimum=std::numeric_limits<long double>::infinity();
long double Maximum=-std::numeric_limits<long double>::infinity(); long double Maximum=-std::numeric_limits<long double>::infinity();
const auto IncludeBiome=[&](const WorldAssemblyBiomeProfileV1& Biome) const auto IncludeBiome=[&](const WorldAssemblyBiomeProfileV1& Biome)
@@ -2145,6 +2653,9 @@ void Heightfield2D::setThreadColumnCaptureBounds(std::int64_t minimumXSubvoxels,
void Heightfield2D::setThreadColumnCacheLegacyDirectMapped(bool enabled) noexcept void Heightfield2D::setThreadColumnCacheLegacyDirectMapped(bool enabled) noexcept
{ world_assembly_detail::HeightfieldColumnCacheLegacyDirectMapped=enabled; } { world_assembly_detail::HeightfieldColumnCacheLegacyDirectMapped=enabled; }
bool Heightfield2D::threadColumnCacheLegacyDirectMapped() noexcept
{ return world_assembly_detail::HeightfieldColumnCacheLegacyDirectMapped; }
void Heightfield2D::setThreadColumnOctaveDrop(std::uint32_t octaveDrop) noexcept void Heightfield2D::setThreadColumnOctaveDrop(std::uint32_t octaveDrop) noexcept
{ world_assembly_detail::HeightfieldColumnOctaveDrop=octaveDrop; } { world_assembly_detail::HeightfieldColumnOctaveDrop=octaveDrop; }
@@ -2178,6 +2689,15 @@ HeightfieldBoxClass Heightfield2D::classifyLatticeBox(std::int64_t minimumX,
&&feature.minimumSubvoxels[2]<=maximumZ&&feature.maximumSubvoxels[2]>=minimumZ) &&feature.minimumSubvoxels[2]<=maximumZ&&feature.maximumSubvoxels[2]>=minimumZ)
return HeightfieldBoxClass::mixed; return HeightfieldBoxClass::mixed;
} }
if (recipe_->surfaceProfile.version == 1)
{
const FieldInterval proof = interval(minimumX, minimumY, minimumZ,
maximumX, maximumY, maximumZ);
if (!proof.known) return HeightfieldBoxClass::unknown;
if (proof.minimumDensitySubvoxels > 0) return HeightfieldBoxClass::allAir;
if (proof.maximumDensitySubvoxels < 0) return HeightfieldBoxClass::allSolid;
return HeightfieldBoxClass::mixed;
}
const std::int64_t stride=static_cast<std::int64_t>(stepVoxels) const std::int64_t stride=static_cast<std::int64_t>(stepVoxels)
*WorldAssemblySubvoxelsPerVoxel; *WorldAssemblySubvoxelsPerVoxel;
if((maximumX-minimumX)%stride!=0||(maximumY-minimumY)%stride!=0 if((maximumX-minimumX)%stride!=0||(maximumY-minimumY)%stride!=0
@@ -2220,7 +2740,29 @@ FieldInterval Heightfield2D::interval(std::int64_t minX, std::int64_t minY,
std::int64_t groundMax = std::numeric_limits<std::int64_t>::min(); std::int64_t groundMax = std::numeric_limits<std::int64_t>::min();
std::int64_t capMin=plan_->capHeightSubvoxels-plan_->capUndulationSubvoxels; std::int64_t capMin=plan_->capHeightSubvoxels-plan_->capUndulationSubvoxels;
std::int64_t capMax=plan_->capHeightSubvoxels+plan_->capUndulationSubvoxels; std::int64_t capMax=plan_->capHeightSubvoxels+plan_->capUndulationSubvoxels;
if(recipe_->evaluatorVersion>=2) if (recipe_->surfaceProfile.version == 1)
{
const auto profileBounds = world_assembly_detail::ProfileColumnBounds(
recipe_->surfaceProfile, *plan_, minX, minY, maxX, maxY);
groundMin = profileBounds.groundMinimum;
groundMax = profileBounds.groundMaximum;
capMin = profileBounds.capMinimum;
capMax = profileBounds.capMaximum;
std::int64_t groundFeatureMagnitude = 0;
std::int64_t capFeatureMagnitude = 0;
for (const auto& feature : plan_->features)
{
if (feature.type == 1)
groundFeatureMagnitude += std::abs(feature.parametersSubvoxels[0]);
if (feature.type == 3)
capFeatureMagnitude += std::abs(feature.parametersSubvoxels[0]);
}
groundMin -= groundFeatureMagnitude;
groundMax += groundFeatureMagnitude;
capMin -= capFeatureMagnitude;
capMax += capFeatureMagnitude;
}
else if(recipe_->evaluatorVersion>=2)
{ {
for(const auto& biome:recipe_->biomes) for(const auto& biome:recipe_->biomes)
{ {
@@ -2313,6 +2855,24 @@ FieldDetailEnvelope Heightfield2D::detailEnvelope() const noexcept
{ {
FieldDetailEnvelope out; FieldDetailEnvelope out;
if (!isValid()) return out; if (!isValid()) return out;
if (recipe_->surfaceProfile.version == 1)
{
const auto& profile = recipe_->surfaceProfile;
out.maximumAbsoluteDisplacementSubvoxels = profile.amplitudeXSubvoxels
+ profile.amplitudeYSubvoxels;
if (profile.kind == WorldAssemblySurfaceProfileKindV1::mirroredRelief)
out.maximumAbsoluteDisplacementSubvoxels +=
(out.maximumAbsoluteDisplacementSubvoxels * profile.mirrorLambdaQ16
+ world_assembly_detail::Q16 - 1) / world_assembly_detail::Q16;
for (const auto& feature : plan_->features)
if (feature.type == 1 || feature.type == 3)
out.maximumAbsoluteDisplacementSubvoxels +=
std::abs(feature.parametersSubvoxels[0]);
if (profile.kind != WorldAssemblySurfaceProfileKindV1::flatField)
out.minimumFeatureSizeSubvoxels = std::max<std::int64_t>(1,
std::min(profile.wavelengthXSubvoxels, profile.wavelengthYSubvoxels) / 2);
return out;
}
std::int64_t maximum = plan_->capUndulationSubvoxels*5/2 std::int64_t maximum = plan_->capUndulationSubvoxels*5/2
+plan_->capDetailAmplitudeSubvoxels*5/2+plan_->capRidgeAmplitudeSubvoxels; +plan_->capDetailAmplitudeSubvoxels*5/2+plan_->capRidgeAmplitudeSubvoxels;
std::int64_t minimumFeature = std::numeric_limits<std::int64_t>::max(); std::int64_t minimumFeature = std::numeric_limits<std::int64_t>::max();
@@ -2448,7 +3008,8 @@ WorldAssemblyBoundsAuditResult AuditHeightfieldBounds(const Heightfield2D& block
&result.capBoxes,false,"cap"); &result.capBoxes,false,"cap");
} }
bool hasCliffProfile=false; bool hasCliffProfile=false;
for(const auto& biome:recipe->biomes)hasCliffProfile|=biome.cliffStrengthQ16>0; if(recipe->surfaceProfile.version==0)
for(const auto& biome:recipe->biomes)hasCliffProfile|=biome.cliffStrengthQ16>0;
if(hasCliffProfile) if(hasCliffProfile)
{ {
const std::int64_t d=16*WorldAssemblySubvoxelsPerVoxel; const std::int64_t d=16*WorldAssemblySubvoxelsPerVoxel;
@@ -2488,7 +3049,8 @@ WorldAssemblyBoundsAuditResult AuditHeightfieldBounds(const Heightfield2D& block
// Controle negatif : cette plage unilaterale exclut un echantillon connu; l'audit doit rejeter cette borne mensongere. // Controle negatif : cette plage unilaterale exclut un echantillon connu; l'audit doit rejeter cette borne mensongere.
const FieldInterval deliberatelyWrong{true, controlPoint + 1, controlPoint + 2}; const FieldInterval deliberatelyWrong{true, controlPoint + 1, controlPoint + 2};
result.negativeControlDetected = !world_assembly_detail::InInterval(deliberatelyWrong, controlPoint); result.negativeControlDetected = !world_assembly_detail::InInterval(deliberatelyWrong, controlPoint);
const bool borderCoverage=recipe->biomes.size()<2||recipe->biomeBorderBlendSubvoxels==0 const bool borderCoverage=recipe->surfaceProfile.version!=0
||recipe->biomes.size()<2||recipe->biomeBorderBlendSubvoxels==0
||result.biomeBorderBoxes>0; ||result.biomeBorderBoxes>0;
const bool cliffCoverage=!hasCliffProfile||result.cliffBoxes>0; const bool cliffCoverage=!hasCliffProfile||result.cliffBoxes>0;
const bool exceptionCoverage=std::none_of(plan->features.begin(),plan->features.end(), const bool exceptionCoverage=std::none_of(plan->features.begin(),plan->features.end(),
+6
View File
@@ -83,6 +83,12 @@ Costs below are design estimates, not timings. Low means bounded analytic featur
A passage planner must produce a traversable route or pair a non-walkable visual passage with another guaranteed route. A narrow crack or drop cannot be assumed walkable because its centerline is air. A passage planner must produce a traversable route or pair a non-walkable visual passage with another guaranteed route. A narrow crack or drop cannot be assumed walkable because its centerline is air.
For a SurfaceWorld strate, the supported arrival-to-departure route follows the sampled terrain
ground and stays within the mouth placement bounds. The inter-strate departure passage owns the
descent from that ground mouth through rock and bedrock. Treating the bottom of a tall SurfaceWorld
strate as the route's departure height would ask the walk planner to cross open terrain air; it is
the wrong endpoint for the intra-strate route.
| Passage type | Planner output | Bound and likely cost | | Passage type | Planner output | Bound and likely cost |
|---|---|---| |---|---|---|
| SlopedTunnel | Straight-style path with switchbacks as needed, capsule clearance, supported floor, maximum grade and landing geometry. | Swept capsule bounds plus floor envelope; low–medium. | | SlopedTunnel | Straight-style path with switchbacks as needed, capsule clearance, supported floor, maximum grade and landing geometry. | Swept capsule bounds plus floor envelope; low–medium. |
@@ -0,0 +1,48 @@
Thank you, that was a strong first pass. Your scope warning about L76 was right and important. I need to correct my
brief: "about 75% of field time is the passage composer" was **wrong**.
- L76's term profiler covered only about 6.0M legacy samples for FI (5.6M for TN).
- L73 counts about 52M density calls per FI or TN whole view: 512 LOD0 tiles × 44,121, 448 LOD1 × 43,322, and so
on.
- The measured passage/support cost is about 6.5 of FI's ~40 field worker-seconds (~15%), not 75%. Roughly
30 worker-seconds of field time is not attributed to any term we've measured.
Your gain arithmetic for recommendation 1 inherited that error. Please redo it.
## Deeper pass (you now have more reasoning budget)
Examine **the whole generation chain**, end to end, for one cold whole view on the legacy FI/TN path. For each
stage, say what it does, how often it runs, what it costs per call (from code structure and the measured numbers),
and whether its work is necessary:
- world/plan resolution;
- tile key selection;
- `ClassifyBoxDetailed`;
- the dispatch into `AnalyticDensityAt` (and whatever runs for the ~46M calls the term profiler did not see);
- the composer;
- grid fill;
- MC;
- normals;
- skirts;
- ground/cap refinement;
- payload;
- Unreal publication.
The central question: **where do the unattributed ~30 worker-seconds most plausibly go?** For example:
- a different evaluation path the profiler doesn't instrument;
- per-call overhead outside the timed terms (dispatch, stratum lookup, virtual calls, allocation, cache misses);
- border/halo samples evaluated twice;
- normals sampling the field again;
- duplicated work between neighbouring tiles or LODs.
Give file:line for each. Then name the cheapest measurement that would confirm your top explanation, so the next
implementation round can verify it first.
Then **revise your ranked recommendations** in the light of the whole chain. Keep what still holds and drop what
doesn't. Add anything the chain review reveals.
Same rules as before:
- read-only;
- no edits anywhere, including temp files;
- web allowed;
- labels [CODE]/[MEASURED]/[PRIOR ART]/[INFERENCE].
- At most ~3,500 words.
- **Lead with the stage-by-stage cost map**, then the revised ranking.
@@ -0,0 +1,74 @@
Thank you for both earlier passes. Your rec #1 (localize passages) turned out to be right, and here is what we've
learned since. This is a focused third pass: **passage evaluation design.** Read and reason only; no edits
anywhere, including temp files. Web allowed. Labels as before.
## What we know now (all measured, ablations verified to remove the work)
- **Owner four-strate world, cold LOD0–2-ready at W12:** FI 2.27 s, TN 2.25 s. Passages off: FI 0.81 s,
TN 0.85 s. Boundary bands cost only 0.1–0.2 s. Passage composition costs **~1.4–1.6 s** of near readiness, and
it alone separates FI/TN from the ~1 s goal. SW 1.02 s and VS 1.13 s are close already.
- **Inside the passage phase** (sampled, L83): carve distance ~40%, wall relief ~21–24% (3D value noise, 3 octaves
at 43/29/19 voxels), support restoration/columns ~14%, mouth shaping ~4%, other ~11%. Top symbols:
`ApplyResolvedStratePassageCarves`, `VF_FieldCachedValueNoise`, `VisitNearestPassageSpatialNode`,
`PassagePotentialWithinNode`, the carve lambda.
- **Exact trims done** (L81–L85):
- a density-aware outer reach bound (carve = `max(source, -roughSDF/Q)`, reach = `-d·Q + 0.24 m`);
- an exact relief skip when it can't change the max;
- per-tile BVH node masks and contiguous ranges;
- heavy-tile splitting;
- heavy-first order.
Each gave 5–12%. Readiness is throughput-bound (workers 81–85% busy).
- **Two representation shortcuts failed:**
- L86: a lazy exact per-sample result cache. 24% hit rate, ~700 MB, +47% slower.
- L88: a tile-local 4-voxel trilinear cache of passage deltas, exact near the surface. Coarse-node
evaluations still paid full route cost, and carve-segment visits rose from 34.5M to 56.2M (FI), making it
+46% slower.
**Lesson:** each route evaluation is expensive in itself, and reorganising *where* we evaluate doesn't help
unless the evaluation gets cheaper.
- **Composer semantics that must keep their meaning:**
- the carve is `max(source, -roughSDF/Q)`;
- support restoration, applied after later overlapping bores;
- segment-local capsule clearance;
- mouth shaping and fades;
- the walkable tread floor;
- Catmull–Rom joins on short segments;
- wall/floor relief of ±0.21/0.20 m.
Reports: `Standalone/Research/WorldAssemblerM3/Linux81`–`Linux88/REPORT.md`; code in `ShapeWorldInternal.h`
(`ApplyResolvedStratePassageCarves` and its helpers).
## The owner's rules (unchanged)
- One seed gives the same world on every machine. Byte equality with older versions isn't required; a perf pass
may change the world slightly.
- Passages stay walkable arrival → departure (support, capsule, grade, ripple audits), and look natural.
- No visible quality regression.
- Target: **LOD0–2 ready in ~1 s** after cold arrival. The whole view is a bonus; continuous low-priority far
generation afterwards.
## Questions
1. **What makes one route evaluation expensive** (read the code path end to end)? Per sample: how many segments are
visited, what does each visit compute (closest point on a Catmull–Rom or linear segment, frames, radius
interpolation, relief noise, support capsule tests, later-bore checks)? Which parts are redundant per sample, per
segment, or per tile?
2. **Design a passage representation where per-sample cost is near-constant and small,** and the work is not merely
moved around. Candidates to evaluate (don't limit yourself):
- analytic primitives: polyline/capsule chains with precomputed per-segment frames and an arc-length table;
- relief defined in 2D (arc length, angle) with a cheap periodic or table noise;
- a precomputed narrow-band distance grid per passage, built once per world at a fixed resolution with
deterministic integer construction, plus its build cost;
- separating "is this sample within reach" (cheap) from "exact carve value" (expensive);
- vectorising across a z-run of samples sharing the same segment candidates.
For each: expected per-sample cost, build cost, memory, how exact (displacement vs today), determinism risk, and
effort.
3. **Rank by expected gain toward ~1 s,** with arithmetic from the numbers above. For the top choice, describe the
smallest prototype and the cheapest falsifier, so the implementer can prove it before building it fully.
## Output
At most ~3,000 words, **ranked recommendation first**, file:line evidence, labels [CODE]/[MEASURED]/[PRIOR ART]/
[INFERENCE].
@@ -0,0 +1,133 @@
# VoxelForge — design review: how do we get a cold whole view from ~2.5–4.6 s to ~1 s?
You're reviewing a voxel terrain generator's performance architecture. **Read and reason only.** Don't edit,
build, run tests, commit or stash. You may read any file in this repository and search the web.
We've spent about 15 rounds finding and fixing hot spots, and the gains are shrinking. We want fresh eyes on the
*approach*, not another micro-optimisation. Question our framing where it's wrong.
## The system (summary, so you don't have to rediscover it)
**VoxelForge** is a UE5 plugin for underground density-field terrain. Generation lives in a standalone C++
library, "Core" (`Standalone/Core/`), that Unreal calls through an adapter
(`Source/VoxelForge/Private/VoxelForgeCoreAdapter.cpp`).
- **The field.** Density is a *function*, not stored data: negative = solid. Core voxels are 25 cm. Tiles hold
32³ voxels.
- **Clipmap.** LOD0–8; each LOD doubles the voxel step. A "whole view" is about 2,250–2,850 tiles across all LODs
around one camera.
- **Meshing.** Marching cubes per tile (about 35³ samples per LOD0/1 tile with borders), plus normals and skirts.
- **The world is a vertical stack of "strates".** Each is ceiling → content → bedrock, with its own generator:
- SurfaceWorld (SW): heightfield, native path;
- FloatingIslands (FI), TunnelNetwork (TN) and VerticalShafts (VS): the "legacy compiled-analytic" path.
- **The owner's test world** stacks four of them: SW 512 m, FI 240 m, TN 128 m, VS 128 m tall.
- **Passages.** Walkable, winding, natural-looking tunnels near (0,0) connect each strate to the next. They're
carved by a shared "composer" that also adds support treads, boundary bands and mouth shaping.
- **Multiplayer.** No geometry is replicated. Every peer regenerates from the seed, the layout and a diff of
player edits. That's why peer determinism is mandatory.
## The goal and constraints
- **Goal:** about 1 s cold whole view at any strate arrival on the owner's PC (Ryzen 5800X3D, 8 cores/16 threads,
7900 XTX). Streaming must stay smooth in VR (Quest 3) and at high travel speed.
- **Must hold:**
- peer determinism (same inputs → same world on every machine);
- no visible quality regression;
- passages stay walkable from arrival mouth to departure mouth (capsule, support and grade audits exist);
- no game-thread hitches.
- **Not required:** byte-identical output with earlier versions. The owner accepts that perf passes change the
world's shape slightly, as long as every peer gets the same result and quality holds. (We have tended to treat
hash equality as a gate anyway; it's a convenience, not a rule.)
- **On the shelf, not a speed excuse:** a disk mesh cache is an accepted feature, but perf is judged cold.
## Measurements (owner world, measured on an i9-12900H with 8 workers, headless unless stated)
**Whole view now** (it was 2.6 / 7.2 / 6.0 / 2.7 s a week ago):
| Strate | Whole view |
|---|---:|
| SW | 2.4 s |
| FI | 4.6 s |
| TN | 4.3 s |
| VS | 2.5 s |
**In Unreal (SW arrival):**
- Core work equals headless;
- initial set ready at 3.74 s vs headless 2.41 s, the extra being scheduling;
- walkable ring 0.4–1.8 s.
**Where the time goes:**
- **L73:** field evaluation inside grid fill is about 40 of FI's 46 worker-seconds (TN 33 of 39). LOD0/1 tiles
evaluate about 44k density samples each.
- **L74/L75:** sound whole-tile skip proofs now certify about 22–26% of tile visits.
- Ceiling: 46–82% of LOD0–2 tiles are truly uniform, and 90–97% of samples lie in uniform 8³ blocks.
- Dominant remaining veto: tiles crossing a strate boundary.
- Legacy sub-tile (block) proofs were unsound once (missed passage wall/floor relief), then sound but slower
than they saved.
- **L76, per legacy sample:**
- passage/support composer ≈ **1.05 µs**;
- primitive scan ≈ 0.19 µs (0.25 primitive distance evaluations per sample, binned);
- boundary band ≈ 0.06 µs;
- noise ≈ 0.01 µs.
**About 75% of field time is the passage composer, even far from passages.**
- Per-tile passage culling was tried and changed 612 density samples / 24 mesh tiles. It was rejected only for
breaking hash equality, which is a convenience, not a rule; nobody checked whether that change was harmless.
**Tried and rejected:**
- the native FI generator (fails passage walk audits on this plan);
- deeper Unreal queues (done: 4.78 → 3.74 s).
**Trap we fell into once:** a diagnostic hash mode silently disabled the skips and doubled the timings. Measure the
production path.
## What to reason about (open; don't limit yourself to these)
1. **Is "evaluate a density function at ~44k points per tile, then march cubes" the right shape** for this world?
Consider, for example:
- sparse/hierarchical evaluation (octree or brick refinement driven by interval or Lipschitz bounds, as in
libfive/Fidget/MPR-style implicit rendering);
- reusing samples across nested clipmap LODs;
- evaluating smooth large-scale terms coarsely and interpolating;
- narrow-band evaluation near the surface only.
2. **The passages are a few winding tubes.** Why does every sample pay 1 µs for them? What representation would
make "far from any passage" free and "near a passage" cheap? For example:
- bake each passage once at plan time into a sparse distance/brick structure;
- a spatial index of segments with a conservative distance early-out;
- a per-tile passage candidate list built once.
What would a correct per-tile culling need so that it doesn't change the result? And if it changes the result,
how should we judge whether that change is acceptable?
3. **Which work is needed for "ready in 1 s"?** Maybe the target should be redefined: walkable ring first,
progressive LOD refinement, far LODs from cheaper representations or impostors, fewer tiles. What do comparable
engines do (Voxel Plugin, Teardown, Dreams, No Man's Sky, Minecraft-style streaming, Nanite-era voxel work)?
4. **Hardware.** 8 CPU cores plus a 7900 XTX that's mostly idle during load. An earlier GPU port was closed, and
determinism across GPU vendors is a concern. Is there a deterministic way to use it, e.g. integer/fixed-point
evaluation or a CPU-authoritative plus GPU-display split? Is SIMD (AVX2) evaluation of the legacy field
realistic?
5. **Anything in our process or measurement** that hides the real bottleneck.
## How to work efficiently
- **Trust the numbers above; don't re-measure or re-derive them.** Spend your effort on thinking.
- **Read code only to check whether a specific idea fits.** Entry points:
- `CODEMAP.md` (navigation) and `ARCHITECTURE.md` §8.10 (performance invariants);
- `Standalone/Core/src/ShapeWorldInternal.h`: composer, `AnalyticDensityAt`, `ClassifyBoxDetailed`, passage
terms;
- `Standalone/Core/src/VoxelForgeCore.cpp`: tile generation and skips;
- reports in `Standalone/Research/WorldAssemblerM3/`: `Linux73`–`Linux76`, `Research36`, and R38–R40 notes
inside `Linux73/` and `Linux76/`.
- **Use the web** for prior art and techniques, and cite them.
- **Go broad first** (many approaches, one or two lines each), then deep on the best three.
## Output
At most ~2,500 words, plain language, **ranked recommendations first**. For each of the top three:
- what changes, and where in this codebase (file and function);
- expected gain, with arithmetic from the numbers above;
- what it risks: determinism, quality, walkability;
- effort;
- **a cheap experiment that would prove it wrong** before anyone builds it fully.
Then the shorter list of other ideas, then any questions only the owner can answer (e.g. what "ready" must mean).
Mark claims as [CODE] (read in this repo), [MEASURED] (from the numbers above), [PRIOR ART] (cited) or
[INFERENCE].
@@ -0,0 +1,130 @@
# Astra 1, pass 2 — whole-chain review (gpt-6-astra, effort medium, read-only), 2026-10-27
Claude verified: PackedDensityAt (ShapeWorldInternal.h ~5909) applies ApplyResolvedStrateComposition outside the L76 term scope; FScopedDensityQueryProfile times whole invocations crossing a 256-point boundary (batch-biased).
**Stage-by-stage cost map**
[MEASURED] The L73 stage timings below are historical, before the later skips. They describe where that run spent time; they cannot be subtracted from L76 term timings to produce a current residual. I also inspected the saved L76 results without executing generation.
[CODE] A major architectural detail: the “compiled-analytic” world **already contains precomputed packed signs and quantized surface-distance proxies**. Many lattice queries never enter `AnalyticDensityAt`.
| Stage | Work and frequency | Cost and necessity |
|---|---|---|
| **World/plan resolution** | [CODE] Headless loads the owner export, resolves/validates its layout, constructs a snapshot, then constructs `World`. Once per cold run. UE’s serialization entry is [`VoxelForgeCoreAdapter.cpp:2062`](/home/jahni/VoxelM/Plugins/VoxelForge/Source/VoxelForge/Private/VoxelForgeCoreAdapter.cpp:2062); headless startup begins at [`StreamBenchmarkHeadless.cpp:1659`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Source/StreamBenchmarkHeadless.cpp:1659). | [MEASURED] Saved L76 FI owner-data loading takes about **25 ms**. No complete isolated resolution cost is supplied. [INFERENCE] Necessary, but not a plausible home for worker time measured inside tile-field queries. |
| **Shape compilation** | [CODE] `World::compile` builds primitives/bins, packed rock intervals, candidate bands, detailed distance proxies, sign-edge repairs, passage validation and far parents. Once for the base shape; additional pages when needed. [`VoxelForgeCore.cpp:1394`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/VoxelForgeCore.cpp:1394), [`ShapeWorldInternal.h:2724`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/ShapeWorldInternal.h:2724). | [MEASURED] Saved L76 FI: **313 ms wall**, including approximately 48 ms shapes, 64 ms intervals/signs, 62 ms surface band and 119 ms far parents. [INFERENCE] Important to a one-second cold budget, but separate from the missing tile-field attribution. It already amortizes substantial base-field work. |
| **Tile-key selection** | [CODE] `desiredTiles` builds clipmap keys, vertical bounds and additional far surface columns. Once initially, then on streaming-set changes; about 2,250 tiles for FI/TN. [`VoxelForgeCore.cpp:1904`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/VoxelForgeCore.cpp:1904). | [INFERENCE] Thousands of key/set operations, not millions of field evaluations. No measured isolated cost. Necessary selection; exact tile count remains a design choice. |
| **Whole-tile classification** | [CODE] Each assembly tile calls `ClassifyBoxDetailed`, including a one-step halo. It delegates to `ClassifyBoundsDetailed`, with conditional slicing and conservative vetoes. [`VoxelForgeCore.cpp:2377`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/VoxelForgeCore.cpp:2377), [`ShapeWorldInternal.h:6385`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/ShapeWorldInternal.h:6385). | [MEASURED] L73: only **4/3 ms total FI/TN**, roughly **2/1 μs per tile**, but ineffective legacy skips then. These are not current classifier costs. [INFERENCE] Necessary only when avoided work pays for it; retain current profitable proofs. |
| **Density dispatch and base evaluation** | [CODE] Scalar lattice queries probe native/legacy-surface paths, then choose packed lookup or analytic evaluation. Batches have additional fast paths. [`ShapeWorldInternal.h:3475`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/ShapeWorldInternal.h:3475), [`:3602`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/ShapeWorldInternal.h:3602), [`:5909`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/ShapeWorldInternal.h:5909). | [MEASURED] L73’s approximately 52M calls and 39.9/33.2 field worker-seconds imply roughly **0.77/0.64 μs per counted point**, averaged over heterogeneous paths. [INFERENCE] Fetching/evaluating the base value is necessary; repeated dispatch is not inherently necessary. |
| **Composer** | [CODE] Packed and scalar analytic paths both call `ApplyResolvedStrateComposition`: cavern graph → boundary → passage/support → stamps → compatibility floor caps. [`ShapeWorldInternal.h:1993`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/ShapeWorldInternal.h:1993). Frequency depends on the actual route, not just the strate label. | [MEASURED] L76 measures approximately **6.5/5.5 worker-seconds** only within its eligible analytic scopes. [CODE] Its passage/support bucket also includes `ApplyResolvedCavernFloorCaps` at [`:2053`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/ShapeWorldInternal.h:2053). [INFERENCE] Composition is necessary where influential; universal invocation is not. |
| **Grid fill** | [CODE] One cached lattice per generated tile: typically **35³ = 42,875** points at LOD0/1, including halo. Scalar, X8 or Z-run traversal fills it. Storage is thread-local and reused. [`Standalone mesher:430`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Source/VoxelForge/Private/VoxelMarchingCubesMesher.cpp:430), [`:957`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Source/VoxelForge/Private/VoxelMarchingCubesMesher.cpp:957), [`:1296`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Source/VoxelForge/Private/VoxelMarchingCubesMesher.cpp:1296). | [MEASURED] L73: **36.14/29.37 s**, approximately **16.1/13.2 ms per visited tile**, including evaluation. [INFERENCE] Dense fill is avoidable in proven-uniform regions. This is the primary workload, not merely array writes. |
| **Marching cubes** | [CODE] Classifies cells using cached corners, computes geometry only for surface cells, interpolates edges and deduplicates vertices. LOD0 midpoint correction can issue extra unclamped queries. [`Mesher:1879`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Source/VoxelForge/Private/VoxelMarchingCubesMesher.cpp:1879), [`:1943`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Source/VoxelForge/Private/VoxelMarchingCubesMesher.cpp:1943). | [MEASURED] L73 MC aggregate: **40.58/32.63 s**, including grid work. Subtracting grid gives about **4.44/3.26 s**, not another 40 seconds. [INFERENCE] Necessary extraction, but replacing MC is not the first lever. |
| **Normals** | [CODE] Central differences normally read the existing grid. At Step 1, proxy-band fallback values trigger `DensityAtUnclamped`; optional gradient memoization avoids repeated corner gradients. [`Mesher:1654`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Source/VoxelForge/Private/VoxelMarchingCubesMesher.cpp:1654). | [MEASURED] L73: **0.306/0.246 s**, about **0.14/0.11 ms per visited tile**. [INFERENCE] Some repeated field queries exist, but six new field evaluations per vertex is not the general path. Normals cannot plausibly explain 30 seconds under these measurements. |
| **Skirts** | [CODE] Boundary-edge detection, extrusion and density probes prevent unsuitable skirt geometry. Work scales with boundary geometry, not tile volume. [`Mesher:2111`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Source/VoxelForge/Private/VoxelMarchingCubesMesher.cpp:2111). | [MEASURED] L73: **1.079/1.091 s**, approximately **0.48/0.49 ms per visited tile**. [INFERENCE] Necessary for the current seam solution; bounded opportunity, not the missing dominant cost. |
| **Ground/cap refinement and far shells** | [CODE] Far stratum/connector repairs and native ground/cap refinement run under eligibility gates, with refinement at LOD≥4 and no overlapping edits. [`VoxelForgeCore.cpp:2792`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/VoxelForgeCore.cpp:2792), [`:2875`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/VoxelForgeCore.cpp:2875). | [MEASURED] L73’s combined “Other,” including these and assembly, is **2.86/2.78 s**. [INFERENCE] Required by the current far representation, but partly corrective work that a better far representation could avoid. Not an explanation for missing grid time. |
| **Payload** | [CODE] Core assembles material/vertex/index outputs; the headless wrapper converts vertices and moves indices/masks. Per output vertex/index, once per tile. [`VoxelForgeCore.cpp:2969`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/VoxelForgeCore.cpp:2969), [`StreamingWorld.h:934`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Source/StreamingWorld.h:934). | [MEASURED] The separately timed headless conversion is **12 ms total**, about **5 μs per tile**. [INFERENCE] This does not include all Core assembly or Unreal upload/collision costs. It is not a useful primary target. |
| **Unreal publication** | [CODE] Worker generation → prepared streams → result queue → budgeted game-thread component/upload/section work → asynchronous collision completion. [`VoxelWorld.cpp:13303`](/home/jahni/VoxelM/Plugins/VoxelForge/Source/VoxelForge/Private/VoxelWorld.cpp:13303), [`:9400`](/home/jahni/VoxelM/Plugins/VoxelForge/Source/VoxelForge/Private/VoxelWorld.cpp:9400), [`:14010`](/home/jahni/VoxelM/Plugins/VoxelForge/Source/VoxelForge/Private/VoxelWorld.cpp:14010), [`:14279`](/home/jahni/VoxelM/Plugins/VoxelForge/Source/VoxelForge/Private/VoxelWorld.cpp:14279). | [MEASURED] SW has **1.33 s additional readiness latency**. [INFERENCE] That is not 1.33 s of CPU publication work. Per-tile apply/cook costs are not established here. Essential to the target, but cannot explain headless field time. |
**Where the “unattributed 30 seconds” most plausibly went**
[CODE] **First: packed-field composition is outside L76’s measurement scope.** The relevant chain is:
`DensityAtLattice` → `PackedDensityAt` → `ApplyResolvedStrateComposition`.
`PackedDensityAt` reads `RockWords`, `CandidateWords` and possibly `SurfaceDistanceQ`, then applies composition. It never enters the `FScopedLegacyFieldTermScope` created later inside `AnalyticDensityAt` at [`ShapeWorldInternal.h:5967`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/ShapeWorldInternal.h:5967).
[CODE] Term timers immediately return when that scope is inactive: [`ShapeWorldInternal.h:2275`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/ShapeWorldInternal.h:2275). Thus an expensive passage query can be counted by the outer field profiler but entirely absent from L76’s passage timing.
[CODE] `DensityDispatchPathAt` returns “compiled-analytic/FloatingIslands” from the bound generator kind without distinguishing packed from analytic execution: [`ShapeWorldInternal.h:3455`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/ShapeWorldInternal.h:3455). That label is insufficient for performance attribution.
[CODE] There are further differences:
- X8 can return packed proxy values directly without invoking the scalar composer; other conditions make it fall back to scalar calls. [`ShapeWorldInternal.h:3675`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/ShapeWorldInternal.h:3675)
- FI LOD0 preferentially uses scalar vertical traversal. [`Mesher:1288`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Source/VoxelForge/Private/VoxelMarchingCubesMesher.cpp:1288)
- Z-run dispatch can fall back to scalar lattice queries, including packed queries. Its analytic term scope is reached only after those fallbacks. [`ShapeWorldInternal.h:11460`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/ShapeWorldInternal.h:11460)
- Native/surface branches and non-FI/TN samples are excluded from the legacy-term population.
[INFERENCE] Therefore, the correction establishes that **6.5 seconds is measured passage cost within one subset**, not that total passage cost is only 15%. Packed composition is my leading explanation for substantial uninstrumented work. I cannot assign it 30 seconds from source alone.
[MEASURED] **Second: the residual mixes different generations of the workload.** Existing [L76 saved results](/home/jahni/VoxelM/Plugins/VoxelForge/Saved/Linux/l76/term-profile-before/summary.json) contain:
| Same saved L76 run | FI | TN |
|---|---:|---:|
| Density point calls | 26.99M | 25.13M |
| Eligible legacy points | 6.01M | 5.56M |
| Reported field estimate | 18.19 worker-s | 15.49 worker-s |
| Tile-worker total | 33.80 worker-s | 28.56 worker-s |
| Whole-view wall | 4.621 s | 3.977 s |
[INFERENCE] The approximately 46M unseen calls belong to subtracting L76’s eligible count from L73’s pre-skip population. They are not an established current population. Likewise, `40−measured_terms` is not a coherent current residual.
[CODE] **Third: the aggregate field estimator can be biased by batching.** `FScopedDensityQueryProfile` samples when the point sequence crosses a multiple of 256, timing the entire invocation and recording its point count. The reducer pools sampled time/points and scales by all points. See [`ShapeWorldInternal.h:2355`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/ShapeWorldInternal.h:2355) and [`StreamBenchmarkPipeline.h:5611`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Source/StreamBenchmarkPipeline.h:5611).
[INFERENCE] A batch of eight has approximately eight times a scalar invocation’s chance of being selected, and contributes eight sampled points when selected. Pooling both without inclusion-probability correction overrepresents batch points. If packed batches are cheap and scalar composition is expensive, the estimate can substantially understate field time. Periodic sampling also risks correlation with spatial traversal.
[MEASURED] This deserves attention: L76 FI LOD0 records **12.70 s grid fill but only 5.96 s estimated field evaluation**. Conversely, LOD3 estimates **3.04 s field time against 2.58 s total tile-worker time**. Those are diagnostic inconsistencies, not proof of where the discrepancy lies. [Saved log](/home/jahni/VoxelM/Plugins/VoxelForge/Saved/Linux/l76/term-profile-before/strate1-w8.log:12880)
[INFERENCE] **Lower-ranked explanations:**
- **Dispatch/lookups:** real repeated work. Stratum lookup uses binary search and coordinate conversion, sometimes repeatedly per sample: [`ShapeWorldInternal.h:437`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/ShapeWorldInternal.h:437). But attributing 30 seconds to this alone means roughly **0.65 μs per purported 46M calls**. That needs evidence; hidden composer execution is more concrete.
- **Allocation/cache misses:** possible contributors, but grid allocation is reused and packed access is direct indexing. There is no evidence of one heap allocation per ordinary density point.
- **Halos/neighbor duplication:** significant but bounded. `35³−33³ = 6,938`, or **16.2%** of a dense tile’s samples, is the gradient halo. Including shared faces, an ideal large same-LOD region could reduce `35³` toward `32³` unique samples per tile: approximately **23.6%** savings before edges and synchronization. This multiplies existing evaluation cost; it does not create a separate unmeasured stage.
- **Normals/midpoints/skirts:** issue additional calls, but their measured stage budgets exclude them as the dominant explanation. Cross-LOD duplication remains unquantified.
**Cheapest decisive measurement**
[INFERENCE] First take a sampling call-stack profile of the clean production run, focused on grid fill. It requires no new per-sample timers and should immediately distinguish packed composition from dispatch or memory stalls.
[INFERENCE] The next instrumentation change should be a **mutually exclusive dispatch census**, not another individual-term profiler. Count and sample time for packed-scalar, packed-X8, analytic-scalar, analytic-batch, native and legacy-surface routes, split by LOD and caller stage. Measure composition inside packed-scalar explicitly.
Use equal-probability invocation sampling with correct expansion, or stratify by route **and batch length**. Avoid nested double-counting; compare the resulting total against directly timed grid fill. Separate passage carving from compatibility floor caps.
[INFERENCE] This falsifies my leading explanation if packed-scalar composition occupies little time. Only then prioritize dispatch, cache misses or other overhead.
**Revised ranked recommendations**
**1. Establish complete attribution, then specialize the dominant lattice route.**
[INFERENCE] This replaces my unconditional “passages first” ranking. The first implementation round should produce a closed cost account and identify which route dominates LOD0/1.
If packed composition dominates, give each tile/brick a stable local composition program and an identity fast path. Extend `FScopedPassageTileQueries`, `PackedDensityAt` and `ApplyResolvedStrateComposition`. Hoist Z-only dispatch decisions into plane/run contexts. Before copying the X8 shortcut into scalar traversal, establish why their composition behavior differs and which semantics are required.
[INFERENCE] Effort: small for attribution, medium for specialization. Risks: incorrect support envelopes, changed composition order, scalar/batch disagreement. Preserve peer determinism and audit clearance, support and grade; old-version hashes remain an exactness diagnostic.
[MEASURED → INFERENCE] **Corrected passage arithmetic:** using your historical budget strictly as an illustration:
- FI, removing 80–90% of **6.5/46** worker-seconds: `4.6 × (1−0.8…0.9 × 6.5/46)` = **4.08–4.02 s**.
- TN, removing 80–90% of **5.5/39**: approximately **3.81–3.75 s**.
These replace my erroneous approximately two-second estimates. They are not forecasts because the operands span rounds. Using the contemporaneous saved L76 totals instead gives approximately **3.91–3.83 s FI**, **3.37–3.29 s TN**, under proportional scaling.
[INFERENCE] Total passage savings could be larger if the missing packed-route work is substantial. Measure it before assigning a percentage.
**2. Remove repeated composed sampling; retain MC.**
[INFERENCE] Keep the retained-proof/local-program recommendation, but build on the existing packed representation. Priorities:
- Retain successful slice/brick proofs rather than requiring a uniform whole-tile verdict.
- Reuse final composed lattice samples across neighboring tiles where inputs and semantics match.
- Evaluate exact surface endpoints and normal stencils; leave certified interiors implicit.
The relevant changes remain `ClassifyBoundsDetailed`, `World::generateTile` and the standalone mesher’s grid fill. Sample-cache keys must include evaluator version, edits and relevant resolution/context—not coordinates alone.
[INFERENCE] An alternative worth testing is applying composition once to a shared near-region lattice. Count its cold construction cost: moving the same work earlier is not a speedup. It wins through deduplication, localization or cheaper batching.
[INFERENCE] Effort: medium-to-large. Risks: stale edit dependencies, seams and false uniform proofs. Cheap falsifier: one representative region spanning adjacent tiles and a strate boundary; compare total construction plus meshing cost against independent tiles.
[INFERENCE] Withdraw the earlier combined one-second projection. At unchanged throughput, FI’s current 4.6 seconds requires approximately **78% critical-path reduction**. Border sharing alone cannot supply that; broad sampling elimination still has to prove its economics.
**3. Preserve a separate arrival deadline and reduce end-to-end latency.**
[INFERENCE] Keep dependency-aware scheduling through collision publication, rather than merely increasing queue depth. The existing near-priority and hot-swap mechanisms already provide the foundation.
Shape compilation’s approximately 0.31 seconds matters once generation approaches one second. Far repair/refinement becomes material too. Optimize these after the dominant grid route is understood; do not hide their cost outside the cold timer.
[MEASURED → INFERENCE] SW’s scheduling gap remains a possible **0–1.33-second** latency opportunity, not a guaranteed CPU saving. Scheduling cannot remove required whole-view work.
[INFERENCE] Effort: medium. Risks: starving far coverage or publishing visuals before safe collision. Cheap falsifier: an arrival-only admission experiment plus prerequisite/publication tracing. If its uncontended critical path exceeds one second, scheduling alone cannot meet arrival readiness.
[INFERENCE] GPU porting, SIMD, native-generator replacement and a new mesher stay below these three. The newly visible distinction is between **cheap cached base density and potentially expensive repeated composition**, not simply “52M analytic evaluations.”
Read-only inspection completed; no edits, builds, tests, commits or stashes.
@@ -0,0 +1,161 @@
# Astra 1, pass 3 — passage evaluation design (gpt-6-astra, medium, read-only), 2026-10-28
**[INFERENCE] Ranked recommendation: replace recursive route queries with a compiled spatial passage evaluator—not another cache of evaluated densities.**
1. **Compile short lists of prepared carve, tread and clearance primitives into spatial bricks.** Evaluate those lists directly, retaining ordered support restoration and explicit mouth exceptions.
2. **Add a compact relief representation**, preferably sampled from today’s relief on the passage surface. Treat this as part of recommendation 1’s performance budget, not a sufficient standalone fix.
3. **Consider a sparse distance grid only if built directly from prepared primitives**, without calling today’s composer at every grid node. Its cold construction cost makes it a less attractive first prototype.
[MEASURED → INFERENCE] The target requires a substantial replacement:
\[
T_{\text{FI}}\approx0.81+1.46r+B,\qquad
T_{\text{TN}}\approx0.85+1.40r+B
\]
Here \(r\) is the fraction of passage cost remaining and \(B\) is added cold critical-path construction time. This is an ablation-based planning model, not a guaranteed linear prediction.
| Passage cost remaining | FI, before added construction | TN |
|---|---:|---:|
| 30% | 1.25 s | 1.27 s |
| 15% | 1.03 s | 1.06 s |
| 10% | 0.96 s | 0.99 s |
| 5% | 0.88 s | 0.92 s |
[INFERENCE] **Tenfold passage acceleration barely reaches one second before construction.** With 30 ms additional construction, TN needs approximately **11.7×**. Another 5–12% trim cannot close this gap.
**What one evaluation actually does**
[CODE] The entry point is [`ApplyResolvedStratePassageCarves:1115`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/ShapeWorldInternal.h:1115). Its cost is a sequence of different geometric questions:
1. **Reach screening.** Check tile flags, incoming density, passage Z range and floor-profile ranges. Solid samples can invoke `PassageMayAffectDensity` before entering the main passage loop. Inside that loop, another reach test may occur.
2. **Column/support preparation.** Scan eligible void crossings and possibly evaluate column distance.
3. **Nearest carve feature.** Search four ranges: descending body, upper endpoint, lower-mouth neighborhood and departure tail.
4. **Relief and mouth shaping.** Compute wall orientation, route-relative distances, entrance projection, relief and fades.
5. **Tread selection.** Find the floor-owning segment separately from the nearest carve segment; evaluate up to three neighboring support segments.
6. **Clearance and composition.** Check the passage’s player capsules, later bores and other passages’ capsules; apply, cancel or defer support. Finally restore mouth support and deferred support.
[CODE] **A carve segment visit is not an iterative closest-point solve on Catmull–Rom.** It computes endpoint differences, squared length, a clamped projection onto the straight chord, then optionally evaluates a Catmull–Rom position at that same parameter. Radius remains interpolated from the endpoints. Distance requires a deterministic square root, followed by stable tie-breaking. [`ShapeWorldInternal.h:1497`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/ShapeWorldInternal.h:1497)
[INFERENCE] Consequently, replacing this with a mathematically accurate spline-distance solver would likely increase cost and change the field. Compiling the existing formula—or approximating it deliberately—is the appropriate comparison.
[CODE] **Traversal itself is substantial.** Each nearest-node bound computes distance to an AABB using a square root, subtracts maximum radius, checks range membership and visits children. Potential-within queries perform a separate recursive search. Tile masks and contiguous ranges already remove some overhead; they do not eliminate per-sample traversal. [`:5590`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/ShapeWorldInternal.h:5590), [`:5676`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/ShapeWorldInternal.h:5676)
[MEASURED → INFERENCE] L88’s approximately 34.5M/33.1M carve visits divided by approximately 14.06M/12.43M passage iterations gives about **2.45/2.66 carve visits per iteration**, assuming those census populations align. This is not visits per density query or per successful route evaluation: iterations include rejected passages, and the visit count excludes internal BVH nodes and separate capsule searches. **The problem is not necessarily hundreds of evaluated segments; it is expensive repeated search around relatively few winners.**
[CODE] **Support is a different geometry query.** It uses horizontal projection, extended tread segments, distinct smoothing rules, native-density-dependent mouth offsets and floor-depth gates. Its floor-profile search deliberately avoids choosing a neighboring helix coil merely because that coil supplies the nearest wall. [`:1833`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/ShapeWorldInternal.h:1833), [`:2127`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/ShapeWorldInternal.h:2127)
[CODE] Capsule checks project horizontally and test a vertical capsule with 0.34 m radius and 0.54 m axial half-length. Later-bore checks already have precomputed overlap candidates, but can fall back to BVH searches. Deferred support is restored after the passage loop. [`:5708`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/ShapeWorldInternal.h:5708), [`:5810`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/ShapeWorldInternal.h:5810), [`:2163`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/ShapeWorldInternal.h:2163)
[CODE] **Relief still costs work on cache hits.** Each of three octaves computes lattice coordinates, a cache hash, fades and seven interpolations. A miss additionally generates eight corner values. The cache has 64 direct-mapped entries. Wall relief uses wavelengths 43/29/19 and weights 0.50/0.35/0.15. [`VoxelForgeFieldShared.h:260`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/VoxelForgeFieldShared.h:260), [`:394`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/VoxelForgeFieldShared.h:394)
[CODE] Mouth work additionally evaluates noise at projected route positions. Some calculations happen before determining whether the sample belongs to the mouth’s small affected region. [`ShapeWorldInternal.h:1683`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/ShapeWorldInternal.h:1683)
[INFERENCE] The reusable information is:
- **Per segment:** chord vectors, inverse squared lengths, lengths, radius slopes, cubic coefficients, support flags, overlap extension and prefix/suffix arc lengths.
- **Per spatial brick:** possible carve winners, floor owners, clearance capsules, column features and ordered passage dependencies.
- **Per sample:** projections, distances, source-dependent support blending and final min/max operations.
- **Across a Z-run:** candidate lists and XY projections; not generally the winning segment or final support decision.
[CODE] `BuildPassageComposerConstants` currently prepares passage-level metadata, not this complete segment representation. [`:5147`](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/ShapeWorldInternal.h:5147)
**1. Compile a spatial passage program**
[INFERENCE] Build immutable sparse bricks containing contiguous references to prepared features. Use separate lists for **carve, tread, clearance and mouth/column operations**. A single nearest-segment identifier cannot represent their different ownership rules.
For each brick:
- Eliminate segments that cannot win its carve query, using conservative lower/upper distance bounds.
- Retain every potentially relevant overlapping coil.
- Store floor candidates independently.
- Store later-bore and other-capsule dependencies in stable passage order.
- Subdivide crowded bricks or use an explicit slow fallback; never silently cap candidates.
[INFERENCE] The common query becomes one brick lookup, typically a few direct projections/distances, one relief lookup and a small ordered composition sequence. No reach-BVH traversal followed by nearest-BVH traversal followed by clearance-BVH traversal.
**Important limitation:** “two to four candidates” is a design target to falsify, not something the current route guarantees. Nearby coils and short, densely authored segments may produce much larger lists.
[INFERENCE] Prepare the existing chord/Catmull formulas first. This avoids multiplying segment count through premature tessellation. Subsequently merge or approximate pieces only where a measured error budget permits. Precomputed coefficients and reciprocals may change floating-point rounding; version the evaluator and enforce the same arithmetic across peers.
[PRIOR ART] If route-coordinate relief needs frames, compute stable frames once. Rotation-minimizing frames are established for swept surfaces; ordinary Frenet frames can become discontinuous at inflections. **Keep the walkable floor gravity-referenced**, regardless of the wall-texture frame. [Wang et al., rotation-minimizing frames](https://www.microsoft.com/en-us/research/publication/computation-rotation-minimizing-frames/)
[INFERENCE] **Do not discard the density-dependent reach rule.** A narrow geometric envelope alone is insufficient when `max(source, -roughSDF/Q)` can change deeply negative source values outside the visible tube. Outside a brick’s detailed region, return identity only with a valid source-aware proof. Otherwise use a wider prepared candidate set or an explicit fallback. Count that fallback in the speed budget.
[INFERENCE] Cost model:
- **Query:** target roughly **0.1–0.3 μs** for an ordinary active query with 2–4 prepared candidates, excluding rare complex exceptions. This is an engineering target, not measured performance.
- **Build:** \(O(S+R)\) segment preparation/reference emission, plus candidate-certification work; \(S\) segments and \(R\) brick references. Target **under 30 ms added cold critical path** initially.
- **Memory:** approximately 128–256 bytes per prepared segment, plus roughly `16 + 4K` bytes per simple brick list, before multiple semantic lists and directory overhead. Thousands of segments should require megabytes, not L86’s hundreds of megabytes.
- **Exactness:** prepared original formulas can preserve geometry closely; segment simplification has no automatic displacement guarantee. Keep mouth/support equations source-dependent.
- **Effort:** medium-to-large; the candidate compiler and semantic separation are the substantial work.
[INFERENCE] Leaving the entire old support phase untouched is unlikely to suffice: **14% of the 1.4-second passage contribution is approximately 0.20 seconds**, already exceeding TN’s available 0.15-second margin. Preserve support’s meaning, but accelerate its feature selection too.
**2. Replace repeated 3D relief evaluation with a small surface field**
[INFERENCE] Use coordinates along the route and around its wall, with periodic angular indexing and continuous frames. A table can combine all three octaves into one lookup. Avoid evaluating general-purpose `atan2` unnecessarily; a specified octant-based angular mapping is an option, but its distortion must be checked.
Prefer initially **sampling today’s 3D relief at the reference wall surface** rather than inventing unrelated 2D noise. This retains much of its spatial appearance. Extend the value radially only over a controlled band; preserve the floor-alignment weights and separate mouth-floor treatment.
[INFERENCE] Costs and risks:
- **Query:** target **20–80 ns** for coordinate mapping plus a warm four-value lookup; cold memory or frame interpolation can exceed this.
- **Build/memory:** illustrative 1 km of route, 0.25 m longitudinal spacing, 64 angular samples and int16 values: **256k samples, approximately 0.5 MB**. Build requires those relief evaluations once, not full composer evaluations.
- **Exactness:** independently regenerated noise can differ by **0.42 m in wall offset** between opposite extrema despite retaining ±0.21 m amplitude. Equal amplitude does not establish equal quality. Surface sampling reduces this risk but does not prove a displacement bound.
- **Determinism:** fixed integer coordinates, specified interpolation/rounding, periodic endpoints and stable frame construction.
- **Effort:** medium; seam handling, frame continuity and floor/mouth validation dominate.
[MEASURED → INFERENCE] Even removing **all** the measured 21–24% relief share saves only roughly **0.3 seconds**. An 80% relief reduction alone predicts roughly **2.0 seconds**, not one second. It belongs in the combined representation.
[INFERENCE] Cheapest falsifier: evaluate table interpolation error and normal/ripple changes on one curved wall, one mouth and one self-overlapping coil. Reject a table that needs near-original per-sample 3D noise to hide seams or preserve appearance.
**3. Sparse narrow-band distance grids**
[INFERENCE] A grid gives genuinely near-constant queries, but only if its construction avoids L88’s failure: **do not fill it by invoking the existing full route evaluator per node**.
Rasterize prepared local primitives into owned bricks, reduce candidates deterministically, and construct the band from those primitives. Store separate carve and support/clearance information where needed. A baked final delta cannot represent all source-density-dependent mouth restoration.
[PRIOR ART] OpenVDB’s narrow-band representation stores active distances near the surface and constant signed values elsewhere. That is useful representation prior art, but its clamped exterior is not automatically compatible with your composer. [OpenVDB representation](https://github.com/AcademySoftwareFoundation/openvdb/blob/master/doc/doc.txt)
[INFERENCE] For route length \(L\), radius \(r\), band half-width \(w\) and spacing \(h\), band sample count is approximately:
\[
N \approx 4\pi r w L/h^3.
\]
Illustratively, \(L=1{,}000\) m, \(r=3\) m, \(w=0.75\) m:
- **25 cm spacing:** approximately 1.8M samples, **3.6 MB per int16 channel**.
- **12.5 cm spacing:** approximately 14.5M samples, **29 MB per channel**.
Overlapping passages, mouth volumes, brick padding and multiple channels add memory.
[INFERENCE] **Query:** roughly **0.05–0.25 μs per interpolated channel** as a target, with locality decisive. **Build:** millions of local distance operations; even 0.1–0.3 μs per sample means 0.18–0.54 CPU-seconds for the coarser example, before indexing, extra channels or allocation. Parallel wall time must be measured; it is not free.
[INFERENCE] Grid spacing is not a displacement bound. At 25 cm, narrow tread/clearance transitions need analytic treatment or finer data. Integer storage does not ensure deterministic construction: integer distance/projection arithmetic, tie-breaking, reduction order and interpolation must also be specified.
[INFERENCE] Effort: large. This is attractive only if direct construction plus all arrival queries beats the compiled analytic representation. A tiny benchmark of grid lookups alone proves nothing.
**Other candidates**
- **[INFERENCE] Cheap reach versus exact value:** retain the distinction, but answer reach from brick metadata or squared primitive bounds. The current distinction already exists; repeating its recursive BVH search is the expense.
- **[INFERENCE] SIMD Z-runs:** useful after candidate compilation. XY projection is reusable for tread/capsule queries, while 3D carve projection varies affinely with Z before clamping. Expect amortized lookup and arithmetic benefits, not eightfold speedup. Memory adds only scratch arrays; construction is unchanged. Deterministic lane arithmetic and stable winner selection are required. Medium effort.
- **[INFERENCE] Pure capsule-chain replacement:** cheap per primitive, but tessellation can increase candidate count and introduce curvature/radius artifacts. Preserve short-join shape with bounded approximation; do not equate a visually smooth centerline with a walkable tread.
**Smallest prototype and decisive falsifier**
[INFERENCE] Implement one prepared passage evaluator for the **FI/TN junction passage**, including an overlapping coil and tread—not a straight isolated tube.
1. Compile segment constants and brick candidate lists; retain existing geometry formulas and relief.
2. Run the complete carve/support/clearance sequence from those lists.
3. Measure construction, query time, candidate-count distribution and fallback time separately.
4. Add the relief table only after direct evaluation beats the old traversal.
[INFERENCE] The cheapest first falsifier is the **candidate compiler census**: if commonly sampled bricks still need many segments or fallback retains more than approximately 10% of original passage time, the proposed common path cannot meet the target even if nearly free.
[INFERENCE] Then replay representative samples with their incoming densities and original spatial order. Include misses, mouths, support and overlapping bores; exclude benchmark-only allocations. A promising kernel must finally survive cold arrival timing including construction, peer comparisons, capsule/support/grade/ripple audits and visual inspection.
[INFERENCE] Budget acceptance around **90–95% total passage-cost removal**, not an attractive isolated kernel speedup. The measured ceiling makes approximately one second plausible, but only if the new representation replaces the search-heavy semantic pipeline broadly enough.
Read-only review; no files changed or generation/tests run.
@@ -0,0 +1,137 @@
# Astra 1 — design review (gpt-6-astra, effort low, read-only), 2026-10-27
Brief: see BRIEF.md. Note from Claude: the brief's "~75% of field time is the passage composer" was WRONG — L76's term profiler covered ~6.0M of ~52M density calls per view (FI); measured passage cost is ~6.5 of ~40 worker-s (~15%). Astra flagged the scope mismatch itself. Its gain arithmetic in rec. 1 inherits the wrong share.
**[INFERENCE] Ranked recommendations:**
1. **Compile passages into spatially local operations.** Make most samples bypass the composer entirely; simplify the remaining work.
2. **Replace repeated block classification with a retained hierarchy of proofs and local field programs.** Keep marching cubes; stop densely evaluating regions that cannot produce geometry.
3. **Give arrival readiness its own deadline-driven pipeline.** Preserve whole-view completion as a separate benchmark; scheduling improvements alone cannot meet it.
**[INFERENCE]** These are complementary. Passage localization is the strongest first investment, but does not plausibly deliver one second alone. A wholesale mesher replacement, GPU rewrite, or native-generator migration is premature.
### 1. Make passage influence local by construction
**[CODE]** There is already a spatial index: `BuildPassageFeatureTileList` queries passage feature bounds. `FScopedPassageTileQueries` turns route candidates into per-passage flags, while retaining segment lists for mouth support. Nevertheless, `ApplyResolvedStratePassageCarves` still iterates all passages and scans crossings. After finding a route distance, it calculates relief and mouth-related terms. See [ShapeWorldInternal.h](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/ShapeWorldInternal.h:989).
**[INFERENCE] What changes:** compile a small, immutable passage program for each spatial region:
- Empty region: no passage invocation.
- Route region: ordered candidate segments, precomputed geometry and distances along the route.
- Mouth/support region: explicit support, transition-fade and later-bore dependencies.
- Overlapping features: retain the original composition order.
Use `BuildPassageComposerConstants`, `BuildPassageFeatureTileList`, `FScopedPassageTileQueries`, and `ApplyResolvedStratePassageCarves`; connect the result through `World::generateTile` in [VoxelForgeCore.cpp](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/VoxelForgeCore.cpp:1997). This is stronger than filtering one loop: the region program should remove entire categories of work.
**[INFERENCE] Exact culling requires an identity proof**, not merely “the tube does not intersect this tile.” For every omitted operation, prove that it leaves the incoming density unchanged over the query domain. Include:
- Spline extrema, variable radius, wall/floor relief and smooth-blend reach.
- Mouth shaping, support treads, columns, boundary fade and dependencies on other passages.
- All sample positions used by normals, borders and skirts.
- Deterministic ordering and tie-breaking among retained features.
A feature can leave density signs unchanged while altering marching-cubes interpolation or normals. Conversely, changing far-away density magnitudes may be harmless. These are different correctness claims.
**[CODE]** L75 already corrected bounds for passage relief and spline extrema. The composer also conditionally restores support and defers support composition. Therefore, baking one distance to the nearest tube would not reproduce its semantics. [L75 report](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Research/WorldAssemblerM3/Linux75/REPORT.md:22)
**[INFERENCE]** If exact influence is awkward or effectively nonlocal, introduce a versioned, compact-support passage operator: identical in the protected walkable corridor and mouth regions, smoothly becoming identity outside an explicit envelope. That is a legitimate world-generation change under your constraints.
**[MEASURED → INFERENCE] Expected gain:** passage work is approximately `0.75 × 40 = 30` of FI’s 46 worker-seconds, and `0.75 × 33 = 24.75` of TN’s 39. Removing 80–90% gives proportional wall-time scenarios:
| View | 80% passage reduction | 90% passage reduction |
|---|---:|---:|
| FI | `4.6 × (46−24)/46 = 2.20 s` | `4.6 × (46−27)/46 = 1.90 s` |
| TN | `4.3 × (39−19.8)/39 = 2.12 s` | `4.3 × (39−22.275)/39 = 1.84 s` |
These assume critical-path time follows work reduction; they are not predictions for the Ryzen. Even eliminating passage cost entirely leaves approximately **1.6 seconds** in both views.
**[INFERENCE] Risks and effort:** medium effort for regional programs; larger for a new passage representation. Stable candidate ordering and versioned arithmetic protect determinism. Underestimated envelopes threaten clearance and support; overly generous envelopes merely lose speed. Run capsule, grade and support audits across entire passages, including landings and seams.
**[INFERENCE] Cheap falsifier:** resurrect the rejected culling candidate as an experiment. First inspect all 612 changed samples and 24 changed mesh tiles: location, zero crossings, surface displacement, normals, support and audit outcomes. Then time the production path including candidate construction. Reject this implementation if conservative lists remain large or composer savings are small. Hash differences alone are neither acceptance nor rejection.
### 2. Retain spatial proofs and simplify the field inside each region
**[INFERENCE]** A continuous density function remains a good world definition. Evaluating its complete program at every lattice point is the questionable implementation. Marching cubes is not currently the dominant problem.
**[CODE]** `ClassifyBoxDetailed` delegates to `ClassifyBoundsDetailed`. The latter already performs conditional strate slicing, but combines slices into a whole-box verdict and abandons the skip when a slice is unknown or has a different sign. L75’s legacy block certificates became audit-only after timing regressions. Simply enabling more block checks repeats a failed approach. [Classifier](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/ShapeWorldInternal.h:6385), [L75 final disposition](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Research/WorldAssemblerM3/Linux75/REPORT.md:64)
**[INFERENCE] What changes:** introduce a compact region tree or brick table whose entries retain:
- A solid/air certificate, or an unresolved range.
- Relevant primitive and passage candidates.
- Terms proven inactive or dominated.
- Child regions requiring further evaluation.
Split first at known strate and transition-band boundaries, then refine unresolved regions spatially. Keep successful proofs even if a neighboring slice fails. Share candidate filtering and bounds down the hierarchy; do not repeatedly invoke the full classifier from scratch.
Start tile-local and retain the regular marching-cubes lattice. Extend `ClassifyBoundsDetailed`, the evaluation feeding `AnalyticDensityAt`, `World::generateTile`, and the grid/proof path in `UVoxelMarchingCubesMesher::GenerateMesh` in [VoxelMarchingCubesMesher.cpp](/home/jahni/VoxelM/Plugins/VoxelForge/Source/VoxelForge/Private/VoxelMarchingCubesMesher.cpp:102).
**[PRIOR ART]** Fidget combines interval evaluation with regional expression simplification: even unresolved regions can use shorter programs. That second benefit matters here as much as empty-space skipping. It also supports bulk SIMD evaluation. [Fidget’s author documentation](https://www.mattkeeter.com/projects/fidget/)
**[INFERENCE]** Do not assume the composed density is a signed distance field with Lipschitz constant one. Warps, blends and relief require their actual bounds. Uniform corners do not prove a uniform interior.
Similarly, do not fill certified interiors with arbitrary constants and then use those constants at surface edges or in normal stencils. Evaluate the exact endpoint and halo values wherever geometry or gradients consume them. A narrow band must be *discovered conservatively*, not guessed from sparse signs.
**[MEASURED → INFERENCE] Expected gain:** the 90–97% uniform-block sample census is an opportunity ceiling, not a realizable skip rate. A useful experiment target is **50–70% reduction of remaining field work, net of classification cost**.
After a 90% passage reduction, FI has approximately 13 field-work units plus 6 others. Reducing those 13 by 50–70% gives:
`4.6 × [6 + 13 × (0.5 to 0.3)] / 46 = 1.25 to 0.99 s`.
TN similarly gives approximately **1.25–1.02 seconds**. Thus the combination approaches the headless target, with little budget left for Unreal overhead. Do not multiply independent headline speedups: both techniques remove overlapping work.
**[INFERENCE] Risks and effort:** medium-to-large effort, substantially less than adaptive meshing with new topology. Incorrect proofs can silently delete geometry; edits must invalidate affected certificates, including their dependency halos. Quality and walkability can remain unchanged if surface samples and stencils remain exact. Unknown bounds must fall back.
**[INFERENCE] Cheap falsifier:** implement one tile-local hierarchy for representative boundary-crossing and passage-adjacent tiles, retaining the existing mesher. Compare total classification-plus-fill cost against dense evaluation, after passage localization. Reject expansion if net field savings fall well below 50%, or bookkeeping and conservative halos consume the benefit. The prior slow block experiment makes this an essential early gate.
### 3. Schedule for an explicit arrival deadline
**[MEASURED]** SW’s Unreal overhead is `3.74−2.41 = 1.33 s`; walkable readiness ranges from 0.4 to 1.8 seconds.
**[INFERENCE]** Keep two separate commitments:
- **Arrival ready:** safe collision and sufficient visible terrain for immediate movement.
- **Whole view complete:** the full requested set at final quality.
If the owner insists both happen within one second, say so explicitly. Progressive refinement cannot be counted as meeting the second commitment.
**[CODE]** §8.10 already specifies occupied/support-tile priority, heading priority, dynamic near reserve, independent region admission, cancellation, bounded result backlog and hot-swap. “Make nearby tiles higher priority” is therefore not a new recommendation. [Performance invariants](/home/jahni/VoxelM/Plugins/VoxelForge/ARCHITECTURE.md:572)
**[INFERENCE] What changes:** make readiness a dependency graph with deadlines: required region compilation → field/mesh → collision preparation → bounded publication. Prioritize prerequisites of the arrival set, not just its tile jobs. Reserve capacity through publication, and schedule travel-ahead work by time-to-arrival.
Inspect and change `AVoxelWorld::UpdateChunksAroundPosition`, `LoadTile`, and `ProcessPendingChunks` in [VoxelWorld.cpp](/home/jahni/VoxelM/Plugins/VoxelForge/Source/VoxelForge/Private/VoxelWorld.cpp:9400). Preserve the existing epoch, cancellation and collision-handoff rules. Refinement should retain covering geometry until replacements are ready.
**[PRIOR ART]** Voxel Plugin separates collision/navmesh demand through invokers. Geometry clipmaps use incremental updates, coarse-to-fine processing and continuity between levels. These support separate readiness domains, not a universal one-second guarantee. [Voxel Plugin](https://docs.voxelplugin.com/2.0p6/knowledgebase/blueprints/collision-navmesh-and-invokers), [Geometry clipmaps](https://developer.nvidia.com/gpugems/gpugems2/part-i-geometric-complexity/chapter-2-terrain-rendering-using-gpu-based-geometry)
**[MEASURED → INFERENCE] Expected gain:** removing half the observed scheduling gap saves about **0.67 seconds**; removing all of it still leaves SW at 2.41 seconds before Core changes. Improving a 1.8-second walkable arrival to one second requires eliminating or deferring 0.8 seconds from that critical path.
**[INFERENCE] Risks and effort:** small-to-medium for dependency scheduling; larger for new far representations. Timing must never change generation inputs. Coarse collision can violate walkability; coarse visuals can pop, particularly in VR. Preserve authoritative near collision and accept temporary visual substitutes only if they satisfy the owner’s quality criterion.
**[INFERENCE] Cheap falsifier:** first replay existing job timings against the dependency graph, then try an arrival-only admission experiment. If prerequisites plus bounded publication already exceed one second without competing work, scheduling cannot solve arrival latency. If the coarse cover visibly degrades the arrival, it cannot redefine “ready.”
**Other approaches, in priority order**
- **[INFERENCE] Bake passage geometry, not necessarily final density.** Precompute spline coefficients, arc lengths, frames and conservative segment bounds first. Sparse sampled bricks are a later option; retain separate carve/support operands and conditions. Count baking in cold latency. Interpolated distance alone can erase treads or alter mouths.
- **[INFERENCE] SIMD after localization.** AVX2 evaluation of batches sharing a local program is realistic; divergent all-passage loops are a poor starting point. Eight lanes do not imply eightfold speedup. Specify arithmetic and reduction order across scalar/vector paths.
- **[INFERENCE] Sample sharing.** Share same-LOD borders first; cross-LOD reuse requires identical coordinates *and field semantics*. Nested lattices overlap, but clipmap shells need not cover the same volume. Compare synchronization cost against duplicate evaluation before building a global cache.
- **[INFERENCE] Coarse smooth terms.** Interpolate bounded macro terms while evaluating fine relief near surfaces. Density error does not imply equal position error where gradients are weak. L76’s 0.01-µs noise row is too small to justify making noise approximation the main project.
- **[INFERENCE] GPU.** A specified integer/fixed-point evaluator can be deterministic: define rounding, overflow, square roots, interpolation and stable emission order. Quantizing floating-point results afterward is insufficient. CPU-authoritative collision plus GPU display is easier, provided visual disagreement is bounded and display results never affect gameplay. GPU readbacks and VR contention can erase gains.
- **[PRIOR ART → INFERENCE]** HLSL `precise` controls arithmetic refactoring; it is not a complete cross-vendor world-generation specification. Prototype one bounded integer passage kernel before reopening a full port. [Microsoft documentation](https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/precise)
- **[PRIOR ART → INFERENCE] Alternative renderers.** Dreams’ published architecture evaluates CSG into multiresolution point clouds; Teardown uses a voxel renderer without polygons. These demonstrate representation choices, not transferable cold-generation timings. Nanite addresses rendering downstream of field generation. [Dreams presentation](https://www.advances.realtimerendering.com/s2015/index.html), [Teardown FAQ](https://www.teardowngame.com/faq.html)
- **[PRIOR ART → INFERENCE] Continuous streaming.** No Man’s Sky’s architecture is explicitly organized around continuous generation. That supports travel-ahead planning, but does not prove cold teleport latency. Disk caching likewise remains useful without counting toward this target. [Hello Games’ GDC talk](https://www.youtube.com/watch?v=sCRzxEEcO2Y)
**Process changes that matter**
**[INFERENCE]** Separate three gates: peer determinism for the *new version*; gameplay/visual acceptance against the previous version; and performance on the production path. Old-version hash identity should only gate changes advertised as exact.
**[CODE]** L76’s term profiler covers selected legacy evaluations; its passage total is about 6.3 worker-seconds, whereas L73 reports broader grid-field totals. Those scopes must not be silently equated. The arithmetic above uses your supplied aggregate attribution as a scenario, not reconciled absolute profiling data. [L76 profiler scope](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Research/WorldAssemblerM3/Linux76/REPORT.md:5)
**[INFERENCE]** Report cold-start boundaries, critical-path stages, worker occupancy, publication latency and worst frame time alongside whole-view time. Include plan compilation and fresh in-memory structures. Validate the winning prototype on the 5800X3D; no reliable conversion follows from the laptop measurements alone.
**Questions only the owner can settle**
- Must every final-quality tile exist at one second, or can safe arrival precede complete refinement?
- What travel speed, teleport distance and VR frame budget must streaming sustain?
- Does “cold” include world planning, and must supported peers reproduce density bits, mesh bits, or an explicitly defined gameplay representation?
Read-only review completed; no edits, builds, tests, commits or stashes.
@@ -0,0 +1,86 @@
# World Assembler L25 — FI helix inside the root
**The ribbon came from two causes.** The shared passage compositor stamped route-mouth tread/support into native air, and the L24 6 m root could not contain this route: its measured centerline reached 5.562 m from the root axis and the mouth bore is 4.5 m. That leaves a nominal `6 - 5.562 - 4.5 = -4.062 m` wall allowance. The axis and units were correct; the support pass ignored surrounding rock, and the root was too small.
L25 gates shared route-mouth support on negative pre-passage density, so it can reinforce existing rock but cannot create a shelf in air. The FI anchor root is now a relief-bearing 13.25 m nominal rock column. I chose a sturdier column with the existing uneven relief over a thin cylinder; it remains column-shaped from outside. The authored spiral stays centered on the root axis.
## Root and passage measurements
Axis `(9.800, 4.571) m`; helix centerline radius `2.999–5.562 m`; bore radius `4.5 m` at the mouth and `3.0 m` through the middle. The conservative wall estimate uses the largest path offset and mouth bore at every height.
| Height (m) | Solid radius min / mean / max (m) |
|---:|---:|
| -68.209 | 12.000 / 12.129 / 12.375 |
| -80.643 | 12.125 / 12.254 / 12.500 |
| -93.595 | 12.500 / 12.672 / 12.875 |
| -106.548 | 12.875 / 13.012 / 13.250 |
| -118.982 | 13.000 / 13.168 / 13.375 |
Minimum measured wall allowance is `1.938 m`, above the existing `1.5 m` reserve.
## Audits
The authored FI Spiral passed on Clang and GCC: 61,173 capsule samples, `blocked=0`, 5,318 support samples, `unsupported=0`, `grade_failures=0`; both route bindings pass, and walkability is 1,135/1,135. Strict layout validation accepted with zero issues; malformed controls were rejected 9/9.
The open-air audit sampled 813,632 passage support points at 0.25 m spacing: `violations=0`, including 11,520 route-support samples. Its L24 ungated-support negative control found 1,438 violations. Naturalness passed with a 0 m flat run and 0.767 m wall-relief peak-to-peak; the L23 smooth-wall negative control was detected at 0 m relief. The capsule, open-air, and naturalness results match between Clang and GCC.
All four style overrides in both recipes passed the open-air audit (zero violations; the L24 control was detected each time). The capsule sweep has failures outside the authored FI Spiral: FI styles 0/1/3 have 7/13/6 blocked samples; SurfaceWorld styles 0/1/2/3 have 4,255/4,071/3,948/4,117 unsupported samples after the safe support gate. Their blocked/grade counts are zero. These are alternate-style walkability failures, not open-air emissions; the canonical FI Spiral and composed SurfaceWorld route pass. The individual logs are `Saved/Linux/linux25-style-*.log`.
L13 parity passed on both compilers: FI 8/8 page pairs, 14 higher-LOD pairs, 782,026 exact-query samples, zero mismatches; SurfaceWorld 5 page pairs, 9 native-only pairs, 14 higher-LOD pairs, 910,651 exact-query samples, zero mismatches. Both had one passing edit pair. L9 uniform-block proofs had zero violations: SurfaceWorld checked 26,977 blocks / 35,906,387 samples; FI used its expected 21,504 fallbacks/unknowns and checked no blocks.
The 24 m crossing passed both compilers and recipes. FI processed 314 moving tiles and SurfaceWorld 432; compiler hashes match per recipe. Crossing whole-view density/mesh/payload/topology hashes (FI 2,370 tiles; SurfaceWorld 2,553):
- FI: `c284b42ced276f4c / f6a90d0027d8d6fe / fdec2a7f61215a1e / 60a99d7c20700cd6`
- SurfaceWorld: `cee18b39a9271559 / c1713be06b92bd8e / fd7954350ebfacfc / c58b075a1b7f2895`
## Determinism and SurfaceWorld
The exact LOD0–8 hash matrix passed at W1/W8/W12 for Clang and GCC: 2,370 whole-view tiles, 960 full-detail tiles, all nine LOD rows and exact-query hashes identical across workers and compilers. Hash vectors are density/mesh/payload/topology:
| Recipe | Whole view (2,370 tiles) | Full detail (960 tiles) | Exact-query density / detail / collision |
|---|---|---|---|
| SurfaceWorld | `8d494f8f843171b2 / 37d21941f6d9cce8 / 47248393fa2f3322 / 36d03d874daef4ae` | `ace56c8f205238ad / a9c603a1248de6b8 / ea55f1f4fcc6a894 / 5ea7bc78a1b678ae` | `c949c4df2ce6f9d9 / 114c501e2d830d94 / e6011d3a248d4849` |
| Floating Islands | `6f0095c01b066744 / efea60f7a9c1d675 / 849c1829e1dcddd5 / 4f7cc65dc1adc234` | `d18e722b37a2479e / 0e410a8e80a3e7f7 / 0751926f0c67d8a4 / f01208bc2f7841ec` | `7b7c50ac24ccadcc / efcba20c0c70c415 / e604823a249029bf` |
Re-run command, with `N=1,8,12`, both compiler binaries, and both recipes:
```sh
timeout 1800s taskset -c 0-11 env LP_NUM_THREADS=12 prlimit --as=6442450944 -- Standalone/bin/linux/VoxelForgeCoreHeadless-linux25-<clang|gcc> --world-assembler-prototype --stream-benchmark --stream-pipeline --stream-hash --force-generate --clip-radius=3 --max-clip-level=8 --far-horizon-lod8-step=0 --workers=N --recipe=<surface-world|floating-islands> Standalone/data/owner_world.json
```
SurfaceWorld away from the passage was directly compared with L23 in L24 and matched at 960 full-detail tiles: `66ac781666579e3e / 914873894a0e38c4 / ec8b03ade039cd56 / a2b621b0321d43dc`. L25 changes only passage/root generation and the shared passage composition region; it does not change the away-from-passage SurfaceWorld field. The L25 full-view hashes above cover a different tile selection from that away-only comparison.
## Captures
The four final captures are 1920×1080 JPEGs under `captures/`, each below 300 KB:
- `fi-pillar-exterior.jpg` (43 KB): wide exterior; thick relief-bearing root, no outside ribbon.
- `fi-pillar-cutaway.jpg` (53 KB): vertical cutaway exposing the helix and central rock.
- `fi-helix-inside.jpg` (37 KB): headlamp on, 90° FOV, camera `(11.495, 7.047, -87.858) m` at resolved route point 200, about 2 m above the tread, aimed down the route tangent. The tight turn leaves a close, wall-heavy view; the cutaway is clearer for the full spiral.
- `sw-arrival-mouth.jpg` (55 KB): headlamp on, 80° FOV, camera `(9.800, 4.571, -133.000) m`, 5.5 m below the lower mouth, looking up into the SW arrival.
## Changes, invariants, and run history
Core evaluator version is 12; FI geometry version is 7; resolved-layout schema V3 is unchanged. Source changes are in the Core passage planner/compositor, FI root geometry, and the standalone audit/hash reporting. `ARCHITECTURE.md` §8.43 and `CODEMAP.md` §3.26 document the change. The only Unreal edit is the adapter's FI geometry-version assignment (`geometryVersion = 7`); Unreal was unavailable, so that adapter edit was not compiled here.
L3 FP-contract preamble/self-test, L4 `FLazy`, L7 shared cache, L9/L12 proofs, L11 readiness/crash fix, L13 route binding, L18/L19 shared ceiling, L21/L22 layout and bands, L23/L24 passages, ARCHITECTURE §8.10, and CLAUDE.md async rules remain intact. No commit, push, or stash was made.
Failed or retried runs:
- The first scene export omitted `--render-distance-chunks=0`; it expanded to 593,068 tiles / about 640 MB and was stopped before 15 minutes, then its partial export was removed. A render-distance-48 retry returned 844 plane-dominated tiles / 31 MB and was discarded. Clipmap-only (195 tiles) and focused 27-tile detail exports succeeded.
- Two extra GCC audit invocations exited 2 because the headless binary needs the owner JSON as a positional path; the corrected invocation with `Standalone/data/owner_world.json` passed. The requested six-worker/compiler/recipe hash matrix itself passed.
- Early interior camera trials missed the resolved helix centerline and showed wall-only frames; the final interior frame uses a point extracted from the current resolved layout. No build or audit exceeded 30 minutes, and no step was left stuck for 15 minutes.
## Orchestrator review (Claude) — side branch, not merged yet
- The FI helix fix is confirmed by my capture review: `fi-pillar-exterior.jpg` shows a solid relief-bearing
column with no outside ribbon, and `fi-pillar-cutaway.jpg` shows the helix inside it.
- **Regression that blocks merge:** the support gate makes non-FI passages unwalkable. With the SurfaceWorld
recipe (the owner world's TunnelNetwork strate above SurfaceWorld), every style has ~4,000 unsupported
capsule samples (L24: 0). FI styles 0/1/3 have blocked samples. The owner world's real TN→SW passage is
affected, so a player can fall through it.
- Kept on side branch `wip/l25-helix`; `assembler/world` stays at L24 (`cb9236c`) until L26 makes every style
in both recipes pass with 0 blocked / 0 unsupported / 0 open-air violations.
- Design decision (owner delegated decisions to me, 2026-10-21): passages are tunnels in rock. The planner keeps
the path inside solid ground where possible; unavoidable open-air crossings get a natural, grounded rock
bridge (thick, relief, connected to rock on both ends), never a floating tread.
Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

@@ -0,0 +1,144 @@
# World Assembler L26 — passages walkable in rock
**All four styles pass for both recipes.** Clang and GCC report zero blocked capsule samples, zero
unsupported samples, zero grade failures, zero open-air violations, passing naturalness, and passing
route bindings. The L24 open-air control and L23 smooth-wall control were detected.
## Where support was missing
In the owner SurfaceWorld recipe, the default Spiral passage has 1,083 control points. Its unsupported
bridge range is segments 98–1077, a 1,957.395 m gap. Segment 98 is at about `(0,-5,-142.7) m`; segment
1077 is at `(-4.6,-1.9,-497.4) m`. Both are inside the SurfaceWorld stratum (`-632..-120 m`), below
its native terrain. The gap starts after the TunnelNetwork transition; it is neither TunnelNetwork
cave air nor a stratum seam. The first L25 failure sample had only 2/5 native support probes, and
following samples had 0/5. Their dispatch path was `SurfaceWorld-native`.
Core now scans the native field sign and adds a deterministic bridge only over contiguous unsupported
ranges. The shared density field gives the bridge at least 5 m width, 3–5 m planned thickness and
surface relief. The audit measured two connected ends, at least 5 m width, 256/256 cross-sections,
3.5–6 m thickness and 2.5 m relief on the default Spiral. All four SurfaceWorld styles use connected
bridges; Floating Islands already has supporting rock and needs none. The capsule clearance gate also
checks the resolved player capsule, fixing FI styles 0/1/3 at their bent mouth segments.
The first bridge export still contained no passage mesh because tile readiness classified all nearby
tiles as native-only. Resolved passage and bridge bounds now keep those tiles shape-dependent. The final
local export changed `shape_free_desired` from 27/27 to 4/27 and contains the composed bridge density.
## Eight-row audit
Counts are from the Clang W12 run; GCC W12 matched every row. `B/U/G` means blocked, unsupported and
grade failures. Route bindings are required bindings passed / required bindings.
| Recipe | Style | Capsule samples | Support samples | B/U/G | Open-air samples / violations | Wall relief | Bindings | Bridge segments / length |
|---|---:|---:|---:|---:|---:|---:|---:|---|
| SurfaceWorld | 0 | 301,140 | 32,765 | 0/0/0 | 3,887,808 / 0 | 0.472 m | 1/1 | 30–293 / 2,004.318 m |
| SurfaceWorld | 1 | 284,949 | 31,046 | 0/0/0 | 3,707,328 / 0 | 0.449 m | 1/1 | 33–357 / 1,945.857 m |
| SurfaceWorld | 2 | 275,877 | 30,072 | 0/0/0 | 3,664,064 / 0 | 0.410 m | 1/1 | 98–1077 / 1,957.395 m |
| SurfaceWorld | 3 | 287,154 | 31,298 | 0/0/0 | 3,741,792 / 0 | 0.552 m | 1/1 | 34–373 / 1,980.607 m |
| Floating Islands | 0 | 50,589 | 4,407 | 0/0/0 | 695,616 / 0 | 0.779 m | 2/2 | none |
| Floating Islands | 1 | 57,015 | 5,060 | 0/0/0 | 742,016 / 0 | 0.806 m | 2/2 | none |
| Floating Islands | 2 | 61,173 | 5,318 | 0/0/0 | 813,632 / 0 | 0.767 m | 2/2 | none |
| Floating Islands | 3 | 54,369 | 4,325 | 0/0/0 | 743,456 / 0 | 0.681 m | 2/2 | none |
Every row passed naturalness (0 m flat run; relief threshold 0.2 m), route binding and strict layout
validation. The validator accepted with zero issues and rejected its malformed controls 9/9. Each L24
open-air negative control and L23 smooth-wall negative control was detected.
## Captures
All are 16:9 JPEGs below 300 KB in `captures/`:
| Capture | View | Size | SHA-256 |
|---|---|---:|---|
| `sw-passage-outside.jpg` | Midspan from outside, 1920×1080 | 90,937 B | `28378eeee755faf7446c0b2ce0eb8d2368c79b42f7de4c15e8b2f4d58fb7754d` |
| `sw-passage-inside.jpg` | Eye-height at first bridged segment, 1600×900 | 47,519 B | `ccadc33c36366a0ca7b2fcda0a21e4cea67bda107f0e20015171fd620d495249` |
| `sw-natural-bridge-wide.jpg` | Wide midspan view, 1920×1080 | 70,192 B | `f4a66fec1adebfbdf5806bb2e7c5a6470e3e8d9dcd60f495d930bbb1d0c5669e` |
| `fi-pillar-exterior.jpg` | Floating Islands pillar exterior, 1600×900 | 35,857 B | `b977ff34acee1294a24c2465b1c9d3d78014cff4b8eceb667f317a0a0b46cc67` |
## Determinism and regressions
The L25 hash command was rerun with the L26 binaries for both recipes, W1/W8/W12, Clang/GCC:
```sh
timeout 1800s taskset -c 0-11 env LP_NUM_THREADS=12 prlimit --as=6442450944 -- \
Saved/Linux/bin/VoxelForgeCoreHeadless-linux26-<clang|gcc> \
--world-assembler-prototype --stream-benchmark --stream-pipeline --stream-hash --force-generate \
--clip-radius=3 --max-clip-level=8 --far-horizon-lod8-step=0 --workers=N \
--recipe=<surface-world|floating-islands> Standalone/data/owner_world.json
```
All six runs per recipe matched. Hash vectors are density / mesh / payload / topology; full detail is
960 tiles and whole view is 2,370 tiles.
| Recipe | Full detail | Whole view | Exact query: density / unclamped / detail / collision |
|---|---|---|---|
| SurfaceWorld | `ace56c8f205238ad / a9c603a1248de6b8 / ea55f1f4fcc6a894 / 5ea7bc78a1b678ae` | `307d5df80e0165b4 / 1d61f30e5733beca / 3aaef136176c4b12 / aa5ff7c2a821196f` | `c949c4df2ce6f9d9 / c949c4df2ce6f9d9 / 114c501e2d830d94 / e6011d3a248d4849` |
| Floating Islands | `d18e722b37a2479e / 0e410a8e80a3e7f7 / 0751926f0c67d8a4 / f01208bc2f7841ec` | `51decfb71d282506 / 69448ec1c7fc954f / e2ff37c98fe8e494 / 5beeb7f94fdbf3d4` | `7b7c50ac24ccadcc / 7b7c50ac24ccadcc / efcba20c0c70c415 / e604823a249029bf` |
The 24 m crossing passed for both compilers and recipes. Each processed 314 moving tiles, with identical
compiler hashes. Moving-tile vectors (density / mesh / payload / topology): SurfaceWorld
`3561ea23485e359f / e8331620fb0fb908 / 765f7dad67c852aa / 3ccc09ac81c05d71`; Floating Islands
`e3d0ea833bca4215 / 6b3d0f148ed83d93 / d6ed85f16acd895e / 9745683036522461`.
SurfaceWorld away from the passage was compared directly between L25 Clang and final L26 Clang at
`--camera=10000,10000,-100,0,0`. Full detail, whole view, all LOD0–8 rows and exact-query hashes were
identical (12/12). Full-detail vector: `1c6abc5e9c657e98 / a1624a3c19bbe554 / bf98934c9d846f3a /
bbdc2a6b821c66d6`; whole-view vector: `40c2be0c7bbdaf28 / 7d9ac2a85020dc7d / c378e48bab2d194f /
81014ec4b888107a`; exact-query vector: `482500abbe835b11 / c4948c7179963784 / efcba20c0c70c415 /
137e8f6c0b03a624`.
Strict validation passed on both compilers and recipes. L13 route parity passed on both compilers/recipes:
8/8 page pairs, 14 higher-LOD pairs, one edit pair, 782,026 exact-query samples and zero mismatches.
For L9 proofs, the passage-centered view has no eligible native blocks. At the same 10 km away-from-route
view, SurfaceWorld checked 4,848 blocks / 6,452,688 samples with 1,296 fallbacks and zero violations
on both compilers. Floating Islands had its expected 21,504 unknown fallbacks and zero violations.
Final headless binary SHA-256: Clang `fc0a5a74f17566384e094cb2429d8925147dd3eb32fb925417393e00c9bb19d5`; GCC
`54843bef3a64087e55d3eb9a76fb0856162b6ad9aeb03d6e1c204c3e91d21ca5`.
Clang built with FP contraction off; GCC used its default FP mode. Both built and started without the L3
FP-contract self-test rejecting them. Core evaluator version is 13; FI geometry remains 7 and layout
schema V3 is unchanged. Changes are shared Core, standalone audits, Linux build output configuration,
and ARCHITECTURE §8.44 / CODEMAP §3.27. No Unreal files changed, and no async path was added. The L4
`FLazy`, L7 cache, L9/L12 proofs, L11 readiness/crash handling, L13 binding, L18/L19 ceiling,
L21/L22 layout and bands, L23–L25 passage/helix, §8.10 and CLAUDE.md async rules remain intact.
## Failed and retried runs
- The first build command used an invalid `clang` variant; corrected to Clang/GCC variants. Early build
iterations R3–R6 had compiler errors and were corrected before final binaries were produced.
- An unsupported `--world-assembler-audit` option exited 2; the correct option is
`--audit-resolved-layout-passages`. One early invocation omitted that flag and performed no passage
audit. Early bridge probes also segfaulted while crossing stratum dispatch; final audits use bounded
resolved-layout queries.
- Support iterations R22–R30 exposed successive failures: FI style 0 had 767, then 27, then 5 blocked /
33 unsupported samples; an offset experiment caused 746 unsupported samples; a control-point capsule
reference left 7 blocked samples. Correcting the capsule reference cleared those. R30 still had SW
bridge sections 254/255, four SW style-1 mouth blocks, and an invalid SW style-2 bridge thickness
sample. R31 corrected them; final matrix is clean.
- The first final audit batch labeled FI JSON files as Floating Islands but omitted `--recipe`, so those
invocations used SurfaceWorld. All 16 style audits were rerun with explicit recipe flags. An initial
proof run used `--force-generate`, which disables L9 block auditing; it was repeated without that flag.
The validator-only command also exited 2 until the required streaming flags were included; all four
corrected strict-validator runs passed.
- `FloorProfileBlend` still reports its L25 alternate-style failures: SurfaceWorld style 1 is 2.544 vox
over the 2.000 threshold and style 3 is 3.645 vox. Both values are identical in the L25 logs; they are
pre-existing and are not capsule, support, open-air or naturalness failures.
- Initial capture attempts used a wrong yaw and missed/partially missed the FI export volume. After
correcting the view and centering the export, the final captures above were rendered. Several inside
camera placements showed wall-only or void-only views; the selected interior frame is at the first
bridged segment.
No run exceeded 30 minutes or remained stuck for 15 minutes. Exports and logs are under `Saved/Linux/`;
this round added only this report and the four small JPEGs under `Standalone/`. An unrelated pre-existing
untracked `Linux18/exports/` directory was left untouched. No Unreal edits, commit, push or stash were made.
## Orchestrator review (Claude) — side branch, not merged
- The audits pass (8/8 rows at 0/0/0), but the SW "natural bridge" is a ~2 km rock ramp spiralling through the
open SurfaceWorld sky from the ceiling (≈−143 m) to the ground (≈−497 m). `sw-natural-bridge-wide.jpg` and
`sw-passage-outside.jpg` show fragmented floating slabs with thin shard spikes: not natural, and visible
from far away.
- Decision (delegated by the owner): one shared mechanism for every strate. When a passage must cross a large
open void inside a strate, it descends inside a natural rock column (ceiling-to-ground, like a
stalactite/stalagmite pair joined), with the spiral tunnel inside, generalising the L25 FI anchor root.
No long bridges through open air. Implemented in L27 on `wip/l25-helix`.
Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

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