Compare commits

..
Author SHA1 Message Date
Fr0zka 82eb5b1c66 Merge branch 'wip/l157-speed' into wip/combined 2026-11-02 20:27:26 +01:00
Fr0zkaandClaude Opus 5.5 52cb3d7a23 streaming: restore same-level refill; early admission on by default; fixed UE harness (L172)
Scheduler stable-sorts the whole level and checks capacity per admission (refill when slots free mid-pass); regression
test with the old partial-sort path as negative control. Harness repoints Source/Standalone/uplugin together, records
root HEAD/status, builds baselines from fresh worktrees, gates on DWARF struct sizes (480/480/480).
Frame-resolution arrival: A/A p90 36.8 ms; fixed-on vs fixed-off -12.2 ms median (4/10 slower). 30 m/s: near 43.3 ->
55.3%, far holes 1.8 -> 0%, p99 <= 7.46 ms, worst <= 12.3 ms.
Defaults: StreamingFastTravelWaitForAllCriticalTiles=0, StreamingFastTravelApplyBudgetMilliseconds=1.0,
StreamingIncrementalDesiredSet=1, CoreRegionConcurrentAdmission=1, StreamingFastTravelForwardFirst=0,
StreamingRebuildOnCoreRegionCompletion=1, StreamingCoreDesiredCacheByCenter=0, audits 0.
Source/: VoxelWorld.cpp, VoxelStreamingAdmissionOrder.h (new).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-11-02 20:27:24 +01:00
Fr0zka 4d7b470ebc Merge branch 'wip/living-plane' into wip/combined 2026-11-02 19:01:43 +01:00
Fr0zka c3a1610b22 Merge branch 'wip/l141-liminal' into wip/combined 2026-11-02 19:01:43 +01:00
Fr0zkaandClaude Opus 5.5 9d088ef96c research: UE arrival A/A could not run (L171)
Two identical ca0bf76 VFHost builds staged together crash at BeginPlay after snapshot parsing
(surface_strates=858993460 = 0x33333333, std::length_error). No arrival pairs measured.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-11-02 18:08:43 +01:00
Fr0zkaandClaude Opus 5.5 24803ab771 streaming: latch fast-travel early admission until the arrival set settles (L170, still opt-in)
Switches verified inactive before first settlement; moving gains hold (near 43.7 -> 55.5%, far holes 1.8 -> 0%, p99
7.21 -> 6.48 ms, worst 12.32 -> 12.27 ms). Arrival median +1.28% (4/7 pairs slower) though the switches did no work
then; defaults remain off (WaitForAllCriticalTiles=1, ApplyBudget=0). Source/: VoxelWorld.cpp, VoxelWorld.h.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-11-02 17:28:52 +01:00
Fr0zkaandClaude Opus 5.5 786ecc4cdf streaming: bounded early admission - partial level sort, apply preflight, sorted transition index (L169, opt-in)
With StreamingFastTravelWaitForAllCriticalTiles=0 and ApplyBudget=1 ms (test values; defaults stay 1 and 0), 7 pairs
vs ca0bf76: near 43.3 -> 56.1%, forward 15.5 -> 17.9%, far holes 1.8 -> 0.0%, p99 7.06 -> 6.52 ms, worst 12.2 ->
11.8 ms, every run p99 <= 7.4 and worst <= 13.8 ms; arrival 1.671 -> 1.683 s (slower in 7/7) so not promoted.
Source/: VoxelWorld.cpp, VoxelWorld.h.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-11-02 16:45:20 +01:00
Fr0zkaandClaude Opus 5.5 ca0bf767ca streaming: incremental desired set on by default (L168)
Defaults after this commit: StreamingIncrementalDesiredSet=1 (Core delta, overlay, priority merge);
StreamingCoreDesiredCacheByCenter=0, StreamingRebuildOnCoreRegionCompletion=1, StreamingFastTravelForwardFirst=0,
StreamingFastTravelWaitForAllCriticalTiles=1, StreamingFastTravelApplyBudgetMilliseconds=0 (L157/L160 stay off);
audits 0. Default-only 30 m/s UE, 5 pairs vs c6357b5: p99 10.07 -> 7.01 ms (all pairs), worst tick 13.24 -> 11.63 ms
(4/5), near +1.4 pp, far holes -0.19 pp, arrival flat. Audit run 307/307/302 equal. Source/: VoxelWorld.cpp.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-11-02 14:34:39 +01:00
Fr0zkaandClaude Opus 5.5 ec89b29853 research: re-test L157/L160 on the incremental base (L167, none promoted)
7 runs each: L157 near 55.4% but a 16.7 ms worst tick (UpdateChunks/level sort/overlay); L160 tick-safe but lower
all-around near and later arrival; both: forward cone 25.2% and p99 <= 11 ms, but worst tick up and a 14.3 ms run.
Also found: voxel.StreamingIncrementalDesiredSet defaults to 0, so L165/L166 gains need it enabled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-11-02 13:44:40 +01:00
Fr0zkaandClaude Opus 5.5 c6357b573f streaming: incremental overlay materialization and same-center priority merge (L166)
Persistent Core/overlay/candidate sets updated from deltas; same-center priority order merges changed keys (full sort
only on center change). Set and order equality audits 28/28 + 28/28, injected mismatch fails. 30 m/s UE, 7 pairs vs
9c70053: p99 10.52 -> 7.42 ms (all pairs), worst tick 12.98 -> 11.65 ms (6/7), near 42.0 -> 43.7% and forward cone
14.8 -> 16.1% (all pairs), far holes 3.20 -> 2.74% median (4/7), arrival flat. Source/: VoxelWorld.cpp, VoxelWorld.h.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-11-02 13:00:55 +01:00
Fr0zkaandClaude Opus 5.5 9c70053543 streaming: incremental clipmap desired-set delta for adjacent crossings (L165)
BuildDelta emits entering/leaving slabs per LOD (incl. coarser-ring coverage changes); cached Core key set updated
from the delta at one-tile crossings, full rebuild for larger jumps or LOD>=4 changes. Equality audit vs full rebuild
(45/45 crossings, 20/20 sampled; injected mismatch asserts) + 630 automation cases. 30 m/s UE, 5 pairs:
BuildDesiredTiles p95 7.80 -> 4.08 ms, p99 11.46 -> 7.97 ms, worst tick 13.73 -> 12.11 ms (all pairs), near and
forward readiness and arrival better in all pairs; far holes better in 4/5 (pair 5 +0.29 pp). Geometry unchanged.
Source/: VoxelClipmapDesiredTiles.h, VoxelWorld.cpp, VoxelWorld.h, Tests/VoxelForgeClipmapNoOverlapTest.cpp.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-11-02 12:01:25 +01:00
Fr0zkaandClaude Opus 5.5 3b71d35eba experiment: LivingPlane repeatable + standalone UE runtime module (L164)
Readback barrier fix (GL_TEXTURE_UPDATE_BARRIER_BIT before glGetTexImage); check_repeatability.py compares full-field
checksums across query/capture settings - Intel GPU PASS (3b9d45905c7aafff), llvmpipe PASS, mismatch control fails.
New runtime module VoxelForgeLivingPlane (separate from generation): RDG global shader (Shaders/LivingPlane.usf),
ping-pong RGBA32F render targets, actor with WPO plane and object inputs, no CPU readback. Compiles in Linux UE 5.7.
Windows build: Source/VoxelForgeLivingPlane/*, Shaders/LivingPlane.usf, VoxelForge.uplugin. Setup: UE-SETUP.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-11-02 11:10:43 +01:00
Fr0zkaandClaude Opus 5.5 e1d87eed26 experiment: LivingPlane readable + alive mode (L163)
RGBA32F displacement/velocity/imprint field; rolling base relief, grazing light, elevation colours, 7.5 cm contours,
follow camera; scenes: roll, rest and wobble, lift-off, second sphere; alive mode = travelling swells + viscoelastic
imprint. Intel ADL GT2: ~0.17 ms/step at 512^2. Open: run-to-run difference with queries on/off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-11-02 10:55:32 +01:00
Fr0zkaandClaude Opus 5.5 5b15595e4a experiment: LivingPlane - GPU wave-equation height field reacting to a moving sphere (L162)
Standalone EGL/OpenGL 4.3 compute runner (runtime GLSL, no shader compiler needed), ping-pong height/velocity field,
damped wave + foundation spring + Gaussian sphere push + optional breathing, vertex-displaced render to PNG.
Independent of generation. Intel ADL GT2: ~0.08 ms/step at 512^2, ~0.29 ms/step at 1024^2 (wall-time difference).
.gitignore now allows Experiments/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-11-02 10:35:37 +01:00
Fr0zkaandClaude Opus 5.5 ff52c9b576 proto: liminal looks - pool rooms, backrooms grid, staircase to nowhere, terraced hills (L161)
Stamp vocabulary v7 (opt-in fillBox, carveBox, fillSteps; carveArch reused); flat-field liminal stamp fixtures; capsule
walk audit with doorway-width gate (1.2 m control fails as expected). Clang/GCC W1/W8/W12 identical; owner canonical
hashes unchanged; fast tier 273/273. Terraced wide view not yet legible.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-11-02 10:11:37 +01:00
Fr0zkaandClaude Opus 5.5 aa458d3607 streaming: ahead-first admission, same-center rebuild suppression, Core key cache; off by default (L160)
30 m/s UE, 5 pairs: forward-cone readiness 14.2 -> 18.2% (+3.75 pp), all-around 39.5 -> 36.6%; p99 <= 11 ms in all
candidate runs, but worst tick, far holes and arrival regressed in some pairs. Rebuilds per crossing 7.2 -> 4.4; per
rebuild cost unchanged (not yet incremental). Source/: VoxelWorld.cpp, VoxelWorld.h (defaults unchanged).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-11-02 09:29:39 +01:00
Fr0zkaandClaude Opus 5.5 323fbe3736 streaming: early-admission + apply-cap experiment controls, off by default; forward-cone metric (L157)
30 m/s UE, 5 pairs: near coverage 36.1 -> 48.6% but 2/5 runs had p99 15.8/18.2 ms (worst 19.9 ms), so controls stay
off. Measured: only ~23% of desired LOD0-2 tiles lie in the 55 deg forward cone; forward readiness is 12.1% (base) /
16.9%, vs 50.9/68.5% behind. Slow frames are dominated by desired-set rebuild/UpdateChunks, not apply. Source/:
VoxelWorld.cpp (default behaviour unchanged).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-11-02 03:21:19 +01:00
Fr0zkaandClaude Opus 5.5 4290672d1c audit: passage interior must be air for every capsule sample (L146)
Root cause of liminal seed 5 (measured): passage carve makes the bore air (+3.52), then the liminal route fill stamp
re-solidifies it (-0.16) where the deck crosses the tube. Three fixes cleared the bore but left 28-29 road stations
unsupported; none kept. New gate: zero solid samples inside any passage interior, with no-passage negative controls.
Owner v227 hashes and fast tier pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-11-01 13:02:31 +01:00
Fr0zkaandClaude Opus 5.5 7d654ff861 wip: opt-in landing-pad contract + Core.Liminal.Field v2 pads (L145)
Layers may publish certified arrival/departure pads; the passage planner binds endpoints and tangents to them;
no-pad layouts serialize unchanged (owner canonical hashes match v227). Pads removed the endpoint grade failures;
seeds 0-4 passed at a 45 m margin, but seed 5 still has 289 blocked passage-capsule samples ~29 m before the
departure pad, where the composed field stays solid (-0.162) inside the tube over native ground (-3.6). Ripple
audit now keeps true route distance across masked gaps (with a synthetic control).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-11-01 12:19:30 +01:00
Fr0zkaandClaude Opus 5.5 a45ba9bb10 wip: Core.Liminal.Field v1 recipe, 4 seed-selected variants between fixed mouths (L144, fails mouth joins)
Plans and draws flat field+monolith, repeating hills, road over cloud floor and pillar grid in a 3-strata fixture,
binding passage/0-1 and 1-2 as fixed endpoints. Composed W1 probes: 3/4 seeds fail one passage interface, 4/4 fail the
liminal walk audit near the mouths (support itself passes). Stopped per AGENTS.md. Same mouth-ownership failure
class as FI (L133/L140) and VS seed 2 (L139).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-11-01 11:17:45 +01:00
Fr0zkaandClaude Opus 5.5 a4e214561f proto: continuous swept road deck; coarse-LOD proxies keep thin pillars intact (L143)
Road: one swept-deck stamp on a shared cubic-Hermite centerline (stamp vocabulary V5), 376.8 m, max 8.5 deg, walk
audit clean, short-road control fails as expected. Pillars: regular fillPillar stamps get deterministic 24-sided
capped-cylinder proxies once the LOD step exceeds their radius or half-height (applies to all worlds). Owner hashes
unchanged (v227); five-fixture Clang/GCC determinism; fast tier green.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-11-01 10:08:37 +01:00
Fr0zkaandClaude Opus 5.5 6cd9e4da76 proto: liminal pass 2 - hills to the horizon, swept road over a cloud floor, pillar grid (L142)
Captures stream LOD0-8 (hills repeat at 80 m to the horizon). Road: cubic swept solid deck, 376.8 m, 8 m wide, max
12.06 deg, 17 supports, cloud floor ~45 m below; walk audit 0 blocked/unsupported, 300 m negative control fails as
expected. 15x15 identical pillar grid at 76 m. Owner canonical hashes unchanged; fast tier, Clang/GCC green.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-11-01 09:31:56 +01:00
Fr0zkaandClaude Opus 5.5 9c6d261d01 proto: first liminal fixtures - flat field + monolith, periodic hills, raised road in fog (L141)
Standalone only: fixtures, liminal_road_override (fillDais), --audit-liminal-road-walk, capture-only distance fog.
Road 65 m x 6 m, 22 m up, capsule walk 127/127. Owner hashes unchanged (v227), fast tier, Clang/GCC green.
Hills repeat every 80 m but the capture reaches 56 m, so only one rise shows. Also R48 (who owns the tunnel mouth):
recommends a bounded joint plan of passage ports and layer landing candidates.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-11-01 08:43:24 +01:00
Fr0zkaandClaude Opus 5.5 eb47d72258 research: R47 liminal/dreamcore style and mapping to Core (text only; images kept local)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-11-01 04:11:52 +01:00
Fr0zkaandClaude Opus 5.5 95bf654fbc docs: AGENTS.md for Codex (standing rules + working procedure)
Codex only auto-loads AGENTS.md; CodexGuidance.md was never read. Carries the per-brief standing rules (limits,
no commit/push, quiet-machine timing, same-world bar, units) and a short procedure distilled from systematic-
debugging/verification-before-completion (obra/superpowers) and ub-mode: count first, suspect the measurement,
root cause before fix, one change at a time, attack the premise / stop after three failed fixes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-11-01 01:37:58 +01:00
Fr0zkaandClaude Opus 5.5 0065ee68e6 tools: per-strate density dispatch report in the fast tier (L132)
--density-dispatch-report prints each strate's bound path and tile shares. Owner world: SW native heightfield;
FI, TN, VS on compiled-analytic legacy fallback (FI lacks an imported FloatingIslandPlan; TN/VS have legacy recipes).
A native FI candidate broke the composed owner walk/shell gates, so the owner stays on its path. Output unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-31 02:40:58 +01:00
Fr0zkaandClaude Opus 5.5 ebae71b142 research: R46 generator capability matrix (read-only)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-31 02:11:29 +01:00
Fr0zkaandClaude Opus 5.5 81071969fc docs+cleanup: CURRENT-STATE.md and dead L86/L88 ablation switches removed (L131)
One current-state page (shipping behaviour, references with sources, gaps, verification, closed lines), linked from
CLAUDE.md. Removes the L86/L88 passage/boundary ablation switches and the unused legacy route-grade audit; inventory
of every kept switch in the report. Output identical: 24/24 + 18/18 hashes, fast tier, walk/seam audits, UE host
build; timing unchanged (-0.2%, CI spans 0). No Source/ changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-31 02:11:10 +01:00
Fr0zkaandClaude Opus 5.5 cbbfd46bd3 research: Astra low open project review — what to focus on now (read-only)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-31 01:19:41 +01:00
Fr0zkaandClaude Opus 5.5 044cd6d9c5 core: one passage influence reach in metres, converted once (L130, evaluator v227)
Reach = 0.75 shell + 0.21 relief + 0.50/6 smooth-max support + 0.01 = 1.0533 m, used by proof, feature, fallback,
off-grid bounds and the sweep cutoff. Removes the dead 4 m term (v225 added metres to core-voxel coordinates).
Captures and mouth close-ups byte-identical; proof audit 0 misses over 25,728 shell/crest samples; floor 7.884 mm;
seams, walkability, fast tier, Clang/GCC W1/W8/W12 green; timing equal within noise.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-31 00:43:44 +01:00
Fr0zkaandClaude Opus 5.5 b96dd739b8 research: Astra low review of per-block bit-flag masks (read-only)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-30 21:30:51 +01:00
183 changed files with 20206 additions and 353 deletions

No files matched your search

+8
View File
@@ -9,12 +9,20 @@
!/Source/ !/Source/
!/Source/** !/Source/**
# Plugin runtime shader source.
!/Shaders/
!/Shaders/**
# Portable CPU generator and D3D11 viewer. # Portable CPU generator and D3D11 viewer.
!/Standalone/ !/Standalone/
!/Standalone/** !/Standalone/**
/Standalone/Build/ /Standalone/Build/
/Standalone/bin/ /Standalone/bin/
# Research and prototype experiments.
!/Experiments/
!/Experiments/**
# The guarded single-entry test harness is source, not generated output. # The guarded single-entry test harness is source, not generated output.
!/Tools/ !/Tools/
!/Tools/** !/Tools/**
+57
View File
@@ -0,0 +1,57 @@
# AGENTS.md — VoxelForge (read automatically by Codex)
You are the implementation agent. The orchestrator (Claude) writes each round's brief, reviews your diff against the
code, and commits. The owner decides direction. Be warm and direct; credit what worked; say plainly what didn't.
Read first, as the task needs: `CURRENT-STATE.md` (what ships, reference numbers, **closed experiments: don't reopen
them without new evidence**), then `CODEMAP.md` and `ARCHITECTURE.md`. Round reports live in
`Standalone/Research/WorldAssemblerM3/Linux*/REPORT.md`.
## Standing rules (every round, unless the brief says otherwise)
- Run as user `jahni`. Write only inside this plugin, plus `/home/jahni/VFHost` and `/home/jahni/UnrealEngine` when
the brief asks for a UE build. No installs, no system changes.
- **No `git commit`, `push` or `stash`.** Leave changes in the working tree; the orchestrator reviews and commits.
- Headless processes and builds: `taskset -c 0-11 prlimit --as=6442450944` (12 P-core threads, 6 GiB). Never use all
cores.
- Unreal (UBT, the editor, commandlets): `taskset -c 0-11` only, **never `prlimit`** (CoreCLR fails). UE builds use
`-NoUBA -MaxParallelActions=4`, never while timing.
- Stop any single run that passes 30 minutes. Logs go in `Saved/Linux/l<round>/`.
- **Timing:** quiet machine only (check `uptime` first; load < ~1.5, nothing else building). L80 protocol: one warm-up
per binary, ≥5 interleaved runs, W8 and W12, all four owner layers. Every number states the window that produced it.
- **Same world for everyone:** a seed must give the same world on every machine and worker count (Clang and GCC,
W1/W8/W12). Byte-identity with older versions is NOT required. If the output changes: bump
`WorldAssemblyEvaluatorVersion`, add baselines, and show captures.
- Density sign: negative = solid, positive = air. Core voxels are 25 cm. Never mix metres and voxels without an
explicit conversion (v225 shipped a reach bug from exactly that).
- The fast tier (`Standalone/Tools/verify/verify.py fast`) must stay green. Don't loosen an audit to make a change pass.
## How to work
1. **Count before you build.** Measure where the time or the failure actually is (stack sampler, census, counters).
State which parts are measured and which are inferred.
2. **Suspect the measurement first.** An alarming or contradictory number is the instrument until a control rules it
out (A/A runs, an ablation that verifiably removes the work).
3. **No fix without a root cause.** Reproduce it, trace it to its source, fix the cause. A guard that hides the symptom
is not a fix.
4. **One change at a time,** each with its own check.
5. **Subtract before you add.** Prefer removing work to reorganising it. The smallest edit that solves the problem.
6. **Attack the premise.** When two fixes sharing one premise fail the same gate, write that premise in one sentence
and question it before trying a third. **After three failed fixes, stop:** it is probably the design, not the
hypothesis. Report it instead of trying fix #4.
7. **Tests must be able to fail.** Name what would make each check fail. Add a negative control when you add an audit.
8. **Refactors:** pin the behaviour (hashes), change the structure, prove nothing changed.
9. **Verify before you claim.** Don't report a check as passed unless it ran on the final source. Say which checks
didn't run and why.
10. Changes that speed things up go in the shared layer, so every generator benefits.
## Report
Write the round's `REPORT.md`, short and plain:
- the result first;
- what changed and why;
- the measurements, with their windows;
- the checks run, and those not run;
- remaining risks.
List any changed Unreal `Source/` files, because the owner compiles them on Windows.
+8 -7
View File
@@ -1522,11 +1522,12 @@ collision ring became walkable at 0.632 s. `voxel.StreamingCoarseFirst=1` with
residency by about one third on the staged plan, but null-RHI residency does not prove rendered residency by about one third on the staged plan, but null-RHI residency does not prove rendered
enclosure. Keep coarse-first opt-in until that view is checked in a rendered owner-plan run. enclosure. Keep coarse-first opt-in until that view is checked in a rendered owner-plan run.
The separate `voxel.StreamingStartupApplyBoost` switch stays default-off. At `1`, it temporarily allows The separate `voxel.StreamingStartupApplyBoost` switch is default-on in the current code. At `1`, it
12 visible mesh submissions / 14 ms while the initial desired set and walkable ring are incomplete, temporarily allows up to 24 visible mesh submissions / 14 ms while the initial desired set and
with a 30 second ceiling; at `0`, the authored budget is unchanged. On the matched legacy-order test, walkable ring are incomplete, with a 30 second ceiling; at `0`, the authored budget is unchanged.
the boost changed full-set readiness from 17.412 s to 17.346 s and removed count-cap frames, but did The historical matched S6 run changed full-set readiness from 17.412 s to 17.346 s and removed
not improve end-to-end residency. Keep the normal 4 / 2 ms guard for play. count-cap frames, but did not improve end-to-end residency. These current defaults are defined in
`Source/VoxelForge/Private/VoxelWorld.cpp`; the S6 measurement remains historical context.
The S6 trace found the shared pool was not saturated: its 10-slot idle estimate was about 132 The S6 trace found the shared pool was not saturated: its 10-slot idle estimate was about 132
slot-seconds on legacy order and 73 on gated coarse-first, while game-thread tile applies totaled only slot-seconds on legacy order and 73 on gated coarse-first, while game-thread tile applies totaled only
@@ -1556,8 +1557,8 @@ by its RAII guard when the worker lambda exits. This still counts queued and run
results do not consume an admission slot. `voxel.StreamingLegacyPendingResultCap=1` restores the old results do not consume an admission slot. `voxel.StreamingLegacyPendingResultCap=1` restores the old
`PendingTiles` accounting; the test harness's `NearReserveMode=Legacy` also sets `PendingTiles` accounting; the test harness's `NearReserveMode=Legacy` also sets
`voxel.StreamingDynamicNearReserve=0`, reproducing the S6 path. `StreamingDynamicNearReserve` now `voxel.StreamingDynamicNearReserve=0`, reproducing the S6 path. `StreamingDynamicNearReserve` now
defaults to `1`; `StreamingCoarseFirst` remains `0`, and the apply boost remains `0` in the matched defaults to `1`; `StreamingCoarseFirst` remains `0`. That historical S6 matched measurement disabled
measurement. the startup apply boost (`voxel.StreamingStartupApplyBoost=0`); the current default is on (§8.27).
On the 2,578-key owner SurfaceWorld trace, the old-path control reached the full set in 17.527 s, On the 2,578-key owner SurfaceWorld trace, the old-path control reached the full set in 17.527 s,
walkable ring in 0.650 s, and full LOD0 in 2.281 s. Dynamic admission reached them in 7.780 s, walkable ring in 0.650 s, and full LOD0 in 2.281 s. Dynamic admission reached them in 7.780 s,
+1
View File
@@ -10,6 +10,7 @@ then wait for his results / pasted errors. Same for in-editor checks — ask for
try to run anything. try to run anything.
## Read first (in order, load only what the task needs) ## Read first (in order, load only what the task needs)
- **[CURRENT-STATE.md](CURRENT-STATE.md) — current shipping snapshot and verification entry point.**
- **[CODEMAP.md](CODEMAP.md) — ALWAYS.** Navigation: what it is, data-flow (§2), symbol→`file:line` - **[CODEMAP.md](CODEMAP.md) — ALWAYS.** Navigation: what it is, data-flow (§2), symbol→`file:line`
index (§3), "I want to change X → go here" (§5), conventions & gotchas (§6). Trust **symbol names index (§3), "I want to change X → go here" (§5), conventions & gotchas (§6). Trust **symbol names
over line numbers** (lines drift). over line numbers** (lines drift).
+2 -2
View File
@@ -388,7 +388,7 @@ casse cette arithmetique *structurellement* — `BeginPlay` loggue une **Error**
| `AdvanceHeadlessDigMotionTest` / `RecordHeadlessDigMotionFrame` | 3060 / 3217 | Explicit `-voxel.TestDigMotion=1` repro: optional near digs, then repeats underfoot digs and samples `Generator->GetDensityAt` immediately after each edit, on its first subsequent simulated frame, and on every following observation frame. `-voxel.TestDigMotionFieldOverride=1` is a measurement-only prototype that clears `CurrentFloor` and switches CMC to falling when the sampled post-edit density is air; it is inactive by default. The test counts false support, false air and downward velocity beyond one gravity step. `-voxel.TestDigMotionUnderfootDigCount` is clamped to 1–100; `-voxel.TestDigMotionUnderfootIntervalSeconds=0` performs per-frame rapid edits. The accompanying gap audit is scoped to the dig session. | | `AdvanceHeadlessDigMotionTest` / `RecordHeadlessDigMotionFrame` | 3060 / 3217 | Explicit `-voxel.TestDigMotion=1` repro: optional near digs, then repeats underfoot digs and samples `Generator->GetDensityAt` immediately after each edit, on its first subsequent simulated frame, and on every following observation frame. `-voxel.TestDigMotionFieldOverride=1` is a measurement-only prototype that clears `CurrentFloor` and switches CMC to falling when the sampled post-edit density is air; it is inactive by default. The test counts false support, false air and downward velocity beyond one gravity step. `-voxel.TestDigMotionUnderfootDigCount` is clamped to 1–100; `-voxel.TestDigMotionUnderfootIntervalSeconds=0` performs per-frame rapid edits. The accompanying gap audit is scoped to the dig session. |
| `MaybeFinishHeadlessStreamingTest` | — | The existing `voxel.TestExitSeconds` diagnostic emits `VoxelForgeStreamingExitDiag` at most every 30 elapsed seconds, including threshold and early-return test flags; no output when the timer is unconfigured. | | `MaybeFinishHeadlessStreamingTest` | — | The existing `voxel.TestExitSeconds` diagnostic emits `VoxelForgeStreamingExitDiag` at most every 30 elapsed seconds, including threshold and early-return test flags; no output when the timer is unconfigured. |
| `UpdateVisualStalenessAudit` | 5034 | Test-only camera-frustum coverage audit: tracks up to 24 real pre-skirt isosurface points per visible component, then counts frames where no visible tile component covers a previously visible, still-desired point (excluding edited bounds). `voxel.TestVisualGapInjectEarlyHide=1` hides a valid component for three frames and must be caught. `voxel.TestGapAuditLegacyHandoff=1` restores old handoff culling for A/B baselines. | | `UpdateVisualStalenessAudit` | 5034 | Test-only camera-frustum coverage audit: tracks up to 24 real pre-skirt isosurface points per visible component, then counts frames where no visible tile component covers a previously visible, still-desired point (excluding edited bounds). `voxel.TestVisualGapInjectEarlyHide=1` hides a valid component for three frames and must be caught. `voxel.TestGapAuditLegacyHandoff=1` restores old handoff culling for A/B baselines. |
| `ProcessPendingChunks` | 7435 | Drains `CriticalProcessQueue`, `EditedProcessQueue`, `NearProcessQueue`, then `ProcessQueue`; applies under the authored 4-mesh/2 ms budget during normal play and the bounded shared startup budget (12 meshes/14 ms) until the initial desired set and walkable ring are ready. `voxel.StreamingStartupApplyBoost=0` restores the authored budget. `startup_apply_config` traces the actor-read CVar and both budgets; `startup_apply_budget` records activation/end. Reads per-request cancellation before removing its map entry, traces stale/obsolete/aborted discards with epoch and ordinal, then applies via `ApplyTileResult`. Step 1 prequeue still releases here and emits `VFStep1UploadCorpusReleased`. | | `ProcessPendingChunks` | 7435 | Drains `CriticalProcessQueue`, `EditedProcessQueue`, `NearProcessQueue`, then `ProcessQueue`; applies under the authored 4-mesh/2 ms budget during normal play and the default-on bounded startup budget (24 meshes/14 ms, at most 30 s) until the initial desired set and walkable ring are ready. `voxel.StreamingStartupApplyBoost=0` restores the authored budget. `startup_apply_config` traces the actor-read CVar and both budgets; `startup_apply_budget` records activation/end. Reads per-request cancellation before removing its map entry, traces stale/obsolete/aborted discards with epoch and ordinal, then applies via `ApplyTileResult`. Step 1 prequeue still releases here and emits `VFStep1UploadCorpusReleased`. |
| `ApplyTileResult` | — | **Shared game-thread apply** for one `FChunkResult` (async drain + sync carve): discards stale generation epochs and keys no longer desired, marks loaded, ingests capture, EMPTY releases the tile's existing component (a re-gen can flip content→empty on band change — old geometry must not linger), else `ApplyMeshToTile`. Returns true iff a visible mesh uploaded (counts the budget). Doesn't touch `PendingTiles` (caller's). | | `ApplyTileResult` | — | **Shared game-thread apply** for one `FChunkResult` (async drain + sync carve): discards stale generation epochs and keys no longer desired, marks loaded, ingests capture, EMPTY releases the tile's existing component (a re-gen can flip content→empty on band change — old geometry must not linger), else `ApplyMeshToTile`. Returns true iff a visible mesh uploaded (counts the budget). Doesn't touch `PendingTiles` (caller's). |
| `FVoxelStackSampler` / `FScopedVoxelStackRegistration` (`VoxelStackSampler.h/.cpp`) | — | **Diagnostic raw stack sampler, off by default.** A sampler thread captures registered generation workers' stacks (`CaptureThreadStackBackTrace`) every N µs and tags each with the tile's LOD. It writes bounded raw PCs to CSV plus a symbolization-free summary under `Saved/`; symbol resolution is deferred until after process exit so the measured process never initializes/calls DbgHelp for this diagnostic. Lifecycle teardown is serialized and registration TLS is session-tagged. Registration is per tile TASK in `LoadTile` (and the export's tasks), never per sample; disabled costs one relaxed atomic load. Game `-voxel.SampleStacks=<us>`, commandlet `-samplestacks[=us]`. | | `FVoxelStackSampler` / `FScopedVoxelStackRegistration` (`VoxelStackSampler.h/.cpp`) | — | **Diagnostic raw stack sampler, off by default.** A sampler thread captures registered generation workers' stacks (`CaptureThreadStackBackTrace`) every N µs and tags each with the tile's LOD. It writes bounded raw PCs to CSV plus a symbolization-free summary under `Saved/`; symbol resolution is deferred until after process exit so the measured process never initializes/calls DbgHelp for this diagnostic. Lifecycle teardown is serialized and registration TLS is session-tagged. Registration is per tile TASK in `LoadTile` (and the export's tasks), never per sample; disabled costs one relaxed atomic load. Game `-voxel.SampleStacks=<us>`, commandlet `-samplestacks[=us]`. |
| Room-cache performance (2026-09-13): `VF_FindPlayerFitPointForRoomMemoized` / `GPlayerFitMemo` (`VoxelCaveMorphology.cpp`), `voxel.TileCacheWindow` + `VoxelGenLOD::TileOriginVoxels/TileCellsPerAxis` (`VoxelGenerator.h`), `FChunkSDFSpatialIndex` | — | **Player-fit memo:** exact 97-word key, process-wide, `voxel.PlayerFitMemo`. **Tile cache window:** the room cache covers the requesting tile's footprint plus a fixed collect margin. It is set via `TGuardValue` in `GenerateMesh`/classify, and is window-invariant by construction (the margin does not grow with the tile). **LOD-gated:** fused path at LOD ≥ `voxel.TileCacheWindowMinLOD` (3), op-stack at LOD ≥ `voxel.TileCacheWindowOpStackMinLOD` (4); lower LODs keep the 4-chunk worker window, because the tile window slowed LOD0 evaluation ~6%. Strates whose authored terrain ops exceed the proven 256-voxel extent (or are malformed/unloaded) fall back to the legacy window (`VF_ComputeTerrainOpEnvelope`). `voxel.SpatialIndex` is -1 auto (off at fused LOD0, on elsewhere), 0 or 1. **Spatial index:** ordered XY buckets over cache primitives, exact rejection. The `static_assert` in `VoxelStrateTypes.h` ties `VF_STRATE_PARAM_FIELDS` to `FStrateGenerationParams` (83 fields + 8 B padding). | | Room-cache performance (2026-09-13): `VF_FindPlayerFitPointForRoomMemoized` / `GPlayerFitMemo` (`VoxelCaveMorphology.cpp`), `voxel.TileCacheWindow` + `VoxelGenLOD::TileOriginVoxels/TileCellsPerAxis` (`VoxelGenerator.h`), `FChunkSDFSpatialIndex` | — | **Player-fit memo:** exact 97-word key, process-wide, `voxel.PlayerFitMemo`. **Tile cache window:** the room cache covers the requesting tile's footprint plus a fixed collect margin. It is set via `TGuardValue` in `GenerateMesh`/classify, and is window-invariant by construction (the margin does not grow with the tile). **LOD-gated:** fused path at LOD ≥ `voxel.TileCacheWindowMinLOD` (3), op-stack at LOD ≥ `voxel.TileCacheWindowOpStackMinLOD` (4); lower LODs keep the 4-chunk worker window, because the tile window slowed LOD0 evaluation ~6%. Strates whose authored terrain ops exceed the proven 256-voxel extent (or are malformed/unloaded) fall back to the legacy window (`VF_ComputeTerrainOpEnvelope`). `voxel.SpatialIndex` is -1 auto (off at fused LOD0, on elsewhere), 0 or 1. **Spatial index:** ordered XY buckets over cache primitives, exact rejection. The `static_assert` in `VoxelStrateTypes.h` ties `VF_STRATE_PARAM_FIELDS` to `FStrateGenerationParams` (83 fields + 8 B padding). |
@@ -396,7 +396,7 @@ casse cette arithmetique *structurellement* — `BeginPlay` loggue une **Error**
| `RecordTileHash` / `WriteTileHashDump` | — | Headless `-voxel.TileHashDump=<absolute path>` parity instrument. Records the exact `FVoxelMeshData` used by the streaming result, including empty/classified tiles, then writes sorted absolute tile keys, LOD step/cells, content-band limits, settings digest context, and the shared `VoxelGeometryHash` at `EndPlay`. | | `RecordTileHash` / `WriteTileHashDump` | — | Headless `-voxel.TileHashDump=<absolute path>` parity instrument. Records the exact `FVoxelMeshData` used by the streaming result, including empty/classified tiles, then writes sorted absolute tile keys, LOD step/cells, content-band limits, settings digest context, and the shared `VoxelGeometryHash` at `EndPlay`. |
| `SyncRemeshTile` | — | **INSTANT DIG**: level-0 same-frame re-mesh on the game thread. Uses `PreEditDensityCache` when the tile is resident in the bounded local cache, replays the current DiffLayer over that exact procedural lattice, then meshes/applies inline so a carve is visible THIS frame. A cache miss uses normal generation; it captures the unedited lattice if the tile needs meshing, while uniform-tile proofs remain enabled. | | `SyncRemeshTile` | — | **INSTANT DIG**: level-0 same-frame re-mesh on the game thread. Uses `PreEditDensityCache` when the tile is resident in the bounded local cache, replays the current DiffLayer over that exact procedural lattice, then meshes/applies inline so a carve is visible THIS frame. A cache miss uses normal generation; it captures the unedited lattice if the tile needs meshing, while uniform-tile proofs remain enabled. |
| `PreEditDensityCache` / `VoxelForgePreEditDensityCache::BuildEditedGrid` | — | Per-world cache of the pawn's current L0 tile: exact 35³ pre-edit samples, max **171,500 bytes**. It is pruned when the pawn crosses chunk boundaries and cleared on `RegenerateAllChunks`. `BuildEditedGrid` snapshots touched diff chunks once and reproduces `GetDensityAt`'s final `pre-edit - EvaluateMods` operation before the per-call shared-grid mesher path. | | `PreEditDensityCache` / `VoxelForgePreEditDensityCache::BuildEditedGrid` | — | Per-world cache of the pawn's current L0 tile: exact 35³ pre-edit samples, max **171,500 bytes**. It is pruned when the pawn crosses chunk boundaries and cleared on `RegenerateAllChunks`. `BuildEditedGrid` snapshots touched diff chunks once and reproduces `GetDensityAt`'s final `pre-edit - EvaluateMods` operation before the per-call shared-grid mesher path. |
| `UpdateChunksAroundPosition` / `GetGenerationAdmissionCount` | 10990 / 10971 | Shared Core/legacy scheduler. Builds the desired set and delta-culls leavers; admits the occupied/support tile plus collision-required LOD0 tiles in the pawn's 3×3 XY ring as `CollisionCritical`. S5 coarse-first admission stays opt-in (`voxel.StreamingCoarseFirst=1`). `voxel.StreamingDynamicNearReserve=1` is now the default: it keeps the authored near reserve while moving or until the stationary walkable ring is ready, then makes those slots available to coarse work. Admission counts submitted queued/running tasks, not completed results waiting in the MPSC result queues; `voxel.StreamingLegacyPendingResultCap=1` restores the old `PendingTiles`-based cap for the negative control. `PendingTiles` still lasts through game-thread apply for duplicate suppression and result bookkeeping. The clipmap stays non-overlapping and load-before-unload / `TransitionHold` reconciliation remains authoritative. Standalone has no mirror of this actor scheduler. §8.10 + §8.26–8.28. | | `UpdateChunksAroundPosition` / `GetGenerationAdmissionCount` | 10990 / 10971 | Shared Core/legacy scheduler. Builds the desired set and delta-culls leavers; admits the occupied/support tile plus collision-required LOD0 tiles in the pawn's 3×3 XY ring as `CollisionCritical`. S5 coarse-first admission stays opt-in (`voxel.StreamingCoarseFirst=1`). `voxel.StreamingDynamicNearReserve=1` is the default: it keeps the authored near reserve while moving or until the stationary walkable ring is ready, then makes those slots available to coarse work. Admission counts submitted queued/running tasks, not completed results waiting in the MPSC result queues; `voxel.StreamingLegacyPendingResultCap=1` restores the old `PendingTiles`-based cap for the negative control. `voxel.StreamingFarApplySupplement=1` is the default L121 lane: after the visible-apply cap, at most one far result is admitted when under half the apply-time budget and startup boost is inactive. `PendingTiles` still lasts through game-thread apply for duplicate suppression and result bookkeeping. The clipmap stays non-overlapping and load-before-unload / `TransitionHold` reconciliation remains authoritative. Standalone has no mirror of this actor scheduler. §8.10 + §8.26–8.28. |
| `AdvanceHeadlessCollisionGateStressTest` / `ObserveHeadlessCollisionGateStressTest` / `MaybeFinishHeadlessCollisionGateStressTest` / `MeasureHeadlessCollisionGateStressTerrain` | — | Explicit `-voxel.TestCollisionGateStress=1` harness only. The normal spawn-height cvar offsets from the measured density surface; `voxel.TestCollisionGateStressDeepDrop=1` carves a process-local box shaft from above the top to just above the floor tile, extending along the post-landing route so the pawn does not run into the shaft sidewall, temporarily raises only the transient test DiffLayer brush-radius allowance for that fixture, removes only the local pawn's redundant streaming anchor for this isolated repro, proves every sample in two complete outside-ring level-0 tiles is air before seeding their known-empty status, prewarms the known-empty in-ring column, and asserts that the support walk reaches the in-layout floor outside the aligned level-0 render ring before the pawn drops. The log reports whether the fixed gate retains that otherwise out-of-ring target. Other streaming anchors remain active. The fixture rejects a target or floor outside the layout, a non-air empty-tile proof, or a floor inside the aligned level-0 ring. The `GetDensityAt` column at capsule feet defines the local air/solid surface; the deep-drop column crossing is cached after its first exact scan. Each frame records actor position, velocity, direct foot tile and gate support readiness, gate state, signed feet clearance, and a ≤0.5-voxel sweep between positions. PASS requires no measured clearance below −5 cm; deep-drop gate-on also requires horizontal travel during a hold. Result logs include the terminal density column, first crossing below spawn height, hold count/time, and gated horizontal progress. | | `AdvanceHeadlessCollisionGateStressTest` / `ObserveHeadlessCollisionGateStressTest` / `MaybeFinishHeadlessCollisionGateStressTest` / `MeasureHeadlessCollisionGateStressTerrain` | — | Explicit `-voxel.TestCollisionGateStress=1` harness only. The normal spawn-height cvar offsets from the measured density surface; `voxel.TestCollisionGateStressDeepDrop=1` carves a process-local box shaft from above the top to just above the floor tile, extending along the post-landing route so the pawn does not run into the shaft sidewall, temporarily raises only the transient test DiffLayer brush-radius allowance for that fixture, removes only the local pawn's redundant streaming anchor for this isolated repro, proves every sample in two complete outside-ring level-0 tiles is air before seeding their known-empty status, prewarms the known-empty in-ring column, and asserts that the support walk reaches the in-layout floor outside the aligned level-0 render ring before the pawn drops. The log reports whether the fixed gate retains that otherwise out-of-ring target. Other streaming anchors remain active. The fixture rejects a target or floor outside the layout, a non-air empty-tile proof, or a floor inside the aligned level-0 ring. The `GetDensityAt` column at capsule feet defines the local air/solid surface; the deep-drop column crossing is cached after its first exact scan. Each frame records actor position, velocity, direct foot tile and gate support readiness, gate state, signed feet clearance, and a ≤0.5-voxel sweep between positions. PASS requires no measured clearance below −5 cm; deep-drop gate-on also requires horizontal travel during a hold. Result logs include the terminal density column, first crossing below spawn height, hold count/time, and gated horizontal progress. |
| `BuildDesiredTiles` | 6482 | Builds `DesiredSorted`+`DesiredStamped` (player clipmap shells), then adds streaming anchors and the pending player's collision-only support column before the leaver sweep. It orders from the true local pawn position and builds `CriticalDesiredTiles` for the unresolved support target, occupied/support and heading tiles. Also rebuilds `DesiredTransitionDescendants` (ancestor → desired descendants, including face/edge-touching replacements) for the reconcile pass. | | `BuildDesiredTiles` | 6482 | Builds `DesiredSorted`+`DesiredStamped` (player clipmap shells), then adds streaming anchors and the pending player's collision-only support column before the leaver sweep. It orders from the true local pawn position and builds `CriticalDesiredTiles` for the unresolved support target, occupied/support and heading tiles. Also rebuilds `DesiredTransitionDescendants` (ancestor → desired descendants, including face/edge-touching replacements) for the reconcile pass. |
| `CollisionGateDesiredTiles` / `RequestCollisionGateSupportTile` | 5062 | Retains an unresolved support target and up to three level-0 tiles below it across desired-set rebuilds. The additional keys are hidden collision-only tiles, queued ahead of ordinary streaming, and pruned once resolved or outside the active column. | | `CollisionGateDesiredTiles` / `RequestCollisionGateSupportTile` | 5062 | Retains an unresolved support target and up to three level-0 tiles below it across desired-set rebuilds. The additional keys are hidden collision-only tiles, queued ahead of ordinary streaming, and pruned once resolved or outside the active column. |
+57
View File
@@ -0,0 +1,57 @@
# VoxelForge current state
As of 2026-10-31. L131 is on `assembler/world` as `8107196`; this L132 worktree is on `wip/l132-dispatch-truth`, starting at `ebae71b`. Current-state claims below point to their code or measured report.
## What ships today
- **Core:** evaluator version **227**. Unreal's `AVoxelWorld::bUseVoxelForgeCore` is opt-in and defaults to `false`; the legacy generator remains the default runtime path. [Core version](Standalone/Core/include/VoxelForgeCore/VoxelForgeCore.h), [runtime switch](Source/VoxelForge/Public/VoxelWorld.h), [L130 report](Standalone/Research/WorldAssemblerM3/Linux130/REPORT.md).
- **Verified owner4 generator dispatch (L132):** SW binds `SurfaceWorld-native` because the owner export contains a matching `SurfaceWorld.Heightfield2D` v2 plan. FI binds `compiled-analytic/FloatingIslands` because its `FloatingIslands.ClusterField` v0 layout has no matching native island plan. TN and VS bind `compiled-analytic/TunnelNetwork` and `compiled-analytic/VerticalShafts`; their legacy recipe IDs provide neither a `NativeCaves`/`NativeLattice` graph recipe nor native field capability. The L132 fast-tier report prints the binding and generated tile-center share at each owner strate. [Dispatch](Standalone/Core/src/ShapeWorldInternal.h), [adapter recipe checks](Standalone/Core/include/VoxelForgeCore/VoxelForgeCore.h), [L132 report](Standalone/Research/WorldAssemblerM3/Linux132/REPORT.md).
- **Passages:** continuous smooth swept tubes with a continuous floor profile. L125 stamps conservative route slabs and outside sentinels into the tile cache; exact route geometry is still evaluated. All 21,425 route samples passed the open-air walk check; the nine-station floor probe's maximum root offset was 7.884 mm. L130 sets the shared influence reach to **1.0533 m** (0.75 m shell + 0.21 m relief + 0.50 m smooth-max support / 6 + 0.01 m margin), converted once from metres to Core voxels for the proof, feature, fallback, and off-grid bounds. [L125](Standalone/Research/WorldAssemblerM3/Linux125/REPORT.md), [L130](Standalone/Research/WorldAssemblerM3/Linux130/REPORT.md).
- **Streaming:** arrival uses a bounded startup apply burst: `voxel.StreamingStartupApplyBoost=1` by default, up to 24 visible meshes or 14 ms per frame for at most 30 seconds, until the initial desired set and walkable ring are ready. `voxel.StreamingFarApplySupplement=1` is also default-on: after the normal visible apply cap, at most one far result applies when under half the apply-time budget; it is inactive during the startup burst. Dynamic near reserve defaults on; coarse-first remains off; the legacy pending-result cap defaults off. The L165/L166 incremental desired-set path now defaults on (`voxel.StreamingIncrementalDesiredSet=1`): Core clipmap keys, overlay membership, and priority order update incrementally, with same-center Core keys cached. No separate overlay or priority incremental switches are required. Audits stay off (`StreamingIncrementalDesiredAuditEvery=0`, `StreamingIncrementalDesiredMaterializationAuditEvery=0`, mismatch injection `=0`). L157 early admission and apply-cap controls stay off (`StreamingFastTravelWaitForAllCriticalTiles=1`, `StreamingFastTravelApplyBudgetMilliseconds=0`). L160 ahead-first and same-center rebuild suppression stay off (`StreamingFastTravelForwardFirst=0`, `StreamingRebuildOnCoreRegionCompletion=1`). Its separate Core desired-cache switch stays off (`StreamingCoreDesiredCacheByCenter=0`); the new incremental path enables its own same-center Core cache. The far-apply lane is Unreal-only. [CVar source](Source/VoxelForge/Private/VoxelWorld.cpp), [L121 report](Standalone/Research/WorldAssemblerM3/Linux121/REPORT.md), [architecture](ARCHITECTURE.md).
- **Determinism:** proven on Linux with Clang and GCC at W1/W8/W12. L131's unchanged-output comparison covers owner4's SW/FI/TN/VS views in 24 compiler/worker cases; the canonical owner4/owner2 recipe matrix also passes. Windows determinism is unverified. [L131 checks](Standalone/Research/WorldAssemblerM3/Linux131/REPORT.md), [v227 canonical hashes](Standalone/Tools/verify/baselines/owner-hash/canonical/).
## Current performance references
Headless medians in seconds, five interleaved L80-style measurements per version in each cell. Near-ready means the complete LOD0–2 set; whole-view is the full requested view. Values below are the edited L131 binary; the paired pre-cleanup comparison is in the [L131 report](Standalone/Research/WorldAssemblerM3/Linux131/REPORT.md) and [timing summary](Saved/Linux/l131/timing/summary.json).
| Stratum | Near-ready W8 / W12 | Whole-view W8 / W12 |
|---|---:|---:|
| S0 | 0.804 / 0.848 | 1.811 / 1.832 |
| S1 | 1.014 / 1.002 | 1.993 / 1.886 |
| S2 | 1.060 / 1.012 | 1.960 / 1.865 |
| S3 | 0.917 / 0.884 | 1.887 / 1.782 |
Across 40 paired runs per metric, the mean relative change from pre-cleanup L130 was −0.22% near-ready (95% CI −1.02% to +0.57%) and −0.29% whole-view (−1.04% to +0.46%); neither indicates a measurable slowdown. The machine gate was load 0.81 and 99.2% idle. [L80 protocol](Standalone/Research/WorldAssemblerM3/Linux80/REPORT.md), [runner and raw runs](Standalone/Research/WorldAssemblerM3/Linux131/RunL131Timing.py).
The latest recorded Linux Unreal start-to-LOD0–2 values are L127's one run per stratum: S0 2.456 s, S1 2.231 s, S2 2.514 s, S3 2.221 s. L130 did not rerun UE startup or movement. Five L127 runs at 30 m/s, 12 s moving plus 5 s dwell, had median moving near coverage **40.22%**, far holes **3.46%**, tick p99 **10.80 ms**, and worst tick **13.27 ms**. After stopping, near coverage reached 100% and far holes reached 0%. These are the latest UE references, not v227 UE measurements. [L127 report](Standalone/Research/WorldAssemblerM3/Linux127/REPORT.md), [L127 movement summary](Saved/Linux/l127/ue/movement-pairs-summary.json), [L127 start summaries](Saved/Linux/l127/ue/merge/start-summary.json).
## Open gaps
- Multiplayer world lifecycle is unfinished: seed/layout replication, authoritative modification RPCs, and serialized diff replay for late join are still open. See [ARCHITECTURE §9.5 and §9.7](ARCHITECTURE.md).
- Determinism has not been verified on Windows. Linux Clang/GCC agreement does not establish MSVC agreement.
- NullRHI measures residency and apply timing, not the first presented pixel or rendered enclosure. L127 also found four low-contrast views among 23 otherwise verified captures. [L121](Standalone/Research/WorldAssemblerM3/Linux121/REPORT.md), [L127](Standalone/Research/WorldAssemblerM3/Linux127/REPORT.md).
- UE startup/movement numbers above predate L130's v227 reach change; there is no L130/L131 UE movement comparison.
## How to verify
- Build standalone Clang or GCC with [`Standalone/BuildLinux.sh`](Standalone/BuildLinux.sh), for example `bash Standalone/BuildLinux.sh --compiler=clang++-19 --variant=l132-clang --fp-contract=off --jobs=4`. The script pins CPUs 0–11 and applies `prlimit --as=6442450944` itself.
- Fast tier: `python3 Standalone/Tools/verify/verify.py fast --out Saved/Linux/l132 --overall-timeout 1740`. It includes the L132 four-pose owner density-dispatch report; per-run logs and the summary stay under `Saved/Linux/l132`.
- Canonical output baselines are the v227 files in `Standalone/Tools/verify/baselines/owner-hash/canonical/`. L131 also provides reproducible pre-cleanup identity matrices for owner4 tile hashes and owner4/owner2 canonical hashes under `Standalone/Research/WorldAssemblerM3/Linux131/`.
- Timing follows L80: quiet machine, no overlapping build, one warm-up per version, five interleaved runs per stratum and worker count, W8/W12. Each headless run uses `taskset -c 0-11`, `prlimit --as=6442450944`, and a 1,740 s timeout. See [`RunL131Timing.py`](Standalone/Research/WorldAssemblerM3/Linux131/RunL131Timing.py).
- Linux host build: `/home/jahni/UnrealEngine/Engine/Build/BatchFiles/Linux/Build.sh VFHostEditor Linux Development -Project=/home/jahni/VFHost/VFHost.uproject -NoUBA -MaxParallelActions=4 -Log=/home/jahni/VoxelM/Plugins/VoxelForge/Saved/Linux/l131/ubt.log`. Run Unreal without `prlimit`.
## Closed experiments
These rejected speed/streaming proposals stay closed unless new evidence changes their measured failure. Reports and surviving patches are linked in the [L131 inventory](Standalone/Research/WorldAssemblerM3/Linux131/REPORT.md).
| Line | Result |
|---|---|
| L116 tunnel chord bound and z cache | Pair count fell 20.8%, but stayed 1.96× L109 and readiness was 15–30% slower. Patch: [`chord-bound-zcolumn-not-merged.patch`](Standalone/Research/WorldAssemblerM3/Linux116/patches/chord-bound-zcolumn-not-merged.patch), commit `89504ec`; see [report](Standalone/Research/WorldAssemblerM3/Linux116/REPORT.md). |
| L118 pair pruning / deferred floor work | Pruned 17–18% of candidate pairs but remained 17.2–25.7% behind L109 near-ready. [Report](Standalone/Research/WorldAssemblerM3/Linux118/REPORT.md); patch: [`l118-designs.patch`](Standalone/Research/WorldAssemblerM3/Linux118/l118-designs.patch). |
| L126 floor-call filters | Cut floor calls 20–23% without reducing pair counts; all eight cells missed L109. Candidate source was restored and no standalone patch was kept; see [report](Standalone/Research/WorldAssemblerM3/Linux126/REPORT.md) and commit `01a5094`. |
| L128 half-open slab ownership | Ownership audit passed, but readiness was 14.8–28.0% behind L109 and moving coverage dropped. Report and patch `l128-slab-ownership.patch` are in archived commit `7022d02`. |
| L129 2 m physical reach | v225's metre/Core-voxel bounds mismatch made the correctly bounded candidate do more work; it was slower and failed UE movement gates. Report and patch `l129-reach-2m.patch` are in archived commit `0d1140c`. |
| L120 priority split / extra worker slots | Neither met coverage and tick gates; 10 slots reached a 16.67 ms worst tick against 15.43 ms baseline. [Report](Standalone/Research/WorldAssemblerM3/Linux120/REPORT.md); no production patch retained. |
| L122 admission relaxation | Early admission missed p99 or far-hole gates; no behavior retained. [Report](Standalone/Research/WorldAssemblerM3/Linux122/REPORT.md); patch: [`l122-trace.patch`](Standalone/Research/WorldAssemblerM3/Linux122/l122-trace.patch). |
| L123 lookahead / completion gate | Lookahead failed p99 and worsened near/far coverage; queue-only also failed p99. [Report](Standalone/Research/WorldAssemblerM3/Linux123/REPORT.md); patch: [`l123-queue-lookahead.patch`](Standalone/Research/WorldAssemblerM3/Linux123/l123-queue-lookahead.patch). |
| L124 early LOD0 pages | Optimistic gain stayed below 100 ms except negative cases; no publication/scheduling implementation was made. [Report](Standalone/Research/WorldAssemblerM3/Linux124/REPORT.md). |
File diff suppressed because it is too large. Load diff
+201
View File
@@ -0,0 +1,201 @@
# L162 — Living Plane
The EGL/OpenGL 4.3 runner builds and passes its llvmpipe correctness and frame checks. The sandbox has no accessible DRM render node, so it did not run or report Intel GPU performance. The runner refuses `--device=gpu` here instead of falling back to software.
## Implementation
`LivingPlane.cpp` runs a ping-pong `RG32F` height/velocity field through a runtime-compiled GLSL compute shader. The damped wave update includes a weak foundation spring, a Gaussian sphere push, and an optional slow breathing force. The spring is needed because a persistent local push otherwise accelerates the zero-frequency height mode and sinks the whole plane. The sphere moves across the plane, stops, and bobs. A vertex-displaced mesh and lit sphere render to an EGL pbuffer-backed framebuffer and save as PNGs.
The timestep is selected from the largest 2D grid eigenfrequency:
`dt = 1.30 / sqrt(8*c*c/(dx*dx) + foundationStiffness)`
The resulting spectral step ratio is 1.30, below the explicit update's 2.0 stability limit. The runner warms the compute kernel for eight unmeasured dispatches, then records one `GL_TIME_ELAPSED` query per requested simulation step in `timing.json`.
The first-step equation audit also caught a GL state error during bring-up: frame rendering left the graphics program active before the next compute dispatch. `Dispatch` now binds the compute program before every step, so the audit fails if a frame silently stops simulation.
Device selection enumerates EGL devices and uses `EGL_EXT_platform_device` for an accessible Intel render node first. On this host, the known integrated device is Intel on `renderD128`. Automatic mode falls back to a surfaceless Mesa context with `LIBGL_ALWAYS_SOFTWARE=1`; explicit GPU mode fails when no accessible hardware node is present. EGL does not expose Vulkan's integrated/discrete enum, so Intel vendor/render-node identity is the selection heuristic.
The Unreal handoff is in [UNREAL-MAPPING.md](UNREAL-MAPPING.md). It keeps the prototype render-only and describes the density mapping if the surface later needs to affect voxel queries. No Unreal `Source/` files changed.
## Measurements and checks
- Built with `Experiments/LivingPlane/build.sh` using the installed EGL, desktop GL, and libpng development files; no shader compiler or package install was needed.
- Final llvmpipe run: 128² field, 360 steps, `dt=9.56814 ms`, spectral ratio 1.30. The first-step equation audit and finite-field/dynamics audit passed. Final field range was −0.139533 m to +0.0366704 m. It wrote 16 128×128 PNGs and a JSON file containing 360 per-step query samples. The frames were inspected; the moving sphere and wake are visible.
- Auto-selection smoke check: 32², 12 steps; selected llvmpipe and passed both audits. Breathing smoke check: 64², 180 steps with `--breathing=on`; passed both audits.
- Negative device-selection control: `--device=gpu` returned an error because the sandbox has no accessible EGL DRM render node.
- Existing fast verification tier passed: 278.9 seconds, ending in `SUMMARY PASS`. Its build and logs are under `Saved/Linux/l162/verify/` and `Saved/Linux/l162/`.
- The llvmpipe `GL_TIME_ELAPSED` samples are preserved in JSON but are software-driver query values, not GPU timings. The requested hardware timing pass remains to be run outside the sandbox.
- No Unreal build was run; no Unreal `Source/` files changed.
## Intel GPU pass
Run these from the plugin root as `jahni`. The frame run writes 512×512 PNGs to `Saved/Linux/l162/gpu-frames-512/`; the two timing runs write `timing.json` with one GPU query per step and skip PNG capture. They still read the field for the first-step and final-state correctness audits.
Before the timing runs, check `uptime` and run them on a quiet machine (load below about 1.5, with no other build active).
```sh
uptime
taskset -c 0-11 prlimit --as=6442450944 -- timeout 1740s ./Saved/Linux/l162/living-plane --device=gpu --size=512 --steps=1800 --capture-every=12 --out=Saved/Linux/l162/gpu-frames-512
taskset -c 0-11 prlimit --as=6442450944 -- timeout 1740s ./Saved/Linux/l162/living-plane --device=gpu --size=512 --steps=1800 --capture-every=0 --out=Saved/Linux/l162/gpu-timing-512
taskset -c 0-11 prlimit --as=6442450944 -- timeout 1740s ./Saved/Linux/l162/living-plane --device=gpu --size=1024 --steps=1800 --capture-every=0 --out=Saved/Linux/l162/gpu-timing-1024
```
Encode the captured sequence as MP4 with:
```sh
ffmpeg -y -framerate 30 -i Saved/Linux/l162/gpu-frames-512/frame_%06d.png -c:v libx264 -pix_fmt yuv420p Saved/Linux/l162/living-plane-512.mp4
```
## Files and remaining risk
The only changed file outside `Experiments/LivingPlane/` is `.gitignore`, which now allows `Experiments/` and its contents. GPU timings and Intel render-node selection remain unverified until the commands above run on the host outside this sandbox.
## Intel GPU pass (run by the orchestrator outside the sandbox, 2026-11-02)
- The device was selected correctly: `Mesa Intel(R) Graphics (ADL GT2)`, OpenGL 4.6, `/dev/dri/renderD128`. 512²,
1,800 steps, 151 frames; the equation audit passes. MP4: `Saved/Linux/l162/living-plane-512.mp4` (local).
- **The `GL_TIME_ELAPSED` per-dispatch values (~0.0001 ms) are not credible** for 262k cells, so they aren't
reported as timings.
- Wall-time difference between 1,800 and 200 steps, divided by the 1,600 steps (start-up cancels out; this includes
submission, so it's an upper bound): **0.080 ms/step at 512²** and **0.292 ms/step at 1024²**.
- Visual read: the effect is very subtle in the current render (a slight dip under the sphere, faint rings). It needs
a larger push amplitude, grazing light or height colouring, and a closer camera to read.
## L163 — readable, living plane
The plane now reads as rolling terrain, and the objects leave visible troughs and wakes. `alive` adds travelling
breathing and a viscoelastic imprint that remains after lift-off. The simulation still runs in one GPU dispatch per
step; CPU work only supplies the two object states.
`LivingPlane.cpp` now keeps the dynamic displacement, velocity, and imprint in an `RGBA32F` ping-pong field. The
surface shader adds broad static terrain relief, calculates normals from relief plus displacement, and uses grazing
light, elevation colours, slope tint, and 7.5 cm contour bands. The camera follows the first sphere at a closer angle.
The wake scene rolls the first sphere, pauses and wobbles it, lifts it, then sends a second sphere through the wake.
The alive scene runs that same sequence with low-frequency travelling swells and a decaying contact imprint. Its
defaults are breathing strength 4.8 m/s², imprint capture 0.15 m/s, recovery time 6 s, and maximum imprint depth
0.34 m. These values have command-line overrides.
The timer query check found no early read or reuse in L162: it allocated a unique query per step, called `glFinish`,
then read every result. The saved Intel/Mesa 25.0.7 samples are 0 or 52 ns for most dispatches (512² median 0,
p95 52 ns; largest sample 17.552 µs), which cannot be a credible per-dispatch cost. The old usage did not reuse
query objects, so lifetime is not the cause; the saved data point to Intel/Mesa's timer-query reporting or timing
scope, but the sandbox cannot isolate which. L163 uses a 64-query ring, reads each query before reusing its slot,
checks availability after `glFinish`, and records `GL_QUERY_COUNTER_BITS`. On llvmpipe the availability check passed
with 64 counter bits and zero waits. The Intel query result still needs the GPU diagnostic command below.
### Measurements and checks
- llvmpipe wake: 128², 600 steps (`dt=9.56814 ms`, 5.741 s simulation window), 151 frames at 30 fps. First-step
equation audit and timer-query lifetime check passed; final displacement range was −0.177488 m to +0.104854 m.
- llvmpipe alive: same grid, steps, and window; equation audit and timer-query lifetime check passed. Final
displacement range was −0.200437 m to +0.115904 m, with a −0.111667 m stored imprint.
- llvmpipe cost: 512², 1,800 steps, `--queries=off`, no frame capture: **0.767473 ms/step** in one timed
simulation-loop window. `timing.json` includes dispatch submission, the step-0 equation readback, and final
`glFinish`, but excludes setup and frame capture. This is a software-renderer measurement, not the Intel GPU cost.
- Both five-second llvmpipe previews are in `Saved/Linux/l163/llvmpipe-wake.mp4` and
`Saved/Linux/l163/llvmpipe-alive.mp4`. They are 128² review previews; use the GPU commands below for the owner
videos.
- Equation-audit negative control: a temporary copy with its expected first-step height forced to zero exited FAIL
at actual −0.0488777 m. The final source passes that same check.
- The fast verification tier passed in 278.5 s. Build and logs are under `Saved/Linux/l163/verify/`.
- No Unreal `Source/` files changed and no Unreal build ran.
### Intel GPU run
Run from the plugin root as `jahni`. First build the runner. For timed runs, check `uptime` and keep the machine
quiet. The wall-time field is valid only when `--capture-every=0`; use `--queries=off` for the step-cost measurement.
```sh
bash Experiments/LivingPlane/build.sh
uptime
taskset -c 0-11 prlimit --as=6442450944 -- timeout 1740s ./Saved/Linux/l163/living-plane --device=gpu --scene=wake --size=512 --steps=2400 --capture-every=16 --queries=off --out=Saved/Linux/l163/gpu-wake-512
taskset -c 0-11 prlimit --as=6442450944 -- timeout 1740s ./Saved/Linux/l163/living-plane --device=gpu --scene=alive --size=512 --steps=2400 --capture-every=16 --queries=off --out=Saved/Linux/l163/gpu-alive-512
ffmpeg -y -framerate 30 -i Saved/Linux/l163/gpu-wake-512/frame_%06d.png -c:v libx264 -pix_fmt yuv420p Saved/Linux/l163/living-plane-wake-512.mp4
ffmpeg -y -framerate 30 -i Saved/Linux/l163/gpu-alive-512/frame_%06d.png -c:v libx264 -pix_fmt yuv420p Saved/Linux/l163/living-plane-alive-512.mp4
taskset -c 0-11 prlimit --as=6442450944 -- timeout 1740s ./Saved/Linux/l163/living-plane --device=gpu --scene=alive --size=512 --steps=1800 --capture-every=0 --queries=off --out=Saved/Linux/l163/gpu-timing-512
taskset -c 0-11 prlimit --as=6442450944 -- timeout 1740s ./Saved/Linux/l163/living-plane --device=gpu --scene=alive --size=512 --steps=1800 --capture-every=0 --queries=on --out=Saved/Linux/l163/gpu-query-check-512
```
`gpu-timing-512/timing.json` reports the 512² batch wall time per step, including dispatch submission and completion.
`gpu-query-check-512/timing.json` contains query counter bits, waits before slot reuse, availability status, and raw
per-step query samples. The sandbox has no accessible Intel DRM node, so the current Intel step cost and new query
diagnostic remain unmeasured here.
### L163 Intel GPU pass (run by the orchestrator, 2026-11-02)
- Intel ADL GT2 (Mesa 25.0.7, `renderD128`): wake and alive scenes, 512², 2,400 steps, 151 frames each; equation
audits PASS. Videos (local): `Saved/Linux/l163/living-plane-wake-512.mp4`, `living-plane-alive-512.mp4`.
- Step cost, alive scene, 512², 1,800 steps, no capture: **0.172 ms/step** with queries off, 0.152 ms/step with
queries on (batch wall time per step).
- The Intel `GL_TIME_ELAPSED` median is still 0 with 64 counter bits and the ring/availability checks passing. That
looks like a Mesa/Intel reporting issue; use wall time.
- **Open issue:** the same scene with the same steps gave different final fields (min −0.637 m with queries off vs
−0.327 m with queries on). Something depends on more than the step index (e.g. wall-clock time); investigate.
## L164 — repeatable field readback and UE runtime actor
**Result:** the repeatability check passes on llvmpipe, and the new `VoxelForgeLivingPlane` runtime module compiles
in the Linux UE 5.7 host. The surface actor is independent of VoxelForge generation and sends no field readback to
the CPU.
### Repeatability finding
`uTime` is `Step * dt`, and `GetBodiesAt` receives that same value. Neither the object schedule nor the breathing
force uses wall time or a rendered-frame counter. Every compute step already issued an image-access barrier before
the next ping-pong image read. The defect was on the diagnostic side: the step-zero and final `glGetTexImage`
readbacks followed shader image writes without `GL_TEXTURE_UPDATE_BARRIER_BIT`. The Khronos OpenGL specification
requires that barrier for `GetTexImage` to observe earlier shader writes ([§7.12](https://registry.khronos.org/OpenGL/specs/gl/glspec44.compatibility.pdf)). Query/capture pacing could therefore affect the reported field values without changing any simulation input. The barrier is now issued before both readbacks.
`check_repeatability.py` runs the same 512² alive scene for 1,800 steps twice: queries off with no captures, then
queries on with captures every 900 steps. The checksum covers every final RGBA32F field value using canonical
little-endian float bytes.
- llvmpipe, queries off/capture off: field range −0.637382 m to +0.109308 m; checksum
`1ba08f5dafc01f82`.
- llvmpipe, queries on/capture every 900: the same range and checksum; equation and timer-query audits pass; three
frames written.
- Negative control: changing one saved checksum made the comparison exit 1 with `FAIL field checksum mismatch`.
- The llvmpipe runs were each one 1,800-step simulation-loop window. Logs and JSON are under
`Saved/Linux/l164/repeatability/`.
The Intel run is not available in this sandbox. The owner should repeat the checksum comparison on the GPU to
confirm that the missing transfer-readback barrier accounts for the earlier Intel min mismatch:
```sh
python3 Experiments/LivingPlane/check_repeatability.py --device=gpu --out=Saved/Linux/l164/gpu-repeatability
```
### Unreal implementation and checks
The plugin descriptor adds a separate `VoxelForgeLivingPlane` runtime module. Its RDG global shader is in
`Shaders/LivingPlane.usf`; module startup maps `/Plugin/VoxelForgeLivingPlane` to the plugin shader directory. The
actor owns two UAV-capable RGBA32F render targets, advances them at the stable fixed step, and supplies the current
texture to a movable plane mesh material. Its Blueprint/C++ object input includes world position, radius, velocity,
base push, and active state. The CPU converts those values to plane-local metres and uploads uniforms; it does not
read the field back. The ignore rules now include `Shaders/` so that the shader ships in the worktree diff.
`Experiments/LivingPlane/UE-SETUP.md` gives level setup, the full material graph, and object driving steps.
- Linux UE 5.7 `VFHostEditor Linux Development`: **PASS**, final incremental build compiled
`VoxelForgeLivingPlaneActor.cpp` and linked `libUnrealEditor-VoxelForgeLivingPlane.so`. Command used
`-NoUBA -MaxParallelActions=4`, `taskset -c 0-11`, and no `prlimit`. Log:
`Saved/Linux/l164/ue-build-final.log`. The initial attempt exposed an incorrect RDG texture registration overload;
it had already compiled `VoxelForgeLivingPlaneModule.cpp` and the generated module code. The corrected final
build passed.
- The host `PluginDeps/VoxelForge/Source` and `.uplugin` links were temporarily pointed at this worktree for the
build and restored to `/home/jahni/VoxelM/Plugins/VoxelForge` afterward. The temporary shader link was removed.
- Standalone build, final repeatability comparison, checksum-mismatch negative control, plugin JSON parse, and
`git diff --check` passed.
- Not run: fast generation verification (generation sources are untouched), Intel GPU checksum comparison, or a UE
editor render/shader-runtime check. The Linux UBT build verifies C++ and module integration, not first-use shader
compilation or material appearance.
New Unreal source and shader files for the owner's Windows build:
- `Source/VoxelForgeLivingPlane/VoxelForgeLivingPlane.Build.cs`
- `Source/VoxelForgeLivingPlane/Public/VoxelForgeLivingPlaneActor.h`
- `Source/VoxelForgeLivingPlane/Private/VoxelForgeLivingPlaneActor.cpp`
- `Source/VoxelForgeLivingPlane/Private/VoxelForgeLivingPlaneModule.cpp`
- `Shaders/LivingPlane.usf`
No VoxelForge generation module files changed. Remaining risks are the Intel checksum confirmation and first-use UE
shader/material rendering, which require the owner's GPU/editor run.
+55
View File
@@ -0,0 +1,55 @@
# Living Plane in Unreal Engine 5.7
`VoxelForgeLivingPlane` is a separate runtime module. It does not call the VoxelForge terrain generators and it does not read the simulated texture back to the CPU. The actor owns two transient `RGBA32f` render targets and advances them with an RDG compute pass. The CPU sends object state and fixed-step uniforms only.
## Add it to a level
1. Enable the VoxelForge plugin and restart the editor so the `VoxelForgeLivingPlane` runtime module and its shader mapping load.
2. Create a material named `M_LivingPlane` using the graph below.
3. Place `VoxelForgeLivingPlaneActor` in the level. Assign `M_LivingPlane` to **Plane Material**.
4. Keep the actor on the world XY plane with unit actor scale. `Plane Length Meters` controls the mesh width and simulation width; the built-in plane mesh is scaled to that size.
5. The actor creates and clears its two GPU state targets on `BeginPlay`. The mesh has collision disabled; this surface is render-only and does not change VoxelForge density or collision queries.
## Material graph
Use a Surface, Opaque material. The actor binds these parameters on its dynamic material instance:
- `LivingField`: Texture Object Parameter. The texture is the current RGBA32f simulation state; **R** is displacement in metres.
- `PlaneLengthMeters`: Scalar Parameter.
- `FieldSize`: Scalar Parameter, equal to the render target width and height.
For World Position Offset:
1. Read `LivingField` at `TextureCoordinate[0]` with a Texture Sample.
2. Multiply its **R** output by `100` to convert metres to Unreal centimetres.
3. Append `(0, 0)` to that value, making `(0, 0, heightCm)`, and connect it to **World Position Offset**.
For the displaced normal, sample the height at four UV offsets using the same texture object:
- Left/right UV: `TexCoord + (-1/FieldSize, 0)` and `TexCoord + (1/FieldSize, 0)`.
- Down/up UV: `TexCoord + (0, -1/FieldSize)` and `TexCoord + (0, 1/FieldSize)`.
- `dHdx = (Right.R - Left.R) * FieldSize / (2 * PlaneLengthMeters)`.
- `dHdy = (Up.R - Down.R) * FieldSize / (2 * PlaneLengthMeters)`.
- Make and normalize the tangent-space vector `(-dHdx, -dHdy, 1)`, then connect it to **Normal**.
The built-in plane's U/V tangent directions align with local X/Y. Use a neutral base colour and roughness around `0.7` to start. The graph assumes a horizontal plane; add a local-to-world transform if the plane needs arbitrary rotation.
## Drive objects
`ObjectInputs` has two slots. Each `FVFLivingPlaneObjectInput` contains world position in centimetres, world velocity in centimetres per second, radius in centimetres, base push acceleration in metres per second squared, and an active flag. Blueprint can use **Set Object State** or set the array entry; C++ can call the same method. Set the object's center about one radius above the plane while it contacts it, and mark the slot inactive after lift-off.
The compute shader uses the radius to scale the Gaussian contact footprint. The original wave equation keeps the L163 wave speed, damping, foundation spring, travelling breathing force, and recovering imprint. The base push acceleration supplies the object force; lateral speed adds `0.25 m/s²` per `1 m/s`, and downward speed adds `0.5 m/s²` per `1 m/s`. Upward velocity does not add force. Object positions and velocities are transformed into the plane's local frame and converted from centimetres to metres before upload.
Each step uses `dt = 1.30 / sqrt(8*c*c/(dx*dx) + foundationStiffness)`, with `dx = PlaneLengthMeters / FieldSize`. Simulation time passed to breathing is the fixed step index times `dt`. Game-thread delta time only determines how many fixed steps are queued; no GPU field data is read back in the normal path.
## Build files
The owner's Windows build needs every added source and shader file:
- `Source/VoxelForgeLivingPlane/VoxelForgeLivingPlane.Build.cs`
- `Source/VoxelForgeLivingPlane/Public/VoxelForgeLivingPlaneActor.h`
- `Source/VoxelForgeLivingPlane/Private/VoxelForgeLivingPlaneActor.cpp`
- `Source/VoxelForgeLivingPlane/Private/VoxelForgeLivingPlaneModule.cpp`
- `Shaders/LivingPlane.usf`
The `VoxelForge.uplugin` runtime-module entry must ship with them.
+33
View File
@@ -0,0 +1,33 @@
# Unreal mapping note
The prototype stores height, vertical velocity, a recovering imprint, and a spare
channel in a pair of `RGBA32F` textures. A world-owned Unreal component can keep
equivalent transient render graph textures and advance them with a compute pass. It
should own simulation time and clear or restore its buffers when the world is recreated.
The sphere path becomes a world-space interaction event: position, contact radius,
and impulse strength are supplied to the compute pass. For multiplayer or deterministic
replay, replicate the compact events and simulation tick, or record the resulting field;
do not assume that independent GPU floating-point runs will produce byte-identical
textures.
The rendered top surface can remain a render-only displaced mesh. If it must participate
in voxel collision or queries, its height must also reach the density evaluator. For a
height `h(x,y)`, the plugin's density convention is negative inside solid and positive
in air, so the plane's signed density is `z - h(x,y)`. Keep this calculation in metres
until the existing voxel/Core boundary converts with the active voxel size (25 cm by
default); do not mix metre distances and voxel counts in the wave solver.
The current sample is an isolated visual field. Wiring this into `AVoxelWorld` would
need an explicit owner for simulation lifetime, collision/update cadence, save/load,
and the replication policy before it could affect shipped terrain.
## L164 render-only Unreal implementation
`Source/VoxelForgeLivingPlane/` now implements this render-only path as a separate
runtime module. `AVoxelForgeLivingPlaneActor` owns two UAV-capable RGBA32F render
targets, advances the wave, breathing, and imprint equations with an RDG global shader,
and binds the current texture to its plane material. Blueprint/C++ supplies object
position, radius, velocity, push, and active state. The actor does not call the
generation modules and does not read the field back. Level setup and the material graph
are in [UE-SETUP.md](UE-SETUP.md).
+22
View File
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
PLUGIN_ROOT="$(cd -- "${SCRIPT_DIR}/../.." && pwd)"
OUTPUT_DIR="${PLUGIN_ROOT}/Saved/Linux/l164"
CXX="${CXX:-g++}"
command -v "${CXX}" >/dev/null || { echo "C++ compiler not found: ${CXX}" >&2; exit 2; }
pkg-config --exists egl gl libpng || {
echo "EGL, desktop OpenGL, and libpng development files are required" >&2
exit 2
}
mkdir -p "${OUTPUT_DIR}"
read -r -a GRAPHICS_FLAGS <<<"$(pkg-config --cflags --libs egl gl libpng)"
taskset -c 0-11 prlimit --as=6442450944 -- \
"${CXX}" -std=c++20 -O2 -g -Wall -Wextra -Wpedantic \
"${SCRIPT_DIR}/LivingPlane.cpp" -o "${OUTPUT_DIR}/living-plane" \
"${GRAPHICS_FLAGS[@]}"
echo "built ${OUTPUT_DIR}/living-plane"
+132
View File
@@ -0,0 +1,132 @@
#!/usr/bin/env python3
"""Compare final field checksums across different query and capture settings."""
from __future__ import annotations
import argparse
import json
import pathlib
import shutil
import subprocess
import sys
PLUGIN_ROOT = pathlib.Path(__file__).resolve().parents[2]
def read_checksum(path: pathlib.Path) -> str:
try:
with path.open(encoding="utf-8") as source:
result = json.load(source)
except (OSError, json.JSONDecodeError) as error:
raise RuntimeError(f"could not read {path}: {error}") from error
checksum = result.get("field_checksum_fnv1a64")
if not isinstance(checksum, str) or len(checksum) != 16:
raise RuntimeError(f"{path} has no 16-digit field checksum")
return checksum
def compare(left: pathlib.Path, right: pathlib.Path) -> bool:
left_checksum = read_checksum(left)
right_checksum = read_checksum(right)
if left_checksum != right_checksum:
print(
"FAIL field checksum mismatch: "
f"{left}={left_checksum}, {right}={right_checksum}",
file=sys.stderr,
)
return False
print(f"PASS field checksum matches: {left_checksum}")
return True
def main() -> int:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
"--binary",
type=pathlib.Path,
default=PLUGIN_ROOT / "Saved/Linux/l164/living-plane",
)
parser.add_argument(
"--out",
type=pathlib.Path,
default=PLUGIN_ROOT / "Saved/Linux/l164/repeatability",
)
parser.add_argument("--device", choices=("auto", "cpu", "gpu"), default="cpu")
parser.add_argument("--size", type=int, default=512)
parser.add_argument("--steps", type=int, default=1800)
parser.add_argument(
"--compare-only",
nargs=2,
type=pathlib.Path,
metavar=("LEFT_JSON", "RIGHT_JSON"),
help="compare existing timing.json files; used to exercise the failure path",
)
options = parser.parse_args()
if options.compare_only:
return 0 if compare(*options.compare_only) else 1
if not options.binary.is_file():
parser.error(f"binary not found: {options.binary}; run Experiments/LivingPlane/build.sh")
options.out.mkdir(parents=True, exist_ok=True)
off_dir = options.out / "queries-off_capture-off"
on_dir = options.out / "queries-on_capture-every-900"
for directory in (off_dir, on_dir):
if directory.exists():
shutil.rmtree(directory)
common = [
f"--device={options.device}",
"--scene=alive",
f"--size={options.size}",
f"--steps={options.steps}",
]
runs = (
("--capture-every=0", "--queries=off", off_dir),
("--capture-every=900", "--queries=on", on_dir),
)
for capture, queries, output in runs:
command = [
"taskset",
"-c",
"0-11",
"prlimit",
"--as=6442450944",
"--",
"timeout",
"1740s",
str(options.binary.resolve()),
*common,
capture,
queries,
f"--out={output}",
]
print("RUN " + " ".join(command), flush=True)
log_path = options.out / f"{output.name}.log"
with log_path.open("w", encoding="utf-8") as log_file:
try:
subprocess.run(
command,
cwd=PLUGIN_ROOT,
check=True,
stdout=log_file,
stderr=subprocess.STDOUT,
)
except subprocess.CalledProcessError:
print(log_path.read_text(encoding="utf-8"), file=sys.stderr)
raise
print(log_path.read_text(encoding="utf-8").rstrip())
left = off_dir / "timing.json"
right = on_dir / "timing.json"
return 0 if compare(left, right) else 1
if __name__ == "__main__":
try:
raise SystemExit(main())
except (OSError, RuntimeError, subprocess.CalledProcessError) as error:
print(f"FAIL repeatability check: {error}", file=sys.stderr)
raise SystemExit(1)
+85
View File
@@ -0,0 +1,85 @@
Texture2D<float4> SourceState;
RWTexture2D<float4> TargetState;
int2 GridSize;
float Dt;
float Dx;
float PlaneLength;
float WaveSpeed;
float Damping;
float FoundationStiffness;
float TimeSeconds;
float2 BreathingSettings;
float4 ImprintSettings;
float4 ObjectPositionRadius[2];
float4 ObjectVelocityPush[2];
[numthreads(8, 8, 1)]
void MainCS(uint3 DispatchThreadId : SV_DispatchThreadID)
{
int2 Pixel = int2(DispatchThreadId.xy);
if (Pixel.x >= GridSize.x || Pixel.y >= GridSize.y)
{
return;
}
int2 Lo = int2(0, 0);
int2 Hi = GridSize - 1;
float4 State = SourceState.Load(int3(Pixel, 0));
float Height = State.r;
float Velocity = State.g;
float Imprint = State.b;
float Left = SourceState.Load(int3(max(Pixel + int2(-1, 0), Lo), 0)).r;
float Right = SourceState.Load(int3(min(Pixel + int2(1, 0), Hi), 0)).r;
float Down = SourceState.Load(int3(max(Pixel + int2(0, -1), Lo), 0)).r;
float Up = SourceState.Load(int3(min(Pixel + int2(0, 1), Hi), 0)).r;
float Laplacian = (Left + Right + Down + Up - 4.0 * Height) / max(Dx * Dx, 1.0e-8);
float2 World = (float2(Pixel) + 0.5) * Dx - PlaneLength * 0.5;
float Interaction = 0.0;
float Contact = 0.0;
for (int ObjectIndex = 0; ObjectIndex < 2; ++ObjectIndex)
{
float4 PositionRadius = ObjectPositionRadius[ObjectIndex];
if (PositionRadius.w <= 0.0)
{
continue;
}
float4 VelocityPush = ObjectVelocityPush[ObjectIndex];
float Radius = PositionRadius.w;
float Sigma = max(Radius * (0.58 / 0.43), Dx);
float2 Offset = World - PositionRadius.xy;
float Weight = exp(-dot(Offset, Offset) / max(2.0 * Sigma * Sigma, 1.0e-8));
float HeightAboveContact = max(PositionRadius.z - Radius, 0.0);
float ContactHeight = 1.0 - smoothstep(0.0, max(Radius, Dx), HeightAboveContact);
float ImpactSpeed = length(VelocityPush.xy) * 0.25 + max(-VelocityPush.z, 0.0) * 0.5;
float Push = max(VelocityPush.w, 0.0) + ImpactSpeed;
Interaction -= Push * Weight * ContactHeight;
if (Push > 0.0)
{
Contact = max(Contact, Weight * ContactHeight);
}
}
float Breathing = 0.0;
if (BreathingSettings.x != 0.0)
{
float Swell = sin(World.x * 0.48 - TimeSeconds * 0.22)
* cos(World.y * 0.42 + TimeSeconds * 0.16);
Breathing = BreathingSettings.y * Swell * sin(TimeSeconds * 0.48);
}
float NextImprint = Imprint;
if (ImprintSettings.x != 0.0)
{
NextImprint = clamp(Imprint * exp(-Dt / max(ImprintSettings.z, 1.0e-4))
- Contact * ImprintSettings.y * Dt, -ImprintSettings.w, 0.0);
}
float FoundationTarget = ImprintSettings.x != 0.0 ? Imprint : 0.0;
float Acceleration = WaveSpeed * WaveSpeed * Laplacian
- FoundationStiffness * (Height - FoundationTarget) + Interaction + Breathing;
float NextVelocity = (Velocity + Acceleration * Dt) * exp(-Damping * Dt);
float NextHeight = Height + NextVelocity * Dt;
TargetState[Pixel] = float4(NextHeight, NextVelocity, NextImprint, 0.0);
}
@@ -322,6 +322,108 @@ bool FVoxelForgeClipmapNoOverlapTest::RunTest(const FString& Parameters)
FirstFailure.IsEmpty() ? TEXT("none") : *FirstFailure)); FirstFailure.IsEmpty() ? TEXT("none") : *FirstFailure));
TestEqual(TEXT("all swept desired sets have zero overlapping pairs"), OverlapCases, 0); TestEqual(TEXT("all swept desired sets have zero overlapping pairs"), OverlapCases, 0);
TestEqual(TEXT("all swept desired sets cover the legacy footprint"), CoverageFailures, 0); TestEqual(TEXT("all swept desired sets cover the legacy footprint"), CoverageFailures, 0);
static const FIntVector DeltaCenters[] = {
FIntVector(-5, -2, -1), FIntVector(-3, 1, 2), FIntVector(-1, -3, 0),
FIntVector(0, 0, 0), FIntVector(1, 3, -2), FIntVector(3, -1, 1),
FIntVector(5, 2, -3),
};
static const FIntVector DeltaSteps[] = {
FIntVector(-1, 0, 0), FIntVector(1, 0, 0),
FIntVector(0, -1, 0), FIntVector(0, 1, 0),
FIntVector(0, 0, -1), FIntVector(0, 0, 1),
};
int32 DeltaCases = 0;
int32 DeltaFailures = 0;
FString FirstDeltaFailure;
for (const FIntVector& Center : DeltaCenters)
for (const FSweepSettings& Sweep : SweepSettings)
for (int32 ClampCase = 0; ClampCase < 3; ++ClampCase)
{
FParameters P;
P.ClipRadius = Sweep.Radius;
P.MaxClipLevel = Sweep.MaxLevel;
P.RenderDistanceChunks = Sweep.RenderDistance;
const auto GetVerticalBounds = [&](int32 CenterZ, int32& OutMinZ, int32& OutMaxZ)
{
OutMinZ = MIN_int32;
OutMaxZ = MAX_int32;
if (ClampCase == 1)
{
OutMinZ = CenterZ - 2;
OutMaxZ = CenterZ + 3;
}
else if (ClampCase == 2)
{
const int32 Band = VoxelClipmapDesiredTiles::FloorDiv(
CenterZ, 1 << Sweep.MaxLevel);
const int64 BandStart = static_cast<int64>(Band)
* (int64{1} << static_cast<uint32>(Sweep.MaxLevel));
OutMinZ = static_cast<int32>(BandStart - 1);
OutMaxZ = OutMinZ + 6;
}
};
int32 PreviousMinZ = 0;
int32 PreviousMaxZ = 0;
GetVerticalBounds(Center.Z, PreviousMinZ, PreviousMaxZ);
TArray<FVoxelTileKey> PreviousTiles;
VoxelClipmapDesiredTiles::Build(Center, PreviousMinZ, PreviousMaxZ, P, PreviousTiles);
for (const FIntVector& Step : DeltaSteps)
{
const FIntVector NextCenter = Center + Step;
int32 NextMinZ = 0;
int32 NextMaxZ = 0;
GetVerticalBounds(NextCenter.Z, NextMinZ, NextMaxZ);
TArray<FVoxelTileKey> Entering;
TArray<FVoxelTileKey> Leaving;
VoxelClipmapDesiredTiles::BuildDelta(
Center, PreviousMinZ, PreviousMaxZ,
NextCenter, NextMinZ, NextMaxZ, P, Entering, Leaving);
TSet<FVoxelTileKey> Updated;
for (const FVoxelTileKey& Tile : PreviousTiles) Updated.Add(Tile);
for (const FVoxelTileKey& Tile : Leaving) Updated.Remove(Tile);
for (const FVoxelTileKey& Tile : Entering) Updated.Add(Tile);
TArray<FVoxelTileKey> FullNextTiles;
VoxelClipmapDesiredTiles::Build(
NextCenter, NextMinZ, NextMaxZ, P, FullNextTiles);
TSet<FVoxelTileKey> FullNextSet;
for (const FVoxelTileKey& Tile : FullNextTiles) FullNextSet.Add(Tile);
bool bMatches = Updated.Num() == FullNextSet.Num();
if (bMatches)
{
for (const FVoxelTileKey& Tile : Updated)
{
if (!FullNextSet.Contains(Tile))
{
bMatches = false;
break;
}
}
}
if (!bMatches)
{
++DeltaFailures;
if (FirstDeltaFailure.IsEmpty())
{
FirstDeltaFailure = FString::Printf(
TEXT("center=(%d,%d,%d) step=(%d,%d,%d) radius=%d level=%d clamp=%d entering=%d leaving=%d full=%d updated=%d"),
Center.X, Center.Y, Center.Z, Step.X, Step.Y, Step.Z,
Sweep.Radius, Sweep.MaxLevel, ClampCase,
Entering.Num(), Leaving.Num(), FullNextSet.Num(), Updated.Num());
}
}
++DeltaCases;
}
}
AddInfo(FString::Printf(
TEXT("clipmap delta cases=%d failures=%d first=%s"), DeltaCases, DeltaFailures,
FirstDeltaFailure.IsEmpty() ? TEXT("none") : *FirstDeltaFailure));
TestEqual(TEXT("clipmap delta update equals a full rebuild on every tested crossing"),
DeltaFailures, 0);
return true; return true;
} }
@@ -182,4 +182,218 @@ namespace VoxelClipmapDesiredTiles
PreviousRingMax = RingMax; PreviousRingMax = RingMax;
} }
} }
// Compute the exact key difference between two adjacent clipmap centers without visiting
// unchanged ring cells. A coarser ring can change membership when its finer child ring moves,
// even when the coarser ring bounds themselves stay fixed; the cover-box delta below includes
// those boundary keys as well.
FORCEINLINE void BuildDelta(
const FIntVector& PreviousCenter, int32 PreviousMinChunkZ, int32 PreviousMaxChunkZ,
const FIntVector& Center, int32 MinChunkZ, int32 MaxChunkZ,
const FParameters& Parameters,
TArray<FVoxelTileKey>& OutEntering, TArray<FVoxelTileKey>& OutLeaving)
{
struct FBox
{
FIntVector Min = FIntVector::ZeroValue;
FIntVector Max = FIntVector::ZeroValue;
bool bValid = false;
};
OutEntering.Reset();
OutLeaving.Reset();
const int32 Radius = FMath::Max(1, Parameters.ClipRadius);
const int32 MaxLevel = FMath::Clamp(Parameters.MaxClipLevel, 0, 8);
const int32 OuterRadius = OuterShellRadius(Parameters, Radius, MaxLevel);
FBox PreviousValid[9];
FBox CurrentValid[9];
FBox PreviousCovered[9];
FBox CurrentCovered[9];
const auto BuildRings = [&](const FIntVector& RingCenter, int32 RingMinChunkZ,
int32 RingMaxChunkZ, FBox* OutValid, FBox* OutCovered)
{
FIntVector ChildRingMin = FIntVector::ZeroValue;
FIntVector ChildRingMax = FIntVector::ZeroValue;
for (int32 Level = 0; Level <= MaxLevel; ++Level)
{
const int32 Pow = static_cast<int32>(uint32{1} << static_cast<uint32>(Level));
const FIntVector CenterLevel = FloorDiv(RingCenter, Pow);
const int32 LevelRadius = (Level == MaxLevel) ? OuterRadius : Radius;
const int32 RingAlignment = Level < MaxLevel ? 2 : 1;
FIntVector RingMin, RingMax;
AlignedRingBounds(CenterLevel, LevelRadius, RingAlignment, RingMin, RingMax);
FBox Valid;
Valid.Min = RingMin;
Valid.Max = RingMax;
Valid.Min.Z = FMath::Max(Valid.Min.Z, FloorDiv(RingMinChunkZ, Pow));
Valid.Max.Z = FMath::Min(Valid.Max.Z, FloorDiv(RingMaxChunkZ, Pow));
Valid.bValid = Valid.Min.X <= Valid.Max.X
&& Valid.Min.Y <= Valid.Max.Y && Valid.Min.Z <= Valid.Max.Z;
OutValid[Level] = Valid;
FBox Covered;
if (Level > 0)
{
Covered.Min = FIntVector(
CeilDiv(ChildRingMin.X, 2), CeilDiv(ChildRingMin.Y, 2),
CeilDiv(ChildRingMin.Z, 2));
Covered.Max = FIntVector(
ClampInt32(FloorDivWide(static_cast<int64>(ChildRingMax.X) - 1, 2)),
ClampInt32(FloorDivWide(static_cast<int64>(ChildRingMax.Y) - 1, 2)),
ClampInt32(FloorDivWide(static_cast<int64>(ChildRingMax.Z) - 1, 2)));
Covered.bValid = Covered.Min.X <= Covered.Max.X
&& Covered.Min.Y <= Covered.Max.Y && Covered.Min.Z <= Covered.Max.Z;
}
OutCovered[Level] = Covered;
ChildRingMin = RingMin;
ChildRingMax = RingMax;
}
};
BuildRings(PreviousCenter, PreviousMinChunkZ, PreviousMaxChunkZ,
PreviousValid, PreviousCovered);
BuildRings(Center, MinChunkZ, MaxChunkZ, CurrentValid, CurrentCovered);
const auto Intersect = [](const FBox& A, const FBox& B)
{
FBox Result;
if (!A.bValid || !B.bValid) return Result;
Result.Min = FIntVector(
FMath::Max(A.Min.X, B.Min.X), FMath::Max(A.Min.Y, B.Min.Y),
FMath::Max(A.Min.Z, B.Min.Z));
Result.Max = FIntVector(
FMath::Min(A.Max.X, B.Max.X), FMath::Min(A.Max.Y, B.Max.Y),
FMath::Min(A.Max.Z, B.Max.Z));
Result.bValid = Result.Min.X <= Result.Max.X
&& Result.Min.Y <= Result.Max.Y && Result.Min.Z <= Result.Max.Z;
return Result;
};
const auto AppendDifference = [&Intersect](const FBox& A, const FBox& B, auto& OutBoxes)
{
if (!A.bValid) return;
const FBox Common = Intersect(A, B);
if (!Common.bValid)
{
OutBoxes.Add(A);
return;
}
// Six disjoint slabs cover A minus Common. The later slabs are narrowed to the
// common extent on each already-partitioned axis, so no key is emitted twice.
FBox Slab = A;
if (A.Min.X < Common.Min.X)
{
Slab.Max.X = Common.Min.X - 1;
Slab.bValid = Slab.Min.X <= Slab.Max.X;
if (Slab.bValid) OutBoxes.Add(Slab);
}
Slab = A;
if (Common.Max.X < A.Max.X)
{
Slab.Min.X = Common.Max.X + 1;
Slab.bValid = Slab.Min.X <= Slab.Max.X;
if (Slab.bValid) OutBoxes.Add(Slab);
}
Slab = A;
Slab.Min.X = Common.Min.X;
Slab.Max.X = Common.Max.X;
if (A.Min.Y < Common.Min.Y)
{
Slab.Max.Y = Common.Min.Y - 1;
Slab.bValid = Slab.Min.Y <= Slab.Max.Y;
if (Slab.bValid) OutBoxes.Add(Slab);
}
Slab = A;
Slab.Min.X = Common.Min.X;
Slab.Max.X = Common.Max.X;
if (Common.Max.Y < A.Max.Y)
{
Slab.Min.Y = Common.Max.Y + 1;
Slab.bValid = Slab.Min.Y <= Slab.Max.Y;
if (Slab.bValid) OutBoxes.Add(Slab);
}
Slab = A;
Slab.Min.X = Common.Min.X;
Slab.Max.X = Common.Max.X;
Slab.Min.Y = Common.Min.Y;
Slab.Max.Y = Common.Max.Y;
if (A.Min.Z < Common.Min.Z)
{
Slab.Max.Z = Common.Min.Z - 1;
Slab.bValid = Slab.Min.Z <= Slab.Max.Z;
if (Slab.bValid) OutBoxes.Add(Slab);
}
Slab = A;
Slab.Min.X = Common.Min.X;
Slab.Max.X = Common.Max.X;
Slab.Min.Y = Common.Min.Y;
Slab.Max.Y = Common.Max.Y;
if (Common.Max.Z < A.Max.Z)
{
Slab.Min.Z = Common.Max.Z + 1;
Slab.bValid = Slab.Min.Z <= Slab.Max.Z;
if (Slab.bValid) OutBoxes.Add(Slab);
}
};
const auto Contains = [](const FBox& Box, const FIntVector& Point)
{
return Box.bValid && Point.X >= Box.Min.X && Point.X <= Box.Max.X
&& Point.Y >= Box.Min.Y && Point.Y <= Box.Max.Y
&& Point.Z >= Box.Min.Z && Point.Z <= Box.Max.Z;
};
const auto ForEachBox = [](const FBox& Box, const auto& Callback)
{
if (!Box.bValid) return;
for (int64 Z = Box.Min.Z; Z <= Box.Max.Z; ++Z)
for (int64 Y = Box.Min.Y; Y <= Box.Max.Y; ++Y)
for (int64 X = Box.Min.X; X <= Box.Max.X; ++X)
{
Callback(FIntVector(static_cast<int32>(X), static_cast<int32>(Y),
static_cast<int32>(Z)));
}
};
for (int32 Level = 0; Level <= MaxLevel; ++Level)
{
TArray<FBox, TInlineAllocator<16>> ChangedBoxes;
AppendDifference(CurrentValid[Level], PreviousValid[Level], ChangedBoxes);
AppendDifference(PreviousValid[Level], CurrentValid[Level], ChangedBoxes);
if (Level > 0)
{
const FBox CommonValid = Intersect(CurrentValid[Level], PreviousValid[Level]);
if (CommonValid.bValid)
{
TArray<FBox, TInlineAllocator<16>> CoverDifferences;
AppendDifference(CurrentCovered[Level], PreviousCovered[Level], CoverDifferences);
AppendDifference(PreviousCovered[Level], CurrentCovered[Level], CoverDifferences);
for (const FBox& CoverDifference : CoverDifferences)
{
const FBox ChangedCover = Intersect(CoverDifference, CommonValid);
if (ChangedCover.bValid) ChangedBoxes.Add(ChangedCover);
}
}
}
for (const FBox& ChangedBox : ChangedBoxes)
{
ForEachBox(ChangedBox, [&](const FIntVector& Coord)
{
const bool bCurrentMember = Contains(CurrentValid[Level], Coord)
&& !Contains(CurrentCovered[Level], Coord);
const bool bPreviousMember = Contains(PreviousValid[Level], Coord)
&& !Contains(PreviousCovered[Level], Coord);
if (bCurrentMember && !bPreviousMember)
{
OutEntering.Emplace(Coord, Level);
}
else if (bPreviousMember && !bCurrentMember)
{
OutLeaving.Emplace(Coord, Level);
}
});
}
}
}
} }
@@ -0,0 +1,28 @@
#pragma once
#include <algorithm>
namespace VoxelStreamingAdmissionOrder
{
template <typename Iterator, typename Less>
void StableSortCandidates(Iterator First, Iterator Last, Less Compare)
{
std::stable_sort(First, Last, Compare);
}
template <typename Range, typename IsAtCapacity, typename SubmitCandidate,
typename OnCapacityReached>
void AdmitInOrder(const Range& Candidates, IsAtCapacity AtCapacity,
SubmitCandidate Submit, OnCapacityReached CapacityReached)
{
for (const auto& Candidate : Candidates)
{
if (AtCapacity())
{
CapacityReached();
break;
}
Submit(Candidate);
}
}
}
File diff suppressed because it is too large. Load diff
+18 -1
View File
@@ -1247,6 +1247,8 @@ public:
bool bSampleStacksStarted = false; bool bSampleStacksStarted = false;
bool bStartupApplyBoostStarted = false; bool bStartupApplyBoostStarted = false;
bool bStartupApplyBoostEnded = false; bool bStartupApplyBoostEnded = false;
// Fast-travel admission stays disabled until the initial near LOD and collision set is ready.
bool bInitialArrivalSetSettled = false;
uint64 StartupApplyBoostStartCycles = 0; 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;
@@ -1254,6 +1256,21 @@ public:
float StartupTraceSpeedCmPerSecond = 0.0f; float StartupTraceSpeedCmPerSecond = 0.0f;
bool bSpeedAwareTravelMode = false; bool bSpeedAwareTravelMode = false;
bool bSpeedAwareFastMode = false; bool bSpeedAwareFastMode = false;
TArray<FVoxelTileKey> CachedCoreDesiredTiles;
TSet<FVoxelTileKey> CachedCoreDesiredTileSet;
FIntVector CachedCoreDesiredCenter = FIntVector(MAX_int32, MAX_int32, MAX_int32);
bool bHasCachedCoreDesiredTiles = false;
TArray<FVoxelTileKey> CachedDesiredCandidateKeys;
TSet<FVoxelTileKey> CachedDesiredCandidateSet;
TSet<FVoxelTileKey> CachedDesiredBaseVisualTiles;
TSet<FVoxelTileKey> CachedDesiredOverlayTiles;
FIntVector CachedDesiredMaterializationCenter = FIntVector(MAX_int32, MAX_int32, MAX_int32);
bool bHasCachedDesiredMaterialization = false;
TArray<FVoxelTileKey> CachedDesiredPriorityOrder;
FIntVector CachedDesiredPriorityCenter = FIntVector(MAX_int32, MAX_int32, MAX_int32);
bool bHasCachedDesiredPriorityOrder = false;
int32 IncrementalDesiredCenterCrossings = 0;
int32 IncrementalDesiredMaterializationUpdates = 0;
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
@@ -1602,7 +1619,7 @@ public:
// ONE frame → a game-thread teardown spike. Drained by ProcessUnloadQueue (catch-up scaled). // ONE frame → a game-thread teardown spike. Drained by ProcessUnloadQueue (catch-up scaled).
TSet<FVoxelTileKey> PendingUnload; TSet<FVoxelTileKey> PendingUnload;
void ProcessPendingChunks(); void ProcessPendingChunks(uint64 TickStartCycles);
void ProcessUnloadQueue(); // budgeted teardown drain (see PendingUnload) void ProcessUnloadQueue(); // budgeted teardown drain (see PendingUnload)
void QueuePendingUnload(const FVoxelTileKey& Tile); void QueuePendingUnload(const FVoxelTileKey& Tile);
void HideOverlappingDesiredVisuals(const FVoxelTileKey& RetiredTile); void HideOverlappingDesiredVisuals(const FVoxelTileKey& RetiredTile);
@@ -0,0 +1,303 @@
#include "VoxelForgeLivingPlaneActor.h"
#include "Engine/TextureRenderTarget2D.h"
#include "Engine/TextureRenderTarget.h"
#include "Engine/StaticMesh.h"
#include "Engine/World.h"
#include "Materials/MaterialInstanceDynamic.h"
#include "Materials/MaterialInterface.h"
#include "RenderGraphBuilder.h"
#include "RenderGraphUtils.h"
#include "RHICommandList.h"
#include "RHIResources.h"
#include "DataDrivenShaderPlatformInfo.h"
#include "GlobalShader.h"
#include "ShaderParameterStruct.h"
#include "UObject/ConstructorHelpers.h"
#include "Components/StaticMeshComponent.h"
namespace
{
constexpr int32 LivingPlaneThreadGroupSize = 8;
struct FLivingPlaneStepInput
{
FVector4f ObjectPositionRadius[2] = {FVector4f(0, 0, 0, -1), FVector4f(0, 0, 0, -1)};
FVector4f ObjectVelocityPush[2] = {FVector4f(0, 0, 0, 0), FVector4f(0, 0, 0, 0)};
float TimeSeconds = 0.0f;
};
class FVFLivingPlaneStepCS final : public FGlobalShader
{
DECLARE_GLOBAL_SHADER(FVFLivingPlaneStepCS);
SHADER_USE_PARAMETER_STRUCT(FVFLivingPlaneStepCS, FGlobalShader);
BEGIN_SHADER_PARAMETER_STRUCT(FParameters, )
SHADER_PARAMETER(FIntPoint, GridSize)
SHADER_PARAMETER(float, Dt)
SHADER_PARAMETER(float, Dx)
SHADER_PARAMETER(float, PlaneLength)
SHADER_PARAMETER(float, WaveSpeed)
SHADER_PARAMETER(float, Damping)
SHADER_PARAMETER(float, FoundationStiffness)
SHADER_PARAMETER(float, TimeSeconds)
SHADER_PARAMETER(FVector2f, BreathingSettings)
SHADER_PARAMETER(FVector4f, ImprintSettings)
SHADER_PARAMETER_ARRAY(FVector4f, ObjectPositionRadius, [2])
SHADER_PARAMETER_ARRAY(FVector4f, ObjectVelocityPush, [2])
SHADER_PARAMETER_RDG_TEXTURE_SRV(Texture2D<float4>, SourceState)
SHADER_PARAMETER_RDG_TEXTURE_UAV(RWTexture2D<float4>, TargetState)
END_SHADER_PARAMETER_STRUCT()
public:
static bool ShouldCompilePermutation(const FGlobalShaderPermutationParameters& Parameters)
{
return IsFeatureLevelSupported(Parameters.Platform, ERHIFeatureLevel::SM5);
}
};
IMPLEMENT_GLOBAL_SHADER(FVFLivingPlaneStepCS,
"/Plugin/VoxelForgeLivingPlane/LivingPlane.usf", "MainCS", SF_Compute)
UTextureRenderTarget2D* CreateFieldTarget(UObject* Outer, int32 Size, FName Name)
{
UTextureRenderTarget2D* Target = NewObject<UTextureRenderTarget2D>(Outer, Name, RF_Transient);
Target->RenderTargetFormat = RTF_RGBA32f;
Target->bCanCreateUAV = true;
Target->bAutoGenerateMips = false;
Target->ClearColor = FLinearColor::Transparent;
Target->Filter = TF_Bilinear;
Target->AddressX = TA_Clamp;
Target->AddressY = TA_Clamp;
Target->InitAutoFormat(Size, Size);
Target->UpdateResourceImmediate(true);
return Target;
}
}
AVoxelForgeLivingPlaneActor::AVoxelForgeLivingPlaneActor()
{
PrimaryActorTick.bCanEverTick = true;
PlaneMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("LivingPlaneMesh"));
SetRootComponent(PlaneMesh);
PlaneMesh->SetCollisionEnabled(ECollisionEnabled::NoCollision);
PlaneMesh->SetMobility(EComponentMobility::Movable);
static ConstructorHelpers::FObjectFinder<UStaticMesh> PlaneAsset(
TEXT("/Engine/BasicShapes/Plane.Plane"));
if (PlaneAsset.Succeeded())
{
PlaneMesh->SetStaticMesh(PlaneAsset.Object);
}
ObjectInputs.SetNum(2);
}
void AVoxelForgeLivingPlaneActor::OnConstruction(const FTransform& Transform)
{
Super::OnConstruction(Transform);
if (PlaneMesh)
{
// /Engine/BasicShapes/Plane is 100 cm square; one Unreal scale unit
// therefore corresponds to one metre of authored plane length.
PlaneMesh->SetRelativeScale3D(FVector(PlaneLengthMeters, PlaneLengthMeters, 1.0));
}
}
float AVoxelForgeLivingPlaneActor::GetStableStepSeconds() const
{
const float Dx = PlaneLengthMeters / static_cast<float>(FMath::Max(GridSize, 16));
const float EigenFrequencySquared = 8.0f * WaveSpeedMetersPerSecond * WaveSpeedMetersPerSecond
/ FMath::Max(Dx * Dx, 1.0e-8f) + FoundationStiffnessPerSecondSquared;
return 1.30f / FMath::Sqrt(FMath::Max(EigenFrequencySquared, 1.0e-8f));
}
void AVoxelForgeLivingPlaneActor::BeginPlay()
{
Super::BeginPlay();
GridSize = FMath::Clamp(GridSize, 16, 2048);
PlaneLengthMeters = FMath::Max(PlaneLengthMeters, 1.0f);
FixedStepSeconds = GetStableStepSeconds();
CreateFieldTargets();
if (PlaneMaterial && PlaneMesh)
{
DynamicPlaneMaterial = PlaneMesh->CreateDynamicMaterialInstance(0, PlaneMaterial);
if (DynamicPlaneMaterial)
{
DynamicPlaneMaterial->SetScalarParameterValue(TEXT("PlaneLengthMeters"), PlaneLengthMeters);
DynamicPlaneMaterial->SetScalarParameterValue(TEXT("FieldSize"), static_cast<float>(GridSize));
}
}
UpdateMaterialField();
}
void AVoxelForgeLivingPlaneActor::CreateFieldTargets()
{
FieldTargets[0] = CreateFieldTarget(this, GridSize, TEXT("LivingPlaneStateA"));
FieldTargets[1] = CreateFieldTarget(this, GridSize, TEXT("LivingPlaneStateB"));
CurrentFieldIndex = 0;
SimulationStepCount = 0;
SimulationAccumulatorSeconds = 0.0;
}
void AVoxelForgeLivingPlaneActor::SetObjectState(int32 ObjectIndex,
const FVFLivingPlaneObjectInput& State)
{
if (!ObjectInputs.IsValidIndex(ObjectIndex) || ObjectIndex >= 2)
{
return;
}
ObjectInputs[ObjectIndex] = State;
}
void AVoxelForgeLivingPlaneActor::ResetSimulation()
{
if (!IsInGameThread() || !FieldTargets[0] || !FieldTargets[1])
{
return;
}
CreateFieldTargets();
FixedStepSeconds = GetStableStepSeconds();
UpdateMaterialField();
}
void AVoxelForgeLivingPlaneActor::UpdateMaterialField()
{
if (DynamicPlaneMaterial && FieldTargets[CurrentFieldIndex])
{
DynamicPlaneMaterial->SetTextureParameterValue(TEXT("LivingField"), FieldTargets[CurrentFieldIndex]);
}
}
void AVoxelForgeLivingPlaneActor::EnqueueSimulationSteps(int32 NumSteps)
{
if (NumSteps <= 0 || !FieldTargets[0] || !FieldTargets[1])
{
return;
}
FTextureRenderTargetResource* ResourceA = FieldTargets[0]->GameThread_GetRenderTargetResource();
FTextureRenderTargetResource* ResourceB = FieldTargets[1]->GameThread_GetRenderTargetResource();
if (!ResourceA || !ResourceB)
{
return;
}
TArray<FLivingPlaneStepInput> Steps;
Steps.Reserve(NumSteps);
const FTransform PlaneTransform = GetActorTransform();
for (int32 Step = 0; Step < NumSteps; ++Step)
{
FLivingPlaneStepInput& Input = Steps.AddDefaulted_GetRef();
Input.TimeSeconds = static_cast<float>(SimulationStepCount + Step) * FixedStepSeconds;
for (int32 ObjectIndex = 0; ObjectIndex < 2; ++ObjectIndex)
{
if (!ObjectInputs.IsValidIndex(ObjectIndex) || !ObjectInputs[ObjectIndex].bActive)
{
continue;
}
const FVFLivingPlaneObjectInput& Object = ObjectInputs[ObjectIndex];
const FVector LocalPosition = PlaneTransform.InverseTransformPosition(Object.WorldPositionCm);
const FVector LocalVelocity = PlaneTransform.InverseTransformVector(Object.WorldVelocityCmPerSecond);
const float RadiusMeters = FMath::Max(Object.RadiusCm * 0.01f, 0.001f);
Input.ObjectPositionRadius[ObjectIndex] = FVector4f(
static_cast<float>(LocalPosition.X * 0.01),
static_cast<float>(LocalPosition.Y * 0.01),
static_cast<float>(LocalPosition.Z * 0.01),
RadiusMeters);
Input.ObjectVelocityPush[ObjectIndex] = FVector4f(
static_cast<float>(LocalVelocity.X * 0.01),
static_cast<float>(LocalVelocity.Y * 0.01),
static_cast<float>(LocalVelocity.Z * 0.01),
FMath::Max(Object.PushAccelerationMetersPerSecondSquared, 0.0f));
}
}
const int32 Resolution = GridSize;
const int32 InitialFieldIndex = CurrentFieldIndex;
const float Dt = static_cast<float>(FixedStepSeconds);
const float Dx = PlaneLengthMeters / static_cast<float>(Resolution);
const float PlaneLength = PlaneLengthMeters;
const float WaveSpeed = WaveSpeedMetersPerSecond;
const float Damping = DampingPerSecond;
const float Foundation = FoundationStiffnessPerSecondSquared;
const float BreathingStrength = bEnableBreathing ? BreathingStrengthMetersPerSecondSquared : 0.0f;
const FVector2f BreathingSettings(bEnableBreathing ? 1.0f : 0.0f, BreathingStrength);
const FVector4f ImprintSettings(bEnableImprint ? 1.0f : 0.0f,
ImprintCaptureMetersPerSecond, FMath::Max(ImprintRecoverySeconds, 1.0e-4f),
FMath::Max(ImprintMaxDepthMeters, 0.0f));
ENQUEUE_RENDER_COMMAND(VoxelForgeLivingPlaneStep)(
[ResourceA, ResourceB, Steps = MoveTemp(Steps), InitialFieldIndex, Resolution, Dt, Dx, PlaneLength,
WaveSpeed, Damping, Foundation, BreathingSettings, ImprintSettings]
(FRHICommandListImmediate& RHICmdList) mutable
{
FRDGBuilder GraphBuilder(RHICmdList, RDG_EVENT_NAME("VoxelForgeLivingPlane"));
FRDGTextureRef Fields[2] = {
RegisterExternalTexture(GraphBuilder, ResourceA->GetRenderTargetTexture().GetReference(), TEXT("LivingPlaneStateA")),
RegisterExternalTexture(GraphBuilder, ResourceB->GetRenderTargetTexture().GetReference(), TEXT("LivingPlaneStateB"))};
TShaderMapRef<FVFLivingPlaneStepCS> ComputeShader(GetGlobalShaderMap(GMaxRHIFeatureLevel));
int32 CurrentIndex = InitialFieldIndex;
for (const FLivingPlaneStepInput& StepInput : Steps)
{
const int32 TargetIndex = 1 - CurrentIndex;
FVFLivingPlaneStepCS::FParameters* PassParameters =
GraphBuilder.AllocParameters<FVFLivingPlaneStepCS::FParameters>();
PassParameters->GridSize = FIntPoint(Resolution, Resolution);
PassParameters->Dt = Dt;
PassParameters->Dx = Dx;
PassParameters->PlaneLength = PlaneLength;
PassParameters->WaveSpeed = WaveSpeed;
PassParameters->Damping = Damping;
PassParameters->FoundationStiffness = Foundation;
PassParameters->TimeSeconds = StepInput.TimeSeconds;
PassParameters->BreathingSettings = BreathingSettings;
PassParameters->ImprintSettings = ImprintSettings;
for (int32 ObjectIndex = 0; ObjectIndex < 2; ++ObjectIndex)
{
PassParameters->ObjectPositionRadius[ObjectIndex] = StepInput.ObjectPositionRadius[ObjectIndex];
PassParameters->ObjectVelocityPush[ObjectIndex] = StepInput.ObjectVelocityPush[ObjectIndex];
}
PassParameters->SourceState = GraphBuilder.CreateSRV(Fields[CurrentIndex]);
PassParameters->TargetState = GraphBuilder.CreateUAV(Fields[TargetIndex]);
FComputeShaderUtils::AddPass(GraphBuilder,
RDG_EVENT_NAME("LivingPlaneStep"),
ComputeShader, PassParameters,
FIntVector(FMath::DivideAndRoundUp(Resolution, LivingPlaneThreadGroupSize),
FMath::DivideAndRoundUp(Resolution, LivingPlaneThreadGroupSize), 1));
CurrentIndex = TargetIndex;
}
GraphBuilder.Execute();
});
CurrentFieldIndex = (InitialFieldIndex + NumSteps) & 1;
SimulationStepCount += NumSteps;
UpdateMaterialField();
}
void AVoxelForgeLivingPlaneActor::Tick(float DeltaSeconds)
{
Super::Tick(DeltaSeconds);
if (FixedStepSeconds <= 0.0 || !FieldTargets[0] || !FieldTargets[1])
{
return;
}
SimulationAccumulatorSeconds += FMath::Max(static_cast<double>(DeltaSeconds), 0.0);
const int32 StepsToRun = FMath::Min(
static_cast<int32>(SimulationAccumulatorSeconds / FixedStepSeconds), 32);
if (StepsToRun > 0)
{
SimulationAccumulatorSeconds -= StepsToRun * FixedStepSeconds;
EnqueueSimulationSteps(StepsToRun);
}
}
void AVoxelForgeLivingPlaneActor::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
Super::EndPlay(EndPlayReason);
DynamicPlaneMaterial = nullptr;
FieldTargets[0] = nullptr;
FieldTargets[1] = nullptr;
}
@@ -0,0 +1,25 @@
#include "Modules/ModuleManager.h"
#include "Interfaces/IPluginManager.h"
#include "Misc/Paths.h"
#include "ShaderCore.h"
class FVoxelForgeLivingPlaneModule final : public IModuleInterface
{
public:
virtual void StartupModule() override
{
const TSharedPtr<IPlugin> Plugin = IPluginManager::Get().FindPlugin(TEXT("VoxelForge"));
if (!Plugin.IsValid())
{
UE_LOG(LogTemp, Error, TEXT("VoxelForgeLivingPlane could not find its owning plugin."));
return;
}
AddShaderSourceDirectoryMapping(
TEXT("/Plugin/VoxelForgeLivingPlane"),
FPaths::Combine(Plugin->GetBaseDir(), TEXT("Shaders")));
}
};
IMPLEMENT_MODULE(FVoxelForgeLivingPlaneModule, VoxelForgeLivingPlane)
@@ -0,0 +1,114 @@
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "VoxelForgeLivingPlaneActor.generated.h"
class UMaterialInterface;
class UMaterialInstanceDynamic;
class UStaticMeshComponent;
class UTextureRenderTarget2D;
USTRUCT(BlueprintType)
struct FVFLivingPlaneObjectInput
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Living Plane|Object")
FVector WorldPositionCm = FVector(0.0, 0.0, 43.0);
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Living Plane|Object")
FVector WorldVelocityCmPerSecond = FVector::ZeroVector;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Living Plane|Object", meta=(ClampMin="0.1"))
float RadiusCm = 43.0f;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Living Plane|Object", meta=(ClampMin="0.0"))
float PushAccelerationMetersPerSecondSquared = 36.0f;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Living Plane|Object")
bool bActive = false;
};
/** A render-only, GPU-stepped heightfield plane. Object state is uploaded; the field is never read back. */
UCLASS(BlueprintType, Blueprintable)
class VOXELFORGELIVINGPLANE_API AVoxelForgeLivingPlaneActor : public AActor
{
GENERATED_BODY()
public:
AVoxelForgeLivingPlaneActor();
virtual void BeginPlay() override;
virtual void Tick(float DeltaSeconds) override;
virtual void OnConstruction(const FTransform& Transform) override;
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
UFUNCTION(BlueprintCallable, Category="Living Plane|Object")
void SetObjectState(int32 ObjectIndex, const FVFLivingPlaneObjectInput& State);
UFUNCTION(BlueprintCallable, Category="Living Plane")
void ResetSimulation();
UFUNCTION(BlueprintPure, Category="Living Plane")
int64 GetSimulationStepCount() const { return SimulationStepCount; }
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Living Plane")
TObjectPtr<UStaticMeshComponent> PlaneMesh;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Living Plane|Rendering")
TObjectPtr<UMaterialInterface> PlaneMaterial;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Living Plane|Simulation", meta=(ClampMin="16", ClampMax="2048"))
int32 GridSize = 256;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Living Plane|Simulation", meta=(ClampMin="1.0", ClampMax="100.0"))
float PlaneLengthMeters = 12.0f;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Living Plane|Simulation", meta=(ClampMin="0.0"))
float WaveSpeedMetersPerSecond = 4.5f;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Living Plane|Simulation", meta=(ClampMin="0.0"))
float DampingPerSecond = 1.35f;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Living Plane|Simulation", meta=(ClampMin="0.0"))
float FoundationStiffnessPerSecondSquared = 28.0f;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Living Plane|Simulation")
bool bEnableBreathing = true;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Living Plane|Simulation", meta=(ClampMin="0.0", ClampMax="30.0"))
float BreathingStrengthMetersPerSecondSquared = 4.8f;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Living Plane|Imprint")
bool bEnableImprint = true;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Living Plane|Imprint", meta=(ClampMin="0.0", ClampMax="1.0"))
float ImprintCaptureMetersPerSecond = 0.15f;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Living Plane|Imprint", meta=(ClampMin="0.1", ClampMax="60.0"))
float ImprintRecoverySeconds = 6.0f;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Living Plane|Imprint", meta=(ClampMin="0.0", ClampMax="1.0"))
float ImprintMaxDepthMeters = 0.34f;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Living Plane|Object")
TArray<FVFLivingPlaneObjectInput> ObjectInputs;
private:
void CreateFieldTargets();
void EnqueueSimulationSteps(int32 NumSteps);
void UpdateMaterialField();
float GetStableStepSeconds() const;
UPROPERTY(Transient)
TObjectPtr<UTextureRenderTarget2D> FieldTargets[2];
UPROPERTY(Transient)
TObjectPtr<UMaterialInstanceDynamic> DynamicPlaneMaterial;
int32 CurrentFieldIndex = 0;
int64 SimulationStepCount = 0;
double SimulationAccumulatorSeconds = 0.0;
double FixedStepSeconds = 0.0;
};
@@ -0,0 +1,28 @@
using UnrealBuildTool;
public class VoxelForgeLivingPlane : ModuleRules
{
public VoxelForgeLivingPlane(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
if (Target.Platform == UnrealTargetPlatform.Linux)
{
bUseUnity = false;
}
PublicDependencyModuleNames.AddRange(new string[]
{
"Core",
"CoreUObject",
"Engine"
});
PrivateDependencyModuleNames.AddRange(new string[]
{
"Projects",
"RenderCore",
"RHI"
});
}
}
@@ -494,7 +494,10 @@ namespace VoxelForgeCore
// Version 223 projects the floor onto one continuous arc-length profile and groups // Version 223 projects the floor onto one continuous arc-length profile and groups
// dense passage samples into coarse tile candidates. Version 224 keeps the same // dense passage samples into coarse tile candidates. Version 224 keeps the same
// continuous floor while relaxing the spline chord tolerance and bounding shell work. // continuous floor while relaxing the spline chord tolerance and bounding shell work.
inline constexpr std::uint32_t WorldAssemblyEvaluatorVersion = 225; // Version 226 unifies the passage influence reach in metres and converts it to core
// voxels for every broadphase and proof bound. Version 227 uses the exact smooth-max
// support width/6 when deriving that reach.
inline constexpr std::uint32_t WorldAssemblyEvaluatorVersion = 227;
enum class FieldChannel : std::uint32_t enum class FieldChannel : std::uint32_t
{ {
@@ -594,6 +597,62 @@ namespace VoxelForgeCore
} }
} }
inline constexpr std::string_view CoreLiminalFieldRecipeIdV1 = "Core.Liminal.Field";
inline constexpr std::uint32_t CoreLiminalFieldRecipeVersionV1 = 1;
inline constexpr std::uint32_t CoreLiminalFieldRecipeVersionV2 = 2;
inline constexpr std::uint32_t CoreLiminalFieldVariantCountV1 = 4;
enum class WorldAssemblyLiminalVariantV1 : std::uint32_t
{
flatFieldMonolith = 0,
repeatingHills = 1,
roadOverCloudFloor = 2,
pillarGrid = 3
};
struct WorldAssemblyLiminalVariantDefinitionV1
{
WorldAssemblyLiminalVariantV1 variant = WorldAssemblyLiminalVariantV1::flatFieldMonolith;
std::string_view name;
WorldAssemblySurfaceProfileKindV1 surfaceKind = WorldAssemblySurfaceProfileKindV1::flatField;
std::int64_t hillAmplitudeMicrometres = 0;
std::int64_t hillWavelengthMicrometres = 0;
std::int64_t routeHalfWidthMicrometres = 0;
std::int64_t routeHalfThicknessMicrometres = 0;
std::int64_t supportSpacingMicrometres = 0;
std::int64_t supportRadiusMicrometres = 0;
std::int64_t monolithRadiusMicrometres = 0;
std::int64_t monolithHeightMicrometres = 0;
std::uint32_t pillarRows = 0;
std::uint32_t pillarColumns = 0;
std::int64_t pillarSpacingMicrometres = 0;
std::int64_t pillarRadiusMicrometres = 0;
std::int64_t pillarHeightMicrometres = 0;
};
inline constexpr std::array<WorldAssemblyLiminalVariantDefinitionV1,
CoreLiminalFieldVariantCountV1> CoreLiminalFieldVariantsV1{{
{WorldAssemblyLiminalVariantV1::flatFieldMonolith, "flatField-monolith",
WorldAssemblySurfaceProfileKindV1::flatField, 0, 0, 1750000, 500000,
36000000, 550000, 1600000, 26000000, 0, 0, 0, 0, 0},
{WorldAssemblyLiminalVariantV1::repeatingHills, "periodicHills",
WorldAssemblySurfaceProfileKindV1::periodicHills, 2200000, 80000000,
1750000, 500000, 36000000, 550000, 0, 0, 0, 0, 0, 0, 0},
{WorldAssemblyLiminalVariantV1::roadOverCloudFloor, "road-over-cloud-floor",
WorldAssemblySurfaceProfileKindV1::flatField, 0, 0, 2000000, 500000,
24000000, 550000, 0, 0, 0, 0, 0, 0, 0},
{WorldAssemblyLiminalVariantV1::pillarGrid, "pillar-grid",
WorldAssemblySurfaceProfileKindV1::flatField, 0, 0, 1750000, 500000,
36000000, 550000, 0, 0, 15, 15, 76000000, 5500000, 40000000}
}};
inline constexpr WorldAssemblyLiminalVariantV1 SelectCoreLiminalFieldVariantV1(
std::uint32_t seed) noexcept
{
return static_cast<WorldAssemblyLiminalVariantV1>(
seed % CoreLiminalFieldVariantCountV1);
}
struct WorldAssemblyRecipeV1 struct WorldAssemblyRecipeV1
{ {
std::uint32_t schemaVersion = WorldAssemblySchemaVersion; std::uint32_t schemaVersion = WorldAssemblySchemaVersion;
@@ -651,6 +710,23 @@ namespace VoxelForgeCore
std::array<std::int64_t, 4> parametersSubvoxels{}; std::array<std::int64_t, 4> parametersSubvoxels{};
}; };
struct WorldAssemblyLiminalFieldPlanV1
{
std::uint32_t version = 0;
WorldAssemblyLiminalVariantV1 variant = WorldAssemblyLiminalVariantV1::flatFieldMonolith;
std::uint32_t seed = 0;
std::array<std::int64_t, 3> arrivalMouthSubvoxels{};
std::array<std::int64_t, 3> departureMouthSubvoxels{};
// Fixed distance from each passage player-center anchor to its walk surface.
std::int64_t mouthFloorOffsetSubvoxels = 0;
std::int64_t floorHeightSubvoxels = 0;
std::int64_t routeHalfWidthSubvoxels = 0;
std::int64_t routeHalfThicknessSubvoxels = 0;
std::int64_t routeOffsetSubvoxels = 0;
std::int64_t supportSpacingSubvoxels = 0;
std::int64_t supportRadiusSubvoxels = 0;
};
struct WorldAssemblyStratumPlanV1 struct WorldAssemblyStratumPlanV1
{ {
std::int32_t strateIndex = -1; std::int32_t strateIndex = -1;
@@ -675,6 +751,7 @@ namespace VoxelForgeCore
std::vector<WorldAssemblyFeatureV1> features; std::vector<WorldAssemblyFeatureV1> features;
WorldAssemblyRouteConstraintsV1 routeConstraints; WorldAssemblyRouteConstraintsV1 routeConstraints;
std::vector<WorldAssemblyRoutePointV1> route; std::vector<WorldAssemblyRoutePointV1> route;
WorldAssemblyLiminalFieldPlanV1 liminalField;
std::uint64_t contentHash = 0; std::uint64_t contentHash = 0;
}; };
@@ -888,6 +965,10 @@ namespace VoxelForgeCore
inline constexpr std::uint32_t ResolvedLayoutStampVocabularyVersionV1 = 1; inline constexpr std::uint32_t ResolvedLayoutStampVocabularyVersionV1 = 1;
inline constexpr std::uint32_t ResolvedLayoutStampVocabularyVersionV2 = 2; inline constexpr std::uint32_t ResolvedLayoutStampVocabularyVersionV2 = 2;
inline constexpr std::uint32_t ResolvedLayoutStampVocabularyVersionV3 = 3; inline constexpr std::uint32_t ResolvedLayoutStampVocabularyVersionV3 = 3;
inline constexpr std::uint32_t ResolvedLayoutStampVocabularyVersionV4 = 4;
inline constexpr std::uint32_t ResolvedLayoutStampVocabularyVersionV5 = 5;
inline constexpr std::uint32_t ResolvedLayoutStampVocabularyVersionV6 = 6;
inline constexpr std::uint32_t ResolvedLayoutStampVocabularyVersionV7 = 7;
inline constexpr std::uint32_t ResolvedLayoutCavernGraphVocabularyVersionV1 = 1; inline constexpr std::uint32_t ResolvedLayoutCavernGraphVocabularyVersionV1 = 1;
inline constexpr std::uint32_t ResolvedLayoutOreVeinVocabularyVersionV1 = 1; inline constexpr std::uint32_t ResolvedLayoutOreVeinVocabularyVersionV1 = 1;
enum class ResolvedLayoutValidationModeV3 : std::uint8_t { compatibility, strict }; enum class ResolvedLayoutValidationModeV3 : std::uint8_t { compatibility, strict };
@@ -901,7 +982,11 @@ namespace VoxelForgeCore
fillPillar = 3, fillPillar = 3,
fillDais = 4, fillDais = 4,
fillMonolith = 5, fillMonolith = 5,
fillPlatform = 6 fillPlatform = 6,
fillSweptDeckSegment = 7,
fillBox = 8,
carveBox = 9,
fillSteps = 10
}; };
struct ResolvedLayoutStampRequestV1 struct ResolvedLayoutStampRequestV1
@@ -911,6 +996,12 @@ namespace VoxelForgeCore
ResolvedSdfStampKindV1 kind = ResolvedSdfStampKindV1::carveEllipsoid; ResolvedSdfStampKindV1 kind = ResolvedSdfStampKindV1::carveEllipsoid;
// A preferred center and a bounded deterministic search radius. // A preferred center and a bounded deterministic search radius.
std::array<std::int64_t, 3> anchorPositionMicrometres{}; std::array<std::int64_t, 3> anchorPositionMicrometres{};
// Present only for fillSweptDeckSegment; defines its directed centerline.
std::array<std::array<std::int64_t, 3>, 2> sweepEndpointsMicrometres{};
// V5 permits one continuous swept deck to carry its complete sampled centerline.
// V6 also permits a path whose X coordinates are not strictly increasing.
// Empty retains the V4 single-segment interpretation.
std::vector<std::array<std::int64_t, 3>> sweepPathMicrometres;
std::int64_t placementRadiusMicrometres = 0; std::int64_t placementRadiusMicrometres = 0;
std::array<std::int64_t, 3> halfExtentsMicrometres{}; std::array<std::int64_t, 3> halfExtentsMicrometres{};
std::int64_t smoothWidthMicrometres = 0; std::int64_t smoothWidthMicrometres = 0;
@@ -918,6 +1009,9 @@ namespace VoxelForgeCore
std::int64_t irregularityWavelengthMicrometres = 0; std::int64_t irregularityWavelengthMicrometres = 0;
std::int64_t roundingRadiusMicrometres = 0; std::int64_t roundingRadiusMicrometres = 0;
std::int64_t minimumSpacingMicrometres = 0; std::int64_t minimumSpacingMicrometres = 0;
// Vocabulary 7: fillSteps divides the X and Z extents into this many
// identical treads and risers. Other stamp kinds keep this at zero.
std::uint16_t stepCount = 0;
// 0 = free placement, 1 = seated on the authored flat profile floor. // 0 = free placement, 1 = seated on the authored flat profile floor.
std::uint8_t attachmentPolicy = 0; std::uint8_t attachmentPolicy = 0;
std::int64_t floorMicrometres = 0; std::int64_t floorMicrometres = 0;
@@ -930,6 +1024,8 @@ namespace VoxelForgeCore
std::int32_t strateIndex = -1; std::int32_t strateIndex = -1;
ResolvedSdfStampKindV1 kind = ResolvedSdfStampKindV1::carveEllipsoid; ResolvedSdfStampKindV1 kind = ResolvedSdfStampKindV1::carveEllipsoid;
std::array<std::int64_t, 3> positionMicrometres{}; std::array<std::int64_t, 3> positionMicrometres{};
std::array<std::array<std::int64_t, 3>, 2> sweepEndpointsMicrometres{};
std::vector<std::array<std::int64_t, 3>> sweepPathMicrometres;
std::array<std::int64_t, 3> boundsMinimumMicrometres{}; std::array<std::int64_t, 3> boundsMinimumMicrometres{};
std::array<std::int64_t, 3> boundsMaximumMicrometres{}; std::array<std::int64_t, 3> boundsMaximumMicrometres{};
std::array<std::int64_t, 3> halfExtentsMicrometres{}; std::array<std::int64_t, 3> halfExtentsMicrometres{};
@@ -938,6 +1034,7 @@ namespace VoxelForgeCore
std::int64_t irregularityWavelengthMicrometres = 0; std::int64_t irregularityWavelengthMicrometres = 0;
std::int64_t roundingRadiusMicrometres = 0; std::int64_t roundingRadiusMicrometres = 0;
std::int64_t minimumSpacingMicrometres = 0; std::int64_t minimumSpacingMicrometres = 0;
std::uint16_t stepCount = 0;
std::uint8_t attachmentPolicy = 0; std::uint8_t attachmentPolicy = 0;
std::int64_t floorMicrometres = 0; std::int64_t floorMicrometres = 0;
std::uint64_t irregularitySeed = 0; std::uint64_t irregularitySeed = 0;
@@ -1057,6 +1154,27 @@ namespace VoxelForgeCore
bool surfaceToTunnelLandingSupport = false; bool surfaceToTunnelLandingSupport = false;
}; };
enum class ResolvedLayoutLandingPadRoleV1 : std::uint32_t
{
arrival = 0,
departure = 1
};
struct ResolvedLayoutLandingPadV1
{
std::string stableId;
ResolvedLayoutLandingPadRoleV1 role = ResolvedLayoutLandingPadRoleV1::arrival;
// Capsule-center position. floorHeightSubvoxels is the supported floor below it.
std::array<std::int64_t, 3> positionSubvoxels{};
std::int64_t floorHeightSubvoxels = 0;
// Unit horizontal travel direction, signed Q16, oriented into the layer route.
std::array<std::int32_t, 2> approachDirectionQ16{};
// Certified horizontal free radius around the capsule center and support below the floor.
std::int64_t clearanceSubvoxels = 0;
std::int64_t supportDepthSubvoxels = 0;
bool certifiedWalkableWithSupport = false;
};
struct ResolvedLayoutStratumV2 struct ResolvedLayoutStratumV2
{ {
std::string stableId; std::string stableId;
@@ -1086,6 +1204,7 @@ 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;
std::vector<ResolvedLayoutLandingPadV1> landingPads;
ResolvedLayoutStratePassageCapabilitiesV1 passageCapabilities; ResolvedLayoutStratePassageCapabilitiesV1 passageCapabilities;
ResolvedLayoutInterfaceCapabilitiesV1 lowerInterfaceCapabilities; ResolvedLayoutInterfaceCapabilitiesV1 lowerInterfaceCapabilities;
}; };
@@ -1225,6 +1344,15 @@ namespace VoxelForgeCore
ResolvedLayoutSnapshotV3& layout, std::int32_t seed, ResolvedLayoutSnapshotV3& layout, std::int32_t seed,
const std::vector<ResolvedLayoutPassageConfigV1>& configs, const std::vector<ResolvedLayoutPassageConfigV1>& configs,
std::string& error); std::string& error);
VFCORE_API bool PlanCoreLiminalFieldV1(
WorldAssemblyRecipeV1& recipe, WorldAssemblyStratumPlanV1& stratum,
const ResolvedLayoutSnapshotV3& layout, std::string& error);
VFCORE_API bool PrepareCoreLiminalLandingPadsV2(
WorldAssemblyRecipeV1& recipe, WorldAssemblyStratumPlanV1& stratum,
ResolvedLayoutSnapshotV3& layout, std::string& error);
VFCORE_API bool PlanCoreLiminalFieldV2(
WorldAssemblyRecipeV1& recipe, WorldAssemblyStratumPlanV1& stratum,
const ResolvedLayoutSnapshotV3& layout, std::string& error);
struct ResolvedLayoutStampPlacementAuditV1 struct ResolvedLayoutStampPlacementAuditV1
{ {
+459 -13
View File
@@ -176,7 +176,7 @@ namespace
{ {
const auto value=static_cast<std::uint8_t>(kind); const auto value=static_cast<std::uint8_t>(kind);
return value>=static_cast<std::uint8_t>(ResolvedSdfStampKindV1::carveEllipsoid) return value>=static_cast<std::uint8_t>(ResolvedSdfStampKindV1::carveEllipsoid)
&&value<=static_cast<std::uint8_t>(ResolvedSdfStampKindV1::fillPlatform); &&value<=static_cast<std::uint8_t>(ResolvedSdfStampKindV1::fillSteps);
} }
bool LayoutStampIsMotif(ResolvedSdfStampKindV1 kind) bool LayoutStampIsMotif(ResolvedSdfStampKindV1 kind)
{return kind==ResolvedSdfStampKindV1::fillMonolith {return kind==ResolvedSdfStampKindV1::fillMonolith
@@ -249,6 +249,71 @@ namespace
/WorldAssemblySubvoxelsPerVoxel)); /WorldAssemblySubvoxelsPerVoxel));
return result; return result;
}; };
const bool liminalRouteStamp=strate->recipeId==CoreLiminalFieldRecipeIdV1
&&stamp.stableId.starts_with("core/liminal-field/route/")
&&(stamp.kind==ResolvedSdfStampKindV1::fillSweptDeckSegment
||stamp.kind==ResolvedSdfStampKindV1::fillPillar);
if(liminalRouteStamp)
{
const auto variant=std::find_if(strate->anchors.begin(),strate->anchors.end(),
[](const auto& anchor){return anchor.kind=="liminal_variant"
&&anchor.values.size()>=6;});
std::vector<const ResolvedLayoutAnchorV2*> points;
for(const auto& anchor:strate->anchors)
if(anchor.kind=="liminal_route_point"&&anchor.values.size()>=4)
points.push_back(&anchor);
if(variant==strate->anchors.end()||points.size()<2)
{if(reason)*reason="Core.Liminal.Field route stamp has no versioned fixed-mouth route";return false;}
const auto routePoint=[&](const ResolvedLayoutAnchorV2& anchor)
{
std::array<std::int64_t,3> q={anchor.values[0],anchor.values[1],anchor.values[2]};
return qToMicrometres(q);
};
const std::int64_t halfThickness=static_cast<std::int64_t>(std::llround(
static_cast<double>(variant->values[5])*coreMicrometres
/WorldAssemblySubvoxelsPerVoxel));
if(stamp.kind==ResolvedSdfStampKindV1::fillSweptDeckSegment)
{
const auto first=routePoint(*points.front());
const auto last=routePoint(*points.back());
if(stamp.sweepPathMicrometres.size()<2
||stamp.sweepPathMicrometres.front()[0]!=first[0]
||stamp.sweepPathMicrometres.front()[1]!=first[1]
||stamp.sweepPathMicrometres.front()[2]!=first[2]-halfThickness
||stamp.sweepPathMicrometres.back()[0]!=last[0]
||stamp.sweepPathMicrometres.back()[1]!=last[1]
||stamp.sweepPathMicrometres.back()[2]!=last[2]-halfThickness)
{if(reason)*reason="Core.Liminal.Field deck does not terminate at its fixed passage mouths";return false;}
return true;
}
const auto deck=std::find_if(layout.stamps.begin(),layout.stamps.end(),
[&](const auto& existing){return existing.strateIndex==stamp.strateIndex
&&existing.stableId=="core/liminal-field/route/deck/000"
&&existing.kind==ResolvedSdfStampKindV1::fillSweptDeckSegment;});
if(deck==layout.stamps.end()||deck->sweepPathMicrometres.size()<2)
{if(reason)*reason="Core.Liminal.Field support has no previously resolved route deck";return false;}
double distance=std::numeric_limits<double>::infinity();
for(std::size_t i=1;i<deck->sweepPathMicrometres.size();++i)
{
const auto& a=deck->sweepPathMicrometres[i-1];
const auto& b=deck->sweepPathMicrometres[i];
const double dx=static_cast<double>(b[0]-a[0]);
const double dy=static_cast<double>(b[1]-a[1]);
const double lengthSquared=dx*dx+dy*dy;
const double t=lengthSquared>0.0?std::clamp(
((stamp.positionMicrometres[0]-a[0])*dx
+(stamp.positionMicrometres[1]-a[1])*dy)/lengthSquared,
0.0,1.0):0.0;
const double offsetX=stamp.positionMicrometres[0]-(a[0]+t*dx);
const double offsetY=stamp.positionMicrometres[1]-(a[1]+t*dy);
distance=std::min(distance,std::hypot(offsetX,offsetY));
}
const double corridorRadius=deck->halfExtentsMicrometres[1]
+stamp.halfExtentsMicrometres[0]+RouteClearanceMicrometres;
if(distance>corridorRadius)
{if(reason)*reason="Core.Liminal.Field route stamp is outside its versioned route corridor";return false;}
return true;
}
for(const auto& passage:layout.passages) for(const auto& passage:layout.passages)
{ {
if(passage.upperStrateIndex!=stamp.strateIndex if(passage.upperStrateIndex!=stamp.strateIndex
@@ -548,7 +613,28 @@ namespace
for(std::size_t v=0;v<anchor.values.size();++v){if(v)out<<',';out<<anchor.values[v];} for(std::size_t v=0;v<anchor.values.size();++v){if(v)out<<',';out<<anchor.values[v];}
out<<"]}"; out<<"]}";
} }
out<<"]}"; out<<']';
if(!x.landingPads.empty())
{
out<<",\"landing_pads\":[";
for(std::size_t p=0;p<x.landingPads.size();++p)
{
if(p)out<<',';const auto& pad=x.landingPads[p];
out<<"{\"stable_id\":"<<LayoutEscape(pad.stableId)
<<",\"role\":"<<static_cast<std::uint32_t>(pad.role)
<<",\"position_q\":["<<pad.positionSubvoxels[0]<<','
<<pad.positionSubvoxels[1]<<','<<pad.positionSubvoxels[2]
<<"],\"floor_q\":"<<pad.floorHeightSubvoxels
<<",\"approach_q16\":["<<pad.approachDirectionQ16[0]<<','
<<pad.approachDirectionQ16[1]<<']'
<<",\"clearance_q\":"<<pad.clearanceSubvoxels
<<",\"support_depth_q\":"<<pad.supportDepthSubvoxels
<<",\"certified\":"
<<(pad.certifiedWalkableWithSupport?"true":"false")<<'}';
}
out<<']';
}
out<<'}';
} }
out<<"],\"passages\":["; out<<"],\"passages\":[";
for(std::size_t i=0;i<s.passages.size();++i) for(std::size_t i=0;i<s.passages.size();++i)
@@ -598,11 +684,35 @@ namespace
<<",\"irregularity_wavelength_um\":"<<stamp.irregularityWavelengthMicrometres <<",\"irregularity_wavelength_um\":"<<stamp.irregularityWavelengthMicrometres
<<",\"irregularity_seed\":"<<stamp.irregularitySeed <<",\"irregularity_seed\":"<<stamp.irregularitySeed
<<",\"yaw_quarter_turns\":"<<static_cast<unsigned>(stamp.yawQuarterTurns); <<",\"yaw_quarter_turns\":"<<static_cast<unsigned>(stamp.yawQuarterTurns);
if(stamp.kind==ResolvedSdfStampKindV1::fillSweptDeckSegment)
{
out<<",\"sweep_endpoints_um\":[["
<<stamp.sweepEndpointsMicrometres[0][0]<<','
<<stamp.sweepEndpointsMicrometres[0][1]<<','
<<stamp.sweepEndpointsMicrometres[0][2]<<"],["
<<stamp.sweepEndpointsMicrometres[1][0]<<','
<<stamp.sweepEndpointsMicrometres[1][1]<<','
<<stamp.sweepEndpointsMicrometres[1][2]<<"]]";
if(!stamp.sweepPathMicrometres.empty())
{
out<<",\"sweep_path_um\":[";
for(std::size_t pointIndex=0;pointIndex<stamp.sweepPathMicrometres.size();
++pointIndex)
{
if(pointIndex)out<<',';
const auto& point=stamp.sweepPathMicrometres[pointIndex];
out<<'['<<point[0]<<','<<point[1]<<','<<point[2]<<']';
}
out<<']';
}
}
if(s.stampVocabularyVersion>=ResolvedLayoutStampVocabularyVersionV3) if(s.stampVocabularyVersion>=ResolvedLayoutStampVocabularyVersionV3)
out<<",\"rounding_radius_um\":"<<stamp.roundingRadiusMicrometres out<<",\"rounding_radius_um\":"<<stamp.roundingRadiusMicrometres
<<",\"minimum_spacing_um\":"<<stamp.minimumSpacingMicrometres <<",\"minimum_spacing_um\":"<<stamp.minimumSpacingMicrometres
<<",\"attachment_policy\":"<<static_cast<unsigned>(stamp.attachmentPolicy) <<",\"attachment_policy\":"<<static_cast<unsigned>(stamp.attachmentPolicy)
<<",\"floor_um\":"<<stamp.floorMicrometres; <<",\"floor_um\":"<<stamp.floorMicrometres;
if(stamp.kind==ResolvedSdfStampKindV1::fillSteps)
out<<",\"step_count\":"<<stamp.stepCount;
out<<'}'; out<<'}';
} }
out<<']'; out<<']';
@@ -870,6 +980,9 @@ bool ResolvedLayoutSnapshotV3::finalize(std::string& error)
for(std::size_t i=0;i<strates.size();++i) for(std::size_t i=0;i<strates.size();++i)
{ {
auto& x=strates[i];x.order=static_cast<std::int32_t>(i); auto& x=strates[i];x.order=static_cast<std::int32_t>(i);
std::stable_sort(x.landingPads.begin(),x.landingPads.end(),[](const auto& a,const auto& b)
{return a.role!=b.role?static_cast<std::uint32_t>(a.role)
<static_cast<std::uint32_t>(b.role):a.stableId<b.stableId;});
if(x.stableId.empty())x.stableId=worldIdentity+"/strate/"+std::to_string(x.strateIndex); if(x.stableId.empty())x.stableId=worldIdentity+"/strate/"+std::to_string(x.strateIndex);
if(x.content.kind.empty())x.content.kind="content"; if(x.content.kind.empty())x.content.kind="content";
if(x.ceiling.kind.empty())x.ceiling.kind="ceiling"; if(x.ceiling.kind.empty())x.ceiling.kind="ceiling";
@@ -930,9 +1043,40 @@ bool ResolvedLayoutSnapshotV3::validate(ResolvedLayoutValidationModeV3 mode,
const auto add=[&](std::string code,std::string detail) const auto add=[&](std::string code,std::string detail)
{issues.push_back({std::move(code),std::move(detail)});}; {issues.push_back({std::move(code),std::move(detail)});};
const bool strict=mode==ResolvedLayoutValidationModeV3::strict; const bool strict=mode==ResolvedLayoutValidationModeV3::strict;
const std::int64_t playerCenterAboveFloorQ=static_cast<std::int64_t>(std::llround(
1.13*WorldAssemblySubvoxelsPerVoxel*1000000.0/coreVoxelSizeMicrometres));
for(std::size_t i=0;i<strates.size();++i) for(std::size_t i=0;i<strates.size();++i)
{ {
const auto& s=strates[i]; const auto& s=strates[i];
std::vector<std::string> landingPadIds;
for(const auto& pad:s.landingPads)
{
if(pad.stableId.empty()
||std::find(landingPadIds.begin(),landingPadIds.end(),pad.stableId)
!=landingPadIds.end())
add("landing_pad_identity",s.stableId+" has an empty or duplicate landing-pad ID");
else landingPadIds.push_back(pad.stableId);
const auto role=static_cast<std::uint32_t>(pad.role);
const std::int64_t directionX=pad.approachDirectionQ16[0];
const std::int64_t directionY=pad.approachDirectionQ16[1];
const std::int64_t directionLengthSquared=directionX*directionX+directionY*directionY;
constexpr std::int64_t UnitQ16Squared=1ll<<32;
const bool unitDirection=directionLengthSquared>=UnitQ16Squared*98/100
&&directionLengthSquared<=UnitQ16Squared*102/100;
const std::int64_t floorMicrometres=pad.floorHeightSubvoxels
*static_cast<std::int64_t>(coreVoxelSizeMicrometres)
/WorldAssemblySubvoxelsPerVoxel;
if(role>static_cast<std::uint32_t>(ResolvedLayoutLandingPadRoleV1::departure)
||pad.positionSubvoxels[2]
!=pad.floorHeightSubvoxels+playerCenterAboveFloorQ
||!s.content.presentInCurrentField
||floorMicrometres<s.content.bottomMicrometres
||floorMicrometres>=s.content.topMicrometres
||!unitDirection||pad.clearanceSubvoxels<=0
||pad.supportDepthSubvoxels<=0
||!pad.certifiedWalkableWithSupport)
add("landing_pad_contract",s.stableId+" publishes an uncertified or malformed landing pad");
}
const std::int64_t effectiveTransitionWidth=LayoutTransitionLimit(s); const std::int64_t effectiveTransitionWidth=LayoutTransitionLimit(s);
if(s.interiorTopMicrometres<=s.interiorBottomMicrometres) if(s.interiorTopMicrometres<=s.interiorBottomMicrometres)
add("invalid_interior",s.stableId+" has non-positive content height"); add("invalid_interior",s.stableId+" has non-positive content height");
@@ -1134,8 +1278,12 @@ bool ResolvedLayoutSnapshotV3::validate(ResolvedLayoutValidationModeV3 mode,
} }
else if(stampVocabularyVersion!=ResolvedLayoutStampVocabularyVersionV1 else if(stampVocabularyVersion!=ResolvedLayoutStampVocabularyVersionV1
&&stampVocabularyVersion!=ResolvedLayoutStampVocabularyVersionV2 &&stampVocabularyVersion!=ResolvedLayoutStampVocabularyVersionV2
&&stampVocabularyVersion!=ResolvedLayoutStampVocabularyVersionV3) &&stampVocabularyVersion!=ResolvedLayoutStampVocabularyVersionV3
add("stamp_vocabulary_version","resolved stamps require supported vocabulary version 1, 2 or 3"); &&stampVocabularyVersion!=ResolvedLayoutStampVocabularyVersionV4
&&stampVocabularyVersion!=ResolvedLayoutStampVocabularyVersionV5
&&stampVocabularyVersion!=ResolvedLayoutStampVocabularyVersionV6
&&stampVocabularyVersion!=ResolvedLayoutStampVocabularyVersionV7)
add("stamp_vocabulary_version","resolved stamps require supported vocabulary version 1 through 7");
std::vector<std::string> stampIds; std::vector<std::string> stampIds;
for(const auto& stamp:stamps) for(const auto& stamp:stamps)
{ {
@@ -1145,8 +1293,20 @@ bool ResolvedLayoutSnapshotV3::validate(ResolvedLayoutValidationModeV3 mode,
else stampIds.push_back(stamp.stableId); else stampIds.push_back(stamp.stableId);
const bool motif=LayoutStampIsMotif(stamp.kind); const bool motif=LayoutStampIsMotif(stamp.kind);
if(!LayoutStampKindValid(stamp.kind)||stamp.yawQuarterTurns>3 if(!LayoutStampKindValid(stamp.kind)||stamp.yawQuarterTurns>3
||(stamp.kind==ResolvedSdfStampKindV1::fillSweptDeckSegment
&&stampVocabularyVersion<ResolvedLayoutStampVocabularyVersionV4)
||((stamp.kind==ResolvedSdfStampKindV1::fillBox
||stamp.kind==ResolvedSdfStampKindV1::carveBox
||stamp.kind==ResolvedSdfStampKindV1::fillSteps)
&&stampVocabularyVersion<ResolvedLayoutStampVocabularyVersionV7)
||(motif&&stampVocabularyVersion<ResolvedLayoutStampVocabularyVersionV3)) ||(motif&&stampVocabularyVersion<ResolvedLayoutStampVocabularyVersionV3))
add("stamp_kind","stamp has an unsupported kind or orientation"); add("stamp_kind","stamp has an unsupported kind or orientation");
if((stamp.kind==ResolvedSdfStampKindV1::fillSteps
&&(stampVocabularyVersion<ResolvedLayoutStampVocabularyVersionV7
||stamp.stepCount<2||stamp.stepCount>128
||stamp.roundingRadiusMicrometres!=0))
||(stamp.kind!=ResolvedSdfStampKindV1::fillSteps&&stamp.stepCount!=0))
add("stamp_steps",stamp.stableId+" has an invalid step count or rounding mode");
bool validExtents=true; bool validExtents=true;
for(const auto extent:stamp.halfExtentsMicrometres) for(const auto extent:stamp.halfExtentsMicrometres)
validExtents=validExtents&&extent>=500000&&extent<=100000000; validExtents=validExtents&&extent>=500000&&extent<=100000000;
@@ -1159,6 +1319,49 @@ bool ResolvedLayoutSnapshotV3::validate(ResolvedLayoutValidationModeV3 mode,
||(stamp.irregularityAmplitudeMicrometres>0 ||(stamp.irregularityAmplitudeMicrometres>0
&&stamp.irregularityWavelengthMicrometres<=0)) &&stamp.irregularityWavelengthMicrometres<=0))
add("stamp_parameters",stamp.stableId+" has invalid or unbounded geometry parameters"); add("stamp_parameters",stamp.stableId+" has invalid or unbounded geometry parameters");
if(stamp.kind==ResolvedSdfStampKindV1::fillSweptDeckSegment)
{
double lengthSquared=0.0;
for(std::size_t axis=0;axis<3;++axis)
{
const auto a=stamp.sweepEndpointsMicrometres[0][axis];
const auto b=stamp.sweepEndpointsMicrometres[1][axis];
if(a<-1000000000000ll||a>1000000000000ll
||b<-1000000000000ll||b>1000000000000ll)
add("stamp_sweep",stamp.stableId+" has an unbounded endpoint");
const double delta=static_cast<double>(stamp.sweepEndpointsMicrometres[1][axis])
-stamp.sweepEndpointsMicrometres[0][axis];
lengthSquared+=delta*delta;
}
if(stamp.sweepPathMicrometres.empty()&&(!(lengthSquared>0.0)
||std::sqrt(lengthSquared)>2.0*stamp.halfExtentsMicrometres[0]+1.0))
add("stamp_sweep",stamp.stableId+" has invalid endpoints or longitudinal extent");
if(!stamp.sweepPathMicrometres.empty())
{
bool validPath=stampVocabularyVersion>=ResolvedLayoutStampVocabularyVersionV5
&&stamp.sweepPathMicrometres.size()>=2
&&stamp.sweepPathMicrometres.size()<=1025
&&stamp.sweepPathMicrometres.front()==stamp.sweepEndpointsMicrometres[0]
&&stamp.sweepPathMicrometres.back()==stamp.sweepEndpointsMicrometres[1];
for(std::size_t pointIndex=0;pointIndex<stamp.sweepPathMicrometres.size();
++pointIndex)
{
const auto& point=stamp.sweepPathMicrometres[pointIndex];
for(const auto coordinate:point)
validPath=validPath&&coordinate>=-1000000000000ll
&&coordinate<=1000000000000ll;
if(pointIndex>0)
{
const auto& previous=stamp.sweepPathMicrometres[pointIndex-1];
validPath=validPath&&previous!=point
&&(stampVocabularyVersion>=ResolvedLayoutStampVocabularyVersionV6
||previous[0]<point[0]);
}
}
if(!validPath)add("stamp_sweep_path",stamp.stableId
+" has an invalid swept-deck path for its vocabulary version");
}
}
if(motif) if(motif)
{ {
const auto minimumExtent=*std::min_element(stamp.halfExtentsMicrometres.begin(), const auto minimumExtent=*std::min_element(stamp.halfExtentsMicrometres.begin(),
@@ -1186,6 +1389,52 @@ bool ResolvedLayoutSnapshotV3::validate(ResolvedLayoutValidationModeV3 mode,
const std::int64_t pad=motif const std::int64_t pad=motif
?(stamp.smoothWidthMicrometres+5)/6+stamp.irregularityAmplitudeMicrometres ?(stamp.smoothWidthMicrometres+5)/6+stamp.irregularityAmplitudeMicrometres
:stamp.smoothWidthMicrometres+stamp.irregularityAmplitudeMicrometres; :stamp.smoothWidthMicrometres+stamp.irregularityAmplitudeMicrometres;
if(stamp.kind==ResolvedSdfStampKindV1::fillSweptDeckSegment
&&stamp.sweepPathMicrometres.empty())
{
double radiusSquared=0.0;
for(const auto extent:stamp.halfExtentsMicrometres)
{
const double expanded=static_cast<double>(extent+pad);
radiusSquared+=expanded*expanded;
}
const auto radius=static_cast<std::int64_t>(std::ceil(std::sqrt(radiusSquared)));
for(std::size_t axis=0;axis<3;++axis)
{
const auto minimum=std::min(stamp.sweepEndpointsMicrometres[0][axis],
stamp.sweepEndpointsMicrometres[1][axis]);
const auto maximum=std::max(stamp.sweepEndpointsMicrometres[0][axis],
stamp.sweepEndpointsMicrometres[1][axis]);
if(stamp.boundsMinimumMicrometres[axis]!=minimum-radius
||stamp.boundsMaximumMicrometres[axis]!=maximum+radius)
add("stamp_bounds",stamp.stableId+" conservative sweep bounds do not match its parameters");
}
}
else if(stamp.kind==ResolvedSdfStampKindV1::fillSweptDeckSegment)
{
double radiusSquared=0.0;
for(std::size_t axis=1;axis<3;++axis)
{
const double expanded=static_cast<double>(stamp.halfExtentsMicrometres[axis]+pad);
radiusSquared+=expanded*expanded;
}
const auto radius=static_cast<std::int64_t>(std::ceil(std::sqrt(radiusSquared)));
std::array<std::int64_t,3> minimum=stamp.sweepPathMicrometres.front();
std::array<std::int64_t,3> maximum=minimum;
for(const auto& point:stamp.sweepPathMicrometres)
for(std::size_t axis=0;axis<3;++axis)
{
minimum[axis]=std::min(minimum[axis],point[axis]);
maximum[axis]=std::max(maximum[axis],point[axis]);
}
for(std::size_t axis=0;axis<3;++axis)
if(stamp.boundsMinimumMicrometres[axis]!=minimum[axis]-radius
||stamp.boundsMaximumMicrometres[axis]!=maximum[axis]+radius)
add("stamp_bounds",stamp.stableId
+" conservative continuous-sweep bounds do not match its path");
}
else
{
const std::array<std::int64_t,3> extents={ const std::array<std::int64_t,3> extents={
stamp.halfExtentsMicrometres[stamp.yawQuarterTurns%2?1:0]+pad, stamp.halfExtentsMicrometres[stamp.yawQuarterTurns%2?1:0]+pad,
stamp.halfExtentsMicrometres[stamp.yawQuarterTurns%2?0:1]+pad, stamp.halfExtentsMicrometres[stamp.yawQuarterTurns%2?0:1]+pad,
@@ -1196,6 +1445,7 @@ bool ResolvedLayoutSnapshotV3::validate(ResolvedLayoutValidationModeV3 mode,
||stamp.boundsMaximumMicrometres[axis] ||stamp.boundsMaximumMicrometres[axis]
!=stamp.positionMicrometres[axis]+extents[axis]) !=stamp.positionMicrometres[axis]+extents[axis])
add("stamp_bounds",stamp.stableId+" conservative bounds do not match its parameters"); add("stamp_bounds",stamp.stableId+" conservative bounds do not match its parameters");
}
std::string safetyReason; std::string safetyReason;
if(!LayoutStampSafe(*this,stamp,&safetyReason)) if(!LayoutStampSafe(*this,stamp,&safetyReason))
add("stamp_placement",stamp.stableId+" is unsafe: "+safetyReason); add("stamp_placement",stamp.stableId+" is unsafe: "+safetyReason);
@@ -1461,6 +1711,22 @@ std::optional<ResolvedLayoutSnapshotV3> ResolvedLayoutSnapshotV3::FromJson(
for(const auto& a:v.Get("anchors").AsArray()) for(const auto& a:v.Get("anchors").AsArray())
{ResolvedLayoutAnchorV2 p;p.kind=LayoutString(a,"kind");p.stableId=LayoutString(a,"stable_id");p.units=LayoutString(a,"units"); {ResolvedLayoutAnchorV2 p;p.kind=LayoutString(a,"kind");p.stableId=LayoutString(a,"stable_id");p.units=LayoutString(a,"units");
for(const auto& value:a.Get("values").AsArray())p.values.push_back(value.Integer());x.anchors.push_back(std::move(p));} for(const auto& value:a.Get("values").AsArray())p.values.push_back(value.Integer());x.anchors.push_back(std::move(p));}
for(const auto& value:v.Get("landing_pads").AsArray())
{
ResolvedLayoutLandingPadV1 pad;pad.stableId=LayoutString(value,"stable_id");
pad.role=static_cast<ResolvedLayoutLandingPadRoleV1>(LayoutInt(value,"role"));
const auto& position=value.Get("position_q").AsArray();
for(std::size_t axis=0;axis<3&&axis<position.size();++axis)
pad.positionSubvoxels[axis]=position[axis].Integer();
pad.floorHeightSubvoxels=LayoutInt(value,"floor_q");
const auto& approach=value.Get("approach_q16").AsArray();
for(std::size_t axis=0;axis<2&&axis<approach.size();++axis)
pad.approachDirectionQ16[axis]=static_cast<std::int32_t>(approach[axis].Integer());
pad.clearanceSubvoxels=LayoutInt(value,"clearance_q");
pad.supportDepthSubvoxels=LayoutInt(value,"support_depth_q");
pad.certifiedWalkableWithSupport=LayoutBool(value,"certified");
x.landingPads.push_back(std::move(pad));
}
s.strates.push_back(std::move(x)); s.strates.push_back(std::move(x));
} }
for(const auto& v:root.Get("passages").AsArray()) for(const auto& v:root.Get("passages").AsArray())
@@ -1497,6 +1763,21 @@ std::optional<ResolvedLayoutSnapshotV3> ResolvedLayoutSnapshotV3::FromJson(
target[axis]=values[axis].Integer(); target[axis]=values[axis].Integer();
}; };
readTriplet("position_um",stamp.positionMicrometres); readTriplet("position_um",stamp.positionMicrometres);
const auto& sweepEndpoints=v.Get("sweep_endpoints_um").AsArray();
for(std::size_t endpoint=0;endpoint<2&&endpoint<sweepEndpoints.size();++endpoint)
{
const auto& values=sweepEndpoints[endpoint].AsArray();
for(std::size_t axis=0;axis<3&&axis<values.size();++axis)
stamp.sweepEndpointsMicrometres[endpoint][axis]=values[axis].Integer();
}
for(const auto& value:v.Get("sweep_path_um").AsArray())
{
std::array<std::int64_t,3> point{};
const auto& values=value.AsArray();
for(std::size_t axis=0;axis<3&&axis<values.size();++axis)
point[axis]=values[axis].Integer();
stamp.sweepPathMicrometres.push_back(point);
}
readTriplet("bounds_min_um",stamp.boundsMinimumMicrometres); readTriplet("bounds_min_um",stamp.boundsMinimumMicrometres);
readTriplet("bounds_max_um",stamp.boundsMaximumMicrometres); readTriplet("bounds_max_um",stamp.boundsMaximumMicrometres);
readTriplet("half_extents_um",stamp.halfExtentsMicrometres); readTriplet("half_extents_um",stamp.halfExtentsMicrometres);
@@ -1509,6 +1790,7 @@ std::optional<ResolvedLayoutSnapshotV3> ResolvedLayoutSnapshotV3::FromJson(
stamp.floorMicrometres=LayoutInt(v,"floor_um"); stamp.floorMicrometres=LayoutInt(v,"floor_um");
stamp.irregularitySeed=static_cast<std::uint64_t>(LayoutInt(v,"irregularity_seed")); stamp.irregularitySeed=static_cast<std::uint64_t>(LayoutInt(v,"irregularity_seed"));
stamp.yawQuarterTurns=static_cast<std::uint8_t>(LayoutInt(v,"yaw_quarter_turns")); stamp.yawQuarterTurns=static_cast<std::uint8_t>(LayoutInt(v,"yaw_quarter_turns"));
stamp.stepCount=static_cast<std::uint16_t>(LayoutInt(v,"step_count"));
s.stamps.push_back(std::move(stamp)); s.stamps.push_back(std::move(stamp));
} }
for(const auto& v:root.Get("cavern_rooms").AsArray()) for(const auto& v:root.Get("cavern_rooms").AsArray())
@@ -1619,7 +1901,31 @@ bool ResolveResolvedLayoutStampsV1(ResolvedLayoutSnapshotV3& layout,std::int32_t
std::sort(ordered.begin(),ordered.end(),[](const auto& a,const auto& b) std::sort(ordered.begin(),ordered.end(),[](const auto& a,const auto& b)
{return a.stableId<b.stableId;}); {return a.stableId<b.stableId;});
ResolvedLayoutSnapshotV3 candidate=layout; ResolvedLayoutSnapshotV3 candidate=layout;
candidate.stampVocabularyVersion=ResolvedLayoutStampVocabularyVersionV1; const bool hasContinuousSweptDeck=std::any_of(ordered.begin(),ordered.end(),[](const auto& request)
{return request.kind==ResolvedSdfStampKindV1::fillSweptDeckSegment
&&!request.sweepPathMicrometres.empty();});
const bool hasNonMonotoneSweptDeck=std::any_of(ordered.begin(),ordered.end(),[](const auto& request)
{
if(request.kind!=ResolvedSdfStampKindV1::fillSweptDeckSegment
||request.sweepPathMicrometres.empty())return false;
for(std::size_t i=1;i<request.sweepPathMicrometres.size();++i)
if(request.sweepPathMicrometres[i-1][0]>=request.sweepPathMicrometres[i][0])
return true;
return false;
});
const bool hasSweptDeck=std::any_of(ordered.begin(),ordered.end(),[](const auto& request)
{return request.kind==ResolvedSdfStampKindV1::fillSweptDeckSegment;});
const bool hasVocabulary7Stamp=std::any_of(ordered.begin(),ordered.end(),[](const auto& request)
{return request.kind==ResolvedSdfStampKindV1::fillBox
||request.kind==ResolvedSdfStampKindV1::carveBox
||request.kind==ResolvedSdfStampKindV1::fillSteps;});
candidate.stampVocabularyVersion=hasVocabulary7Stamp
?ResolvedLayoutStampVocabularyVersionV7
:hasContinuousSweptDeck
?(hasNonMonotoneSweptDeck?ResolvedLayoutStampVocabularyVersionV6
:ResolvedLayoutStampVocabularyVersionV5)
:hasSweptDeck?ResolvedLayoutStampVocabularyVersionV4
:ResolvedLayoutStampVocabularyVersionV1;
candidate.stamps.clear();candidate.stamps.reserve(ordered.size()); candidate.stamps.clear();candidate.stamps.reserve(ordered.size());
for(std::size_t requestIndex=0;requestIndex<ordered.size();++requestIndex) for(std::size_t requestIndex=0;requestIndex<ordered.size();++requestIndex)
{ {
@@ -1628,8 +1934,14 @@ bool ResolveResolvedLayoutStampsV1(ResolvedLayoutSnapshotV3& layout,std::int32_t
&&ordered[requestIndex-1].stableId==request.stableId)) &&ordered[requestIndex-1].stableId==request.stableId))
{error="stamp requests require non-empty unique stable IDs";return false;} {error="stamp requests require non-empty unique stable IDs";return false;}
if(!LayoutStampKindValid(request.kind)||request.yawQuarterTurns>3 if(!LayoutStampKindValid(request.kind)||request.yawQuarterTurns>3
||(request.kind==ResolvedSdfStampKindV1::fillSteps
?(request.stepCount<2||request.stepCount>128
||request.roundingRadiusMicrometres!=0)
:request.stepCount!=0)
||request.placementRadiusMicrometres<0 ||request.placementRadiusMicrometres<0
||request.placementRadiusMicrometres>100000000 ||request.placementRadiusMicrometres>100000000
||(request.kind==ResolvedSdfStampKindV1::fillSweptDeckSegment
&&request.placementRadiusMicrometres!=0)
||request.smoothWidthMicrometres<0||request.smoothWidthMicrometres>10000000 ||request.smoothWidthMicrometres<0||request.smoothWidthMicrometres>10000000
||request.irregularityAmplitudeMicrometres<0 ||request.irregularityAmplitudeMicrometres<0
||request.irregularityAmplitudeMicrometres>10000000 ||request.irregularityAmplitudeMicrometres>10000000
@@ -1648,6 +1960,43 @@ bool ResolveResolvedLayoutStampsV1(ResolvedLayoutSnapshotV3& layout,std::int32_t
for(const auto coordinate:request.anchorPositionMicrometres) for(const auto coordinate:request.anchorPositionMicrometres)
if(coordinate<-1000000000000ll||coordinate>1000000000000ll) if(coordinate<-1000000000000ll||coordinate>1000000000000ll)
{error="stamp request "+request.stableId+" has an unbounded anchor";return false;} {error="stamp request "+request.stableId+" has an unbounded anchor";return false;}
if(request.kind==ResolvedSdfStampKindV1::fillSweptDeckSegment
&&request.sweepPathMicrometres.empty())
{
double lengthSquared=0.0;
for(std::size_t axis=0;axis<3;++axis)
{
const auto a=request.sweepEndpointsMicrometres[0][axis];
const auto b=request.sweepEndpointsMicrometres[1][axis];
if(a<-1000000000000ll||a>1000000000000ll
||b<-1000000000000ll||b>1000000000000ll)
{error="stamp request "+request.stableId+" has an unbounded sweep endpoint";return false;}
const double delta=static_cast<double>(b)-a;
lengthSquared+=delta*delta;
}
if(!(lengthSquared>0.0)
||std::sqrt(lengthSquared)>2.0*request.halfExtentsMicrometres[0]+1.0)
{error="stamp request "+request.stableId+" has invalid swept-segment extents";return false;}
}
if(request.kind==ResolvedSdfStampKindV1::fillSweptDeckSegment
&&!request.sweepPathMicrometres.empty())
{
if(request.sweepPathMicrometres.size()<2
||request.sweepPathMicrometres.size()>1025
||request.sweepPathMicrometres.front()!=request.sweepEndpointsMicrometres[0]
||request.sweepPathMicrometres.back()!=request.sweepEndpointsMicrometres[1])
{error="stamp request "+request.stableId+" has an invalid continuous deck path";return false;}
for(std::size_t pointIndex=0;pointIndex<request.sweepPathMicrometres.size();
++pointIndex)
{
const auto& point=request.sweepPathMicrometres[pointIndex];
for(const auto coordinate:point)
if(coordinate<-1000000000000ll||coordinate>1000000000000ll)
{error="stamp request "+request.stableId+" has an unbounded path point";return false;}
if(pointIndex>0&&request.sweepPathMicrometres[pointIndex-1]==point)
{error="stamp request "+request.stableId+" path contains a zero-length segment";return false;}
}
}
// The shared JSON value type stores numbers as IEEE-754 doubles; keep the // The shared JSON value type stores numbers as IEEE-754 doubles; keep the
// serialized seed in its exact integer range so the canonical round trip holds. // serialized seed in its exact integer range so the canonical round trip holds.
@@ -1662,14 +2011,18 @@ bool ResolveResolvedLayoutStampsV1(ResolvedLayoutSnapshotV3& layout,std::int32_t
return static_cast<std::int64_t>(bits%span)-radius; return static_cast<std::int64_t>(bits%span)-radius;
}; };
bool placed=false; bool placed=false;
std::string lastPlacementFailure;
for(std::uint32_t attempt=0;attempt<(request.placementRadiusMicrometres==0?1u:512u);++attempt) for(std::uint32_t attempt=0;attempt<(request.placementRadiusMicrometres==0?1u:512u);++attempt)
{ {
ResolvedLayoutStampV1 stamp;stamp.stableId=request.stableId; ResolvedLayoutStampV1 stamp;stamp.stableId=request.stableId;
stamp.strateIndex=request.strateIndex;stamp.kind=request.kind; stamp.strateIndex=request.strateIndex;stamp.kind=request.kind;
stamp.sweepEndpointsMicrometres=request.sweepEndpointsMicrometres;
stamp.sweepPathMicrometres=request.sweepPathMicrometres;
stamp.halfExtentsMicrometres=request.halfExtentsMicrometres; stamp.halfExtentsMicrometres=request.halfExtentsMicrometres;
stamp.smoothWidthMicrometres=request.smoothWidthMicrometres; stamp.smoothWidthMicrometres=request.smoothWidthMicrometres;
stamp.irregularityAmplitudeMicrometres=request.irregularityAmplitudeMicrometres; stamp.irregularityAmplitudeMicrometres=request.irregularityAmplitudeMicrometres;
stamp.irregularityWavelengthMicrometres=request.irregularityWavelengthMicrometres; stamp.irregularityWavelengthMicrometres=request.irregularityWavelengthMicrometres;
stamp.stepCount=request.stepCount;
stamp.irregularitySeed=baseSeed;stamp.yawQuarterTurns=request.yawQuarterTurns; stamp.irregularitySeed=baseSeed;stamp.yawQuarterTurns=request.yawQuarterTurns;
std::array<std::int64_t,3> offset{}; std::array<std::int64_t,3> offset{};
if(request.placementRadiusMicrometres>0) if(request.placementRadiusMicrometres>0)
@@ -1687,6 +2040,52 @@ bool ResolveResolvedLayoutStampsV1(ResolvedLayoutSnapshotV3& layout,std::int32_t
stamp.positionMicrometres[axis]=request.anchorPositionMicrometres[axis]+offset[axis]; stamp.positionMicrometres[axis]=request.anchorPositionMicrometres[axis]+offset[axis];
const std::int64_t pad=stamp.smoothWidthMicrometres const std::int64_t pad=stamp.smoothWidthMicrometres
+stamp.irregularityAmplitudeMicrometres; +stamp.irregularityAmplitudeMicrometres;
if(stamp.kind==ResolvedSdfStampKindV1::fillSweptDeckSegment
&&stamp.sweepPathMicrometres.empty())
{
double radiusSquared=0.0;
for(const auto extent:stamp.halfExtentsMicrometres)
{
const double expanded=static_cast<double>(extent+pad);
radiusSquared+=expanded*expanded;
}
const std::int64_t radius=static_cast<std::int64_t>(std::ceil(std::sqrt(radiusSquared)));
for(std::size_t axis=0;axis<3;++axis)
{
const auto minimum=std::min(stamp.sweepEndpointsMicrometres[0][axis],
stamp.sweepEndpointsMicrometres[1][axis]);
const auto maximum=std::max(stamp.sweepEndpointsMicrometres[0][axis],
stamp.sweepEndpointsMicrometres[1][axis]);
stamp.boundsMinimumMicrometres[axis]=minimum-radius;
stamp.boundsMaximumMicrometres[axis]=maximum+radius;
}
}
else if(stamp.kind==ResolvedSdfStampKindV1::fillSweptDeckSegment)
{
double radiusSquared=0.0;
for(std::size_t axis=1;axis<3;++axis)
{
const double expanded=static_cast<double>(stamp.halfExtentsMicrometres[axis]+pad);
radiusSquared+=expanded*expanded;
}
const std::int64_t radius=static_cast<std::int64_t>(
std::ceil(std::sqrt(radiusSquared)));
std::array<std::int64_t,3> minimum=stamp.sweepPathMicrometres.front();
std::array<std::int64_t,3> maximum=minimum;
for(const auto& point:stamp.sweepPathMicrometres)
for(std::size_t axis=0;axis<3;++axis)
{
minimum[axis]=std::min(minimum[axis],point[axis]);
maximum[axis]=std::max(maximum[axis],point[axis]);
}
for(std::size_t axis=0;axis<3;++axis)
{
stamp.boundsMinimumMicrometres[axis]=minimum[axis]-radius;
stamp.boundsMaximumMicrometres[axis]=maximum[axis]+radius;
}
}
else
{
const std::array<std::int64_t,3> extents={ const std::array<std::int64_t,3> extents={
stamp.halfExtentsMicrometres[stamp.yawQuarterTurns%2?1:0]+pad, stamp.halfExtentsMicrometres[stamp.yawQuarterTurns%2?1:0]+pad,
stamp.halfExtentsMicrometres[stamp.yawQuarterTurns%2?0:1]+pad, stamp.halfExtentsMicrometres[stamp.yawQuarterTurns%2?0:1]+pad,
@@ -1696,11 +2095,15 @@ bool ResolveResolvedLayoutStampsV1(ResolvedLayoutSnapshotV3& layout,std::int32_t
stamp.boundsMinimumMicrometres[axis]=stamp.positionMicrometres[axis]-extents[axis]; stamp.boundsMinimumMicrometres[axis]=stamp.positionMicrometres[axis]-extents[axis];
stamp.boundsMaximumMicrometres[axis]=stamp.positionMicrometres[axis]+extents[axis]; stamp.boundsMaximumMicrometres[axis]=stamp.positionMicrometres[axis]+extents[axis];
} }
if(!LayoutStampSafe(candidate,stamp))continue; }
std::string safetyReason;
if(!LayoutStampSafe(candidate,stamp,&safetyReason))
{lastPlacementFailure=std::move(safetyReason);continue;}
candidate.stamps.push_back(std::move(stamp));placed=true;break; candidate.stamps.push_back(std::move(stamp));placed=true;break;
} }
if(!placed) if(!placed)
{error="stamp request "+request.stableId+" has no deterministic passage-safe content placement";return false;} {error="stamp request "+request.stableId+" has no deterministic passage-safe content placement"
+(lastPlacementFailure.empty()?std::string{}:": "+lastPlacementFailure);return false;}
} }
if(!candidate.finalize(error))return false; if(!candidate.finalize(error))return false;
std::vector<ResolvedLayoutIssueV2> issues;std::string strictError; std::vector<ResolvedLayoutIssueV2> issues;std::string strictError;
@@ -2259,6 +2662,17 @@ bool PlanResolvedLayoutPassagesV1(ResolvedLayoutSnapshotV3& layout,std::int32_t
{return c.upperStrateIndex==strate;}); {return c.upperStrateIndex==strate;});
return it==configs.end()?nullptr:&*it; return it==configs.end()?nullptr:&*it;
}; };
const auto landingPadFor=[](const ResolvedLayoutStratumV2& stratum,
ResolvedLayoutLandingPadRoleV1 role,std::uint32_t ordinal)
->const ResolvedLayoutLandingPadV1*
{
std::vector<const ResolvedLayoutLandingPadV1*> candidates;
for(const auto& pad:stratum.landingPads)
if(pad.role==role)candidates.push_back(&pad);
std::sort(candidates.begin(),candidates.end(),[](const auto* a,const auto* b)
{return a->stableId<b->stableId;});
return ordinal<candidates.size()?candidates[ordinal]:nullptr;
};
const auto routeAnchor=[](const ResolvedLayoutStratumV2& s,bool departure, const auto routeAnchor=[](const ResolvedLayoutStratumV2& s,bool departure,
std::array<std::int64_t,3>& out) std::array<std::int64_t,3>& out)
{ {
@@ -2355,9 +2769,37 @@ bool PlanResolvedLayoutPassagesV1(ResolvedLayoutSnapshotV3& layout,std::int32_t
passage.upperStrateIndex=upper.strateIndex;passage.lowerStrateIndex=lower.strateIndex; passage.upperStrateIndex=upper.strateIndex;passage.lowerStrateIndex=lower.strateIndex;
passage.placementRadiusSubvoxels=placementRadius; passage.placementRadiusSubvoxels=placementRadius;
passage.mouthRadiusSubvoxels=mouthRadius;passage.midRadiusSubvoxels=midRadius; passage.mouthRadiusSubvoxels=mouthRadius;passage.midRadiusSubvoxels=midRadius;
const auto* upperDeparturePad=landingPadFor(upper,
ResolvedLayoutLandingPadRoleV1::departure,connection);
const auto* lowerArrivalPad=landingPadFor(lower,
ResolvedLayoutLandingPadRoleV1::arrival,connection);
const auto validateLandingPad=[&](const ResolvedLayoutLandingPadV1* pad,
std::string_view side)
{
if(!pad)return true;
const std::int64_t requiredClearance=mouthRadius
+static_cast<std::int64_t>(std::llround(0.34*qPerMetre));
if(!pad->certifiedWalkableWithSupport||pad->clearanceSubvoxels<requiredClearance
||pad->supportDepthSubvoxels<static_cast<std::int64_t>(std::llround(0.50*qPerMetre))
||!radialWithin(pad->positionSubvoxels,placementRadius)
||pad->positionSubvoxels[2]
!=pad->floorHeightSubvoxels+playerCenterAboveFloorQ)
{
error=passage.stableId+" "+std::string(side)
+" landing pad is uncertified, unsupported, too tight, or outside PassageConfig.DistanceMax";
return false;
}
return true;
};
if(!validateLandingPad(upperDeparturePad,"departure")
||!validateLandingPad(lowerArrivalPad,"arrival"))return false;
std::array<std::int64_t,3> upperMouth{},lowerMouth{}; std::array<std::int64_t,3> upperMouth{},lowerMouth{};
const bool hasUpperRoute=connection==0&&routeAnchor(upper,true,upperMouth); const bool hasUpperRoute=upperDeparturePad
const bool hasLowerRoute=connection==0&&routeAnchor(lower,false,lowerMouth); ?(upperMouth=upperDeparturePad->positionSubvoxels,true)
:connection==0&&routeAnchor(upper,true,upperMouth);
const bool hasLowerRoute=lowerArrivalPad
?(lowerMouth=lowerArrivalPad->positionSubvoxels,true)
:connection==0&&routeAnchor(lower,false,lowerMouth);
const bool surfaceGroundDeparture=hasUpperRoute&&upperIsSurfaceWorld; const bool surfaceGroundDeparture=hasUpperRoute&&upperIsSurfaceWorld;
const ResolvedLayoutAnchorV2* passageAnchor=nullptr; const ResolvedLayoutAnchorV2* passageAnchor=nullptr;
if(connection==0) if(connection==0)
@@ -2406,13 +2848,17 @@ bool PlanResolvedLayoutPassagesV1(ResolvedLayoutSnapshotV3& layout,std::int32_t
constexpr std::int64_t LandingExtensionQ=8; constexpr std::int64_t LandingExtensionQ=8;
std::array<std::int64_t,2> upperTangent{},lowerTangent{}; std::array<std::int64_t,2> upperTangent{},lowerTangent{};
const bool hasUpperTangent=hasUpperRoute const bool hasUpperTangent=upperDeparturePad
&&routeTangent(upper,true,upperTangent); ?(upperTangent={upperDeparturePad->approachDirectionQ16[0],
upperDeparturePad->approachDirectionQ16[1]},true)
:hasUpperRoute&&routeTangent(upper,true,upperTangent);
const bool hasPassageArrival=std::any_of(lower.anchors.begin(),lower.anchors.end(), const bool hasPassageArrival=std::any_of(lower.anchors.begin(),lower.anchors.end(),
[](const auto& anchor){return anchor.kind=="passage_arrival" [](const auto& anchor){return anchor.kind=="passage_arrival"
&&anchor.values.size()>=3;}); &&anchor.values.size()>=3;});
const bool hasLowerTangent=hasLowerRoute&&!hasPassageArrival const bool hasLowerTangent=lowerArrivalPad
&&routeTangent(lower,false,lowerTangent); ?(lowerTangent={lowerArrivalPad->approachDirectionQ16[0],
lowerArrivalPad->approachDirectionQ16[1]},true)
:hasLowerRoute&&!hasPassageArrival&&routeTangent(lower,false,lowerTangent);
const bool profiledSurfaceJoin=hasLowerTangent const bool profiledSurfaceJoin=hasLowerTangent
&&std::any_of(lower.anchors.begin(),lower.anchors.end(), &&std::any_of(lower.anchors.begin(),lower.anchors.end(),
[](const auto& anchor){return anchor.kind=="heightfield_profile" [](const auto& anchor){return anchor.kind=="heightfield_profile"
+528 -78
View File
@@ -33,50 +33,41 @@
#include <variant> #include <variant>
#include <vector> #include <vector>
// L88-only composition split. These switches let the timing harness remove passage work and static bool VF_IsDiagnosticEnvSwitchEnabled(const char* Name)
// resolved boundary-band work independently. They are diagnostic only, never world settings.
static bool VF_IsL88DiagnosticSwitchEnabled(const char* Name)
{ {
const char* Value=std::getenv(Name); const char* Value=std::getenv(Name);
return Value&&Value[0]=='1'&&Value[1]=='\0'; return Value&&Value[0]=='1'&&Value[1]=='\0';
} }
static bool VF_IsL88PassageCompositionDisabled()
{
static const bool bDisabled=VF_IsL88DiagnosticSwitchEnabled(
"VOXELFORGE_L88_DISABLE_PASSAGES")
||VF_IsL88DiagnosticSwitchEnabled("VOXELFORGE_L86_DISABLE_PASSAGE_COMPOSITION");
return bDisabled;
}
static bool VF_IsL88BoundaryBandsDisabled()
{
static const bool bDisabled=VF_IsL88DiagnosticSwitchEnabled(
"VOXELFORGE_L88_DISABLE_BOUNDARY_BANDS")
||VF_IsL88DiagnosticSwitchEnabled("VOXELFORGE_L86_DISABLE_PASSAGE_COMPOSITION");
return bDisabled;
}
static bool VF_IsL88AllowPassageAblationWalkabilityFailure()
{
static const bool bEnabled=VF_IsL88DiagnosticSwitchEnabled(
"VOXELFORGE_L88_ALLOW_PASSAGE_ABLATION_WALKABILITY_FAILURE");
return bEnabled;
}
static bool VF_IsL98PassagePrepareTraceEnabled() static bool VF_IsL98PassagePrepareTraceEnabled()
{ {
static const bool bEnabled=VF_IsL88DiagnosticSwitchEnabled( static const bool bEnabled=VF_IsDiagnosticEnvSwitchEnabled(
"VOXELFORGE_L98_PASSAGE_PREP_TRACE"); "VOXELFORGE_L98_PASSAGE_PREP_TRACE");
return bEnabled; return bEnabled;
} }
static double VF_L93PassageCarveReachMetres() static bool VF_IsL130PassageReachProofAuditEnabled()
{ {
// The generated world uses a fixed bounded tube influence. An explicit diagnostic static const bool bEnabled=VF_IsDiagnosticEnvSwitchEnabled(
// option can still select the legacy point-evaluation path for comparisons. "VOXELFORGE_L130_PASSAGE_REACH_PROOF_AUDIT");
return 4.0; return bEnabled;
}
static constexpr double VF_PassageShellThicknessMetres=0.75;
static constexpr double VF_PassageWallReliefMetres=0.21;
static constexpr double VF_PassageCornerBlendMetres=0.50;
static constexpr double VF_PassageReachMarginMetres=0.01;
// Radial support in metres: shell + maximum relief + the smooth-max support
// (corner-blend width / 6) + a 1 cm guard for float and bound rounding.
static constexpr double VF_PassageInfluenceReachMetres=
VF_PassageShellThicknessMetres+VF_PassageWallReliefMetres
+VF_PassageCornerBlendMetres/6.0+VF_PassageReachMarginMetres;
static double VF_PassageInfluenceReachCoreVoxels(
std::uint32_t coreVoxelSizeMicrometres)
{
return VF_PassageInfluenceReachMetres*1000000.0
/std::max<std::uint32_t>(1,coreVoxelSizeMicrometres);
} }
enum class EPassageDensityQueryCaller : std::size_t enum class EPassageDensityQueryCaller : std::size_t
@@ -306,22 +297,18 @@ public:
profileStats_(profileStats),profileLod_(profileLod), profileStats_(profileStats),profileLod_(profileLod),
passageCarveReachMetres_(std::isfinite(passageCarveReachMetres) passageCarveReachMetres_(std::isfinite(passageCarveReachMetres)
&&passageCarveReachMetres>=0.0?passageCarveReachMetres &&passageCarveReachMetres>=0.0?passageCarveReachMetres
:VF_L93PassageCarveReachMetres()) :VF_PassageInfluenceReachMetres)
{ {
mayContainResolvedBoundaryBand_=shape.ResolvedBoundaryBandsIntersectSubvoxelRange( mayContainResolvedBoundaryBand_=shape.ResolvedBoundaryBandsIntersectSubvoxelRange(
minimumSubvoxels_[2],maximumSubvoxels_[2]); minimumSubvoxels_[2],maximumSubvoxels_[2]);
const bool disablePassageComposition=VF_IsL88PassageCompositionDisabled(); mayContainTransitionPassageFade_=shape.ResolvedTransitionPassageFadeIntersectsTileXY(
if(VF_IsL88BoundaryBandsDisabled())mayContainResolvedBoundaryBand_=false;
mayContainTransitionPassageFade_=!disablePassageComposition
&&shape.ResolvedTransitionPassageFadeIntersectsTileXY(
minimumSubvoxels_,maximumSubvoxels_); minimumSubvoxels_,maximumSubvoxels_);
if(!disablePassageComposition)
featureIndices_=shape.BuildPassageFeatureTileList( featureIndices_=shape.BuildPassageFeatureTileList(
minimumSubvoxels_,maximumSubvoxels_); minimumSubvoxels_,maximumSubvoxels_);
stampIndices_=shape.BuildStampTileList(minimumSubvoxels_,maximumSubvoxels_); stampIndices_=shape.BuildStampTileList(minimumSubvoxels_,maximumSubvoxels_);
cavernFeatureIndices_=shape.BuildCavernFeatureTileList( cavernFeatureIndices_=shape.BuildCavernFeatureTileList(
minimumSubvoxels_,maximumSubvoxels_); minimumSubvoxels_,maximumSubvoxels_);
passageRoutes_.assign(shape.ResolvedLayout&&!disablePassageComposition passageRoutes_.assign(shape.ResolvedLayout
?shape.ResolvedLayout->passages.size():0,0); ?shape.ResolvedLayout->passages.size():0,0);
passageRouteSegments_.resize(passageRoutes_.size()); passageRouteSegments_.resize(passageRoutes_.size());
for(const std::uint32_t featureIndex:featureIndices_) for(const std::uint32_t featureIndex:featureIndices_)
@@ -1204,8 +1191,8 @@ public:
if(!ResolvedLayout||ResolvedLayout->passages.empty()||!std::isfinite(X) if(!ResolvedLayout||ResolvedLayout->passages.empty()||!std::isfinite(X)
||!std::isfinite(Y)||!std::isfinite(Z))return density; ||!std::isfinite(Y)||!std::isfinite(Z))return density;
constexpr double Q=static_cast<double>(VoxelForgeCore::WorldAssemblySubvoxelsPerVoxel); constexpr double Q=static_cast<double>(VoxelForgeCore::WorldAssemblySubvoxelsPerVoxel);
constexpr double FloorShellThicknessMetres=0.75; constexpr double FloorShellThicknessMetres=VF_PassageShellThicknessMetres;
constexpr double WallReliefMetres=0.21; constexpr double WallReliefMetres=VF_PassageWallReliefMetres;
constexpr double OpenAirSideWallHeightMetres=1.0; constexpr double OpenAirSideWallHeightMetres=1.0;
constexpr double MouthShellBlendMetres=5.0; constexpr double MouthShellBlendMetres=5.0;
const double qPerMetre=Q*1000000.0/ const double qPerMetre=Q*1000000.0/
@@ -1536,6 +1523,8 @@ public:
&nativeLatticeFloorSupport); &nativeLatticeFloorSupport);
} }
const auto* bound=FindBoundStratumForManagerZ(Z); const auto* bound=FindBoundStratumForManagerZ(Z);
const bool liminalRouteComposition=bound&&bound->Resolved
&&bound->Resolved->recipeId==VoxelForgeCore::CoreLiminalFieldRecipeIdV1;
const bool nativeLattice=bound&&bound->Resolved const bool nativeLattice=bound&&bound->Resolved
&&VoxelForgeCore::IsNativeLatticeFieldStratum(*bound->Resolved) &&VoxelForgeCore::IsNativeLatticeFieldStratum(*bound->Resolved)
&&bound->Resolved->passageCapabilities.hasNativeLatticeField; &&bound->Resolved->passageCapabilities.hasNativeLatticeField;
@@ -1544,12 +1533,8 @@ public:
// the generic stratum transition distance creates a discontinuity at a // the generic stratum transition distance creates a discontinuity at a
// mouth that crosses a wide transition band. Keep that opt-in field whole; // mouth that crosses a wide transition band. Keep that opt-in field whole;
// its host-rock value already supplies the ceiling and bedrock. // its host-rock value already supplies the ceiling and bedrock.
const bool disablePassageComposition=!nativeLattice
&&VF_IsL88PassageCompositionDisabled();
const bool disableBoundaryBands=!nativeLattice
&&VF_IsL88BoundaryBandsDisabled();
float boundary=graphDensity; float boundary=graphDensity;
if(!nativeLattice&&!disableBoundaryBands) if(!nativeLattice)
{ {
VoxelForgeCore::Linux77Profiler::FScopedPhase l77BandsPhase( VoxelForgeCore::Linux77Profiler::FScopedPhase l77BandsPhase(
VoxelForgeCore::Linux77Profiler::EPhase::Bands); VoxelForgeCore::Linux77Profiler::EPhase::Bands);
@@ -1563,7 +1548,9 @@ public:
VoxelForgeCore::Linux77Profiler::FScopedPhase l77StampPhase( VoxelForgeCore::Linux77Profiler::FScopedPhase l77StampPhase(
VoxelForgeCore::Linux77Profiler::EPhase::Stamps); VoxelForgeCore::Linux77Profiler::EPhase::Stamps);
FScopedLegacyFieldTermTimer TermTimer(ELegacyFieldTerm::ComposerStamps); FScopedLegacyFieldTermTimer TermTimer(ELegacyFieldTerm::ComposerStamps);
stamped=ApplyResolvedSdfStamps(composed,X,Y,Z); stamped=ApplyResolvedSdfStamps(composed,X,Y,Z,
liminalRouteComposition?std::string_view("core/liminal-field/route/")
:std::string_view{});
} }
static const bool bL75TraceTnComposition=[] static const bool bL75TraceTnComposition=[]
{ {
@@ -1578,7 +1565,6 @@ public:
?bound->Resolved->passageCapabilities.hasNativeCaveField ?bound->Resolved->passageCapabilities.hasNativeCaveField
:bound->Resolved->passageCapabilities.hasNativeLatticeField)) :bound->Resolved->passageCapabilities.hasNativeLatticeField))
{ {
if(!disablePassageComposition)
{ {
VoxelForgeCore::Linux77Profiler::FScopedPhase l77PassagePhase( VoxelForgeCore::Linux77Profiler::FScopedPhase l77PassagePhase(
VoxelForgeCore::Linux77Profiler::EPhase::Passage); VoxelForgeCore::Linux77Profiler::EPhase::Passage);
@@ -1609,7 +1595,6 @@ public:
ELegacyFieldTerm::ComposerPassage); ELegacyFieldTerm::ComposerPassage);
final=ApplyResolvedCavernFloorCaps(stamped,X,Y,Z); final=ApplyResolvedCavernFloorCaps(stamped,X,Y,Z);
} }
if(!disablePassageComposition)
{ {
VoxelForgeCore::Linux77Profiler::FScopedPhase l77PassagePhase( VoxelForgeCore::Linux77Profiler::FScopedPhase l77PassagePhase(
VoxelForgeCore::Linux77Profiler::EPhase::Passage); VoxelForgeCore::Linux77Profiler::EPhase::Passage);
@@ -1617,6 +1602,12 @@ public:
ELegacyFieldTerm::ComposerPassage); ELegacyFieldTerm::ComposerPassage);
final=ApplyResolvedStratePassageCarves(final,X,Y,Z); final=ApplyResolvedStratePassageCarves(final,X,Y,Z);
} }
// A liminal route is authored to terminate at fixed passage mouths. The
// passage carve owns the surrounding bore, while the deck/support stamps
// restore its walkable floor so the composed route crosses the interface.
if(liminalRouteComposition)
final=ApplyResolvedSdfStamps(final,X,Y,Z,{},
"core/liminal-field/route/");
if(bTraceTnComposition) if(bTraceTnComposition)
std::printf("[L75TNCompositionTrace] input=%.9g graph=%.9g boundary=%.9g passage=%.9g stamp=%.9g final=%.9g native=0\n", std::printf("[L75TNCompositionTrace] input=%.9g graph=%.9g boundary=%.9g passage=%.9g stamp=%.9g final=%.9g native=0\n",
density,graphDensity,boundary,composed,stamped,final); density,graphDensity,boundary,composed,stamped,final);
@@ -1630,8 +1621,8 @@ public:
{ {
constexpr double Q=static_cast<double>( constexpr double Q=static_cast<double>(
VoxelForgeCore::WorldAssemblySubvoxelsPerVoxel); VoxelForgeCore::WorldAssemblySubvoxelsPerVoxel);
const double qPerMetre=Q*1000000.0/ const double reachCoreVoxels=VF_PassageInfluenceReachCoreVoxels(
std::max<std::uint32_t>(1,ResolvedLayout->coreVoxelSizeMicrometres); ResolvedLayout->coreVoxelSizeMicrometres);
const auto overlaps=[&](const double low[3],const double high[3]) const auto overlaps=[&](const double low[3],const double high[3])
{ {
for(int axis=0;axis<3;++axis) for(int axis=0;axis<3;++axis)
@@ -1648,7 +1639,8 @@ public:
const auto& p3=passage.controlPoints[ const auto& p3=passage.controlPoints[
std::min(segment+2,passage.controlPoints.size()-1)]; std::min(segment+2,passage.controlPoints.size()-1)];
const double radius=std::max(static_cast<double>(a.radiusSubvoxels), const double radius=std::max(static_cast<double>(a.radiusSubvoxels),
static_cast<double>(b.radiusSubvoxels))/Q+1.0; static_cast<double>(b.radiusSubvoxels))/Q
+reachCoreVoxels+0.01;
double low[3]{},high[3]{}; double low[3]{},high[3]{};
for(int axis=0;axis<3;++axis) for(int axis=0;axis<3;++axis)
{ {
@@ -2313,20 +2305,10 @@ public:
Substage=Clock::now(); Substage=Clock::now();
const bool bPassageRoutesValid=!bValidatePassageRoutes||ValidatePassageRoutes(); const bool bPassageRoutesValid=!bValidatePassageRoutes||ValidatePassageRoutes();
if(!bPassageRoutesValid) if(!bPassageRoutesValid)
{
if(VF_IsL88PassageCompositionDisabled()
&&!VF_IsL88BoundaryBandsDisabled()
&&VF_IsL88AllowPassageAblationWalkabilityFailure())
{
std::printf("[L88PassageAblation] route walkability failed as expected; "
"continuing only to measure passage-off/bands-on readiness\n");
}
else
{ {
Error="compiled shape world contains a solid passage centreline sample"; Error="compiled shape world contains a solid passage centreline sample";
return false; return false;
} }
}
Stats.PassageValidationSeconds=std::chrono::duration<double>(Clock::now()-Substage).count(); Stats.PassageValidationSeconds=std::chrono::duration<double>(Clock::now()-Substage).count();
Built=true; Built=true;
if(bIncludeFarWorld)BuildFarWorld(); if(bIncludeFarWorld)BuildFarWorld();
@@ -3499,7 +3481,7 @@ private:
double centerZSubvoxels,double queryZSubvoxels,double floorDepthSubvoxels, double centerZSubvoxels,double queryZSubvoxels,double floorDepthSubvoxels,
double qPerMetre) double qPerMetre)
{ {
constexpr double CornerBlendMetres=0.50; constexpr double CornerBlendMetres=VF_PassageCornerBlendMetres;
const float floorDistance=static_cast<float>(centerZSubvoxels const float floorDistance=static_cast<float>(centerZSubvoxels
-floorDepthSubvoxels-queryZSubvoxels); -floorDepthSubvoxels-queryZSubvoxels);
return SmoothMaxDistance(roundDistanceSubvoxels,floorDistance, return SmoothMaxDistance(roundDistanceSubvoxels,floorDistance,
@@ -3563,6 +3545,8 @@ private:
{ {
const VoxelForgeCore::ResolvedLayoutStampV1* record=nullptr; const VoxelForgeCore::ResolvedLayoutStampV1* record=nullptr;
std::array<float,3> positionVoxels{},halfExtentsVoxels{}; std::array<float,3> positionVoxels{},halfExtentsVoxels{};
std::array<std::array<float,3>,2> sweepEndpointsVoxels{};
std::vector<std::array<float,3>> sweepPathVoxels;
float smoothWidthVoxels=0.0f; float smoothWidthVoxels=0.0f;
float irregularityAmplitudeVoxels=0.0f; float irregularityAmplitudeVoxels=0.0f;
float irregularityWavelengthVoxels=0.0f; float irregularityWavelengthVoxels=0.0f;
@@ -3728,9 +3712,24 @@ private:
StampSpatialBounds.push_back(bound); StampSpatialBounds.push_back(bound);
FStampRuntime runtime;runtime.record=&stamp; FStampRuntime runtime;runtime.record=&stamp;
for(std::size_t axis=0;axis<3;++axis) for(std::size_t axis=0;axis<3;++axis)
{
runtime.positionVoxels[axis]=static_cast<float>( runtime.positionVoxels[axis]=static_cast<float>(
static_cast<double>(stamp.positionMicrometres[axis]) static_cast<double>(stamp.positionMicrometres[axis])
/Owner->CoreVoxelSizeMicrons); /Owner->CoreVoxelSizeMicrons);
for(std::size_t endpoint=0;endpoint<2;++endpoint)
runtime.sweepEndpointsVoxels[endpoint][axis]=static_cast<float>(
static_cast<double>(stamp.sweepEndpointsMicrometres[endpoint][axis])
/Owner->CoreVoxelSizeMicrons);
}
runtime.sweepPathVoxels.reserve(stamp.sweepPathMicrometres.size());
for(const auto& pointMicrometres:stamp.sweepPathMicrometres)
{
std::array<float,3> point{};
for(std::size_t axis=0;axis<3;++axis)
point[axis]=static_cast<float>(static_cast<double>(pointMicrometres[axis])
/Owner->CoreVoxelSizeMicrons);
runtime.sweepPathVoxels.push_back(point);
}
const std::size_t xAxis=stamp.yawQuarterTurns%2?1:0; const std::size_t xAxis=stamp.yawQuarterTurns%2?1:0;
const std::size_t yAxis=stamp.yawQuarterTurns%2?0:1; const std::size_t yAxis=stamp.yawQuarterTurns%2?0:1;
runtime.halfExtentsVoxels={ runtime.halfExtentsVoxels={
@@ -4811,13 +4810,9 @@ private:
PassageNearestNodes.resize(ResolvedLayout?ResolvedLayout->passages.size():0); PassageNearestNodes.resize(ResolvedLayout?ResolvedLayout->passages.size():0);
if(!ResolvedLayout||ResolvedLayout->passages.empty())return; if(!ResolvedLayout||ResolvedLayout->passages.empty())return;
constexpr double Q=static_cast<double>(VoxelForgeCore::WorldAssemblySubvoxelsPerVoxel); constexpr double Q=static_cast<double>(VoxelForgeCore::WorldAssemblySubvoxelsPerVoxel);
constexpr double PassageShellMetres=0.75;
constexpr double ReliefMetres=0.21;
constexpr double SweepReachMetres=4.0;
constexpr double CornerBlendMetres=0.50;
constexpr std::size_t CandidateFineSamplesPerSpan=5; constexpr std::size_t CandidateFineSamplesPerSpan=5;
const double requiredReach=std::max(SweepReachMetres+ReliefMetres const double requiredReachCoreVoxels=VF_PassageInfluenceReachCoreVoxels(
+CornerBlendMetres*0.25,PassageShellMetres+ReliefMetres); ResolvedLayout->coreVoxelSizeMicrometres);
for(std::size_t passageIndex=0;passageIndex<ResolvedLayout->passages.size(); for(std::size_t passageIndex=0;passageIndex<ResolvedLayout->passages.size();
++passageIndex) ++passageIndex)
{ {
@@ -4854,7 +4849,7 @@ private:
routeMinimum[axis]=std::min(routeMinimum[axis],localMinimum[axis]); routeMinimum[axis]=std::min(routeMinimum[axis],localMinimum[axis]);
routeMaximum[axis]=std::max(routeMaximum[axis],localMaximum[axis]); routeMaximum[axis]=std::max(routeMaximum[axis],localMaximum[axis]);
} }
const double localExtent=requiredReach const double localExtent=requiredReachCoreVoxels
+std::max(prepared.radiusA,prepared.radiusB)/Q+0.01; +std::max(prepared.radiusA,prepared.radiusB)/Q+0.01;
FPassageProofBound proof; FPassageProofBound proof;
for(std::size_t axis=0;axis<3;++axis) for(std::size_t axis=0;axis<3;++axis)
@@ -4872,7 +4867,8 @@ private:
std::ceil((localMaximum[axis]+localExtent)*Q)); std::ceil((localMaximum[axis]+localExtent)*Q));
} }
} }
const double routeExtent=maximumRadiusSubvoxels/Q+requiredReach+0.01; const double routeExtent=maximumRadiusSubvoxels/Q
+requiredReachCoreVoxels+0.01;
const double tileExtent=routeExtent; const double tileExtent=routeExtent;
std::array<std::int64_t,3> featureMinimum{},featureMaximum{}; std::array<std::int64_t,3> featureMinimum{},featureMaximum{};
for(std::size_t axis=0;axis<3;++axis) for(std::size_t axis=0;axis<3;++axis)
@@ -4899,6 +4895,113 @@ private:
BuildPassageFeatureNode(0,PassageFeatureOrder.size()); BuildPassageFeatureNode(0,PassageFeatureOrder.size());
if(!PassageProofBounds.empty()) if(!PassageProofBounds.empty())
BuildPassageProofNode(0,PassageProofBounds.size()); BuildPassageProofNode(0,PassageProofBounds.size());
if(VF_IsL130PassageReachProofAuditEnabled())
{
constexpr double Q=static_cast<double>(
VoxelForgeCore::WorldAssemblySubvoxelsPerVoxel);
constexpr std::array<std::array<double,2>,8> RadialDirections={{
{1.0,0.0},{0.7071067811865475,0.7071067811865475},
{0.0,1.0},{-0.7071067811865475,0.7071067811865475},
{-1.0,0.0},{-0.7071067811865475,-0.7071067811865475},
{0.0,-1.0},{0.7071067811865475,-0.7071067811865475}}};
constexpr std::array<double,2> CrestHeightsMetres={0.625,0.875};
const double qPerMetre=Q*1000000.0/
std::max<std::uint32_t>(1,ResolvedLayout->coreVoxelSizeMicrometres);
const std::array<double,6> shellOffsetsMetres={0.70,0.78,0.86,0.94,
VF_PassageInfluenceReachMetres-0.005,
VF_PassageInfluenceReachMetres+0.005};
std::uint64_t sampled=0,signRelevant=0,proofMisses=0,featureMisses=0;
for(std::size_t passageIndex=0;
passageIndex<PassageSegmentData.size();++passageIndex)
{
const auto& segments=PassageSegmentData[passageIndex];
if(segments.empty())continue;
const auto& constants=PassageComposerConstants[passageIndex];
const std::size_t stride=std::max<std::size_t>(1,
(segments.size()+127)/128);
for(std::size_t segmentIndex=0;segmentIndex<segments.size();
segmentIndex+=stride)
{
const auto& segment=segments[segmentIndex];
if(segment.lengthSq<=1.0e-12)continue;
constexpr double T=0.5;
const double centerX=segment.a[0]+T*segment.delta[0];
const double centerY=segment.a[1]+T*segment.delta[1];
const double centerZ=segment.a[2]+T*segment.delta[2];
const double radius=segment.radiusA+T*segment.radiusDelta;
const double floorDepth=PassageFlatFloorDepthSubvoxels(
constants,segmentIndex,T,radius,qPerMetre);
const double floorCenterZ=PassageFlatFloorCenterZSubvoxels(
constants,segments,segmentIndex,T,segment,centerX,centerY,
floorDepth,qPerMetre);
for(const double crestHeightMetres:CrestHeightsMetres)
{
const double sampleZ=floorCenterZ-floorDepth
+crestHeightMetres*qPerMetre;
const double verticalDelta=sampleZ-centerZ;
for(const double shellOffsetMetres:shellOffsetsMetres)
{
const double radialDistance=radius
+shellOffsetMetres*qPerMetre;
if(radialDistance*radialDistance
<=verticalDelta*verticalDelta)continue;
const double horizontalDistance=std::sqrt(
radialDistance*radialDistance
-verticalDelta*verticalDelta);
for(const auto& direction:RadialDirections)
{
const double sampleQ[3]={
centerX+direction[0]*horizontalDistance,
centerY+direction[1]*horizontalDistance,sampleZ};
const double sampleVoxel[3]={sampleQ[0]/Q,
sampleQ[1]/Q,sampleQ[2]/Q};
const float contribution=ApplyResolvedStratePassageCarves(
0.0f,static_cast<float>(sampleVoxel[0]),
static_cast<float>(sampleVoxel[1]),
static_cast<float>(sampleVoxel[2]));
++sampled;
if(std::abs(contribution)<=1.0e-6f)continue;
++signRelevant;
if(PassageProofNodes.empty()
||!PassageProofBoundsOverlapNode(0,sampleVoxel,
sampleVoxel))
++proofMisses;
std::array<std::int64_t,3> sampleMinimum{},sampleMaximum{};
for(std::size_t axis=0;axis<3;++axis)
{
sampleMinimum[axis]=static_cast<std::int64_t>(
std::floor(sampleQ[axis]));
sampleMaximum[axis]=static_cast<std::int64_t>(
std::ceil(sampleQ[axis]));
}
const auto candidates=BuildPassageFeatureTileList(
sampleMinimum,sampleMaximum);
const bool featureContainsSample=std::any_of(
candidates.begin(),candidates.end(),
[&](std::uint32_t featureIndex)
{
return featureIndex<PassageTileFeatures.size()
&&PassageTileFeatures[featureIndex].passageIndex
==passageIndex;
});
if(!featureContainsSample)++featureMisses;
}
}
}
}
}
const bool auditPassed=sampled>0&&signRelevant>0
&&proofMisses==0&&featureMisses==0;
std::printf("[L130PassageReachProofAudit] reach_m=%.3f sampled=%llu sign_relevant=%llu proof_misses=%llu feature_misses=%llu status=%s\n",
VF_PassageInfluenceReachMetres,
static_cast<unsigned long long>(sampled),
static_cast<unsigned long long>(signRelevant),
static_cast<unsigned long long>(proofMisses),
static_cast<unsigned long long>(featureMisses),
auditPassed?"PASS":"FAIL");
if(!auditPassed)std::abort();
}
} }
bool PassageProofBoundsOverlapNode(int nodeIndex,const double minimum[3], bool PassageProofBoundsOverlapNode(int nodeIndex,const double minimum[3],
@@ -5086,6 +5189,20 @@ private:
} }
public: public:
static std::int32_t& CurrentStampSamplingStep() noexcept
{
static thread_local std::int32_t Step=0;
return Step;
}
struct FScopedStampSamplingStep
{
explicit FScopedStampSamplingStep(std::int32_t Step)
:Previous(CurrentStampSamplingStep())
{CurrentStampSamplingStep()=std::max(0,Step);}
~FScopedStampSamplingStep(){CurrentStampSamplingStep()=Previous;}
std::int32_t Previous=0;
};
bool GetNativeSurfaceHeightsAt(float X,float Y,int32 ChunkZ, bool GetNativeSurfaceHeightsAt(float X,float Y,int32 ChunkZ,
float& OutGroundZ,float& OutCeilingZ) const float& OutGroundZ,float& OutCeilingZ) const
{ {
@@ -7040,6 +7157,134 @@ private:
const float top=std::max(StampEllipsoidSdf(x,y,z,halfSize),-z); const float top=std::max(StampEllipsoidSdf(x,y,z,halfSize),-z);
return SmoothMinDistance(lower,top,round*2.0f); return SmoothMinDistance(lower,top,round*2.0f);
} }
static float StampStepsSdf(float x,float y,float z,
const std::array<float,3>& halfSize,std::uint16_t stepCount)
{
if(stepCount<2||stepCount>128)return std::numeric_limits<float>::infinity();
const float treadWidth=(2.0f*halfSize[0])/stepCount;
const float riserHeight=(2.0f*halfSize[2])/stepCount;
float distance=std::numeric_limits<float>::infinity();
for(std::uint16_t step=0;step<stepCount;++step)
{
const float stepHeight=(step+1)*riserHeight;
const float centerX=-halfSize[0]+(step+0.5f)*treadWidth;
const float centerZ=-halfSize[2]+stepHeight*0.5f;
const std::array<float,3> extent={treadWidth*0.5f,halfSize[1],stepHeight*0.5f};
distance=std::min(distance,StampRoundedBoxSdf(x-centerX,y,z-centerZ,extent,0.0f));
}
return distance;
}
static float StampContinuousSweptDeckSdf(const FStampRuntime& stamp,
float x,float y,float z)
{
const auto& path=stamp.sweepPathVoxels;
if(path.size()<2)return std::numeric_limits<float>::infinity();
const float halfWidth=stamp.halfExtentsVoxels[1];
const float halfThickness=stamp.halfExtentsVoxels[2];
const float round=std::min(0.35f,std::min(halfWidth,halfThickness)*0.15f);
const float searchMargin=halfWidth+halfThickness+2.0f;
const bool increasingX=std::adjacent_find(path.begin(),path.end(),
[](const auto& a,const auto& b){return a[0]>=b[0];})==path.end();
const auto first=increasingX
?std::lower_bound(path.begin(),path.end(),x-searchMargin,
[](const auto& point,float value){return point[0]<value;})
:path.begin();
const auto last=increasingX
?std::upper_bound(first,path.end(),x+searchMargin,
[](float value,const auto& point){return value<point[0];})
:path.end();
const std::size_t firstIndex=static_cast<std::size_t>(first-path.begin());
const std::size_t lastIndex=static_cast<std::size_t>(last-path.begin());
const std::size_t segmentBegin=std::min(path.size()-2,
firstIndex==0?std::size_t{0}:firstIndex-1);
const std::size_t segmentEnd=std::min(path.size()-2,lastIndex);
std::size_t nearestSegment=path.size();
float nearestProjection=0.0f;
float nearestDistanceSquared=std::numeric_limits<float>::infinity();
for(std::size_t segment=segmentBegin;segment<=segmentEnd;++segment)
{
const auto& a=path[segment];const auto& b=path[segment+1];
const float dx=b[0]-a[0],dy=b[1]-a[1];
const float horizontalSquared=dx*dx+dy*dy;
if(!(horizontalSquared>1.0e-10f))continue;
const float projection=std::clamp(((x-a[0])*dx+(y-a[1])*dy)
/horizontalSquared,0.0f,1.0f);
const float nearestX=a[0]+projection*dx;
const float nearestY=a[1]+projection*dy;
const float offsetX=x-nearestX,offsetY=y-nearestY;
const float distanceSquared=offsetX*offsetX+offsetY*offsetY;
if(distanceSquared<nearestDistanceSquared
||(distanceSquared==nearestDistanceSquared&&segment<nearestSegment))
{
nearestSegment=segment;
nearestProjection=projection;
nearestDistanceSquared=distanceSquared;
}
}
if(nearestSegment>=path.size()-1)return std::numeric_limits<float>::infinity();
const auto evalCenterline=[&](float parameter,std::array<float,3>& center,
std::array<float,3>& tangent)
{
const auto& p0=path[nearestSegment];
const auto& p1=path[nearestSegment+1];
const auto& before=path[nearestSegment==0?nearestSegment:nearestSegment-1];
const auto& after=path[nearestSegment+2<path.size()
?nearestSegment+2:nearestSegment+1];
const float t2=parameter*parameter,t3=t2*parameter;
const float h00=2.0f*t3-3.0f*t2+1.0f;
const float h10=t3-2.0f*t2+parameter;
const float h01=-2.0f*t3+3.0f*t2;
const float h11=t3-t2;
const float d00=6.0f*t2-6.0f*parameter;
const float d10=3.0f*t2-4.0f*parameter+1.0f;
const float d01=-6.0f*t2+6.0f*parameter;
const float d11=3.0f*t2-2.0f*parameter;
for(std::size_t axis=0;axis<3;++axis)
{
const float m0=nearestSegment==0?p1[axis]-p0[axis]
:0.5f*(p1[axis]-before[axis]);
const float m1=nearestSegment+2>=path.size()?p1[axis]-p0[axis]
:0.5f*(after[axis]-p0[axis]);
center[axis]=h00*p0[axis]+h10*m0+h01*p1[axis]+h11*m1;
tangent[axis]=d00*p0[axis]+d10*m0+d01*p1[axis]+d11*m1;
}
};
std::array<float,3> center{},tangent{};
for(int refinement=0;refinement<2;++refinement)
{
evalCenterline(nearestProjection,center,tangent);
const float derivativeSquared=tangent[0]*tangent[0]+tangent[1]*tangent[1];
if(!(derivativeSquared>1.0e-10f))return std::numeric_limits<float>::infinity();
const float offsetX=center[0]-x,offsetY=center[1]-y;
nearestProjection=std::clamp(nearestProjection
-(offsetX*tangent[0]+offsetY*tangent[1])/derivativeSquared,0.0f,1.0f);
}
evalCenterline(nearestProjection,center,tangent);
const float tangentLength=std::sqrt(tangent[0]*tangent[0]
+tangent[1]*tangent[1]+tangent[2]*tangent[2]);
if(!(tangentLength>1.0e-8f))return std::numeric_limits<float>::infinity();
for(float& component:tangent)component/=tangentLength;
const float horizontalLength=std::sqrt(tangent[0]*tangent[0]
+tangent[1]*tangent[1]);
if(!(horizontalLength>1.0e-8f))return std::numeric_limits<float>::infinity();
const std::array<float,3> side={-tangent[1]/horizontalLength,
tangent[0]/horizontalLength,0.0f};
const std::array<float,3> up={-tangent[2]*side[1],tangent[2]*side[0],
tangent[0]*side[1]-tangent[1]*side[0]};
const std::array<float,3> relative={x-center[0],y-center[1],z-center[2]};
const auto dot=[&](const std::array<float,3>& axis)
{return relative[0]*axis[0]+relative[1]*axis[1]+relative[2]*axis[2];};
const float lateral=dot(side),vertical=dot(up);
if((nearestSegment==0&&nearestProjection<=0.0f)
||(nearestSegment+2==path.size()&&nearestProjection>=1.0f))
return StampRoundedBoxSdf(dot(tangent),lateral,vertical,
{halfThickness+round,halfWidth,halfThickness},round);
const float qSide=std::abs(lateral)-halfWidth+round;
const float qUp=std::abs(vertical)-halfThickness+round;
const float outside=std::sqrt(std::max(qSide,0.0f)*std::max(qSide,0.0f)
+std::max(qUp,0.0f)*std::max(qUp,0.0f));
return outside+std::min(std::max(qSide,qUp),0.0f)-round;
}
float StampSdf(const FStampRuntime& stamp,float x,float y,float z) const float StampSdf(const FStampRuntime& stamp,float x,float y,float z) const
{ {
float localX=x-stamp.positionVoxels[0]; float localX=x-stamp.positionVoxels[0];
@@ -7067,6 +7312,13 @@ private:
case VoxelForgeCore::ResolvedSdfStampKindV1::fillPlatform: case VoxelForgeCore::ResolvedSdfStampKindV1::fillPlatform:
distance=StampRoundedBoxSdf(localX,localY,localZ, distance=StampRoundedBoxSdf(localX,localY,localZ,
stamp.halfExtentsVoxels,stamp.roundingRadiusVoxels);break; stamp.halfExtentsVoxels,stamp.roundingRadiusVoxels);break;
case VoxelForgeCore::ResolvedSdfStampKindV1::fillBox:
case VoxelForgeCore::ResolvedSdfStampKindV1::carveBox:
distance=StampRoundedBoxSdf(localX,localY,localZ,
stamp.halfExtentsVoxels,stamp.roundingRadiusVoxels);break;
case VoxelForgeCore::ResolvedSdfStampKindV1::fillSteps:
distance=StampStepsSdf(localX,localY,localZ,stamp.halfExtentsVoxels,
stamp.record->stepCount);break;
case VoxelForgeCore::ResolvedSdfStampKindV1::fillDais: case VoxelForgeCore::ResolvedSdfStampKindV1::fillDais:
if(ResolvedLayout&&ResolvedLayout->stampVocabularyVersion if(ResolvedLayout&&ResolvedLayout->stampVocabularyVersion
>=VoxelForgeCore::ResolvedLayoutStampVocabularyVersionV2) >=VoxelForgeCore::ResolvedLayoutStampVocabularyVersionV2)
@@ -7076,6 +7328,40 @@ private:
std::min(0.35f,std::min({stamp.halfExtentsVoxels[0], std::min(0.35f,std::min({stamp.halfExtentsVoxels[0],
stamp.halfExtentsVoxels[1],stamp.halfExtentsVoxels[2]})*0.15f)); stamp.halfExtentsVoxels[1],stamp.halfExtentsVoxels[2]})*0.15f));
break; break;
case VoxelForgeCore::ResolvedSdfStampKindV1::fillSweptDeckSegment:
{
if(!stamp.sweepPathVoxels.empty())
{
distance=StampContinuousSweptDeckSdf(stamp,x,y,z);
break;
}
std::array<float,3> tangent{},side{},up{},delta{};
float lengthSquared=0.0f,horizontalSquared=0.0f;
for(std::size_t axis=0;axis<3;++axis)
{
delta[axis]=stamp.sweepEndpointsVoxels[1][axis]
-stamp.sweepEndpointsVoxels[0][axis];
lengthSquared+=delta[axis]*delta[axis];
if(axis<2)horizontalSquared+=delta[axis]*delta[axis];
}
const float segmentLength=std::sqrt(lengthSquared);
const float horizontalLength=std::sqrt(horizontalSquared);
if(!(segmentLength>1.0e-5f&&horizontalLength>1.0e-5f))
return std::numeric_limits<float>::infinity();
for(std::size_t axis=0;axis<3;++axis)tangent[axis]=delta[axis]/segmentLength;
side={-delta[1]/horizontalLength,delta[0]/horizontalLength,0.0f};
up={-tangent[2]*side[1],tangent[2]*side[0],
tangent[0]*side[1]-tangent[1]*side[0]};
const std::array<float,3> offset={
x-stamp.positionVoxels[0],y-stamp.positionVoxels[1],z-stamp.positionVoxels[2]};
const auto dot=[&](const std::array<float,3>& axis)
{return offset[0]*axis[0]+offset[1]*axis[1]+offset[2]*axis[2];};
const float rounded=std::min(0.35f,
std::min(stamp.halfExtentsVoxels[1],stamp.halfExtentsVoxels[2])*0.15f);
distance=StampRoundedBoxSdf(dot(tangent),dot(side),dot(up),
stamp.halfExtentsVoxels,rounded);
break;
}
default:return std::numeric_limits<float>::infinity(); default:return std::numeric_limits<float>::infinity();
} }
if(stamp.irregularityAmplitudeVoxels>0.0f) if(stamp.irregularityAmplitudeVoxels>0.0f)
@@ -7087,6 +7373,15 @@ private:
static double StampAbsMinimum(double minimum,double maximum) static double StampAbsMinimum(double minimum,double maximum)
{return minimum<=0.0&&maximum>=0.0?0.0:std::min(std::abs(minimum),std::abs(maximum));} {return minimum<=0.0&&maximum>=0.0?0.0:std::min(std::abs(minimum),std::abs(maximum));}
static bool UsesCoarsePillarProxy(const FStampRuntime& stamp,std::int32_t sampleStep)
{
if(!stamp.record||stamp.record->kind
!=VoxelForgeCore::ResolvedSdfStampKindV1::fillPillar
||sampleStep<=0||stamp.irregularityAmplitudeVoxels>0.0f)return false;
return static_cast<float>(sampleStep)>std::min(stamp.halfExtentsVoxels[0],
stamp.halfExtentsVoxels[1])
||static_cast<float>(sampleStep)>stamp.halfExtentsVoxels[2];
}
static double StampRoundedBoxSdfDouble(const std::array<double,3>& absolute, static double StampRoundedBoxSdfDouble(const std::array<double,3>& absolute,
const std::array<double,3>& halfSize,double rounding) const std::array<double,3>& halfSize,double rounding)
{ {
@@ -7171,7 +7466,9 @@ private:
std::nextafter(maximum+outwardPadding, std::nextafter(maximum+outwardPadding,
std::numeric_limits<double>::infinity()),true}; std::numeric_limits<double>::infinity()),true};
} }
float ApplyResolvedSdfStamps(float density,float X,float Y,float Z) const float ApplyResolvedSdfStamps(float density,float X,float Y,float Z,
std::string_view excludedStableIdPrefix={},
std::string_view includedStableIdPrefix={}) const
{ {
if(StampRuntime.empty()||!Owner||Owner->CoreVoxelSizeMicrons==0)return density; if(StampRuntime.empty()||!Owner||Owner->CoreVoxelSizeMicrons==0)return density;
const auto* tileQueries=ActivePassageTileQueries; const auto* tileQueries=ActivePassageTileQueries;
@@ -7188,12 +7485,18 @@ private:
if(index>=StampRuntime.size())return; if(index>=StampRuntime.size())return;
const auto& runtime=StampRuntime[index];const auto& record=*runtime.record; const auto& runtime=StampRuntime[index];const auto& record=*runtime.record;
if(record.strateIndex!=bound->StrateIndex)return; if(record.strateIndex!=bound->StrateIndex)return;
if(!excludedStableIdPrefix.empty()
&&record.stableId.starts_with(excludedStableIdPrefix))return;
if(!includedStableIdPrefix.empty()
&&!record.stableId.starts_with(includedStableIdPrefix))return;
if(UsesCoarsePillarProxy(runtime,CurrentStampSamplingStep()))return;
for(std::size_t axis=0;axis<3;++axis) for(std::size_t axis=0;axis<3;++axis)
if(worldMicrometres[axis]<record.boundsMinimumMicrometres[axis] if(worldMicrometres[axis]<record.boundsMinimumMicrometres[axis]
||worldMicrometres[axis]>record.boundsMaximumMicrometres[axis])return; ||worldMicrometres[axis]>record.boundsMaximumMicrometres[axis])return;
const float distance=StampSdf(runtime,X,Y,Z); const float distance=StampSdf(runtime,X,Y,Z);
if(record.kind==VoxelForgeCore::ResolvedSdfStampKindV1::carveEllipsoid if(record.kind==VoxelForgeCore::ResolvedSdfStampKindV1::carveEllipsoid
||record.kind==VoxelForgeCore::ResolvedSdfStampKindV1::carveArch) ||record.kind==VoxelForgeCore::ResolvedSdfStampKindV1::carveArch
||record.kind==VoxelForgeCore::ResolvedSdfStampKindV1::carveBox)
composed=SmoothMaxDistance(composed,-distance,runtime.smoothWidthVoxels); composed=SmoothMaxDistance(composed,-distance,runtime.smoothWidthVoxels);
else else
composed=SmoothMinDistance(composed,distance,runtime.smoothWidthVoxels); composed=SmoothMinDistance(composed,distance,runtime.smoothWidthVoxels);
@@ -7205,6 +7508,154 @@ private:
apply(static_cast<std::uint32_t>(index)); apply(static_cast<std::uint32_t>(index));
return composed; return composed;
} }
public:
std::uint32_t AppendCoarsePillarProxies(FVoxelMeshData& mesh,
const FIntVector& tileOrigin,std::int32_t tileExtent,std::int32_t sampleStep) const
{
if(!Owner||Owner->CoreVoxelSizeMicrons==0||tileExtent<=0||sampleStep<=0
||StampRuntime.empty())return 0;
constexpr int32 sideCount=24;
constexpr double TwoPi=6.2831853071795864769;
const int32 originalVertexCount=mesh.Vertices.Num();
const int32 originalSurfaceVertices=std::clamp(mesh.NumSurfaceVertices,0,
originalVertexCount);
const bool hasNormals=mesh.Normals.Num()==originalVertexCount;
const bool hasUvs=mesh.UVs.Num()==originalVertexCount;
const bool hasColors=mesh.Colors.Num()==originalVertexCount;
const double voxelCentimetres=Owner->CoreVoxelSizeMicrons/10000.0;
const std::int64_t tileMinimum[3]={tileOrigin.X,tileOrigin.Y,tileOrigin.Z};
const std::int64_t tileMaximum[3]={static_cast<std::int64_t>(tileOrigin.X)+tileExtent,
static_cast<std::int64_t>(tileOrigin.Y)+tileExtent,
static_cast<std::int64_t>(tileOrigin.Z)+tileExtent};
std::vector<int32> proxyIndices;
std::uint32_t proxyCount=0;
const auto addVertex=[&](const FVector& position,const FVector& normal,
const FVector2f& uv)
{
const int32 index=mesh.Vertices.Add(position);
if(hasNormals)mesh.Normals.Add(normal);
if(hasUvs)mesh.UVs.Add(uv);
if(hasColors)mesh.Colors.Add(FColor::White);
return index;
};
for(const auto& stamp:StampRuntime)
{
if(!UsesCoarsePillarProxy(stamp,sampleStep))continue;
const auto& center=stamp.positionVoxels;
if(center[0]<tileMinimum[0]||center[0]>=tileMaximum[0]
||center[1]<tileMinimum[1]||center[1]>=tileMaximum[1]
||center[2]<tileMinimum[2]||center[2]>=tileMaximum[2])continue;
const double radiusX=stamp.halfExtentsVoxels[0];
const double radiusY=stamp.halfExtentsVoxels[1];
const double bottomVoxel=center[2]-stamp.halfExtentsVoxels[2]-1.0;
const double topVoxel=center[2]+stamp.halfExtentsVoxels[2];
const auto point=[&](double angle,double z)
{
return FVector((center[0]+radiusX*std::cos(angle))*voxelCentimetres,
(center[1]+radiusY*std::sin(angle))*voxelCentimetres,
z*voxelCentimetres);
};
const int32 capTopCenter=addVertex(FVector(center[0]*voxelCentimetres,
center[1]*voxelCentimetres,topVoxel*voxelCentimetres),
FVector(0.0,0.0,1.0),FVector2f(0.5f,0.5f));
const int32 capBottomCenter=addVertex(FVector(center[0]*voxelCentimetres,
center[1]*voxelCentimetres,bottomVoxel*voxelCentimetres),
FVector(0.0,0.0,-1.0),FVector2f(0.5f,0.5f));
for(int32 sideIndex=0;sideIndex<sideCount;++sideIndex)
{
const double u0=static_cast<double>(sideIndex)/sideCount;
const double u1=static_cast<double>(sideIndex+1)/sideCount;
const double a0=TwoPi*u0,a1=TwoPi*u1;
const FVector n0=FVector(std::cos(a0)/radiusX,
std::sin(a0)/radiusY,0.0).GetSafeNormal();
const FVector n1=FVector(std::cos(a1)/radiusX,
std::sin(a1)/radiusY,0.0).GetSafeNormal();
const int32 bottomA=addVertex(point(a0,bottomVoxel),n0,FVector2f(u0,0.0f));
const int32 bottomB=addVertex(point(a1,bottomVoxel),n1,FVector2f(u1,0.0f));
const int32 topB=addVertex(point(a1,topVoxel),n1,FVector2f(u1,1.0f));
const int32 topA=addVertex(point(a0,topVoxel),n0,FVector2f(u0,1.0f));
proxyIndices.insert(proxyIndices.end(),{bottomA,bottomB,topB,
bottomA,topB,topA});
const int32 topAIndex=addVertex(point(a0,topVoxel),FVector(0.0,0.0,1.0),
FVector2f(static_cast<float>(0.5+0.5*std::cos(a0)),
static_cast<float>(0.5+0.5*std::sin(a0))));
const int32 topBIndex=addVertex(point(a1,topVoxel),FVector(0.0,0.0,1.0),
FVector2f(static_cast<float>(0.5+0.5*std::cos(a1)),
static_cast<float>(0.5+0.5*std::sin(a1))));
proxyIndices.insert(proxyIndices.end(),{capTopCenter,topAIndex,topBIndex});
const int32 bottomAIndex=addVertex(point(a0,bottomVoxel),FVector(0.0,0.0,-1.0),
FVector2f(static_cast<float>(0.5+0.5*std::cos(a0)),
static_cast<float>(0.5+0.5*std::sin(a0))));
const int32 bottomBIndex=addVertex(point(a1,bottomVoxel),FVector(0.0,0.0,-1.0),
FVector2f(static_cast<float>(0.5+0.5*std::cos(a1)),
static_cast<float>(0.5+0.5*std::sin(a1))));
proxyIndices.insert(proxyIndices.end(),
{capBottomCenter,bottomBIndex,bottomAIndex});
}
++proxyCount;
}
if(proxyIndices.empty())return 0;
const int32 proxyVertexCount=mesh.Vertices.Num()-originalVertexCount;
const auto insertProxyVertices=[&](auto& values)
{
if(values.Num()!=originalVertexCount+proxyVertexCount)return;
using FArray=std::remove_reference_t<decltype(values)>;
FArray reordered;
reordered.Reserve(values.Num());
for(int32 index=0;index<originalSurfaceVertices;++index)
reordered.Add(values[index]);
for(int32 index=originalVertexCount;index<values.Num();++index)
reordered.Add(values[index]);
for(int32 index=originalSurfaceVertices;index<originalVertexCount;++index)
reordered.Add(values[index]);
values=MoveTemp(reordered);
};
insertProxyVertices(mesh.Vertices);
if(hasNormals)insertProxyVertices(mesh.Normals);
if(hasUvs)insertProxyVertices(mesh.UVs);
if(hasColors)insertProxyVertices(mesh.Colors);
const int32 oldTriangleCount=mesh.Triangles.Num()/3;
const int32 ceilingStart=std::max(0,mesh.Triangles.Num()-mesh.NumCeilingTriangles*3);
const int32 groundTriangleCount=ceilingStart/3;
const int32 proxyTriangleCount=static_cast<int32>(proxyIndices.size()/3);
TArray<int32> mergedIndices;
mergedIndices.Reserve(mesh.Triangles.Num()+static_cast<int32>(proxyIndices.size()));
for(int32 index=0;index<ceilingStart;++index)
{
const int32 oldIndex=mesh.Triangles[index];
mergedIndices.Add(oldIndex>=originalSurfaceVertices
?oldIndex+proxyVertexCount:oldIndex);
}
for(const int32 index:proxyIndices)
mergedIndices.Add(originalSurfaceVertices+index-originalVertexCount);
for(int32 index=ceilingStart;index<mesh.Triangles.Num();++index)
{
const int32 oldIndex=mesh.Triangles[index];
mergedIndices.Add(oldIndex>=originalSurfaceVertices
?oldIndex+proxyVertexCount:oldIndex);
}
mesh.Triangles=MoveTemp(mergedIndices);
TArray<uint8> mergedMasks;
mergedMasks.Reserve(oldTriangleCount+proxyTriangleCount);
for(int32 triangle=0;triangle<groundTriangleCount;++triangle)
mergedMasks.Add(mesh.TriangleSkirtFaceMasks.IsValidIndex(triangle)
?mesh.TriangleSkirtFaceMasks[triangle]:0);
for(int32 triangle=0;triangle<proxyTriangleCount;++triangle)mergedMasks.Add(0);
if(groundTriangleCount<oldTriangleCount)
for(int32 triangle=groundTriangleCount;triangle<oldTriangleCount;++triangle)
mergedMasks.Add(mesh.TriangleSkirtFaceMasks.IsValidIndex(triangle)
?mesh.TriangleSkirtFaceMasks[triangle]:0);
mesh.TriangleSkirtFaceMasks=MoveTemp(mergedMasks);
mesh.NumSurfaceVertices=originalSurfaceVertices+proxyVertexCount;
return proxyCount;
}
private:
float ApplyResolvedCavernGraph(float density,float X,float Y,float Z, float ApplyResolvedCavernGraph(float density,float X,float Y,float Z,
float* nativeFloorSupport=nullptr) const float* nativeFloorSupport=nullptr) const
{ {
@@ -11442,10 +11893,9 @@ inline void FStandaloneShapeWorld::FScopedPassageTileQueries::prepareSweptTubeBa
const FIntVector& origin,std::int32_t step,std::int32_t cells,std::uint32_t seed) const FIntVector& origin,std::int32_t step,std::int32_t cells,std::uint32_t seed)
{ {
constexpr std::int64_t Q=VoxelForgeCore::WorldAssemblySubvoxelsPerVoxel; constexpr std::int64_t Q=VoxelForgeCore::WorldAssemblySubvoxelsPerVoxel;
constexpr double InfluenceMetres=4.0;
constexpr double OpenAirSideWallHeightMetres=1.0; constexpr double OpenAirSideWallHeightMetres=1.0;
if(!shape_||step<=0||cells<=0||!std::isfinite(passageCarveReachMetres_) if(!shape_||step<=0||cells<=0||!std::isfinite(passageCarveReachMetres_)
||std::abs(passageCarveReachMetres_-InfluenceMetres)>1.0e-9)return; ||std::abs(passageCarveReachMetres_-VF_PassageInfluenceReachMetres)>1.0e-9)return;
const bool profile=profileStats_!=nullptr; const bool profile=profileStats_!=nullptr;
const auto prepareStart=profile?std::chrono::steady_clock::now() const auto prepareStart=profile?std::chrono::steady_clock::now()
:std::chrono::steady_clock::time_point{}; :std::chrono::steady_clock::time_point{};
@@ -11459,7 +11909,7 @@ inline void FStandaloneShapeWorld::FScopedPassageTileQueries::prepareSweptTubeBa
sweep->dimension=cells+3; sweep->dimension=cells+3;
const std::size_t gridSampleCount=static_cast<std::size_t>(sweep->dimension) const std::size_t gridSampleCount=static_cast<std::size_t>(sweep->dimension)
*static_cast<std::size_t>(sweep->dimension)*static_cast<std::size_t>(sweep->dimension); *static_cast<std::size_t>(sweep->dimension)*static_cast<std::size_t>(sweep->dimension);
sweep->influenceSubvoxels=InfluenceMetres*static_cast<double>(Q)*1000000.0 sweep->influenceSubvoxels=passageCarveReachMetres_*static_cast<double>(Q)*1000000.0
/std::max<std::uint32_t>(1,shape_->ResolvedLayout /std::max<std::uint32_t>(1,shape_->ResolvedLayout
?shape_->ResolvedLayout->coreVoxelSizeMicrometres:250000); ?shape_->ResolvedLayout->coreVoxelSizeMicrometres:250000);
sweep->passageToSweep.assign(passageRouteSegments_.size(),-1); sweep->passageToSweep.assign(passageRouteSegments_.size(),-1);
@@ -11473,7 +11923,7 @@ inline void FStandaloneShapeWorld::FScopedPassageTileQueries::prepareSweptTubeBa
const double qPerMetre=static_cast<double>(Q)*1000000.0/ const double qPerMetre=static_cast<double>(Q)*1000000.0/
std::max<std::uint32_t>(1,shape_->ResolvedLayout std::max<std::uint32_t>(1,shape_->ResolvedLayout
?shape_->ResolvedLayout->coreVoxelSizeMicrometres:250000); ?shape_->ResolvedLayout->coreVoxelSizeMicrometres:250000);
const double shellThickness=0.75*qPerMetre; const double shellThickness=VF_PassageShellThicknessMetres*qPerMetre;
const double stampedOutsideDistance=sweep->influenceSubvoxels+1.0; const double stampedOutsideDistance=sweep->influenceSubvoxels+1.0;
constexpr double MouthShellBlendMetres=5.0; constexpr double MouthShellBlendMetres=5.0;
const double wallReliefShell=0.41*qPerMetre; const double wallReliefShell=0.41*qPerMetre;
@@ -11633,7 +12083,7 @@ inline void FStandaloneShapeWorld::FScopedPassageTileQueries::prepareSweptTubeBa
// more than cornerWidth/6. Skip its work for pairs outside this exact // more than cornerWidth/6. Skip its work for pairs outside this exact
// support, with a small subvoxel guard for float rounding. The final // support, with a small subvoxel guard for float rounding. The final
// shell union only consumes negative distances. // shell union only consumes negative distances.
constexpr double CornerBlendMetres=0.50; constexpr double CornerBlendMetres=VF_PassageCornerBlendMetres;
const float roundDistanceFloat=static_cast<float>(signedDistance); const float roundDistanceFloat=static_cast<float>(signedDistance);
const float floorDistanceFloat=static_cast<float>(floorCenterZ-floorDepth-qz); const float floorDistanceFloat=static_cast<float>(floorCenterZ-floorDepth-qz);
const double flatDistanceLowerBound=std::max( const double flatDistanceLowerBound=std::max(
+12 -1
View File
@@ -2889,12 +2889,16 @@ namespace VoxelForgeCore
VoxelForgeCore::Heightfield2D::threadColumnCacheStats().columnComputeMilliseconds; VoxelForgeCore::Heightfield2D::threadColumnCacheStats().columnComputeMilliseconds;
const auto MarchingCubesStart=std::chrono::steady_clock::now(); const auto MarchingCubesStart=std::chrono::steady_clock::now();
FVoxelUniformBlockProofAuditStats BlockProofAudit; FVoxelUniformBlockProofAuditStats BlockProofAudit;
FVoxelMeshData mesh=mesher.GenerateMesh(origin,MeshStep,MeshCells,nullptr, FVoxelMeshData mesh;
{
FStandaloneShapeWorld::FScopedStampSamplingStep stampSamplingStep(MeshStep);
mesh=mesher.GenerateMesh(origin,MeshStep,MeshCells,nullptr,
MeshBandMinZVoxel,MeshBandMaxZVoxel,&sampleCount,nullptr,nullptr, MeshBandMinZVoxel,MeshBandMaxZVoxel,&sampleCount,nullptr,nullptr,
(options.hashDensity||options.captureDensitySamples)?&densityValues:nullptr, (options.hashDensity||options.captureDensitySamples)?&densityValues:nullptr,
options.profileMesherStages?&McStageTimings:nullptr, options.profileMesherStages?&McStageTimings:nullptr,
options.auditUniformBlockProofs?&BlockProofAudit:nullptr, options.auditUniformBlockProofs?&BlockProofAudit:nullptr,
options.forceFullDensityCapture); options.forceFullDensityCapture);
}
passageFeatureScope.copySweptTubeRuntimeCounts(); passageFeatureScope.copySweptTubeRuntimeCounts();
if(options.auditUniformBlockProofs) if(options.auditUniformBlockProofs)
{ {
@@ -3107,6 +3111,13 @@ namespace VoxelForgeCore
AppendStratumBoundaryFloors(world,farShape,nativeKey,step,mesh); AppendStratumBoundaryFloors(world,farShape,nativeKey,step,mesh);
AppendStratumBoundaryCeilings(world,farShape,nativeKey,step,mesh); AppendStratumBoundaryCeilings(world,farShape,nativeKey,step,mesh);
} }
const std::uint32_t coarsePillarProxyCount=tileShape.AppendCoarsePillarProxies(
mesh,origin,extent,MeshStep);
if(coarsePillarProxyCount>0)
std::printf("[CoarsePillarProxy] key=(%d,%d,%d,lod%d) sampling_step_vox=%d "
"pillars=%u mode=exact_capped_cylinder status=EMITTED\n",
key.coordinate.x,key.coordinate.y,key.coordinate.z,key.lod,MeshStep,
coarsePillarProxyCount);
l77RefineStage.Restore(); l77RefineStage.Restore();
out.densitySampleCount=static_cast<std::uint64_t>(std::max<int64>(0,sampleCount)); out.densitySampleCount=static_cast<std::uint64_t>(std::max<int64>(0,sampleCount));
@@ -539,6 +539,38 @@ namespace world_assembly_detail
if (squared == 0) if (squared == 0)
{ error = "world assembly route contains a zero-length segment"; return false; } { error = "world assembly route contains a zero-length segment"; return false; }
} }
const auto& liminal = stratum.liminalField;
if (liminal.version != 0)
{
if ((liminal.version != CoreLiminalFieldRecipeVersionV1
&& liminal.version != CoreLiminalFieldRecipeVersionV2)
|| static_cast<std::uint32_t>(liminal.variant) >= CoreLiminalFieldVariantCountV1
|| liminal.seed != effectiveRecipe.seed
|| liminal.variant != SelectCoreLiminalFieldVariantV1(liminal.seed)
|| stratum.route.size() < 2
|| liminal.mouthFloorOffsetSubvoxels <= 0
|| stratum.route.front().positionSubvoxels[0] != liminal.arrivalMouthSubvoxels[0]
|| stratum.route.front().positionSubvoxels[1] != liminal.arrivalMouthSubvoxels[1]
|| stratum.route.front().positionSubvoxels[2]
!= liminal.arrivalMouthSubvoxels[2]-liminal.mouthFloorOffsetSubvoxels
|| stratum.route.back().positionSubvoxels[0] != liminal.departureMouthSubvoxels[0]
|| stratum.route.back().positionSubvoxels[1] != liminal.departureMouthSubvoxels[1]
|| stratum.route.back().positionSubvoxels[2]
!= liminal.departureMouthSubvoxels[2]-liminal.mouthFloorOffsetSubvoxels
|| liminal.routeHalfWidthSubvoxels < stratum.routeConstraints.capsuleRadiusSubvoxels
|| liminal.routeHalfThicknessSubvoxels <= 0
|| liminal.routeOffsetSubvoxels <= 0
|| liminal.supportSpacingSubvoxels <= 0
|| liminal.supportRadiusSubvoxels <= 0
|| stratum.surfaceProfile.version != 1)
{ error = "Core.Liminal.Field plan has invalid version, seed-selected variant, route mouths or dimensions"; return false; }
const std::int64_t bottom = static_cast<std::int64_t>(stratum.bottomChunkZ)
* layoutChunkWidthSubvoxels;
const std::int64_t top = (static_cast<std::int64_t>(stratum.topChunkZ) + 1)
* layoutChunkWidthSubvoxels;
if (liminal.floorHeightSubvoxels <= bottom || liminal.floorHeightSubvoxels >= top)
{ error = "Core.Liminal.Field floor escapes its finite stratum bounds"; return false; }
}
const auto& constraints = stratum.routeConstraints; const auto& constraints = stratum.routeConstraints;
if (constraints.version == 0) if (constraints.version == 0)
{ {
@@ -682,6 +714,24 @@ 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.liminalField.version != 0)
{
const auto& liminal = stratum.liminalField;
HashWord(hash, 0x4c494d494e414c31ull, 8);
HashWord(hash, liminal.version, 4);
HashWord(hash, static_cast<std::uint32_t>(liminal.variant), 4);
HashWord(hash, liminal.seed, 4);
for (const auto value : liminal.arrivalMouthSubvoxels)
HashWord(hash, static_cast<std::uint64_t>(value), 8);
for (const auto value : liminal.departureMouthSubvoxels)
HashWord(hash, static_cast<std::uint64_t>(value), 8);
for (const auto value : {liminal.mouthFloorOffsetSubvoxels,
liminal.floorHeightSubvoxels,
liminal.routeHalfWidthSubvoxels, liminal.routeHalfThicknessSubvoxels,
liminal.routeOffsetSubvoxels, liminal.supportSpacingSubvoxels,
liminal.supportRadiusSubvoxels})
HashWord(hash, static_cast<std::uint64_t>(value), 8);
}
if (stratum.surfaceProfile.version != 0) if (stratum.surfaceProfile.version != 0)
HashSurfaceProfile(hash, stratum.surfaceProfile); HashSurfaceProfile(hash, stratum.surfaceProfile);
return hash; return hash;
@@ -1059,6 +1109,30 @@ namespace world_assembly_detail
{ error = "world assembly route point is missing a fixed-scale field"; return false; } { error = "world assembly route point is missing a fixed-scale field"; return false; }
stratum.route.push_back(point); stratum.route.push_back(point);
} }
const VFJson::Value& liminalValue = item.Get("liminal_field");
if (!std::holds_alternative<std::nullptr_t>(liminalValue.Data))
{
auto& liminal = stratum.liminalField;
std::uint32_t variant = 0;
if (!liminalValue.IsObject()
|| !ReadU32(liminalValue.Get("version"), liminal.version)
|| !ReadU32(liminalValue.Get("variant"), variant)
|| !ReadU32(liminalValue.Get("seed"), liminal.seed)
|| !ReadArray(liminalValue.Get("arrival_mouth_q"),
liminal.arrivalMouthSubvoxels.data(), 3)
|| !ReadArray(liminalValue.Get("departure_mouth_q"),
liminal.departureMouthSubvoxels.data(), 3)
|| !ReadInteger(liminalValue.Get("mouth_floor_offset_q"),
liminal.mouthFloorOffsetSubvoxels)
|| !ReadInteger(liminalValue.Get("floor_height_q"), liminal.floorHeightSubvoxels)
|| !ReadInteger(liminalValue.Get("route_half_width_q"), liminal.routeHalfWidthSubvoxels)
|| !ReadInteger(liminalValue.Get("route_half_thickness_q"), liminal.routeHalfThicknessSubvoxels)
|| !ReadInteger(liminalValue.Get("route_offset_q"), liminal.routeOffsetSubvoxels)
|| !ReadInteger(liminalValue.Get("support_spacing_q"), liminal.supportSpacingSubvoxels)
|| !ReadInteger(liminalValue.Get("support_radius_q"), liminal.supportRadiusSubvoxels))
{ error = "Core.Liminal.Field plan is missing a fixed-scale field"; return false; }
liminal.variant = static_cast<WorldAssemblyLiminalVariantV1>(variant);
}
plan.strates.push_back(std::move(stratum)); plan.strates.push_back(std::move(stratum));
} }
return true; return true;
@@ -2324,6 +2398,724 @@ bool WorldAssemblyManifest::validate(std::string& error) const
return true; return true;
} }
bool PlanCoreLiminalFieldV1(WorldAssemblyRecipeV1& recipe,
WorldAssemblyStratumPlanV1& stratum,const ResolvedLayoutSnapshotV3& layout,
std::string& error)
{
error.clear();
if(layout.coreVoxelSizeMicrometres==0||stratum.strateIndex<0
||stratum.topChunkZ<stratum.bottomChunkZ)
{error="Core.Liminal.Field needs a finite stratum and resolved Core voxel size";return false;}
const auto resolvedStratum=std::find_if(layout.strates.begin(),layout.strates.end(),
[&](const auto& value){return value.strateIndex==stratum.strateIndex
&&value.generatorKind=="SurfaceWorld";});
if(resolvedStratum==layout.strates.end()||!resolvedStratum->content.presentInCurrentField)
{error="Core.Liminal.Field must target a resolved SurfaceWorld content band";return false;}
const ResolvedLayoutPassageV1* arrival=nullptr;
const ResolvedLayoutPassageV1* departure=nullptr;
for(const auto& passage:layout.passages)
{
if(passage.lowerStrateIndex==stratum.strateIndex)
{
if(arrival){error="Core.Liminal.Field requires one fixed arrival passage mouth";return false;}
arrival=&passage;
}
if(passage.upperStrateIndex==stratum.strateIndex)
{
if(departure){error="Core.Liminal.Field requires one fixed departure passage mouth";return false;}
departure=&passage;
}
}
if(!arrival||!departure)
{error="Core.Liminal.Field requires an adjacent passage on both sides";return false;}
constexpr std::int64_t Q=WorldAssemblySubvoxelsPerVoxel;
const std::int64_t coreMicrons=layout.coreVoxelSizeMicrometres;
const auto micrometresToQ=[&](std::int64_t micrometres)
{
const std::int64_t numerator=micrometres*Q;
return numerator>=0?(numerator+coreMicrons/2)/coreMicrons
:(numerator-coreMicrons/2)/coreMicrons;
};
const std::int64_t qPerMetre=micrometresToQ(1000000);
if(qPerMetre<=0){error="Core.Liminal.Field could not resolve fixed-scale metres";return false;}
const std::uint32_t seed=recipe.seed;
const WorldAssemblyLiminalVariantV1 variant=SelectCoreLiminalFieldVariantV1(seed);
const auto& definition=CoreLiminalFieldVariantsV1[static_cast<std::size_t>(variant)];
const auto& start=arrival->lowerMouthSubvoxels;
const auto& finish=departure->upperMouthSubvoxels;
constexpr std::int64_t MaximumMouthCoordinateQ=1000000000ll;
if(std::abs(start[0])>MaximumMouthCoordinateQ||std::abs(start[1])>MaximumMouthCoordinateQ
||std::abs(start[2])>MaximumMouthCoordinateQ||std::abs(finish[0])>MaximumMouthCoordinateQ
||std::abs(finish[1])>MaximumMouthCoordinateQ||std::abs(finish[2])>MaximumMouthCoordinateQ)
{error="Core.Liminal.Field passage mouth exceeds the supported fixed-coordinate range";return false;}
const std::int64_t mouthPlayerCenterHeight=micrometresToQ(1130000);
auto routeStart=start;
auto routeFinish=finish;
routeStart[2]-=mouthPlayerCenterHeight;
routeFinish[2]-=mouthPlayerCenterHeight;
const auto findMouthControl=[&](const ResolvedLayoutPassageV1& passage,
const std::array<std::int64_t,3>& mouth)
{
std::size_t found=passage.controlPoints.size();
for(std::size_t i=0;i<passage.controlPoints.size();++i)
{
const auto& point=passage.controlPoints[i];
if(point.positionSubvoxels[0]==mouth[0]
&&point.positionSubvoxels[1]==mouth[1]
&&point.positionSubvoxels[2]-point.radiusSubvoxels
+mouthPlayerCenterHeight==mouth[2])
{
if(found!=passage.controlPoints.size())return passage.controlPoints.size();
found=i;
}
}
return found;
};
const std::size_t arrivalControl=findMouthControl(*arrival,start);
const std::size_t departureControl=findMouthControl(*departure,finish);
if(arrival->controlPoints.size()<2||departure->controlPoints.size()<2
||arrivalControl>=arrival->controlPoints.size()
||departureControl>=departure->controlPoints.size())
{error="Core.Liminal.Field needs exact passage-control bindings at both fixed mouths";return false;}
const auto horizontalLengthQ=[](std::int64_t dx,std::int64_t dy)
{
const auto absX=static_cast<std::uint64_t>(std::abs(dx));
const auto absY=static_cast<std::uint64_t>(std::abs(dy));
return world_assembly_detail::IntegerSqrt(absX*absX+absY*absY);
};
const auto roundRatio=[](std::int64_t numerator,std::uint64_t denominator)
{
if(denominator==0)return std::int64_t{0};
const auto positiveDenominator=static_cast<std::int64_t>(denominator);
return numerator>=0
?(numerator+positiveDenominator/2)/positiveDenominator
:-((-numerator+positiveDenominator/2)/positiveDenominator);
};
const auto passageSplineControls=[](const ResolvedLayoutPassageV1& passage)
{
std::vector<PassageSpline::FPoint> controls;
controls.reserve(passage.controlPoints.size());
for(const auto& point:passage.controlPoints)
controls.push_back({static_cast<double>(point.positionSubvoxels[0]),
static_cast<double>(point.positionSubvoxels[1]),
static_cast<double>(point.positionSubvoxels[2]-point.radiusSubvoxels),
static_cast<double>(point.radiusSubvoxels)});
return controls;
};
const auto arrivalSpline=passageSplineControls(*arrival);
const auto departureSpline=passageSplineControls(*departure);
constexpr double MouthTangentProbeParameter=0.5;
const std::size_t arrivalSegment=arrivalControl==0?0:arrivalControl-1;
const double arrivalAtT=arrivalControl==0?0.0:1.0;
const double arrivalNearT=arrivalControl==0?MouthTangentProbeParameter
:1.0-MouthTangentProbeParameter;
const auto arrivalNear=PassageSpline::EvaluateRaw(arrivalSpline,arrivalSegment,
arrivalNearT,static_cast<double>(qPerMetre));
const auto arrivalAt=PassageSpline::EvaluateRaw(arrivalSpline,arrivalSegment,
arrivalAtT,static_cast<double>(qPerMetre));
const std::size_t departureSegment=departureControl+1==departure->controlPoints.size()
?departureControl-1:departureControl;
const double departureAtT=departureControl+1==departure->controlPoints.size()?1.0:0.0;
const double departureNearT=departureControl+1==departure->controlPoints.size()
?1.0-MouthTangentProbeParameter:MouthTangentProbeParameter;
const auto departureAt=PassageSpline::EvaluateRaw(departureSpline,departureSegment,
departureAtT,static_cast<double>(qPerMetre));
const auto departureNear=PassageSpline::EvaluateRaw(departureSpline,departureSegment,
departureNearT,static_cast<double>(qPerMetre));
const auto roundedDelta=[](double startValue,double endValue)
{return static_cast<std::int64_t>(std::llround(endValue-startValue));};
const std::int64_t arrivalDx=roundedDelta(arrivalNear[0],arrivalAt[0]);
const std::int64_t arrivalDy=roundedDelta(arrivalNear[1],arrivalAt[1]);
const std::int64_t arrivalFloorDelta=roundedDelta(arrivalNear[2],arrivalAt[2]);
const std::uint64_t arrivalLength=horizontalLengthQ(arrivalDx,arrivalDy);
const std::int64_t departureDx=roundedDelta(departureAt[0],departureNear[0]);
const std::int64_t departureDy=roundedDelta(departureAt[1],departureNear[1]);
const std::int64_t departureFloorDelta=roundedDelta(departureAt[2],departureNear[2]);
const std::uint64_t departureLength=horizontalLengthQ(departureDx,departureDy);
if(arrivalLength==0||departureLength==0)
{error="Core.Liminal.Field passage mouth tangent is too short for a stable connector";return false;}
const auto extendMouth=[&](const std::array<std::int64_t,3>& mouth,
std::int64_t dx,std::int64_t dy,std::int64_t dz,std::uint64_t horizontalLength,
std::int64_t distance,bool forward)
{
const std::int64_t sign=forward?1:-1;
return std::array<std::int64_t,3>{
mouth[0]+roundRatio(sign*dx*distance,horizontalLength),
mouth[1]+roundRatio(sign*dy*distance,horizontalLength),
mouth[2]+roundRatio(sign*dz*distance,horizontalLength)};
};
constexpr std::int64_t MouthConnectorMidMetres=5;
constexpr std::int64_t MouthConnectorFullMetres=10;
const auto arrivalConnectorMid=extendMouth(routeStart,arrivalDx,arrivalDy,
arrivalFloorDelta,arrivalLength,MouthConnectorMidMetres*qPerMetre,true);
const auto arrivalConnector=extendMouth(routeStart,arrivalDx,arrivalDy,
arrivalFloorDelta,arrivalLength,MouthConnectorFullMetres*qPerMetre,true);
const auto departureConnector=extendMouth(routeFinish,departureDx,departureDy,
departureFloorDelta,departureLength,MouthConnectorFullMetres*qPerMetre,false);
const auto departureConnectorMid=extendMouth(routeFinish,departureDx,departureDy,
departureFloorDelta,departureLength,MouthConnectorMidMetres*qPerMetre,false);
const std::int64_t bottom=static_cast<std::int64_t>(stratum.bottomChunkZ)
*recipe.layoutChunkWidthSubvoxels;
const std::int64_t top=(static_cast<std::int64_t>(stratum.topChunkZ)+1)
*recipe.layoutChunkWidthSubvoxels;
const std::int64_t minRouteFloor=std::min({routeStart[2],routeFinish[2],
arrivalConnectorMid[2],arrivalConnector[2],departureConnector[2],
departureConnectorMid[2]});
const std::int64_t contentBottom=micrometresToQ(
resolvedStratum->content.bottomMicrometres);
const std::int64_t profileRelief=variant==WorldAssemblyLiminalVariantV1::repeatingHills
?2*micrometresToQ(definition.hillAmplitudeMicrometres):0;
const std::int64_t floorHeight=std::max(contentBottom+profileRelief+qPerMetre/4,
minRouteFloor-8*qPerMetre);
if(floorHeight>=minRouteFloor-2*qPerMetre||floorHeight<=bottom||top<=floorHeight+8*qPerMetre)
{error="Core.Liminal.Field has no room for its floor and passage route";return false;}
stratum.hasRecipeOverride=true;
stratum.recipeOverride=recipe;
WorldAssemblySurfaceProfileV1 profile;
profile.version=1;
profile.kind=definition.surfaceKind;
profile.h0Subvoxels=floorHeight;
if(profile.kind==WorldAssemblySurfaceProfileKindV1::periodicHills)
{
profile.amplitudeXSubvoxels=micrometresToQ(definition.hillAmplitudeMicrometres);
profile.amplitudeYSubvoxels=profile.amplitudeXSubvoxels;
profile.wavelengthXSubvoxels=micrometresToQ(definition.hillWavelengthMicrometres);
profile.wavelengthYSubvoxels=profile.wavelengthXSubvoxels;
ResolveWorldAssemblySurfaceProfilePhasesV1(profile,seed);
}
stratum.recipeOverride.surfaceProfile=profile;
stratum.recipeOverride.contentHash=0;
stratum.surfaceProfile=profile;
stratum.capHeightSubvoxels=top-4*qPerMetre;
stratum.capUndulationSubvoxels=0;
stratum.capDetailAmplitudeSubvoxels=0;
stratum.capRidgeAmplitudeSubvoxels=0;
stratum.waterEnabled=false;
stratum.waterSurfaceSubvoxels=0;
WorldAssemblyLiminalFieldPlanV1 liminal;
liminal.version=CoreLiminalFieldRecipeVersionV1;
liminal.variant=variant;
liminal.seed=seed;
liminal.arrivalMouthSubvoxels=start;
liminal.departureMouthSubvoxels=finish;
liminal.floorHeightSubvoxels=floorHeight;
liminal.routeHalfWidthSubvoxels=micrometresToQ(definition.routeHalfWidthMicrometres);
liminal.routeHalfThicknessSubvoxels=micrometresToQ(definition.routeHalfThicknessMicrometres);
liminal.supportSpacingSubvoxels=micrometresToQ(definition.supportSpacingMicrometres);
liminal.supportRadiusSubvoxels=micrometresToQ(definition.supportRadiusMicrometres);
liminal.mouthFloorOffsetSubvoxels=mouthPlayerCenterHeight;
constexpr std::int64_t GradeQ16=17560;
constexpr std::int64_t MinimumPathOffsetMetres=150;
constexpr std::int64_t ConnectorSpanMetres=16;
const std::int64_t dx=departureConnector[0]-arrivalConnector[0];
const std::int64_t dy=departureConnector[1]-arrivalConnector[1];
const std::uint64_t chord=horizontalLengthQ(dx,dy);
std::int64_t directionX=dx,directionY=dy;
std::uint64_t directionLength=chord;
if(directionLength<static_cast<std::uint64_t>(qPerMetre/4))
{directionX=Q;directionY=0;directionLength=static_cast<std::uint64_t>(Q);}
const std::int64_t normalX=-directionY;
const std::int64_t normalY=directionX;
const std::int64_t vertical=std::abs(departureConnector[2]-arrivalConnector[2]);
const std::int64_t requiredHorizontal=(vertical*65536+GradeQ16-1)/GradeQ16;
std::int64_t routeOffset=std::max(MinimumPathOffsetMetres*qPerMetre,
(requiredHorizontal+1)/2+20*qPerMetre);
if(chord<ConnectorSpanMetres*static_cast<std::uint64_t>(qPerMetre))
routeOffset=std::max(routeOffset,MinimumPathOffsetMetres*qPerMetre);
liminal.routeOffsetSubvoxels=routeOffset;
const auto normalOffset=[&](std::int64_t scale)
{
return std::array<std::int64_t,2>{
normalX*scale/static_cast<std::int64_t>(directionLength),
normalY*scale/static_cast<std::int64_t>(directionLength)};
};
const auto directionOffset=[&](std::int64_t scale)
{
return std::array<std::int64_t,2>{
directionX*scale/static_cast<std::int64_t>(directionLength),
directionY*scale/static_cast<std::int64_t>(directionLength)};
};
const auto normal=normalOffset(routeOffset);
const auto connector=chord<ConnectorSpanMetres*static_cast<std::uint64_t>(qPerMetre)
?directionOffset(ConnectorSpanMetres*qPerMetre):std::array<std::int64_t,2>{0,0};
std::vector<std::array<std::int64_t,3>> horizontalPath;
horizontalPath.reserve(8);
horizontalPath.push_back(routeStart);
horizontalPath.push_back(arrivalConnectorMid);
horizontalPath.push_back(arrivalConnector);
horizontalPath.push_back({arrivalConnector[0]+normal[0],
arrivalConnector[1]+normal[1],0});
horizontalPath.push_back({departureConnector[0]+normal[0]+connector[0],
departureConnector[1]+normal[1]+connector[1],0});
horizontalPath.push_back(departureConnector);
horizontalPath.push_back(departureConnectorMid);
horizontalPath.push_back(routeFinish);
std::vector<WorldAssemblyRoutePointV1> route;
route.reserve(horizontalPath.size());
std::vector<std::uint64_t> cumulative(horizontalPath.size(),0);
std::uint64_t totalHorizontal=0;
for(std::size_t i=1;i<horizontalPath.size();++i)
{
const std::int64_t sx=horizontalPath[i][0]-horizontalPath[i-1][0];
const std::int64_t sy=horizontalPath[i][1]-horizontalPath[i-1][1];
const std::uint64_t segment=horizontalLengthQ(sx,sy);
if(segment==0){error="Core.Liminal.Field route contains a zero-horizontal segment";return false;}
totalHorizontal+=segment;
cumulative[i]=totalHorizontal;
}
if(totalHorizontal<static_cast<std::uint64_t>(requiredHorizontal))
{error="Core.Liminal.Field route cannot meet the 15-degree grade bound";return false;}
const std::uint64_t centralFirst=horizontalLengthQ(
horizontalPath[3][0]-horizontalPath[2][0],
horizontalPath[3][1]-horizontalPath[2][1]);
const std::uint64_t centralMiddle=horizontalLengthQ(
horizontalPath[4][0]-horizontalPath[3][0],
horizontalPath[4][1]-horizontalPath[3][1]);
const std::uint64_t centralLast=horizontalLengthQ(
horizontalPath[5][0]-horizontalPath[4][0],
horizontalPath[5][1]-horizontalPath[4][1]);
const std::uint64_t centralTotal=centralFirst+centralMiddle+centralLast;
if(centralTotal==0)
{error="Core.Liminal.Field central route has no horizontal span";return false;}
const std::int64_t centralVertical=departureConnector[2]-arrivalConnector[2];
horizontalPath[3][2]=arrivalConnector[2]+roundRatio(
centralVertical*static_cast<std::int64_t>(centralFirst),centralTotal);
horizontalPath[4][2]=arrivalConnector[2]+roundRatio(
centralVertical*static_cast<std::int64_t>(centralFirst+centralMiddle),centralTotal);
for(std::size_t i=0;i<horizontalPath.size();++i)
{
auto point=horizontalPath[i];
WorldAssemblyRoutePointV1 routePoint;
routePoint.positionSubvoxels=point;
routePoint.radiusSubvoxels=std::max<std::int64_t>(liminal.routeHalfWidthSubvoxels,
micrometresToQ(500000));
std::uint64_t id=14695981039346656037ull;
const auto add=[&](std::uint64_t value,std::uint32_t bytes)
{for(std::uint32_t byte=0;byte<bytes;++byte){id^=static_cast<std::uint8_t>(value>>(byte*8));id*=1099511628211ull;}};
add(seed,4);add(static_cast<std::uint32_t>(stratum.strateIndex),4);add(i,4);
routePoint.stableFeatureId=id?id:1;
route.push_back(routePoint);
}
stratum.route=std::move(route);
stratum.routeConstraints={1,micrometresToQ(340000),micrometresToQ(1760000),
GradeQ16,micrometresToQ(125000),micrometresToQ(250000),
micrometresToQ(1000000),micrometresToQ(120000),3};
stratum.liminalField=liminal;
std::string validationError;
if(!world_assembly_detail::ValidateSurfaceProfile(stratum.surfaceProfile,seed,validationError)
||!world_assembly_detail::ValidateStratum(stratum,recipe,validationError))
{error=validationError.empty()?"Core.Liminal.Field produced an invalid plan":validationError;return false;}
std::printf("[CoreLiminalFieldPlan] recipe=%.*s version=%u variant=%.*s seed=%u arrival=%s departure=%s route_points=%zu route_offset_m=%.3f route_grade_limit_deg=15.000 status=PASS\n",
static_cast<int>(CoreLiminalFieldRecipeIdV1.size()),CoreLiminalFieldRecipeIdV1.data(),
liminal.version,static_cast<int>(definition.name.size()),definition.name.data(),seed,
arrival->stableId.c_str(),departure->stableId.c_str(),stratum.route.size(),
static_cast<double>(routeOffset)/qPerMetre);
return true;
}
std::array<std::array<std::int64_t,2>,6> CoreLiminalRouteXYV2(
std::int64_t startX,std::int64_t startY,std::int64_t finishX,
std::int64_t finishY,std::int64_t qPerMetre)
{
return {{{{startX,startY}},{{-40*qPerMetre,40*qPerMetre}},
{{-40*qPerMetre,-40*qPerMetre}},{{40*qPerMetre,-40*qPerMetre}},
{{40*qPerMetre,40*qPerMetre}},{{finishX,finishY}}}};
}
std::vector<WorldAssemblyRoutePointV1> BuildCoreLiminalRouteV2(
const WorldAssemblySurfaceProfileV1& profile,
const ResolvedLayoutLandingPadV1& arrivalPad,
const ResolvedLayoutLandingPadV1& departurePad,
const WorldAssemblyLiminalVariantDefinitionV1& definition,
std::uint32_t seed,std::int32_t strateIndex,std::int64_t coreMicrons,
std::int64_t qPerMetre,
std::uint64_t& totalHorizontal,std::string& error)
{
error.clear();totalHorizontal=0;
const auto groundHeightAt=[&](std::int64_t x,std::int64_t y)
{
if(profile.kind==WorldAssemblySurfaceProfileKindV1::flatField)
return profile.h0Subvoxels;
const std::int64_t turnX=world_assembly_detail::SurfaceProfileTurnAtCoordinate(
x,profile.wavelengthXSubvoxels,profile.phaseXTurnsQ32);
const std::int64_t turnY=world_assembly_detail::SurfaceProfileTurnAtCoordinate(
y,profile.wavelengthYSubvoxels,profile.phaseYTurnsQ32);
return profile.h0Subvoxels
+world_assembly_detail::MulQ30(profile.amplitudeXSubvoxels,
world_assembly_detail::CosineQ30(turnX))
+world_assembly_detail::MulQ30(profile.amplitudeYSubvoxels,
world_assembly_detail::CosineQ30(turnY));
};
const auto horizontalLengthQ=[](std::int64_t dx,std::int64_t dy)
{return world_assembly_detail::IntegerSqrt(static_cast<std::uint64_t>(dx*dx+dy*dy));};
const auto micrometresToQ=[&](std::int64_t micrometres)
{return (micrometres*WorldAssemblySubvoxelsPerVoxel+coreMicrons/2)/coreMicrons;};
const auto routeXY=CoreLiminalRouteXYV2(arrivalPad.positionSubvoxels[0],
arrivalPad.positionSubvoxels[1],departurePad.positionSubvoxels[0],
departurePad.positionSubvoxels[1],qPerMetre);
std::vector<WorldAssemblyRoutePointV1> route;
const std::int64_t pointSpacing=12*qPerMetre;
const std::int64_t routeRadius=std::max<std::int64_t>(
micrometresToQ(definition.routeHalfWidthMicrometres),micrometresToQ(500000));
const auto routeId=[&](std::size_t ordinal)
{
std::uint64_t id=14695981039346656037ull;
const auto add=[&](std::uint64_t value,std::uint32_t bytes)
{for(std::uint32_t byte=0;byte<bytes;++byte)
{id^=static_cast<std::uint8_t>(value>>(byte*8));id*=1099511628211ull;}};
add(seed,4);add(static_cast<std::uint32_t>(strateIndex),4);add(ordinal,4);
return id?id:1;
};
const auto appendRoutePoint=[&](std::int64_t x,std::int64_t y)
{
WorldAssemblyRoutePointV1 point;
point.positionSubvoxels={x,y,groundHeightAt(x,y)};
point.radiusSubvoxels=routeRadius;
point.stableFeatureId=routeId(route.size());
route.push_back(point);
};
const auto interpolate=[](std::int64_t start,std::int64_t delta,
std::uint64_t step,std::uint64_t steps)
{
const std::int64_t numerator=delta*static_cast<std::int64_t>(step);
const std::int64_t divisor=static_cast<std::int64_t>(steps);
return start+(numerator>=0?(numerator+divisor/2)/divisor
:(numerator-divisor/2)/divisor);
};
appendRoutePoint(routeXY.front()[0],routeXY.front()[1]);
for(std::size_t segment=1;segment<routeXY.size();++segment)
{
const std::int64_t dx=routeXY[segment][0]-routeXY[segment-1][0];
const std::int64_t dy=routeXY[segment][1]-routeXY[segment-1][1];
const std::uint64_t length=horizontalLengthQ(dx,dy);
if(length==0){error="Core.Liminal.Field v2 route contains a zero-horizontal segment";return {};}
totalHorizontal+=length;
const std::uint64_t steps=std::max<std::uint64_t>(1,
(length+static_cast<std::uint64_t>(pointSpacing)-1)
/static_cast<std::uint64_t>(pointSpacing));
for(std::uint64_t step=1;step<=steps;++step)
appendRoutePoint(interpolate(routeXY[segment-1][0],dx,step,steps),
interpolate(routeXY[segment-1][1],dy,step,steps));
}
if(route.size()<2||totalHorizontal<300*static_cast<std::uint64_t>(qPerMetre)
||route.front().positionSubvoxels[2]!=arrivalPad.floorHeightSubvoxels
||route.back().positionSubvoxels[2]!=departurePad.floorHeightSubvoxels)
{error="Core.Liminal.Field v2 pad-to-pad route is incomplete or too short";return {};}
return route;
}
bool PrepareCoreLiminalLandingPadsV2(WorldAssemblyRecipeV1& recipe,
WorldAssemblyStratumPlanV1& stratum,ResolvedLayoutSnapshotV3& layout,
std::string& error)
{
error.clear();
if(layout.coreVoxelSizeMicrometres==0||stratum.strateIndex<0
||stratum.topChunkZ<stratum.bottomChunkZ)
{error="Core.Liminal.Field v2 needs a finite stratum and resolved Core voxel size";return false;}
auto resolved=std::find_if(layout.strates.begin(),layout.strates.end(),
[&](const auto& value){return value.strateIndex==stratum.strateIndex
&&value.generatorKind=="SurfaceWorld";});
if(resolved==layout.strates.end()||!resolved->content.presentInCurrentField)
{error="Core.Liminal.Field v2 must target a resolved SurfaceWorld content band";return false;}
constexpr std::int64_t Q=WorldAssemblySubvoxelsPerVoxel;
const std::int64_t coreMicrons=layout.coreVoxelSizeMicrometres;
const auto micrometresToQ=[&](std::int64_t micrometres)
{
const std::int64_t numerator=micrometres*Q;
return numerator>=0?(numerator+coreMicrons/2)/coreMicrons
:(numerator-coreMicrons/2)/coreMicrons;
};
const std::int64_t qPerMetre=micrometresToQ(1000000);
if(qPerMetre<=0){error="Core.Liminal.Field v2 could not resolve fixed-scale metres";return false;}
const std::uint32_t seed=recipe.seed;
const WorldAssemblyLiminalVariantV1 variant=SelectCoreLiminalFieldVariantV1(seed);
const auto& definition=CoreLiminalFieldVariantsV1[static_cast<std::size_t>(variant)];
const std::int64_t bottom=static_cast<std::int64_t>(stratum.bottomChunkZ)
*recipe.layoutChunkWidthSubvoxels;
const std::int64_t top=(static_cast<std::int64_t>(stratum.topChunkZ)+1)
*recipe.layoutChunkWidthSubvoxels;
const std::int64_t contentBottom=micrometresToQ(resolved->content.bottomMicrometres);
const std::int64_t profileRelief=variant==WorldAssemblyLiminalVariantV1::repeatingHills
?2*micrometresToQ(definition.hillAmplitudeMicrometres):0;
const std::int64_t deckSweepRadius=static_cast<std::int64_t>(std::ceil(std::hypot(
static_cast<double>(definition.routeHalfWidthMicrometres+250000),
static_cast<double>(definition.routeHalfThicknessMicrometres+250000))));
const std::int64_t floorClearance=definition.routeHalfThicknessMicrometres
+deckSweepRadius+250000;
// Keep the field above the lower tunnel's mouth transition so the routed
// departure has a clean open section before it reaches the cave wall.
constexpr std::int64_t MinimumFieldGroundMarginMicrometres=20000000;
const std::int64_t fieldGroundMargin=std::max(floorClearance,
MinimumFieldGroundMarginMicrometres);
const std::int64_t floorHeight=contentBottom+profileRelief
+micrometresToQ(fieldGroundMargin);
if(floorHeight<=bottom||top<=floorHeight+8*qPerMetre)
{error="Core.Liminal.Field v2 has no room for its supported field and cap";return false;}
WorldAssemblySurfaceProfileV1 profile;
profile.version=1;
profile.kind=definition.surfaceKind;
profile.h0Subvoxels=floorHeight;
if(profile.kind==WorldAssemblySurfaceProfileKindV1::periodicHills)
{
profile.amplitudeXSubvoxels=micrometresToQ(definition.hillAmplitudeMicrometres);
profile.amplitudeYSubvoxels=profile.amplitudeXSubvoxels;
profile.wavelengthXSubvoxels=micrometresToQ(definition.hillWavelengthMicrometres);
profile.wavelengthYSubvoxels=profile.wavelengthXSubvoxels;
ResolveWorldAssemblySurfaceProfilePhasesV1(profile,seed);
}
if(!world_assembly_detail::ValidateSurfaceProfile(profile,seed,error))return false;
stratum.hasRecipeOverride=true;
stratum.recipeOverride=recipe;
stratum.recipeOverride.surfaceProfile=profile;
stratum.recipeOverride.contentHash=0;
stratum.surfaceProfile=profile;
stratum.capHeightSubvoxels=top-4*qPerMetre;
stratum.capUndulationSubvoxels=0;
stratum.capDetailAmplitudeSubvoxels=0;
stratum.capRidgeAmplitudeSubvoxels=0;
stratum.waterEnabled=false;
stratum.waterSurfaceSubvoxels=0;
const auto groundHeightAt=[&](std::int64_t x,std::int64_t y)
{
if(profile.kind==WorldAssemblySurfaceProfileKindV1::flatField)
return profile.h0Subvoxels;
const std::int64_t turnX=world_assembly_detail::SurfaceProfileTurnAtCoordinate(
x,profile.wavelengthXSubvoxels,profile.phaseXTurnsQ32);
const std::int64_t turnY=world_assembly_detail::SurfaceProfileTurnAtCoordinate(
y,profile.wavelengthYSubvoxels,profile.phaseYTurnsQ32);
return profile.h0Subvoxels
+world_assembly_detail::MulQ30(profile.amplitudeXSubvoxels,
world_assembly_detail::CosineQ30(turnX))
+world_assembly_detail::MulQ30(profile.amplitudeYSubvoxels,
world_assembly_detail::CosineQ30(turnY));
};
const auto routeXY=CoreLiminalRouteXYV2(-12*qPerMetre,0,12*qPerMetre,0,qPerMetre);
const auto squareRoot=[](std::uint64_t value)
{return world_assembly_detail::IntegerSqrt(value);};
const auto directionQ16=[&](std::int64_t dx,std::int64_t dy)
{
const std::uint64_t length=squareRoot(static_cast<std::uint64_t>(dx*dx+dy*dy));
if(length==0)return std::array<std::int32_t,2>{{0,0}};
const auto rounded=[&](std::int64_t value)
{return value>=0?(value+static_cast<std::int64_t>(length/2))
/static_cast<std::int64_t>(length)
:(value-static_cast<std::int64_t>(length/2))
/static_cast<std::int64_t>(length);};
return std::array<std::int32_t,2>{{
static_cast<std::int32_t>(rounded(dx*65536)),
static_cast<std::int32_t>(rounded(dy*65536))}};
};
const auto arrivalDirection=directionQ16(routeXY[1][0]-routeXY[0][0],
routeXY[1][1]-routeXY[0][1]);
const auto departureDirection=directionQ16(routeXY.back()[0]-routeXY[routeXY.size()-2][0],
routeXY.back()[1]-routeXY[routeXY.size()-2][1]);
const std::int64_t playerCenterAboveFloor=micrometresToQ(1130000);
const std::int64_t landingClearance=micrometresToQ(6000000);
const std::int64_t supportDepth=micrometresToQ(2000000);
const auto makePad=[&](std::string id,ResolvedLayoutLandingPadRoleV1 role,
const std::array<std::int64_t,2>& xy,const std::array<std::int32_t,2>& direction)
{
ResolvedLayoutLandingPadV1 pad;
pad.stableId=std::move(id);pad.role=role;
pad.floorHeightSubvoxels=groundHeightAt(xy[0],xy[1]);
pad.positionSubvoxels={xy[0],xy[1],pad.floorHeightSubvoxels+playerCenterAboveFloor};
pad.approachDirectionQ16=direction;
pad.clearanceSubvoxels=landingClearance;
pad.supportDepthSubvoxels=supportDepth;
pad.certifiedWalkableWithSupport=true;
return pad;
};
resolved->recipeId=std::string(CoreLiminalFieldRecipeIdV1);
resolved->recipeVersion=CoreLiminalFieldRecipeVersionV2;
resolved->landingPads.clear();
resolved->landingPads.push_back(makePad("core/liminal-field/landing/arrival/000",
ResolvedLayoutLandingPadRoleV1::arrival,routeXY.front(),arrivalDirection));
resolved->landingPads.push_back(makePad("core/liminal-field/landing/departure/000",
ResolvedLayoutLandingPadRoleV1::departure,routeXY.back(),departureDirection));
std::uint64_t routeLength=0;
stratum.route=BuildCoreLiminalRouteV2(profile,resolved->landingPads[0],
resolved->landingPads[1],definition,seed,stratum.strateIndex,coreMicrons,
qPerMetre,routeLength,error);
if(!error.empty())return false;
stratum.routeConstraints={1,micrometresToQ(340000),micrometresToQ(1760000),
17560,micrometresToQ(125000),micrometresToQ(250000),
micrometresToQ(1000000),micrometresToQ(120000),3};
resolved->anchors.erase(std::remove_if(resolved->anchors.begin(),resolved->anchors.end(),
[](const auto& anchor){return anchor.kind=="route_point"
||anchor.kind=="liminal_route_point"||anchor.kind=="liminal_variant"
||anchor.kind=="heightfield_profile";}),resolved->anchors.end());
ResolvedLayoutAnchorV2 profileAnchor;
profileAnchor.kind="heightfield_profile";
profileAnchor.stableId="heightfield-profile/liminal/"
+std::to_string(static_cast<std::uint32_t>(profile.kind));
profileAnchor.units="profile kind enum";
profileAnchor.values={1,static_cast<std::int64_t>(profile.kind)};
resolved->anchors.push_back(std::move(profileAnchor));
std::uint64_t routeAnchorDistance=0,lastRouteAnchorDistance=0;
for(std::size_t pointIndex=0;pointIndex<stratum.route.size();++pointIndex)
{
if(pointIndex>0)
{
const auto& previous=stratum.route[pointIndex-1].positionSubvoxels;
const auto& current=stratum.route[pointIndex].positionSubvoxels;
const auto dx=static_cast<std::uint64_t>(current[0]-previous[0]);
const auto dy=static_cast<std::uint64_t>(current[1]-previous[1]);
routeAnchorDistance+=world_assembly_detail::IntegerSqrt(dx*dx+dy*dy);
}
const bool first=pointIndex==0;
const bool last=pointIndex+1==stratum.route.size();
const bool spaced=routeAnchorDistance-lastRouteAnchorDistance
>=static_cast<std::uint64_t>(8*qPerMetre);
if(!first&&!last&&!spaced)continue;
const auto& point=stratum.route[pointIndex];
ResolvedLayoutAnchorV2 routeAnchor;
routeAnchor.kind="route_point";
routeAnchor.stableId="route/"+std::to_string(pointIndex);
routeAnchor.units="1/256 Core voxel";
routeAnchor.values={point.positionSubvoxels[0],point.positionSubvoxels[1],
point.positionSubvoxels[2]+playerCenterAboveFloor,point.radiusSubvoxels};
resolved->anchors.push_back(std::move(routeAnchor));
lastRouteAnchorDistance=routeAnchorDistance;
}
if(!layout.finalize(error))return false;
const auto reportPad=[&](const ResolvedLayoutLandingPadV1& pad)
{
std::printf("[ResolvedLandingPad] strate=%d id=%s role=%s position_m=(%.3f,%.3f,%.3f) "
"floor_m=%.3f approach_q16=(%d,%d) clearance_m=%.3f support_m=%.3f "
"certified_walkable_with_support=true status=PASS\n",stratum.strateIndex,
pad.stableId.c_str(),pad.role==ResolvedLayoutLandingPadRoleV1::arrival?"arrival":"departure",
pad.positionSubvoxels[0]/static_cast<double>(qPerMetre),
pad.positionSubvoxels[1]/static_cast<double>(qPerMetre),
pad.positionSubvoxels[2]/static_cast<double>(qPerMetre),
pad.floorHeightSubvoxels/static_cast<double>(qPerMetre),
pad.approachDirectionQ16[0],pad.approachDirectionQ16[1],
pad.clearanceSubvoxels/static_cast<double>(qPerMetre),
pad.supportDepthSubvoxels/static_cast<double>(qPerMetre));
};
reportPad(resolved->landingPads[0]);reportPad(resolved->landingPads[1]);
std::printf("[LiminalPadRoute] points=%zu path_length_m=%.3f spacing_max_m=4.000 "
"profile_ground_following=true status=PASS\n",stratum.route.size(),
routeLength/static_cast<double>(qPerMetre));
return true;
}
bool PlanCoreLiminalFieldV2(WorldAssemblyRecipeV1& recipe,
WorldAssemblyStratumPlanV1& stratum,const ResolvedLayoutSnapshotV3& layout,
std::string& error)
{
error.clear();
if(layout.coreVoxelSizeMicrometres==0||stratum.strateIndex<0
||stratum.topChunkZ<stratum.bottomChunkZ)
{error="Core.Liminal.Field v2 needs a finite stratum and resolved Core voxel size";return false;}
const auto resolved=std::find_if(layout.strates.begin(),layout.strates.end(),
[&](const auto& value){return value.strateIndex==stratum.strateIndex
&&value.recipeId==CoreLiminalFieldRecipeIdV1
&&value.recipeVersion==CoreLiminalFieldRecipeVersionV2;});
if(resolved==layout.strates.end()||!resolved->content.presentInCurrentField
||stratum.surfaceProfile.version!=1)
{error="Core.Liminal.Field v2 needs its prepared profile and resolved landing pads";return false;}
const ResolvedLayoutLandingPadV1* arrivalPad=nullptr;
const ResolvedLayoutLandingPadV1* departurePad=nullptr;
for(const auto& pad:resolved->landingPads)
{
if(pad.role==ResolvedLayoutLandingPadRoleV1::arrival)
{if(arrivalPad){error="Core.Liminal.Field v2 has multiple arrival pads";return false;}arrivalPad=&pad;}
if(pad.role==ResolvedLayoutLandingPadRoleV1::departure)
{if(departurePad){error="Core.Liminal.Field v2 has multiple departure pads";return false;}departurePad=&pad;}
}
if(!arrivalPad||!departurePad||!arrivalPad->certifiedWalkableWithSupport
||!departurePad->certifiedWalkableWithSupport)
{error="Core.Liminal.Field v2 requires certified arrival and departure pads";return false;}
const ResolvedLayoutPassageV1* arrival=nullptr;
const ResolvedLayoutPassageV1* departure=nullptr;
for(const auto& passage:layout.passages)
{
if(passage.lowerStrateIndex==stratum.strateIndex)
{if(arrival){error="Core.Liminal.Field v2 requires one arrival passage";return false;}arrival=&passage;}
if(passage.upperStrateIndex==stratum.strateIndex)
{if(departure){error="Core.Liminal.Field v2 requires one departure passage";return false;}departure=&passage;}
}
if(!arrival||!departure||arrival->lowerMouthSubvoxels!=arrivalPad->positionSubvoxels
||departure->upperMouthSubvoxels!=departurePad->positionSubvoxels)
{error="Core.Liminal.Field v2 passage mouths are not bound to the certified layer pads";return false;}
constexpr std::int64_t Q=WorldAssemblySubvoxelsPerVoxel;
const std::int64_t coreMicrons=layout.coreVoxelSizeMicrometres;
const auto micrometresToQ=[&](std::int64_t micrometres)
{
const std::int64_t numerator=micrometres*Q;
return numerator>=0?(numerator+coreMicrons/2)/coreMicrons
:(numerator-coreMicrons/2)/coreMicrons;
};
const std::int64_t qPerMetre=micrometresToQ(1000000);
const std::int64_t playerCenterAboveFloor=micrometresToQ(1130000);
if(qPerMetre<=0||arrivalPad->positionSubvoxels[2]
!=arrivalPad->floorHeightSubvoxels+playerCenterAboveFloor
||departurePad->positionSubvoxels[2]
!=departurePad->floorHeightSubvoxels+playerCenterAboveFloor)
{error="Core.Liminal.Field v2 pad floor and capsule-center heights differ";return false;}
const std::uint32_t seed=recipe.seed;
const WorldAssemblyLiminalVariantV1 variant=SelectCoreLiminalFieldVariantV1(seed);
const auto& definition=CoreLiminalFieldVariantsV1[static_cast<std::size_t>(variant)];
const auto& profile=stratum.surfaceProfile;
std::uint64_t totalHorizontal=0;
std::vector<WorldAssemblyRoutePointV1> route=BuildCoreLiminalRouteV2(profile,
*arrivalPad,*departurePad,definition,seed,stratum.strateIndex,coreMicrons,
qPerMetre,totalHorizontal,error);
if(!error.empty())return false;
if(route.size()!=stratum.route.size())
{error="Core.Liminal.Field v2 route differs from the path used to certify its pads";return false;}
for(std::size_t index=0;index<route.size();++index)
if(route[index].stableFeatureId!=stratum.route[index].stableFeatureId
||route[index].positionSubvoxels!=stratum.route[index].positionSubvoxels
||route[index].radiusSubvoxels!=stratum.route[index].radiusSubvoxels)
{error="Core.Liminal.Field v2 route differs from the path used to certify its pads";return false;}
WorldAssemblyLiminalFieldPlanV1 liminal;
liminal.version=CoreLiminalFieldRecipeVersionV2;
liminal.variant=variant;liminal.seed=seed;
liminal.arrivalMouthSubvoxels=arrivalPad->positionSubvoxels;
liminal.departureMouthSubvoxels=departurePad->positionSubvoxels;
liminal.floorHeightSubvoxels=profile.h0Subvoxels;
liminal.routeHalfWidthSubvoxels=micrometresToQ(definition.routeHalfWidthMicrometres);
liminal.routeHalfThicknessSubvoxels=micrometresToQ(definition.routeHalfThicknessMicrometres);
liminal.routeOffsetSubvoxels=150*qPerMetre;
liminal.supportSpacingSubvoxels=micrometresToQ(definition.supportSpacingMicrometres);
liminal.supportRadiusSubvoxels=micrometresToQ(definition.supportRadiusMicrometres);
liminal.mouthFloorOffsetSubvoxels=playerCenterAboveFloor;
stratum.route=std::move(route);
stratum.routeConstraints={1,micrometresToQ(340000),micrometresToQ(1760000),
17560,micrometresToQ(125000),micrometresToQ(250000),
micrometresToQ(1000000),micrometresToQ(120000),3};
stratum.liminalField=liminal;
std::string validationError;
if(!world_assembly_detail::ValidateSurfaceProfile(stratum.surfaceProfile,seed,validationError)
||!world_assembly_detail::ValidateStratum(stratum,recipe,validationError))
{error=validationError.empty()?"Core.Liminal.Field v2 produced an invalid plan":validationError;return false;}
std::printf("[CoreLiminalFieldPlan] recipe=%.*s version=%u variant=%.*s seed=%u "
"arrival_pad=%s departure_pad=%s route_points=%zu path_length_m=%.3f "
"profile_ground_following=true route_grade_limit_deg=15.000 status=PASS\n",
static_cast<int>(CoreLiminalFieldRecipeIdV1.size()),CoreLiminalFieldRecipeIdV1.data(),
liminal.version,static_cast<int>(definition.name.size()),definition.name.data(),seed,
arrivalPad->stableId.c_str(),departurePad->stableId.c_str(),stratum.route.size(),
totalHorizontal/static_cast<double>(qPerMetre));
return true;
}
std::string WorldAssemblyManifest::ToJson() const std::string WorldAssemblyManifest::ToJson() const
{ {
std::string error; std::string error;
@@ -2391,6 +3183,27 @@ std::string WorldAssemblyManifest::ToJson() const
<< ",\"minimum_clearance_q\":" << constraints.minimumClearanceSubvoxels << ",\"minimum_clearance_q\":" << constraints.minimumClearanceSubvoxels
<< ",\"minimum_support_probes\":" << constraints.minimumSupportProbes << '}'; << ",\"minimum_support_probes\":" << constraints.minimumSupportProbes << '}';
} }
if (stratum.liminalField.version != 0)
{
const auto& liminal = stratum.liminalField;
out << ",\"liminal_field\":{\"version\":" << liminal.version
<< ",\"variant\":" << static_cast<std::uint32_t>(liminal.variant)
<< ",\"seed\":" << liminal.seed << ",\"arrival_mouth_q\":["
<< liminal.arrivalMouthSubvoxels[0] << ','
<< liminal.arrivalMouthSubvoxels[1] << ','
<< liminal.arrivalMouthSubvoxels[2] << "],\"departure_mouth_q\":["
<< liminal.departureMouthSubvoxels[0] << ','
<< liminal.departureMouthSubvoxels[1] << ','
<< liminal.departureMouthSubvoxels[2]
<< "],\"mouth_floor_offset_q\":" << liminal.mouthFloorOffsetSubvoxels
<< ",\"floor_height_q\":"
<< liminal.floorHeightSubvoxels
<< ",\"route_half_width_q\":" << liminal.routeHalfWidthSubvoxels
<< ",\"route_half_thickness_q\":" << liminal.routeHalfThicknessSubvoxels
<< ",\"route_offset_q\":" << liminal.routeOffsetSubvoxels
<< ",\"support_spacing_q\":" << liminal.supportSpacingSubvoxels
<< ",\"support_radius_q\":" << liminal.supportRadiusSubvoxels << '}';
}
out << ",\"route\":["; out << ",\"route\":[";
for (std::size_t p = 0; p < stratum.route.size(); ++p) for (std::size_t p = 0; p < stratum.route.size(); ++p)
{ {
@@ -0,0 +1,53 @@
# VoxelForge — read-only design review: per-block bit flags (masks) to skip work
You are reviewing an idea against real code. **Do not edit, create or delete any file, and do not build or run
anything.** Read code and reason. Be thorough; mark each claim as [CODE] (with file:line), [MEASURED] (from a report),
or [INFERENCE].
## Context
VoxelForge Core (`Standalone/Core`) generates a density field: negative = solid, positive = air, 25 cm voxels, 32³ tiles,
LOD0–8 clipmap, marching cubes. The production mesher for the standalone path is in `Standalone/Source/...`, and Core is
also compiled into Unreal. Same seed must give the same world on every machine and worker count; byte-identity with
older versions is NOT required.
Branch `assembler/world` (HEAD `7022d02`'s parent line, currently `4041d4b`) has the smooth inter-strate tunnels.
Readiness target: LOD0–2 near terrain in ~1 s on arrival. Measured today: SW ~0.7–0.8 s, VS ~0.9 s, FI/TN ~1.0 s
headless. In Linux UE, start→LOD0–2 is ~2.2–2.5 s. At 30 m/s in UE, near coverage is ~40%.
Reports to consult: `Standalone/Research/WorldAssemblerM3/Linux1*/REPORT.md`, especially:
- L77/L87/L117, cost census;
- L124, shape gate and per-strate timings;
- L125/L126/L128, tunnel prepare: per-segment work, 67–73% pair overlap, support up to 7.9 m;
- L128, where an exact one-owner slab scheme halved pairs but got slower because of per-sample ownership tests.
Tile skipping already exists at tile level: box verdicts / classify, where all-solid or all-air tiles are skipped.
## The idea (from the owner)
Keep bit flags per block (1 bit per voxel, or per small brick of e.g. 4³ or 8³ voxels): for example "certainly deep
solid", "certainly deep air", "near a surface", "touched by a tunnel", "already evaluated". Use them to skip work in
generation and meshing, and possibly elsewhere (collision, streaming, edits, AI/nav, lighting).
## Questions
1. Where does time actually go per tile today, and which of that work a mask could skip? Cover density fill,
classification, mesher (marching cubes, normals/gradients, skirts, seam refinement), passage prepare, and composition.
Use measured census numbers where they exist.
2. Which flags are sound? A flag must be a proof, never a guess. A mask "certainly solid" must be derived from a
conservative bound (the bound must be the supremum of what the evaluator produces), or the mesher will delete
surfaces. Which bounds already exist in the code (box verdicts, interval bounds) that a brick-level mask could reuse?
Name the existing hazards. For example, `Identity` means `Sdf >= T`, and `ClassifyTile` proving below-TerrainZ solid
would delete 3D caves.
3. Granularity: per-voxel bits vs per-brick (4³/8³) vs per-column. What does each cost to build, versus what it
saves? Consider SIMD and cache behaviour. Marching cubes needs only cells whose corner signs differ, and gradients
need a halo.
4. "Already evaluated" or "checked" flags: where would they be correct (memoisation of identical queries), and where
would they be wrong (nearest-of-many queries like the tunnel segments)? Is there repeated identical evaluation today,
for example halo samples shared between neighbouring tiles, or skirt/seam re-queries?
5. Other uses: player edits (diff layer), collision-only server tiles, streaming priority, nav. Which would a mask
genuinely help, given the multiplayer rule (replicate seed + layout + diff, never geometry)?
6. Recommendation: the one or two mask designs most likely to pay off, with the expected gain (a range, marked
inference), the measurement that would prove or kill each, and the risks. Keep it short.
Write plain Markdown, at most ~1,200 words.
@@ -0,0 +1,83 @@
[INFERENCE] **Improve the existing brick-proof system; don’t add a general “checked voxel” mask.** The promising savings are avoided field/composition work and passage preparation, rather than marching-cubes classification.
References below abbreviate these files: [M = production mesher](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Source/VoxelForge/Private/VoxelMarchingCubesMesher.cpp), [S = ShapeWorldInternal.h](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/ShapeWorldInternal.h), [C = VoxelForgeCore.cpp](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/VoxelForgeCore.cpp), [O = VoxelDensityOpStack.cpp](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Source/VoxelForge/Private/VoxelDensityOpStack.cpp). L-numbers identify `Standalone/Research/WorldAssemblerM3/LinuxN/REPORT.md`.
[INFERENCE] Evidence limitation: Linux128 is absent from this checkout. Its supplied 7.9 m support and slower one-owner result remain unverified here. The reports below span different revisions; their percentages must not be presented as today’s census.
**1. Where time goes**
[MEASURED] L77’s exclusive FI/TN LOD0–2 worker account:
| Work | FI | TN |
|---|---:|---:|
| Total worker CPU/view | 23.02 s | 21.50 s |
| Passage composition | 65.9% | 65.4% |
| Support | 14.2% | 13.5% |
| Base field | 3.2% | 3.3% |
| Bands / dispatch | 2.3% / 3.7% | 2.6% / 3.6% |
| MC / skirts / refinement, excluding field work | 1.6% / 0.1% / 7.5% | 1.2% / 0.2% / 8.6% |
[MEASURED] Grid fill occupied 19.058/17.377 worker-seconds, **overlapping** those phase categories. L117’s later census found support zero; its smooth-tunnel regression concentrated about 95% of added tile CPU in passage-feature tiles. Cell classification stayed flat; gradients became cheaper. Thus L77 identifies historical leverage, not current percentages.
[MEASURED] L125 preparation averaged 514/130/4.1 ms worker work at LOD0/1/2. LOD0 evaluated 3.11–8.49 million segment/sample pairs with 67–72% overlap, although the exact band occupied only 5–7% of grid samples. L126 reduced floor-profile calls 20–23% without useful readiness improvement.
[CODE] Brick skipping already exists: configurable block verdicts, required-sample masks, and active-block gradient halos (M:646,1053). MC already rejects cells without sign crossings before interpolation/gradients (M:2186). Gradient memoisation exists (M:1956). Skirts issue separate density queries (M:2491); refinement has its own stage (C:2975).
[INFERENCE] A pre-evaluation proof can save density, composition, and subsequent MC work. A sign mask constructed after density evaluation saves only downstream scanning. Classification itself costs work; no isolated current classification percentage is established by these reports.
[MEASURED] L124’s shape gate alone took 179–226 ms, with no near-tile admissions before completion. L87 additionally measured a 107–153 ms far-parent gate and no headless collision wait. Tile masks cannot directly remove these gates or explain the supplied UE/headless gap.
**2. Sound flags and hazards**
[INFERENCE] For final density \(D\), solid requires an upper bound covering the evaluator’s supremum, \(U<0\); air requires a valid lower bound \(L\ge0\). “Deep” requires an explicit margin. Unknown must stay unknown. A crossing proves an MC-active cell; uniform sampled signs do not prove an entire continuous volume surface-free.
[CODE] Reusable proofs include:
- S:5428: halo-expanded box classification.
- S:5974: exact surface-column extrema over the MC lattice.
- S:6019: floating-island density intervals.
- S:5197,6032: native cave intervals.
- S:5949: stamp interval composition with outward numerical padding.
- O:6998: operation-specific inactivity from SDF lower bounds.
[CODE] These proofs have guards: passage overlap returns unknown (S:5687); unsupported stamp composition returns unknown (S:5655); stratum crossings are rejected (S:5900). The mesher distinguishes uniform candidates from `bSkipSafe` certificates (M:715,756), and otherwise validates candidates against actual samples (M:1838).
[CODE] For gated modifiers, `Identity` can mean `Sdf >= T`, not `abs(Sdf) >= T` (O:1496,6998). Noise bounds cannot assume nominal `[-1,1]`: FBM and unclamped cellular bounds are explicitly discussed at O:848,301.
[INFERENCE] Additional hazards: confusing internal SDF with final density; certifying base terrain before caves, tunnels, shells, stamps or edits; using lattice proofs for off-grid queries; ignoring rounding or gradient halos. A below-`TerrainZ` solid rule applied to 3D caves deletes caves. “Touched by tunnel” should mean conservative candidate overlap; only **proven untouched** authorizes omission.
**3. Granularity**
[INFERENCE] Storage per flag for 32³ cells:
| Granularity | Storage | Construction/tradeoff |
|---|---:|---|
| Per cell | 4 KiB | 32,768 decisions; expensive unless derived during necessary work |
| 4³ bricks | 64 B | 512 proofs; tighter boundaries, more proof/halo overhead |
| 8³ bricks | 8 B | 64 proofs; cheaper, more mixed bricks |
| XY columns | 128 B | 1,024 decisions; useful mainly for heightfield-specific proofs |
[INFERENCE] These exclude corner/halo samples, metadata and additional flags. A column bit cannot represent multiple cave intervals. Brick runs preserve contiguous X sampling and SIMD better than scattered per-sample branches; bit packing alone does not establish a speedup.
[CODE] The existing implementation uses byte arrays and preserves exact samples around active bricks (M:1053–1083). Replacing densities with arbitrary same-sign constants near active cells would corrupt interpolated positions or normals.
**4. “Already evaluated”**
[CODE] Passage preparation precedes meshing (C:2747). Its valid sentinel is initialization, not completion: subsequent segments update floor selection, shell minima and round-distance winners, with deterministic tie-breaking (S:11520,11615,11688).
[INFERENCE] Therefore first-visitor wins is invalid. Memoisation is valid only for identical queries against identical seed/layout/evaluator/edit revision and query semantics; cache the value, not just a bit.
[MEASURED] L77 counted 8.6–8.9% halo points, without measuring duplicate coordinates. L125 verified 4,900 shared samples across four neighbour pairs and still recorded substantial off-grid skirt/midpoint fallbacks.
[CODE] Shared-grid reuse and gradient validity caches already exist (M:1031,1956). [INFERENCE] Skirt/seam queries are reuse candidates only when coordinates and semantics actually match; “same voxel” is insufficient.
**5. Other uses**
[INFERENCE] Edit-dirty bricks can localize regeneration, with invalidation expanded through normals, seams and collision dependencies. Collision-only servers can skip certified empty regions, but still need boundary geometry. Streaming can prioritize potentially occupied bricks; nav and lighting need clearance/connectivity or visibility data beyond occupancy. Keep masks derived locally from replicated seed + layout + diff, versioned with that state.
**6. Recommendation**
- [INFERENCE] **Tune existing 4³/8³ certificates**, caching proofs and emitting contiguous required-sample runs. Plausible incremental near-ready saving: **0–5%**, with regressions possible. Measure proof time, samples avoided, halo expansion, total worker CPU and UE readiness.
- [INFERENCE] **Pass required-region information into passage preparation**, rejecting whole segment/brick regions conservatively. Plausible near-ready saving: **0–10%**, highly uncertain because passage overlap currently vetoes proofs. Kill it if pair reduction fails to reduce preparation and end-to-end time.
[INFERENCE] Both require seam/off-grid validation, adversarial bound checks, edit invalidation tests, and cross-machine/worker determinism. Preserve canonical tie-breaking; old-version byte identity need not constrain a sound redesign.
@@ -0,0 +1,37 @@
# VoxelForge — open read-only review: what should be done and focused on now?
You are an outside reviewer. **Do not edit, create or delete any file, and do not build or run anything.** Read the
repository and its reports and reason. Be thorough; mark each claim as [CODE] (with file:line), [MEASURED] (from a
report), or [INFERENCE].
## The project, in the owner's words and goals
- VoxelForge is a UE5 density-field voxel plugin for a **multiplayer** game. The world is made of stacked "strates"
(layers) linked by tunnels. The standalone C++ generator is "Core" (`Standalone/Core`), and it is also compiled into
Unreal. Read `CLAUDE.md`, `CODEMAP.md`, `ARCHITECTURE.md`, `GDD.md`, `COMPOSER-NOTES.md` and `fable-idea.md` at the
plugin root for the game and design intent. The research reports are in
`Standalone/Research/WorldAssemblerM3/Linux*/REPORT.md` and the `Astra*/` reviews.
- Owner goals stated over time:
- the near terrain (LOD0–2) ready in ~1 s on arrival, then far terrain keeps filling in at low priority;
- same seed gives the same world on every machine (byte-identity with older versions is NOT required);
- smooth for VR and high-speed travel;
- all generators (surface, floating islands, caves, dreamcore/liminal, etc.) working in Core;
- the system should eventually *invent* strates and worlds from tagged authored content plus a seed;
- keep things simple and avoid over-complication.
- The current main line is branch `assembler/world`.
## Your task
Look at the whole: code, reports, design docs, and the direction of the last few dozen rounds. Tell the owner what
should be done and focused on now, whatever it is. That may be performance, features, generation quality, gameplay
foundations, architecture, technical debt, tooling, process, or stopping something. Don't assume the recent focus is
the right one; question it if the evidence says so.
Answer:
1. **Where the project actually is**: what works, what's fragile, what's missing for the game to exist.
2. **The top 3–5 things to focus on now**, ranked, each with why, a rough size, what "done" looks like, and how to
tell it worked.
3. **What to stop or deprioritise**, and why.
4. **Risks or debts** that will bite later if ignored.
Write plain Markdown, at most ~1,500 words, readable by a non-specialist owner (explain jargon briefly).
@@ -0,0 +1,72 @@
[INFERENCE] **Focus now on a small, persistent multiplayer descent, supported by end-to-end Unreal performance work.** VoxelForge has substantial terrain technology. The larger uncertainty is whether it delivers a reliable, interesting shared expedition. Another sequence of tunnel optimizations will not resolve that.
Read-only review of `assembler/world` at `044cd6d`; no files changed and no builds, tests, or project execution. [CODE] identifies repository evidence; design-document references establish intent, not implementation. [MEASURED] means reported results, not independently reproduced measurements.
**1. Where the project actually is**
[CODE] **Core is real and integrated, but generator implementation remains mixed.** Unreal compiles the canonical standalone sources through validated wrappers. Core dispatches to surface, floating-island and native graph evaluators, with a legacy-generator fallback when appropriate. That is useful coverage, but does not mean every family has a complete native implementation. See [VoxelForgeCore.Build.cs:15](/home/jahni/VoxelM/Plugins/VoxelForge/Source/VoxelForgeCore/VoxelForgeCore.Build.cs:15) and [ShapeWorldInternal.h:600](/home/jahni/VoxelM/Plugins/VoxelForge/Standalone/Core/src/ShapeWorldInternal.h:600).
[MEASURED] **Passage correctness and speed have improved substantially.** L109 simplified tunnels and removed support-restoration machinery, reducing floating-island and tunnel-network near-generation times by approximately 31–38%. L125 reports 21,425/21,425 open route samples, a maximum sampled floor offset of 7.884 mm, and matching cross-compiler/worker hashes. These are meaningful engineering achievements. [L109](Standalone/Research/WorldAssemblerM3/Linux109/REPORT.md), [L125](Standalone/Research/WorldAssemblerM3/Linux125/REPORT.md).
[MEASURED] **The one-second player experience is not achieved.** L125’s standalone near-ready medians were approximately 0.78–1.03 seconds. L127’s Unreal startup took 2.22–2.51 seconds; at 30 m/s, median near coverage fell from 43.36% to 40.22% after the smooth-tunnel merge. Both versions recovered after stopping. L130 found no measurable timing improvement and skipped Unreal movement. These are different workloads; subtracting their times would not isolate a particular overhead. [L125](Standalone/Research/WorldAssemblerM3/Linux125/REPORT.md), [L127](Standalone/Research/WorldAssemblerM3/Linux127/REPORT.md), [L130](Standalone/Research/WorldAssemblerM3/Linux130/REPORT.md).
[CODE] **Multiplayer foundations exist; the multiplayer lifecycle remains unfinished here.** There are season hashes, local terrain-edit entry points, and streaming-anchor infrastructure. The architecture explicitly leaves join replication, authoritative edit messages, late-join snapshots and networked season changes open. The edit entry point directly dispatches to local modification paths. [VoxelWorld.h:574](/home/jahni/VoxelM/Plugins/VoxelForge/Source/VoxelForge/Public/VoxelWorld.h:574), [VoxelWorld.cpp:15771](/home/jahni/VoxelM/Plugins/VoxelForge/Source/VoxelForge/Private/VoxelWorld.cpp:15771), [ARCHITECTURE.md:2408](/home/jahni/VoxelM/Plugins/VoxelForge/ARCHITECTURE.md:2408).
[CODE] **The composer is more than a proposal, but less than the full content vision.** It rolls candidates, measures them and rejects failures. The intended system additionally combines tagged geometry, materials, decorations, creatures and audio; theme coherence remains an open design item. [VoxelSeasonManifest.cpp:2523](/home/jahni/VoxelM/Plugins/VoxelForge/Source/VoxelForge/Private/VoxelSeasonManifest.cpp:2523), [COMPOSER-NOTES.md:1512](/home/jahni/VoxelM/Plugins/VoxelForge/COMPOSER-NOTES.md:1512).
[INFERENCE] **This repository demonstrates a capable terrain platform, not yet a validated game loop.** I cannot establish what gameplay exists outside the plugin. The GDD itself identifies “Is the descent fun?” as its first unresolved question. [GDD.md:441](/home/jahni/VoxelM/Plugins/VoxelForge/GDD.md:441).
**2. Ranked priorities**
All sizes below are [INFERENCE]: rough focused engineering estimates, excluding substantial art production.
**1 — Deliver one multiplayer expedition that survives reconnecting. Size: 3–6 weeks.**
[INFERENCE] Use two contrasting strates and their connecting tunnel. Two players descend, find one destination, uncover or collect something, return, and retain their changes after restart. Include a third player joining after terrain has changed. Avoid expanding immediately into the city economy or community backend.
[INFERENCE] The necessary foundation is a server-approved world identity, ordered authoritative edits, a saved snapshot plus subsequent edits, and collision around separated players. Give edits stable identifiers so retransmission cannot apply them twice. Reuse the existing local edit and anchor systems.
[INFERENCE] **Done:** host/client edits agree; a late joiner reconstructs the same terrain; restart preserves it; incompatible world versions fail clearly; remote players have ground when away from the host.
[INFERENCE] **Success:** a complete shared expedition without terrain disagreement, lost progress or collision failures—and players can explain what made them want to descend again. This tests the project’s central assumptions much earlier than a complete RPG would.
**2 — Close the Unreal arrival and movement gap. Size: 1–3 weeks initially.**
[MEASURED] L122 found idle generation capacity while admission was blocked; L123 measured approximately 19 ms from region request to game-thread observation despite sub-millisecond median compilation. Simple lookahead and admission relaxations failed their combined coverage/frame-time gates. L121’s modest extra far-apply lane did improve far coverage. [L121](Standalone/Research/WorldAssemblerM3/Linux121/REPORT.md), [L122](Standalone/Research/WorldAssemblerM3/Linux122/REPORT.md), [L123](Standalone/Research/WorldAssemblerM3/Linux123/REPORT.md).
[INFERENCE] First establish one current-build, rendered Unreal baseline on intended hardware. Measure arrival through **visible terrain and usable collision**, then walking, 30 m/s travel, turns, teleporting and edits. Record near coverage, far gaps, frame-time spikes and memory separately. NullRHI measurements, which omit rendering, cannot certify VR comfort.
[INFERENCE] Investigate region completion, admission and publication before another broad density rewrite. A game-thread continuation is a candidate experiment, not a proven solution; keep world mutation on its owning thread.
[INFERENCE] **Done:** approximately one-second LOD0–2 readiness on the agreed hardware, safe collision, steadily filling far terrain, and an explicit movement-coverage target without worsening frame spikes. **Success:** repeated rendered runs meet those limits, including with remote-player collision work. Do not redefine “ready” as only the nearest handful of tiles.
**3 — Turn generator breadth into playable variety. Size: 2–4 weeks for the first content slice.**
[INFERENCE] Establish a compact capability matrix for each family: Core dispatch, entrances/exits, interior connectivity, edits, materials/content, far terrain and performance. Include dreamcore/liminal explicitly; motif generation alone does not establish a convincing anomalous place.
[MEASURED] L58 illustrates the distinction: its lattice route passed reachability checks, but the review described a corkscrew tunnel rather than the intended open vertical shaft. Technical validity and identity are separate acceptance criteria. [L58](Standalone/Research/WorldAssemblerM3/Linux58/REPORT.md).
[INFERENCE] Extend the existing offline composer with a small tagged library: a grounded cave, an island environment and one liminal identity, each with coherent materials, sound and a destination. Preserve owner review before publishing a season.
[INFERENCE] **Done:** several seeds produce recognizably different, coherent places with findable progression and usable encounter spaces. **Success:** players navigate them without developer guidance and distinguish their identities without reading labels. Expand families after this works.
**4 — Consolidate the evidence and remove obsolete complexity incrementally. Size: 2–4 days, then ongoing.**
[INFERENCE] Maintain one short current-state page: shipped behavior, open defects, active baseline, hardware and next acceptance test. Keep historical reports as history. Remove rejected experimental paths when they no longer serve a specific comparison; extract stable responsibilities when touching oversized files.
[INFERENCE] **Done:** a contributor can identify the current evaluator, runtime path, multiplayer gaps and performance limits without reconstructing 130 rounds. **Success:** new work no longer repeats rejected experiments or treats old measurements as current.
**3. Stop or deprioritise**
- [INFERENCE] **Pause open-ended tunnel micro-optimization.** L125/L126 missed the older speed bar; L130’s reach correction produced no measurable speedup. Keep correctness fixes, but require a current cost account and a bounded experiment before further optimization. [MEASURED: L126](Standalone/Research/WorldAssemblerM3/Linux126/REPORT.md), [L130](Standalone/Research/WorldAssemblerM3/Linux130/REPORT.md).
- [INFERENCE] **Do not implement Astra recommendations mechanically.** Astra1’s support-heavy model predates L109’s simplification. Astra2/3 offer hypotheses, not measured wins for today’s code. Re-profile before adopting them.
- [INFERENCE] **Defer GPU generation, a mesher replacement, elaborate discovery systems and large-scale backend work.** None currently resolves the missing shared expedition.
- [INFERENCE] **Stop requiring old-version byte identity for deliberate generation changes.** Preserve peer agreement within a version and explicit versioned saves; permit reviewed geometry improvements.
**4. Debts that will bite later**
[INFERENCE] **Determinism needs a deployment contract.** Linux Clang/GCC and worker-count agreement is strong evidence, not proof across every intended machine. Include Windows/compiler/CPU combinations actually supported. World identity must cover evaluator, content, layout, scale and edit state—not merely seed. [MEASURED: L130](Standalone/Research/WorldAssemblerM3/Linux130/REPORT.md).
[CODE] **Scale and fallback complexity remain active integration risks.** Core is opt-in, and runtime queries bridge different coordinate conventions. [VoxelWorld.h:300](/home/jahni/VoxelM/Plugins/VoxelForge/Source/VoxelForge/Public/VoxelWorld.h:300), [VoxelWorld.cpp:15612](/home/jahni/VoxelM/Plugins/VoxelForge/Source/VoxelForge/Private/VoxelWorld.cpp:15612). [INFERENCE] Test edits, content placement and collision across those boundaries before broadening authoring.
[INFERENCE] **A passing route audit does not prove a whole strate is enjoyable, connected or suitable for six-player combat.** Retain geometric checks, but add actual traversal, destination discovery and encounter-space evaluation. Those are now more valuable than another polished tunnel benchmark.
@@ -0,0 +1,9 @@
# Linux130 — passage reach
On `wip/l130-reach-units` from `b96dd73`, passage influence is now **1.0533 m**: 0.75 m shell + 0.21 m relief + 0.50 m smooth-max support (`width/6`) + 0.01 m margin. One metres-to-core-voxels conversion feeds proof, feature, fallback and off-grid bounds; the sweep cutoff uses the same metre value. The dead 4 m cutoff is removed. Evaluator version is 227.
The debug shell/crest audit sampled 25,728 points, including 5 mm inside and outside the reach; 18,993 had sign-relevant passage contribution. Proof and feature bounds missed none. The nine-station floor probe still peaks at **7.884 mm**, matching L125. The 23 L125 views and six L129 mouth close-ups are byte-identical. Fast verification, walkability and shell audits pass; the seam audit found 0 mismatches across 4 pairs / 4,900 shared samples.
Clang/GCC W1/W8/W12 hashes agree across all 18 runs. Versus v225, hashes changed for owner4 full-detail, whole-view and LOD0–3; owner2 surface-world and floating-islands whole-view and LOD2–3. Exact-query hashes stayed unchanged. The v227 canonical baselines are recorded; changed hashes reflect the shorter density influence halo, while sampled sign-relevant bounds and captured surfaces remain covered.
L80 timing used 10 interleaved pairs per stratum/worker count. Across the eight case medians, the weighted deltas were +0.33% for LOD0–2 and +0.31% whole-view. Across 80 paired runs, mean deltas were +0.26% (95% interval −0.44% to +0.96%) and +0.47% (−0.06% to +1.00%); both intervals include zero. No measurable timing change; UE movement was skipped. The Linux UE host build succeeded in 76.30 s with `-NoUBA -MaxParallelActions=4`, without `prlimit`. `ARCHITECTURE.md` and `CODEMAP.md` had no note for this optimized influence reach, so they were unchanged.
@@ -0,0 +1,95 @@
#!/usr/bin/env python3
"""Run Clang/GCC owner hashes at W1/W8/W12 and compare with b96dd73."""
from __future__ import annotations
import json
import re
import subprocess
import time
from pathlib import Path
ROOT = Path(__file__).resolve().parents[4]
OUT = ROOT / "Saved/Linux/l130/hashes"
BASELINE = json.loads((ROOT / "Saved/Linux/l125/hashes/summary.json").read_text())
DATASETS = {
"owner4": ROOT / "Standalone/data/owner_world.json",
"owner2": ROOT / "Standalone/data/regression/owner_world_2strate_l61.json",
}
RECIPES = {"owner4": ("surface-world",),
"owner2": ("surface-world", "floating-islands")}
BINARIES = {
"clang": ROOT / "Saved/Linux/l130/bin/VoxelForgeCoreHeadless-l130-clang",
"gcc": ROOT / "Saved/Linux/l130/bin/VoxelForgeCoreHeadless-l130-gcc",
}
HASH_RE = re.compile(r"^\[Pipeline(?:FullDetailHash|WholeViewHash|LODHash|ExactQueryHash)\].*$", re.M)
STAMP_RE = re.compile(r"^\[VoxelForgeSourceStamp\] sha256=(\S+)$", re.M)
def run(dataset: str, recipe: str, workers: int, compiler: str) -> dict:
OUT.mkdir(parents=True, exist_ok=True)
label = f"{dataset}-{recipe}-w{workers}-{compiler}"
log = OUT / f"{label}.log"
layout = OUT / f"{label}.layout.json"
command = ["taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--",
"timeout", "1740s", str(BINARIES[compiler]), str(DATASETS[dataset]),
f"--workers={workers}", "--world-assembler-prototype", "--stream-benchmark",
"--stream-pipeline", "--force-generate", "--clip-radius=3",
"--max-clip-level=8", "--max-level=8", f"--recipe={recipe}",
"--stream-hash", f"--resolved-layout-output={layout}"]
started = time.monotonic()
with log.open("w", encoding="utf-8") as stream:
result = subprocess.run(command, cwd=ROOT, stdout=stream,
stderr=subprocess.STDOUT, check=False, timeout=1740)
output = log.read_text(encoding="utf-8", errors="replace")
hashes = HASH_RE.findall(output)
if result.returncode or len(hashes) != 12:
raise SystemExit(f"hash run failed: {label}; exit={result.returncode} "
f"hashes={len(hashes)} log={log}")
stamp = STAMP_RE.search(output)
row = {"dataset": dataset, "recipe": recipe, "workers": workers,
"compiler": compiler, "exit_code": result.returncode, "hashes": hashes,
"source_stamp": stamp.group(1) if stamp else None,
"elapsed_s": round(time.monotonic() - started, 3),
"log": str(log.relative_to(ROOT))}
print("[L130HashRun] " + json.dumps(row, sort_keys=True), flush=True)
return row
def main() -> int:
if any(not path.is_file() for path in (*DATASETS.values(), *BINARIES.values())):
raise SystemExit("missing L130 hash input")
old = {(row["dataset"], row["recipe"], row["workers"], row["compiler"]): row
for row in BASELINE["runs"]}
rows = []
for dataset, recipes in RECIPES.items():
for recipe in recipes:
for workers in (1, 8, 12):
for compiler in ("clang", "gcc"):
rows.append(run(dataset, recipe, workers, compiler))
(OUT / "runs-partial.json").write_text(
json.dumps(rows, indent=2) + "\n", encoding="utf-8")
groups = {}
for dataset, recipes in RECIPES.items():
for recipe in recipes:
group = [row for row in rows if row["dataset"] == dataset
and row["recipe"] == recipe]
key = f"{dataset}/{recipe}"
stable = all(row["hashes"] == group[0]["hashes"] for row in group)
baseline = old[(dataset, recipe, 12, "clang")]["hashes"]
changed = [i for i, (before, after) in enumerate(zip(baseline,
group[0]["hashes"])) if before != after]
groups[key] = {"all_workers_and_compilers_match": stable,
"matches_b96dd73_v225": not changed,
"changed_hash_rows_from_v225": changed,
"source_stamps": sorted({row["source_stamp"] for row in group})}
if not stable:
raise SystemExit(f"worker/compiler hash mismatch: {key}")
(OUT / "summary.json").write_text(
json.dumps({"baseline_source": "b96dd73", "runs": rows,
"groups": groups}, indent=2) + "\n", encoding="utf-8")
print("[L130HashSummary] " + json.dumps(groups, sort_keys=True), flush=True)
return 0
if __name__ == "__main__":
raise SystemExit(main())
@@ -0,0 +1,136 @@
#!/usr/bin/env python3
"""Render the six L129 b96dd73 mouth views against the L130 meshes."""
from __future__ import annotations
import hashlib
import html
import json
import re
import subprocess
import time
from pathlib import Path
ROOT = Path(__file__).resolve().parents[4]
SOURCE = ROOT / "Saved/Linux/l129/captures/mouth-closeups/before"
SAVED = ROOT / "Saved/Linux/l130/captures/mouth-closeups"
CAPTURES = ROOT / "Standalone/Research/WorldAssemblerM3/Linux130/captures/mouth-closeups"
DATA = ROOT / "Standalone/data/owner_world.json"
HEADLESS = ROOT / "Saved/Linux/l130/bin/VoxelForgeCoreHeadless-l130-clang"
RENDERER = ROOT / "Saved/Linux/l130/bin/VoxelForgeOffscreenCapture-l130-clang"
HEADLESS_CONFIG = re.compile(
r"^\[HeadlessConfig\].*?camera_m=\(([^)]*)\) camera_rotation_deg=\(([^)]*)\)", re.M)
SCENE = re.compile(r"^\[OffscreenScene\].*?height_center_m=(-?[\d.]+)", re.M)
DRAWN = re.compile(r"drawn_triangles=(\d+)")
def wrapped(command: list[str]) -> list[str]:
return ["taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--",
"timeout", "1740s", *map(str, command)]
def run(label: str, command: list[str], log: Path) -> str:
started = time.monotonic()
log.parent.mkdir(parents=True, exist_ok=True)
with log.open("w", encoding="utf-8") as output:
result = subprocess.run(wrapped(command), cwd=ROOT, stdout=output,
stderr=subprocess.STDOUT, check=False, timeout=1740)
content = log.read_text(encoding="utf-8", errors="replace")
if result.returncode:
raise SystemExit(f"{label} failed exit={result.returncode}: {log}")
print(f"[L130MouthProcess] {label} elapsed_s={time.monotonic()-started:.2f}",
flush=True)
return content
def parse_vector(text: str) -> tuple[float, ...]:
return tuple(float(value) for value in text.split(","))
def sha256(path: Path) -> str:
return hashlib.sha256(path.read_bytes()).hexdigest()
def main() -> int:
if any(not path.is_file() for path in (DATA, HEADLESS, RENDERER)):
raise SystemExit("missing L130 mouth capture input")
(CAPTURES / "b96dd73").mkdir(parents=True, exist_ok=True)
(CAPTURES / "L130").mkdir(parents=True, exist_ok=True)
rows = []
for source_log in sorted(SOURCE.glob("*-mouth-mesh.log")):
name = source_log.name.removesuffix("-mesh.log")
source_render = SOURCE / f"{name}-render.log"
baseline_mesh = SOURCE / f"{name}.vfmesh"
if not all(path.is_file() for path in (source_render, baseline_mesh)):
raise SystemExit(f"missing b96dd73 source artifact for {name}")
config = HEADLESS_CONFIG.search(source_log.read_text())
scene = SCENE.search(source_render.read_text())
if config is None or scene is None:
raise SystemExit(f"missing camera metadata for {name}")
camera = parse_vector(config.group(1))
yaw, pitch = parse_vector(config.group(2))
height_center = float(scene.group(1))
camera_arg = ",".join(f"{value:.6f}" for value in (*camera, yaw, pitch))
candidate_mesh = SAVED / "L130" / f"{name}.vfmesh"
candidate_mesh.parent.mkdir(parents=True, exist_ok=True)
run(f"{name}-mesh", [HEADLESS, DATA, "--world-assembler-prototype",
"--stream-benchmark", "--stream-pipeline", "--workers=12",
"--clip-radius=3", "--max-clip-level=0", "--max-level=0",
"--force-generate", "--recipe=surface-world", f"--camera={camera_arg}",
"--render-distance-chunks=1", f"--mesh-export={candidate_mesh}"],
SAVED / "L130" / f"{name}-mesh.log")
if not candidate_mesh.is_file() or candidate_mesh.stat().st_size == 0:
raise SystemExit(f"empty L130 mesh for {name}")
render_args = ["--size=1920x1080",
f"--camera-m={','.join(f'{value:.6f}' for value in camera)}",
f"--yaw-deg={yaw:.6f}", f"--pitch-deg={pitch:.6f}",
"--shade=readable", "--headlamp=on", "--height-tint=on",
f"--height-center-m={height_center:.6f}", "--height-range-m=32"]
images = {}
draw_counts = {}
for variant, mesh in (("b96dd73", baseline_mesh), ("L130", candidate_mesh)):
image = CAPTURES / variant / f"{name}.png"
render_log = SAVED / variant / f"{name}-render.log"
content = run(f"{name}-{variant}-render",
[RENDERER, mesh, image, *render_args], render_log)
drawn = DRAWN.search(content)
if drawn is None or int(drawn.group(1)) <= 0 or not image.is_file():
raise SystemExit(f"render has no visible triangles for {name}/{variant}")
images[variant] = image
draw_counts[variant] = int(drawn.group(1))
equal = images["b96dd73"].read_bytes() == images["L130"].read_bytes()
row = {"name": name, "camera_m": camera, "yaw_deg": yaw,
"pitch_deg": pitch, "height_center_m": height_center,
"source_mesh": str(baseline_mesh.relative_to(ROOT)),
"candidate_mesh": str(candidate_mesh.relative_to(ROOT)),
"baseline_png": str(images["b96dd73"].relative_to(ROOT)),
"candidate_png": str(images["L130"].relative_to(ROOT)),
"baseline_sha256": sha256(images["b96dd73"]),
"candidate_sha256": sha256(images["L130"]),
"byte_identical": equal, "drawn_triangles": draw_counts}
rows.append(row)
print(f"[L130MouthCompare] {name} byte_identical={equal} "
f"sha256={row['candidate_sha256']}", flush=True)
if len(rows) != 6:
raise SystemExit(f"expected six L129 mouth views, found {len(rows)}")
(CAPTURES / "summary.json").write_text(json.dumps(rows, indent=2) + "\n")
sections = []
for row in rows:
name = html.escape(row["name"])
sections.append(f"<section><h2>{name}</h2><p>byte identical: "
f"{str(row['byte_identical']).lower()}</p><div>"
f"<figure><figcaption>b96dd73 source mesh</figcaption><img src='b96dd73/{name}.png'></figure>"
f"<figure><figcaption>L130 reach units</figcaption><img src='L130/{name}.png'></figure>"
"</div></section>")
page = ("<!doctype html><meta charset='utf-8'><title>L130 mouth closeups</title>"
"<style>body{font:14px system-ui;margin:24px;background:#17191d;color:#eee}"
"section{margin:28px 0}div{display:grid;grid-template-columns:1fr 1fr;gap:12px}"
"img{width:100%;height:auto}p{color:#bbb}</style>"
"<h1>L129 mouth closeups: b96dd73 vs L130</h1>" + "\n".join(sections))
(CAPTURES / "COMPARE.html").write_text(page)
return 0 if all(row["byte_identical"] for row in rows) else 1
if __name__ == "__main__":
raise SystemExit(main())
@@ -0,0 +1,98 @@
#!/usr/bin/env python3
"""Render the 23 L125 camera poses with the L130 evaluator and compare them."""
from __future__ import annotations
import html
import importlib.util
import json
import shutil
from pathlib import Path
ROOT = Path(__file__).resolve().parents[4]
RESEARCH = Path(__file__).resolve().parent
CAPTURES = RESEARCH / "captures"
SAVED = ROOT / "Saved/Linux/l130/captures"
BASELINE_INDEX = (ROOT / "Standalone/Research/WorldAssemblerM3/Linux119"
/ "captures/L119/capture-index.json")
REFERENCE = ROOT / "Standalone/Research/WorldAssemblerM3/Linux125/captures/L125"
LAYOUT = ROOT / "Saved/Linux/l130/hashes/owner4-surface-world-w12-clang.layout.json"
HEADLESS = ROOT / "Saved/Linux/l130/bin/VoxelForgeCoreHeadless-l130-clang"
RENDERER = ROOT / "Saved/Linux/l130/bin/VoxelForgeOffscreenCapture-l130-clang"
HELPER_PATH = ROOT / "Standalone/Research/WorldAssemblerM3/Linux113/RunL113Captures.py"
def main() -> int:
if any(not path.is_file() for path in
(BASELINE_INDEX, REFERENCE / "passage-0-1-0-rock-floor-station-1.png",
LAYOUT, HEADLESS, RENDERER)):
raise SystemExit("missing pose, layout, or L130 capture input")
spec = importlib.util.spec_from_file_location("l125_capture_runner",
ROOT / "Standalone/Research/WorldAssemblerM3/Linux125/RunL125Captures.py")
if spec is None or spec.loader is None:
raise SystemExit("cannot load the verified L125 pose set")
runner = importlib.util.module_from_spec(spec)
spec.loader.exec_module(runner)
runner.RESEARCH = RESEARCH
runner.CAPTURES = CAPTURES
runner.SAVED = SAVED
runner.LAYOUT = LAYOUT
runner.CLANG = HEADLESS
runner.RENDERER = RENDERER
runner.HELPERS.RESEARCH = RESEARCH
runner.HELPERS.CAPTURES = CAPTURES
runner.HELPERS.SAVED = SAVED
runner.HELPERS.BINARIES = {"L125": HEADLESS}
runner.HELPERS.RENDERERS = {"L125": RENDERER}
if runner.main() != 0:
raise SystemExit("L130 pose generation failed")
new_captures = CAPTURES / "L125"
new_saved = SAVED / "L125"
index_path = new_captures / "capture-index.json"
data = json.loads(index_path.read_text())
if len(data["captures"]) != 23:
raise SystemExit(f"expected 23 poses, found {len(data['captures'])}")
identical = 0
sections = []
for row in data["captures"]:
name = row["name"]
old_image = REFERENCE / f"{name}.png"
new_image = new_captures / f"{name}.png"
if not old_image.is_file() or not new_image.is_file():
raise SystemExit(f"missing comparison image for {name}")
same = old_image.read_bytes() == new_image.read_bytes()
identical += int(same)
row["variant"] = "L130-v227"
row["capture"] = row["capture"].replace("captures/L125/", "captures/L130/")
row["scene"] = row["scene"].replace("captures/L125/", "captures/L130/")
row["logs"] = [path.replace("captures/L125/", "captures/L130/")
for path in row.get("logs", [])]
sections.append(f"<section><h2>{html.escape(row['passage'])} — "
f"{html.escape(row.get('station', ''))}</h2><p>{html.escape(row['kind'])} · "
f"byte identical: {str(same).lower()}</p><div>"
f"<figure><figcaption>L125 v225</figcaption><img src='../../Linux125/captures/L125/{html.escape(name)}.png'></figure>"
f"<figure><figcaption>L130 v227</figcaption><img src='L130/{html.escape(name)}.png'></figure>"
"</div></section>")
if identical != 23:
raise SystemExit(f"only {identical}/23 L125 pose captures are byte-identical")
index_path.write_text(json.dumps(data, indent=2) + "\n")
old_captures, old_saved = CAPTURES / "L130", SAVED / "L130"
if old_captures.exists():
shutil.rmtree(old_captures)
if old_saved.exists():
shutil.rmtree(old_saved)
new_captures.rename(old_captures)
new_saved.rename(old_saved)
page = ("<!doctype html><meta charset='utf-8'><title>L130 passage captures</title>"
"<style>body{font:14px system-ui;margin:24px;background:#17191d;color:#eee}"
"section{margin:28px 0}div{display:grid;grid-template-columns:1fr 1fr;gap:12px}"
"img{width:100%;height:auto}p{color:#bbb}</style>"
"<h1>L125 v225 vs L130 v227: passage captures</h1>" + "\n".join(sections))
(CAPTURES / "COMPARE.html").write_text(page)
print(f"[L130PoseCapture] poses=23 byte_identical={identical}/23", flush=True)
return 0
if __name__ == "__main__":
raise SystemExit(main())
@@ -0,0 +1,137 @@
#!/usr/bin/env python3
"""Five interleaved L80 near-ready runs per stratum/worker vs b96dd73."""
from __future__ import annotations
import json
import os
import re
import statistics
import subprocess
import time
from pathlib import Path
ROOT = Path(__file__).resolve().parents[4]
OUT = ROOT / "Saved/Linux/l130/timing"
PASS_ID = int(os.environ.get("VOXELFORGE_L130_TIMING_PASS", "1"))
REPLICATE_FIRST = (PASS_ID - 1) * 5 + 1
DATA = ROOT / "Standalone/data/owner_world.json"
BINARIES = {
"b96dd73": ROOT / "Saved/Linux/l125/bin/VoxelForgeCoreHeadless-l125-clang",
"L130": ROOT / "Saved/Linux/l130/bin/VoxelForgeCoreHeadless-l130-clang",
}
CAMERAS = {
0: (8.0, 16.0, -372.2626953125),
1: (25.8369140625, 3.19921875, -737.0),
2: (19.166015625, -14.2001953125, -753.3740234375),
3: (-20.0625, -5.068359375, -900.353515625),
}
PIPELINE_RE = re.compile(r"^\[StreamPipeline\] (.*)$", re.M)
FIELDS_RE = re.compile(r"([a-zA-Z0-9_]+)=([^ ]+)")
NEAR_RE = re.compile(
r"^\[WorldAssemblerNearLODReady\] lods=0-2 tiles=(\d+)/(\d+) cold_ready_s=([0-9.]+)$",
re.M)
def run(strate: int, workers: int, version: str, phase: str, replicate: int) -> dict:
OUT.mkdir(parents=True, exist_ok=True)
pass_suffix = "" if PASS_ID == 1 else f"-p{PASS_ID}"
label = f"s{strate}-w{workers}-{version}-{phase}{replicate}-l130-v227{pass_suffix}"
log = OUT / f"{label}.log"
camera = ",".join(f"{value:.12f}" for value in CAMERAS[strate]) + ",0,0"
command = ["taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--",
"timeout", "1740s", str(BINARIES[version]), str(DATA),
"--world-assembler-prototype", "--stream-benchmark", "--stream-pipeline",
f"--workers={workers}", "--clip-radius=3", "--max-clip-level=8",
"--max-level=8", f"--camera={camera}", "--profile-lod-work",
"--stream-scheduler-policy=3"]
started = time.monotonic()
with log.open("w", encoding="utf-8") as output:
result = subprocess.run(command, cwd=ROOT, stdout=output,
stderr=subprocess.STDOUT, check=False, timeout=1740)
content = log.read_text(encoding="utf-8", errors="replace")
pipeline, near = PIPELINE_RE.search(content), NEAR_RE.search(content)
if result.returncode or pipeline is None or near is None:
raise SystemExit(f"timing run failed: {log}; exit={result.returncode}")
fields = dict(FIELDS_RE.findall(pipeline.group(1)))
row = {"strate": strate, "workers": workers, "version": version,
"phase": phase, "replicate": replicate, "exit_code": result.returncode,
"wall_s": round(time.monotonic() - started, 3),
"lod02_ready_s": float(near.group(3)),
"whole_view_ready_s": float(fields["whole_view_ready"].removesuffix("s")),
"log": str(log.relative_to(ROOT))}
print("[L130TimingRun] " + json.dumps(row, sort_keys=True), flush=True)
return row
def main() -> int:
if any(not path.is_file() for path in (DATA, *BINARIES.values())):
raise SystemExit("missing L130 timing input")
OUT.mkdir(parents=True, exist_ok=True)
load_1m = __import__("os").getloadavg()[0]
def cpu_idle(interval: float = 2.0) -> float:
def totals() -> tuple[int, int]:
fields = Path("/proc/stat").read_text().splitlines()[0].split()
values = [int(value) for value in fields[1:]]
return sum(values), values[3] + (values[4] if len(values) > 4 else 0)
before = totals()
time.sleep(interval)
after = totals()
return 100.0 * (after[1] - before[1]) / max(1, after[0] - before[0])
idle = cpu_idle()
pass_suffix = "" if PASS_ID == 1 else f"-p{PASS_ID}"
(OUT / f"machine-load-v227{pass_suffix}-before.txt").write_text(
f"1-minute load: {load_1m:.2f}\n2-second CPU idle: {idle:.1f}%\n")
print(f"[L130TimingGate] load_1m={load_1m:.2f} cpu_idle_2s={idle:.1f}%",
flush=True)
if load_1m >= 0.9 or idle < 97.0:
raise SystemExit("timing refused: machine is above the quiet-load gate")
rows = []
for strate in range(4):
for workers in (8, 12):
for version in BINARIES:
run(strate, workers, version, "warmup", 0)
for replicate in range(REPLICATE_FIRST, REPLICATE_FIRST + 5):
order = tuple(BINARIES) if replicate % 2 else tuple(reversed(BINARIES))
for version in order:
rows.append(run(strate, workers, version, "measured", replicate))
(OUT / f"runs-v227{pass_suffix}-partial.json").write_text(
json.dumps(rows, indent=2) + "\n", encoding="utf-8")
prior_runs = []
if PASS_ID > 1:
previous = OUT / ("v227-summary.json" if PASS_ID == 2
else "v227-combined-summary.json")
if previous.is_file():
prior_runs = json.loads(previous.read_text(encoding="utf-8")).get("runs", [])
all_rows = prior_runs + rows
measured_rows = [row for row in all_rows if row["phase"] == "measured"]
summary = []
for strate in range(4):
for workers in (8, 12):
group_size = sum(row["strate"] == strate and row["workers"] == workers
for row in measured_rows) // 2
item = {"strate": strate, "workers": workers,
"replicates_per_version": group_size}
medians = {}
for version in BINARIES:
group = [row for row in measured_rows if row["strate"] == strate
and row["workers"] == workers and row["version"] == version]
medians[version] = {}
for key in ("lod02_ready_s", "whole_view_ready_s"):
values = [row[key] for row in group]
medians[version][key] = statistics.median(values)
item[f"{version}_{key}_values"] = values
item[f"{version}_{key}_median"] = medians[version][key]
for key in ("lod02_ready_s", "whole_view_ready_s"):
item[f"L130_vs_b96dd73_{key}_delta_pct"] = round(
100.0*(medians["L130"][key]/medians["b96dd73"][key]-1.0), 2)
summary.append(item)
summary_path = OUT / ("v227-summary.json" if PASS_ID == 1
else f"v227-combined-summary.json")
summary_path.write_text(json.dumps(
{"runs": all_rows, "summary": summary}, indent=2) + "\n", encoding="utf-8")
return 0
if __name__ == "__main__":
raise SystemExit(main())
@@ -0,0 +1,23 @@
<!doctype html><meta charset='utf-8'><title>L130 passage captures</title><style>body{font:14px system-ui;margin:24px;background:#17191d;color:#eee}section{margin:28px 0}div{display:grid;grid-template-columns:1fr 1fr;gap:12px}img{width:100%;height:auto}p{color:#bbb}</style><h1>L125 v225 vs L130 v227: passage captures</h1><section><h2>passage/0-1/0 — rock-floor/401.7m</h2><p>rock-floor-close · byte identical: true</p><div><figure><figcaption>L125 v225</figcaption><img src='../../Linux125/captures/L125/passage-0-1-0-rock-floor-station-1.png'></figure><figure><figcaption>L130 v227</figcaption><img src='L130/passage-0-1-0-rock-floor-station-1.png'></figure></div></section>
<section><h2>passage/0-1/0 — rock-floor/792.8m</h2><p>rock-floor-close · byte identical: true</p><div><figure><figcaption>L125 v225</figcaption><img src='../../Linux125/captures/L125/passage-0-1-0-rock-floor-station-2.png'></figure><figure><figcaption>L130 v227</figcaption><img src='L130/passage-0-1-0-rock-floor-station-2.png'></figure></div></section>
<section><h2>passage/0-1/0 — rock-floor/1634.5m</h2><p>rock-floor-close · byte identical: true</p><div><figure><figcaption>L125 v225</figcaption><img src='../../Linux125/captures/L125/passage-0-1-0-rock-floor-station-3.png'></figure><figure><figcaption>L130 v227</figcaption><img src='L130/passage-0-1-0-rock-floor-station-3.png'></figure></div></section>
<section><h2>passage/1-2/0 — rock-floor/27.0m</h2><p>rock-floor-close · byte identical: true</p><div><figure><figcaption>L125 v225</figcaption><img src='../../Linux125/captures/L125/passage-1-2-0-rock-floor-station-1.png'></figure><figure><figcaption>L130 v227</figcaption><img src='L130/passage-1-2-0-rock-floor-station-1.png'></figure></div></section>
<section><h2>passage/1-2/0 — rock-floor/52.9m</h2><p>rock-floor-close · byte identical: true</p><div><figure><figcaption>L125 v225</figcaption><img src='../../Linux125/captures/L125/passage-1-2-0-rock-floor-station-2.png'></figure><figure><figcaption>L130 v227</figcaption><img src='L130/passage-1-2-0-rock-floor-station-2.png'></figure></div></section>
<section><h2>passage/1-2/0 — rock-floor/78.9m</h2><p>rock-floor-close · byte identical: true</p><div><figure><figcaption>L125 v225</figcaption><img src='../../Linux125/captures/L125/passage-1-2-0-rock-floor-station-3.png'></figure><figure><figcaption>L130 v227</figcaption><img src='L130/passage-1-2-0-rock-floor-station-3.png'></figure></div></section>
<section><h2>passage/2-3/0 — rock-floor/323.4m</h2><p>rock-floor-close · byte identical: true</p><div><figure><figcaption>L125 v225</figcaption><img src='../../Linux125/captures/L125/passage-2-3-0-rock-floor-station-1.png'></figure><figure><figcaption>L130 v227</figcaption><img src='L130/passage-2-3-0-rock-floor-station-1.png'></figure></div></section>
<section><h2>passage/2-3/0 — rock-floor/333.4m</h2><p>rock-floor-close · byte identical: true</p><div><figure><figcaption>L125 v225</figcaption><img src='../../Linux125/captures/L125/passage-2-3-0-rock-floor-station-2.png'></figure><figure><figcaption>L130 v227</figcaption><img src='L130/passage-2-3-0-rock-floor-station-2.png'></figure></div></section>
<section><h2>passage/2-3/0 — rock-floor/343.4m</h2><p>rock-floor-close · byte identical: true</p><div><figure><figcaption>L125 v225</figcaption><img src='../../Linux125/captures/L125/passage-2-3-0-rock-floor-station-3.png'></figure><figure><figcaption>L130 v227</figcaption><img src='L130/passage-2-3-0-rock-floor-station-3.png'></figure></div></section>
<section><h2>passage/0-1/0 — section-1/4m-outside</h2><p>open-air-close · byte identical: true</p><div><figure><figcaption>L125 v225</figcaption><img src='../../Linux125/captures/L125/passage-0-1-0-openair-1-4m-outside.png'></figure><figure><figcaption>L130 v227</figcaption><img src='L130/passage-0-1-0-openair-1-4m-outside.png'></figure></div></section>
<section><h2>passage/0-1/0 — section-1/4m-interior-wall</h2><p>open-air-close · byte identical: true</p><div><figure><figcaption>L125 v225</figcaption><img src='../../Linux125/captures/L125/passage-0-1-0-openair-1-4m-interior-wall.png'></figure><figure><figcaption>L130 v227</figcaption><img src='L130/passage-0-1-0-openair-1-4m-interior-wall.png'></figure></div></section>
<section><h2>passage/0-1/0 — section-2/4m-outside</h2><p>open-air-close · byte identical: true</p><div><figure><figcaption>L125 v225</figcaption><img src='../../Linux125/captures/L125/passage-0-1-0-openair-2-4m-outside.png'></figure><figure><figcaption>L130 v227</figcaption><img src='L130/passage-0-1-0-openair-2-4m-outside.png'></figure></div></section>
<section><h2>passage/0-1/0 — section-2/4m-interior-wall</h2><p>open-air-close · byte identical: true</p><div><figure><figcaption>L125 v225</figcaption><img src='../../Linux125/captures/L125/passage-0-1-0-openair-2-4m-interior-wall.png'></figure><figure><figcaption>L130 v227</figcaption><img src='L130/passage-0-1-0-openair-2-4m-interior-wall.png'></figure></div></section>
<section><h2>passage/0-1/0 — section-3/4m-outside</h2><p>open-air-close · byte identical: true</p><div><figure><figcaption>L125 v225</figcaption><img src='../../Linux125/captures/L125/passage-0-1-0-openair-3-4m-outside.png'></figure><figure><figcaption>L130 v227</figcaption><img src='L130/passage-0-1-0-openair-3-4m-outside.png'></figure></div></section>
<section><h2>passage/0-1/0 — section-3/4m-interior-wall</h2><p>open-air-close · byte identical: true</p><div><figure><figcaption>L125 v225</figcaption><img src='../../Linux125/captures/L125/passage-0-1-0-openair-3-4m-interior-wall.png'></figure><figure><figcaption>L130 v227</figcaption><img src='L130/passage-0-1-0-openair-3-4m-interior-wall.png'></figure></div></section>
<section><h2>passage/1-2/0 — section-1/4m-outside</h2><p>open-air-close · byte identical: true</p><div><figure><figcaption>L125 v225</figcaption><img src='../../Linux125/captures/L125/passage-1-2-0-openair-1-4m-outside.png'></figure><figure><figcaption>L130 v227</figcaption><img src='L130/passage-1-2-0-openair-1-4m-outside.png'></figure></div></section>
<section><h2>passage/1-2/0 — section-1/4m-interior-wall</h2><p>open-air-close · byte identical: true</p><div><figure><figcaption>L125 v225</figcaption><img src='../../Linux125/captures/L125/passage-1-2-0-openair-1-4m-interior-wall.png'></figure><figure><figcaption>L130 v227</figcaption><img src='L130/passage-1-2-0-openair-1-4m-interior-wall.png'></figure></div></section>
<section><h2>passage/1-2/0 — section-2/4m-outside</h2><p>open-air-close · byte identical: true</p><div><figure><figcaption>L125 v225</figcaption><img src='../../Linux125/captures/L125/passage-1-2-0-openair-2-4m-outside.png'></figure><figure><figcaption>L130 v227</figcaption><img src='L130/passage-1-2-0-openair-2-4m-outside.png'></figure></div></section>
<section><h2>passage/1-2/0 — section-2/4m-interior-wall</h2><p>open-air-close · byte identical: true</p><div><figure><figcaption>L125 v225</figcaption><img src='../../Linux125/captures/L125/passage-1-2-0-openair-2-4m-interior-wall.png'></figure><figure><figcaption>L130 v227</figcaption><img src='L130/passage-1-2-0-openair-2-4m-interior-wall.png'></figure></div></section>
<section><h2>passage/2-3/0 — section-1/4m-outside</h2><p>open-air-close · byte identical: true</p><div><figure><figcaption>L125 v225</figcaption><img src='../../Linux125/captures/L125/passage-2-3-0-openair-1-4m-outside.png'></figure><figure><figcaption>L130 v227</figcaption><img src='L130/passage-2-3-0-openair-1-4m-outside.png'></figure></div></section>
<section><h2>passage/2-3/0 — section-1/4m-interior-wall</h2><p>open-air-close · byte identical: true</p><div><figure><figcaption>L125 v225</figcaption><img src='../../Linux125/captures/L125/passage-2-3-0-openair-1-4m-interior-wall.png'></figure><figure><figcaption>L130 v227</figcaption><img src='L130/passage-2-3-0-openair-1-4m-interior-wall.png'></figure></div></section>
<section><h2>passage/2-3/0 — section-2/4m-outside</h2><p>open-air-close · byte identical: true</p><div><figure><figcaption>L125 v225</figcaption><img src='../../Linux125/captures/L125/passage-2-3-0-openair-2-4m-outside.png'></figure><figure><figcaption>L130 v227</figcaption><img src='L130/passage-2-3-0-openair-2-4m-outside.png'></figure></div></section>
<section><h2>passage/2-3/0 — section-2/4m-interior-wall</h2><p>open-air-close · byte identical: true</p><div><figure><figcaption>L125 v225</figcaption><img src='../../Linux125/captures/L125/passage-2-3-0-openair-2-4m-interior-wall.png'></figure><figure><figcaption>L130 v227</figcaption><img src='L130/passage-2-3-0-openair-2-4m-interior-wall.png'></figure></div></section>
File diff suppressed because it is too large. Load diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

@@ -0,0 +1,6 @@
<!doctype html><meta charset='utf-8'><title>L130 mouth closeups</title><style>body{font:14px system-ui;margin:24px;background:#17191d;color:#eee}section{margin:28px 0}div{display:grid;grid-template-columns:1fr 1fr;gap:12px}img{width:100%;height:auto}p{color:#bbb}</style><h1>L129 mouth closeups: b96dd73 vs L130</h1><section><h2>passage-0-1-0-lower-mouth</h2><p>byte identical: true</p><div><figure><figcaption>b96dd73 source mesh</figcaption><img src='b96dd73/passage-0-1-0-lower-mouth.png'></figure><figure><figcaption>L130 reach units</figcaption><img src='L130/passage-0-1-0-lower-mouth.png'></figure></div></section>
<section><h2>passage-0-1-0-upper-mouth</h2><p>byte identical: true</p><div><figure><figcaption>b96dd73 source mesh</figcaption><img src='b96dd73/passage-0-1-0-upper-mouth.png'></figure><figure><figcaption>L130 reach units</figcaption><img src='L130/passage-0-1-0-upper-mouth.png'></figure></div></section>
<section><h2>passage-1-2-0-lower-mouth</h2><p>byte identical: true</p><div><figure><figcaption>b96dd73 source mesh</figcaption><img src='b96dd73/passage-1-2-0-lower-mouth.png'></figure><figure><figcaption>L130 reach units</figcaption><img src='L130/passage-1-2-0-lower-mouth.png'></figure></div></section>
<section><h2>passage-1-2-0-upper-mouth</h2><p>byte identical: true</p><div><figure><figcaption>b96dd73 source mesh</figcaption><img src='b96dd73/passage-1-2-0-upper-mouth.png'></figure><figure><figcaption>L130 reach units</figcaption><img src='L130/passage-1-2-0-upper-mouth.png'></figure></div></section>
<section><h2>passage-2-3-0-lower-mouth</h2><p>byte identical: true</p><div><figure><figcaption>b96dd73 source mesh</figcaption><img src='b96dd73/passage-2-3-0-lower-mouth.png'></figure><figure><figcaption>L130 reach units</figcaption><img src='L130/passage-2-3-0-lower-mouth.png'></figure></div></section>
<section><h2>passage-2-3-0-upper-mouth</h2><p>byte identical: true</p><div><figure><figcaption>b96dd73 source mesh</figcaption><img src='b96dd73/passage-2-3-0-upper-mouth.png'></figure><figure><figcaption>L130 reach units</figcaption><img src='L130/passage-2-3-0-upper-mouth.png'></figure></div></section>
Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

@@ -0,0 +1,134 @@
[
{
"name": "passage-0-1-0-lower-mouth",
"camera_m": [
32.688347,
9.553723,
-735.48053
],
"yaw_deg": -132.845,
"pitch_deg": -6.052,
"height_center_m": -736.267,
"source_mesh": "Saved/Linux/l129/captures/mouth-closeups/before/passage-0-1-0-lower-mouth.vfmesh",
"candidate_mesh": "Saved/Linux/l130/captures/mouth-closeups/L130/passage-0-1-0-lower-mouth.vfmesh",
"baseline_png": "Standalone/Research/WorldAssemblerM3/Linux130/captures/mouth-closeups/b96dd73/passage-0-1-0-lower-mouth.png",
"candidate_png": "Standalone/Research/WorldAssemblerM3/Linux130/captures/mouth-closeups/L130/passage-0-1-0-lower-mouth.png",
"baseline_sha256": "aff7310b94e1b57e9cd1e42d3294e10964aed4a56e74bec8c1cdc0a5b2bffa98",
"candidate_sha256": "aff7310b94e1b57e9cd1e42d3294e10964aed4a56e74bec8c1cdc0a5b2bffa98",
"byte_identical": true,
"drawn_triangles": {
"b96dd73": 549170,
"L130": 549170
}
},
{
"name": "passage-0-1-0-upper-mouth",
"camera_m": [
8.324777,
20.450708,
-371.84259
],
"yaw_deg": -175.826,
"pitch_deg": -0.889,
"height_center_m": -372.122,
"source_mesh": "Saved/Linux/l129/captures/mouth-closeups/before/passage-0-1-0-upper-mouth.vfmesh",
"candidate_mesh": "Saved/Linux/l130/captures/mouth-closeups/L130/passage-0-1-0-upper-mouth.vfmesh",
"baseline_png": "Standalone/Research/WorldAssemblerM3/Linux130/captures/mouth-closeups/b96dd73/passage-0-1-0-upper-mouth.png",
"candidate_png": "Standalone/Research/WorldAssemblerM3/Linux130/captures/mouth-closeups/L130/passage-0-1-0-upper-mouth.png",
"baseline_sha256": "76dbb3263eb4f2018d13496f42b6eff7eb875e2029358776e22337aea8893a6d",
"candidate_sha256": "76dbb3263eb4f2018d13496f42b6eff7eb875e2029358776e22337aea8893a6d",
"byte_identical": true,
"drawn_triangles": {
"b96dd73": 243380,
"L130": 243380
}
},
{
"name": "passage-1-2-0-lower-mouth",
"camera_m": [
27.129938,
-19.07345,
-751.877197
],
"yaw_deg": -58.537,
"pitch_deg": -5.944,
"height_center_m": -751.734,
"source_mesh": "Saved/Linux/l129/captures/mouth-closeups/before/passage-1-2-0-lower-mouth.vfmesh",
"candidate_mesh": "Saved/Linux/l130/captures/mouth-closeups/L130/passage-1-2-0-lower-mouth.vfmesh",
"baseline_png": "Standalone/Research/WorldAssemblerM3/Linux130/captures/mouth-closeups/b96dd73/passage-1-2-0-lower-mouth.png",
"candidate_png": "Standalone/Research/WorldAssemblerM3/Linux130/captures/mouth-closeups/L130/passage-1-2-0-lower-mouth.png",
"baseline_sha256": "1c193b6fcb65b98b1c721704990392dc816486639e047b53bb72b4a17d89ae4c",
"candidate_sha256": "1c193b6fcb65b98b1c721704990392dc816486639e047b53bb72b4a17d89ae4c",
"byte_identical": true,
"drawn_triangles": {
"b96dd73": 544808,
"L130": 544808
}
},
{
"name": "passage-1-2-0-upper-mouth",
"camera_m": [
23.391808,
-15.509525,
-731.781067
],
"yaw_deg": -72.785,
"pitch_deg": -0.897,
"height_center_m": -730.561,
"source_mesh": "Saved/Linux/l129/captures/mouth-closeups/before/passage-1-2-0-upper-mouth.vfmesh",
"candidate_mesh": "Saved/Linux/l130/captures/mouth-closeups/L130/passage-1-2-0-upper-mouth.vfmesh",
"baseline_png": "Standalone/Research/WorldAssemblerM3/Linux130/captures/mouth-closeups/b96dd73/passage-1-2-0-upper-mouth.png",
"candidate_png": "Standalone/Research/WorldAssemblerM3/Linux130/captures/mouth-closeups/L130/passage-1-2-0-upper-mouth.png",
"baseline_sha256": "28576cefb1b59601d2e68981a7b77fc28a1d667c58ab27292deac0acd9deb338",
"candidate_sha256": "28576cefb1b59601d2e68981a7b77fc28a1d667c58ab27292deac0acd9deb338",
"byte_identical": true,
"drawn_triangles": {
"b96dd73": 593026,
"L130": 593026
}
},
{
"name": "passage-2-3-0-lower-mouth",
"camera_m": [
-28.589163,
-1.226313,
-898.811707
],
"yaw_deg": 114.256,
"pitch_deg": -6.159,
"height_center_m": -898.713,
"source_mesh": "Saved/Linux/l129/captures/mouth-closeups/before/passage-2-3-0-lower-mouth.vfmesh",
"candidate_mesh": "Saved/Linux/l130/captures/mouth-closeups/L130/passage-2-3-0-lower-mouth.vfmesh",
"baseline_png": "Standalone/Research/WorldAssemblerM3/Linux130/captures/mouth-closeups/b96dd73/passage-2-3-0-lower-mouth.png",
"candidate_png": "Standalone/Research/WorldAssemblerM3/Linux130/captures/mouth-closeups/L130/passage-2-3-0-lower-mouth.png",
"baseline_sha256": "58cd3ea88c754afab20d1cdcaf5f0edf676f0303d9f392d3632a6f2257205766",
"candidate_sha256": "58cd3ea88c754afab20d1cdcaf5f0edf676f0303d9f392d3632a6f2257205766",
"byte_identical": true,
"drawn_triangles": {
"b96dd73": 293832,
"L130": 293832
}
},
{
"name": "passage-2-3-0-upper-mouth",
"camera_m": [
-24.455027,
-5.631774,
-811.975403
],
"yaw_deg": 82.691,
"pitch_deg": -0.896,
"height_center_m": -810.755,
"source_mesh": "Saved/Linux/l129/captures/mouth-closeups/before/passage-2-3-0-upper-mouth.vfmesh",
"candidate_mesh": "Saved/Linux/l130/captures/mouth-closeups/L130/passage-2-3-0-upper-mouth.vfmesh",
"baseline_png": "Standalone/Research/WorldAssemblerM3/Linux130/captures/mouth-closeups/b96dd73/passage-2-3-0-upper-mouth.png",
"candidate_png": "Standalone/Research/WorldAssemblerM3/Linux130/captures/mouth-closeups/L130/passage-2-3-0-upper-mouth.png",
"baseline_sha256": "6b903c68fac1a20783185afbac8cdad717c6e9374e665e3618e118c5a6aadf51",
"candidate_sha256": "6b903c68fac1a20783185afbac8cdad717c6e9374e665e3618e118c5a6aadf51",
"byte_identical": true,
"drawn_triangles": {
"b96dd73": 59554,
"L130": 59554
}
}
]
@@ -0,0 +1,50 @@
# Linux131 — current state and dead experiment cleanup
Branch `wip/l131-current-state`, based on `cbbfd46`; Core evaluator remains v227. The root [`CURRENT-STATE.md`](../../../../CURRENT-STATE.md) consolidates the shipping behavior, current references, verification commands, open gaps, and closed proposals.
## Removed
- Removed `VOXELFORGE_L86_DISABLE_PASSAGE_COMPOSITION`, `VOXELFORGE_L88_DISABLE_PASSAGES`, `VOXELFORGE_L88_DISABLE_BOUNDARY_BANDS`, and `VOXELFORGE_L88_ALLOW_PASSAGE_ABLATION_WALKABILITY_FAILURE`. These only supported archived passage/boundary ablations in `Linux86/RunL86Ceiling.py`, `Linux87/RunL87Timeline.py`, and `Linux88/RunL88CeilingSplit.py`; no current `verify.py` gate or live comparison uses them. Passage feature selection, passage composition, and boundary bands now run on the normal path, and passage-route validation cannot be waived by the old ablation flag.
- Removed the `VOXELFORGE_AUDIT_LEGACY_ROUTE_GRADE` block from `Standalone/Source/WorldAssemblyPrototype.h`. The source contained its only reference; no test, current tool, or report invoked it.
- Kept route-candidate grading and all user-visible behavior. This cleanup adds no evaluator version or baseline change.
## Switch and hook inventory
### Environment switches in compiled Core/Source
| Switch | Effect and consumer | Keep decision |
|---|---|---|
| `VOXELFORGE_L74_TIGHT_PROOF_CONTROL` | Proof negative control. `Linux74/FalsifierL74.py` and `Linux75/FalsifierL75.py`. | Keep for falsifier reproducibility; not a current fast-tier input. |
| `VOXELFORGE_L75_TN_BLOCK_REGRESSION` | Fixed TunnelNetwork regression path in Core and mesher. `RunTnBlockRegressionL75.py` and `FalsifierL75.py`. | Keep; the regression tools still consume it. |
| `VOXELFORGE_L98_PASSAGE_PREP_TRACE` | Emits preparation-stage timing/count data. `RunL98Hashes.py` and `RunL98ReuseCounts.py`. | Keep as a focused profiler for future preparation comparisons. |
| `VOXELFORGE_L98_PASSAGE_REUSE_PROBE` | Compares the prepared projection with direct scalar queries. `RunL98ReuseCounts.py`. | Keep for exactness probes. |
| `VOXELFORGE_L104_FAR_HIT_CACHE` | Selects indexed versus linear far-hit candidate lookup. `RunL104ReadinessPairs.py` and `RunL104ProbeStats.py`. | Keep for reproducible A/B comparisons; cache defaults on. |
| `VOXELFORGE_L104_FAR_HIT_STATS` | Emits far-hit candidate/query counters. `RunL104ProbeStats.py`. | Keep for the measurement tool. |
| `VOXELFORGE_L115_DENSITY_PROFILE` | Enables density and floor-query profiling. `RunL115DensityProbe.py`, `RunL119DensityProbe.py`, and `RunL125DensityProbe.py`. | Keep; these remain the focused floor-probe path. |
| `VOXELFORGE_L130_PASSAGE_REACH_PROOF_AUDIT` | Checks passage proof/feature influence bounds. L130's reach audit and report. | Keep for reach changes and audit reproduction. |
Archived runners also set `VOXELFORGE_L81_PASSAGE_BOUND_PADDING_VOXELS`, `VOXELFORGE_L86_PASSAGE_RESULT_CACHE`, `VOXELFORGE_L90_PASSAGE_BRICK_METRES`, `VOXELFORGE_L90_PASSAGE_CANDIDATE_CENSUS`, `VOXELFORGE_L90_PASSAGE_REACH_METRES`, `VOXELFORGE_L91_PASSAGE_SOURCE_FLOOR_VOXELS`, `VOXELFORGE_L93_PASSAGE_CARVE_REACH_METRES`, `VOXELFORGE_L98_PASSAGE_REUSE_COUNTS`, `VOXELFORGE_L114_DENSITY_PROFILE`, and `VOXELFORGE_L118_TAG_TIMING`. None has a compiled-source reader at `cbbfd46`; they are inert historical runner strings.
### Other experiments, diagnostics, and legacy paths retained
- **World-changing tunnel ablations:** all 14 `voxel.TunnelAblate*` controls remain (`CaveWarp`, `DetailOps`, `RoomSDF`, `TunnelSDF`, `TunnelCore`, `PassageCarving`, `PassageStructuralPosts`, `NativeFloor`, `Disturbances`, `OriginSpine`, `BoundarySeal`, `LandingPosts`, `XYEdgeSeal`, `PitChimneySDF`). The editor commandlet writes their resolved mask into export and result manifests; the archived `PERF-SAMPLED.md` and `WORK-NEXT.md` record their measurements. No current runner invokes an ablation. Keep for manifest attribution and historical reproduction; removing it needs a metadata migration. Source: [`VoxelDensityAblation.cpp`](../../../../Source/VoxelForge/Private/VoxelDensityAblation.cpp), [`VoxelForgeExploreCommandlet.cpp`](../../../../Source/VoxelForgeEditor/Private/VoxelForgeExploreCommandlet.cpp).
- **Research fields:** `voxel.ResearchRedefinedDensityField`, `voxel.ResearchRedefinedDensityDetailScale`, `voxel.ResearchParameterizedCave`, and `voxel.ResearchParameterizedCaveSet` are default-off and used by `Tools/VoxelForgeTest.ps1` steps 2d/2e/2f. The region-eval commandlet consumes `SetResearchBrickBinningEnabled`, `SetResearchBrickRoomReachScale`, and `SetResearchRegionCacheWindowEnabled`; keep these editor-only experiment paths. Source: [`VoxelForgeRegionEvalExperiment.cpp`](../../../../Source/VoxelForgeEditor/Private/VoxelForgeRegionEvalExperiment.cpp), [`VoxelForgeTest.ps1`](../../../../Tools/VoxelForgeTest.ps1).
- **Runtime profiling and trace:** `voxel.SampleStacks` still starts `FVoxelStackSampler` (the guarded `Tools/VoxelForgeTest.ps1 -SampleDensityStacks` path consumes it); `voxel.ProfileDensity`, `voxel.ProfileDensityFull`, `voxel.ProfileTileGeneration`, `voxel.ProfileCollisionCookStages`, and `voxel.PerfAttribution` remain opt-in. `voxel.StartupTraceFile`, `voxel.StartupTraceMaxTiles`, and `voxel.StartupTraceUntilEndPlay` feed the Unreal startup trace used by the arrival/movement runners. Keep. Build-time `VOXELFORGE_PROFILE_LEGACY_TERMS` (L76) and `VOXELFORGE_PROFILE_L77`/`--linux77-profile` (stack sampler and route census) remain in `Standalone/BuildLinux.sh` and Core.
- **Standalone profiles and timelines:** retained `--profile-column-overlap`, `--profile-lod-work`, `--profile-passage-composer`, `--instrument-tile-drain`, `--cold-worker-timeline`, `--linux77-profile`, `--tls-probe=N`, `--tls-probe-touch=...`, and `--diagnostic-slow-shape-compile-ms=N`. The viewer's `--profile-attribution`, `--profile-detail-band`, and `--profile-far-column-overlap` remain. The L77 profiler, tile drain instrumentation, timelines, and TLS probe are measurement hooks; archived reports and runners still provide reproducible consumers.
- **Standalone audits:** all source-advertised hooks remain: `--audit-ore-vein-yield`, `--audit-resolved-layout-boundaries`, `--audit-strate-transitions`, `--audit-resolved-layout-passages`, `--audit-heightfield-profile`, `--audit-motif-intervals`, `--audit-landmark-reachability`, `--audit-native-caves`, `--audit-native-lattice`, `--audit-surface-clearance`, `--audit-uniform-block-proofs`, `--audit-base-page-equivalence`, `--audit-route-parity`, `--audit-passage-tile-seams`, `--audit-passage-source-clamp`, `--audit-passage-carve-reach`, `--audit-tile-shape-readiness`, and the mesher's `--audit-raw-skirts`. `verify.py fast` consumes the current route, passage, block-proof, transition, native-field and negative-control subset; dedicated L37/L75/L125/L130 runners exercise the specialized audits. Keep the whole audit set.
- **Evaluator A/B controls:** `voxel.FastIsFinite`, `voxel.UseFusedEvaluator`, `voxel.WormBlockSkip`, `voxel.TileCacheWindow` / its two minimum-LOD controls, `voxel.SpatialIndex`, `voxel.ChunkRoutingCache`, `voxel.UseOperatorBlock`, `voxel.CoreColumnCacheDirectMapped`, `voxel.CoreMCGradientMemoization`, `voxel.FloorRound1PassageProjectionCache`, `voxel.PlayerFitMemo`, `voxel.UseBlockEarlyOut`, `voxel.OuterClassifierMode`, and `voxel.SealedSolidProof` remain. They select optimized or comparison paths; the density block equivalence test explicitly forces `UseFusedEvaluator=0`, while most others are production defaults or historical measurement controls. `voxel.WormsForceOff` is a world-changing development measurement override. Kept; no current L131 gate changes them.
- **Standalone A/B and geometry controls:** `--exact-midpoint-density-memo`, `--no-exact-midpoint-density-memo`, `--active-lane-batching`, `--proof-block-cells=N`, `--parallel-sign-edge-repair`, `--serial-sign-edge-repair`, and `--shape-helper-limit=8|12` remain. The L94 report documents serial edge repair; no current `verify.py` consumer was found for the other CLI A/B controls, so they remain pending a separately reviewed removal. `voxel.TilePostReachDebug`, `voxel.TilePostReachScale`, and `voxel.TileReachCostDiagnostics` remain for the tile-post-reach test; `voxel.TunnelMouthTrim` remains a development-only room-mouth geometry control. No L131 gate uses these.
- `FLegacyGeneratorFieldAdapter` remains the Core fallback for unsupported generator/recipe combinations, and Unreal's Core switch remains default-off. `voxel.StreamingLegacyPendingResultCap=1` remains the L120–L123 admission negative control; `voxel.StreamingCoarseFirst` remains opt-in pending a rendered owner-plan check. `bStandaloneResearchRoundTunnels` and `bStandaloneResearchEnhancedWalls` remain consumed by the standalone viewer/Core adapter.
## Checks
- Clang 19 and GCC standalone builds passed with the L131 source stamp `5119cee164406856cbca496d160c0e0a8124ae2529fa7c0ebd51634a7c65a6cb`. `Standalone/BuildLinux.sh` applied the required CPU and address-space limits.
- L80 timing: one warm-up per binary and five interleaved pairs in each of four strata × W8/W12 cells, comparing the pre-cleanup L130 binary with L131. Load was 0.81; CPU idle was 99.2%. Across 40 pairs per metric, mean relative change was −0.22% near-ready (95% CI −1.02% to +0.57%) and −0.29% whole-view (−1.04% to +0.46%); the intervals include zero. [Raw timing summary](../../../../Saved/Linux/l131/timing/summary.json).
- Exact hashes: **24/24** owner4 SW/FI/TN/VS × Clang/GCC × W1/W8/W12 tile and whole-view identities; **18/18** canonical cases across owner4 SurfaceWorld and owner2 SurfaceWorld/FloatingIslands. All match the pre-cleanup L130 binary and agree across compiler/worker combinations. For transparency, forcing the owner4 dataset through `--recipe=floating-islands` exited during setup with “could not find a finite SurfaceWorld strate”, before hashing; it is not a valid canonical case. [Tile matrix](../../../../Saved/Linux/l131/hash-matrix/summary.json), [canonical matrix](../../../../Saved/Linux/l131/canonical-matrix/summary.json).
- Walkability: **21,425/21,425** passage centerline samples open. Seam audit: **4 pairs / 4,900** shared samples, zero mismatches. [Audit log](../../../../Saved/Linux/l131/seam-audit.log).
- Fast tier: **PASS**, 259 gated checks plus 5 diagnostics, 80 runs, 371.0 s. The five diagnostic-only comparisons are historical baselines; all required checks pass. [Summary](../../../../Saved/Linux/l131/fast-summary.json).
- Linux `VFHostEditor`: **PASS**, 27/27 actions, 78.81 s with `-NoUBA -MaxParallelActions=4`, no `prlimit`. UBT's default log rotation first failed before compilation in the read-only user config directory; the successful rerun set `-Log=.../Saved/Linux/l131/ubt.log`. Three existing RealtimeMesh deprecation warnings remain. [Build log](../../../../Saved/Linux/l131/ue-build.log).
- Unreal `Source/` files changed: **none**. No Windows compile is requested by this diff; Windows determinism remains unverified.
- `git diff --check` passes. No commit, push, or stash was made.
Builds, per-run logs, timing records, hash records, and audit output are under `Saved/Linux/l131/`.
@@ -0,0 +1,75 @@
#!/usr/bin/env python3
"""Compare 18 canonical owner4/owner2 hashes with the pre-cleanup L130 binary."""
from __future__ import annotations
import json
import re
import subprocess
import time
from pathlib import Path
ROOT = Path(__file__).resolve().parents[4]
OUT = ROOT / "Saved/Linux/l131/canonical-matrix"
DATASETS = {
"owner4": ROOT / "Standalone/data/owner_world.json",
"owner2": ROOT / "Standalone/data/regression/owner_world_2strate_l61.json",
}
RECIPES = {"owner4": ("surface-world",), "owner2": ("surface-world", "floating-islands")}
BINARIES = {
"base": ROOT / "Saved/Linux/l130/bin/VoxelForgeCoreHeadless-l130-{compiler}",
"l131": ROOT / "Saved/Linux/l131/bin/VoxelForgeCoreHeadless-l131-{compiler}",
}
HASH_RE = re.compile(r"^\[Pipeline(?:FullDetailHash|WholeViewHash|LODHash|ExactQueryHash)\].*$", re.M)
def run(dataset: str, recipe: str, compiler: str, workers: int, version: str) -> tuple[list[str], float]:
binary = Path(str(BINARIES[version]).format(compiler=compiler))
label = f"{dataset}-{recipe}-{compiler}-w{workers}-{version}"
log = OUT / f"{label}.log"
command = ["taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--",
"timeout", "1740s", str(binary), str(DATASETS[dataset]),
"--world-assembler-prototype", "--stream-benchmark", "--stream-pipeline",
"--force-generate", f"--workers={workers}", "--clip-radius=3",
"--max-clip-level=8", "--max-level=8", f"--recipe={recipe}", "--stream-hash"]
started = time.monotonic()
with log.open("w", encoding="utf-8") as stream:
process = subprocess.run(command, cwd=ROOT, stdout=stream,
stderr=subprocess.STDOUT, check=False, timeout=1740)
hashes = HASH_RE.findall(log.read_text(encoding="utf-8", errors="replace"))
if process.returncode or len(hashes) != 12:
raise RuntimeError(f"hash run failed: {log}; exit={process.returncode}; rows={len(hashes)}")
return hashes, time.monotonic() - started
def main() -> int:
OUT.mkdir(parents=True, exist_ok=True)
rows = []
groups = {}
for dataset, recipes in RECIPES.items():
for recipe in recipes:
signatures = []
for workers in (1, 8, 12):
for compiler in ("clang", "gcc"):
before, before_s = run(dataset, recipe, compiler, workers, "base")
after, after_s = run(dataset, recipe, compiler, workers, "l131")
row = {"dataset": dataset, "recipe": recipe, "compiler": compiler,
"workers": workers, "hash_mismatches": sum(a != b for a, b in zip(before, after)),
"rows": len(after), "base_s": round(before_s, 3), "l131_s": round(after_s, 3),
"base_log": f"Saved/Linux/l131/canonical-matrix/{dataset}-{recipe}-{compiler}-w{workers}-base.log",
"l131_log": f"Saved/Linux/l131/canonical-matrix/{dataset}-{recipe}-{compiler}-w{workers}-l131.log"}
rows.append(row)
signatures.append((compiler, workers, after))
print("[L131CanonicalHash] " + json.dumps(row, sort_keys=True), flush=True)
(OUT / "runs-partial.json").write_text(json.dumps(rows, indent=2) + "\n")
first = signatures[0][2]
stable = all(sig == first for _, _, sig in signatures)
groups[f"{dataset}/{recipe}"] = {"base_equals_l131": all(row["hash_mismatches"] == 0 for row in rows if row["dataset"] == dataset and row["recipe"] == recipe),
"all_clang_gcc_workers_agree": stable}
failures = [row for row in rows if row["hash_mismatches"]]
(OUT / "summary.json").write_text(json.dumps({"runs": rows, "groups": groups,
"passed": len(rows)-len(failures), "failed": len(failures)}, indent=2) + "\n")
return 1 if failures or not all(group["all_clang_gcc_workers_agree"] for group in groups.values()) else 0
if __name__ == "__main__":
raise SystemExit(main())
@@ -0,0 +1,84 @@
#!/usr/bin/env python3
"""Compare 24 owner4 tile-hash cases with the pre-cleanup L130 binary."""
from __future__ import annotations
import json
import re
import subprocess
import time
from pathlib import Path
ROOT = Path(__file__).resolve().parents[4]
OUT = ROOT / "Saved/Linux/l131/hash-matrix"
DATA = ROOT / "Standalone/data/owner_world.json"
BINARIES = {
"base": ROOT / "Saved/Linux/l130/bin/VoxelForgeCoreHeadless-l130-{compiler}",
"l131": ROOT / "Saved/Linux/l131/bin/VoxelForgeCoreHeadless-l131-{compiler}",
}
CAMERAS = {
"sw": ((8.0, 16.0, -372.2626953125), 2850),
"fi": ((25.8369140625, 3.19921875, -737.0), 2249),
"tn": ((19.166015625, -14.2001953125, -753.3740234375), 2233),
"vs": ((-20.0625, -5.068359375, -900.353515625), 2329),
}
TILE_RE = re.compile(
r"^\[PipelineTileHash\] lod=(-?\d+) x=(-?\d+) y=(-?\d+) z=(-?\d+) "
r"density=(0x[0-9a-f]+) mesh=(0x[0-9a-f]+) payload=(0x[0-9a-f]+) "
r"topology=(0x[0-9a-f]+)$", re.M)
WHOLE_RE = re.compile(
r"^\[PipelineWholeViewHash\] tiles=(\d+) density=(0x[0-9a-f]+) "
r"mesh=(0x[0-9a-f]+) payload=(0x[0-9a-f]+) topology=(0x[0-9a-f]+)$", re.M)
def capture(camera_name: str, compiler: str, workers: int, version: str) -> tuple[dict, tuple[str, ...], float]:
camera, expected_tiles = CAMERAS[camera_name]
camera_arg = ",".join(f"{value:.12f}" for value in camera) + ",0,0"
binary = Path(str(BINARIES[version]).format(compiler=compiler))
log = OUT / f"owner4-{camera_name}-{compiler}-w{workers}-{version}.log"
command = ["taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--",
"timeout", "1740s", str(binary), str(DATA), "--world-assembler-prototype",
"--stream-benchmark", "--stream-pipeline", f"--workers={workers}",
"--clip-radius=3", "--max-clip-level=8", "--max-level=8",
f"--camera={camera_arg}", "--stream-hash-tiles"]
started = time.monotonic()
with log.open("w", encoding="utf-8") as stream:
result = subprocess.run(command, cwd=ROOT, stdout=stream,
stderr=subprocess.STDOUT, check=False, timeout=1740)
elapsed = time.monotonic() - started
output = log.read_text(encoding="utf-8", errors="replace")
tiles = {(int(match.group(1)), int(match.group(2)), int(match.group(3)), int(match.group(4))):
match.group(5, 6, 7, 8) for match in TILE_RE.finditer(output)}
whole = WHOLE_RE.search(output)
if result.returncode or whole is None or len(tiles) != expected_tiles or len(tiles) != int(whole.group(1)):
raise RuntimeError(f"incomplete {version} {camera_name}/{compiler}/W{workers}: {log}")
return tiles, whole.groups(), elapsed
def main() -> int:
OUT.mkdir(parents=True, exist_ok=True)
rows = []
for camera_name in CAMERAS:
for compiler in ("clang", "gcc"):
for workers in (1, 8, 12):
old_tiles, old_whole, old_s = capture(camera_name, compiler, workers, "base")
new_tiles, new_whole, new_s = capture(camera_name, compiler, workers, "l131")
keys = set(old_tiles) | set(new_tiles)
tile_mismatches = sum(old_tiles.get(key) != new_tiles.get(key) for key in keys)
row = {"owner": "owner4", "camera": camera_name, "compiler": compiler,
"workers": workers, "tiles": len(new_tiles),
"tile_mismatches": tile_mismatches,
"whole_view_match": old_whole == new_whole,
"base_s": round(old_s, 3), "l131_s": round(new_s, 3),
"base_log": f"Saved/Linux/l131/hash-matrix/owner4-{camera_name}-{compiler}-w{workers}-base.log",
"l131_log": f"Saved/Linux/l131/hash-matrix/owner4-{camera_name}-{compiler}-w{workers}-l131.log"}
rows.append(row)
print("[L131HashIdentity] " + json.dumps(row, sort_keys=True), flush=True)
(OUT / "runs-partial.json").write_text(json.dumps(rows, indent=2) + "\n")
failures = [row for row in rows if row["tile_mismatches"] or not row["whole_view_match"]]
(OUT / "summary.json").write_text(json.dumps({"runs": rows, "passed": len(rows)-len(failures),
"failed": len(failures)}, indent=2) + "\n")
return 1 if failures else 0
if __name__ == "__main__":
raise SystemExit(main())
@@ -0,0 +1,115 @@
#!/usr/bin/env python3
"""Five interleaved L80 readiness measurements per stratum and worker count."""
from __future__ import annotations
import json
import os
import re
import statistics
import subprocess
import time
from pathlib import Path
ROOT = Path(__file__).resolve().parents[4]
OUT = ROOT / "Saved/Linux/l131/timing"
DATA = ROOT / "Standalone/data/owner_world.json"
BINARIES = {
"base": ROOT / "Saved/Linux/l130/bin/VoxelForgeCoreHeadless-l130-clang",
"l131": ROOT / "Saved/Linux/l131/bin/VoxelForgeCoreHeadless-l131-clang",
}
CAMERAS = {
0: (8.0, 16.0, -372.2626953125),
1: (25.8369140625, 3.19921875, -737.0),
2: (19.166015625, -14.2001953125, -753.3740234375),
3: (-20.0625, -5.068359375, -900.353515625),
}
PIPELINE_RE = re.compile(r"^\[StreamPipeline\] (.*)$", re.M)
FIELDS_RE = re.compile(r"([a-zA-Z0-9_]+)=([^ ]+)")
NEAR_RE = re.compile(r"^\[WorldAssemblerNearLODReady\] lods=0-2 tiles=(\d+)/(\d+) cold_ready_s=([0-9.]+)$", re.M)
def run(strate: int, workers: int, version: str, phase: str, replicate: int) -> dict:
camera = ",".join(f"{value:.12f}" for value in CAMERAS[strate]) + ",0,0"
label = f"s{strate}-w{workers}-{version}-{phase}{replicate}-l131-v227"
log = OUT / f"{label}.log"
command = ["taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--",
"timeout", "1740s", str(BINARIES[version]), str(DATA),
"--world-assembler-prototype", "--stream-benchmark", "--stream-pipeline",
f"--workers={workers}", "--clip-radius=3", "--max-clip-level=8",
"--max-level=8", f"--camera={camera}", "--profile-lod-work",
"--stream-scheduler-policy=3"]
started = time.monotonic()
with log.open("w", encoding="utf-8") as output:
result = subprocess.run(command, cwd=ROOT, stdout=output,
stderr=subprocess.STDOUT, check=False, timeout=1740)
content = log.read_text(encoding="utf-8", errors="replace")
pipeline, near = PIPELINE_RE.search(content), NEAR_RE.search(content)
if result.returncode or pipeline is None or near is None:
raise RuntimeError(f"timing run failed: {log}; exit={result.returncode}")
fields = dict(FIELDS_RE.findall(pipeline.group(1)))
row = {"strate": strate, "workers": workers, "version": version,
"phase": phase, "replicate": replicate,
"lod02_ready_s": float(near.group(3)),
"whole_view_ready_s": float(fields["whole_view_ready"].removesuffix("s")),
"wall_s": round(time.monotonic() - started, 3),
"log": str(log.relative_to(ROOT))}
print("[L131TimingRun] " + json.dumps(row, sort_keys=True), flush=True)
return row
def quiet_machine() -> tuple[float, float]:
load_1m = os.getloadavg()[0]
def totals() -> tuple[int, int]:
fields = Path("/proc/stat").read_text().splitlines()[0].split()
values = [int(value) for value in fields[1:]]
return sum(values), values[3] + (values[4] if len(values) > 4 else 0)
before = totals()
time.sleep(2.0)
after = totals()
idle = 100.0 * (after[1] - before[1]) / max(1, after[0] - before[0])
return load_1m, idle
def main() -> int:
if any(not path.is_file() for path in (DATA, *BINARIES.values())):
raise SystemExit("missing timing input")
OUT.mkdir(parents=True, exist_ok=True)
load_1m, idle = quiet_machine()
(OUT / "machine-load-before.txt").write_text(
f"1-minute load: {load_1m:.2f}\n2-second CPU idle: {idle:.1f}%\n")
print(f"[L131TimingGate] load_1m={load_1m:.2f} cpu_idle_2s={idle:.1f}%", flush=True)
if load_1m >= 0.9 or idle < 97.0:
raise SystemExit("timing refused: machine is above the L80 quiet-load gate")
rows = []
for strate in range(4):
for workers in (8, 12):
for version in BINARIES:
rows.append(run(strate, workers, version, "warmup", 0))
for replicate in range(1, 6):
order = tuple(BINARIES) if replicate % 2 else tuple(reversed(BINARIES))
for version in order:
rows.append(run(strate, workers, version, "measured", replicate))
(OUT / "runs-partial.json").write_text(json.dumps(rows, indent=2) + "\n")
measured = [row for row in rows if row["phase"] == "measured"]
summary = []
for strate in range(4):
for workers in (8, 12):
old = [row for row in measured if row["strate"] == strate and row["workers"] == workers and row["version"] == "base"]
new = [row for row in measured if row["strate"] == strate and row["workers"] == workers and row["version"] == "l131"]
item = {"strate": strate, "workers": workers, "replicates_per_version": 5}
for key in ("lod02_ready_s", "whole_view_ready_s"):
old_med, new_med = statistics.median(row[key] for row in old), statistics.median(row[key] for row in new)
item[f"base_{key}_median"] = old_med
item[f"l131_{key}_median"] = new_med
item[f"delta_pct_{key}"] = round(100.0 * (new_med / old_med - 1.0), 2)
item[f"base_{key}_values"] = [row[key] for row in old]
item[f"l131_{key}_values"] = [row[key] for row in new]
summary.append(item)
(OUT / "summary.json").write_text(json.dumps({"runs": rows, "summary": summary}, indent=2) + "\n")
return 0
if __name__ == "__main__":
raise SystemExit(main())
@@ -0,0 +1,44 @@
#!/usr/bin/env python3
"""Create the isolated L132 owner snapshot with a native plan for existing FI strate 1."""
from __future__ import annotations
import json
from pathlib import Path
ROOT = Path(__file__).resolve().parents[4]
SOURCE = ROOT / "Standalone/data/owner_world.json"
MANIFEST = ROOT / "Saved/Linux/l132/fixtures/owner-native-fi.world-assembly.json"
LAYOUT = ROOT / "Saved/Linux/l132/fixtures/owner-native-fi.resolved-layout.json"
OUTPUT = ROOT / "Saved/Linux/l132/fixtures/owner_world_native_fi.json"
def main() -> int:
owner = json.loads(SOURCE.read_text(encoding="utf-8"))
manifest_text = MANIFEST.read_text(encoding="utf-8").strip()
layout_text = LAYOUT.read_text(encoding="utf-8").strip()
manifest = json.loads(manifest_text)
layout = json.loads(layout_text)
islands = manifest.get("floating_islands", [])
native = [row for row in islands if row.get("strate_index") == 1]
resolved = [row for row in layout.get("strates", [])
if row.get("strate_index") == 1]
if len(native) != 1 or len(resolved) != 1:
raise SystemExit("native FI snapshot must contain exactly one strate-1 island plan/layout")
if (resolved[0].get("generator_kind") != "FloatingIslands"
or resolved[0].get("recipe_id") != "FloatingIslands.ClusterField"
or resolved[0].get("recipe_version") != 8):
raise SystemExit("resolved strate 1 is not FloatingIslands.ClusterField v8")
owner["world_assembly"] = manifest
owner["core_world_assembly_json"] = manifest_text
owner["resolved_layout_json"] = layout_text
OUTPUT.parent.mkdir(parents=True, exist_ok=True)
OUTPUT.write_text(json.dumps(owner, separators=(",", ":")) + "\n", encoding="utf-8")
print(f"[L132NativeFISnapshot] path={OUTPUT.relative_to(ROOT)} "
f"islands={len(native[0].get('manifest', {}).get('plan', {}).get('islands', []))} "
"strate=1 recipe=FloatingIslands.ClusterField/v8 status=PASS")
return 0
if __name__ == "__main__":
raise SystemExit(main())
@@ -0,0 +1,41 @@
# L132 — owner density dispatch
## Result
With Core enabled in the owner headless pipeline, the four strates bind to four paths. Unreal’s `bUseVoxelForgeCore` remains opt-in and defaults off. The fast-tier diagnostic reports the Core bindings at the four L80 owner poses and attributes hashed tiles by tile-center height within the resolved stratum bounds.
| Strate | Owner recipe | Bound path | Tile centers / share |
|---|---|---|---:|
| SW (0) | `SurfaceWorld.Heightfield2D` v2 | `SurfaceWorld-native` | 2,640 / 100% |
| FI (1) | `FloatingIslands.ClusterField` v0 | `compiled-analytic/FloatingIslands` | 2,128 / 100% |
| TN (2) | `legacy.TunnelNetwork` v0 | `compiled-analytic/TunnelNetwork` | 2,208 / 100% |
| VS (3) | `legacy.VerticalShafts` v0 | `compiled-analytic/VerticalShafts` | 1,392 / 100% |
SW has a matching strate/bounds `SurfaceWorld` plan, and its `Heightfield2D` evaluator is valid. FI has a legacy v0 layout record but no matching `FloatingIslandPlan`, so `FloatingIslandFieldV1` cannot bind. The Core owner manifest has zero island plans. TN and VS have legacy recipe IDs, not `Core.Caves.PrimitiveField` v1 or `Core.Lattice.PrimitiveField` v1. Their resolved layouts therefore lack the matching graph recipe and native-field capability. All three fall through to `FLegacyGeneratorFieldAdapter`.
The dispatch check is in the fast tier and can also be requested from the headless binary with `--density-dispatch-report`. It prints the per-strate bound adapter/path and hashed tile-center path shares. Its tile counts aggregate the four standard owner poses; tiles whose centers fall outside an interior interval are excluded, and a tile spanning a boundary is assigned by its center. Per-view logs are `Saved/Linux/l132/owner-density-dispatch-s*-clang.log`; the printed shares are in `Saved/Linux/l132/logs/verify-fast.log` and `Saved/Linux/l132/fast-summary.json`.
Across the 8,368 classified tile centers, path shares are 31.5% SurfaceWorld-native, 25.4% compiled-analytic/FloatingIslands, 26.4% compiled-analytic/TunnelNetwork, and 16.6% compiled-analytic/VerticalShafts.
## Native FI decision
The native evaluator is present. `BuildFloatingIslandStratumPlan` can convert the owner’s legacy island parameters to a v8 plan, but the owner’s imported manifest does not contain that plan. The existing automatic-plan branch is guarded by `bImportedOverride` inside the generated-assembly branch, so it does not fill this owner’s missing imported plan.
I built a candidate v8 plan for the existing owner FI strate without changing the default owner data. Its raw island-route audit passed: 29 route points, 78,336 capsule samples, zero blocked samples, zero unsupported probes, and zero grade failures. The composed owner audit did not pass:
- Existing compiled-analytic owner: all 3 passage interfaces pass; shell floor violations 0; ripple checks 3/3.
- Native FI candidate: only 2/3 interfaces pass; the added FI route is not walkable (1/2 strate routes walkable); shell floor violations 13; ripple checks 2/3.
- Passage tile seams passed for both bindings: 4 pairs, 4,900 shared samples, zero mismatches.
Native FI is a quality regression on the owner’s current passages, despite its standalone route plan passing. I did not switch the owner. The conditional captures, W8/W12 timing matrix, and Clang/GCC W1/W8/W12 matrix were not run because the candidate failed the composed walk/shell gate. No Core version or output baseline changed; the default owner output remains on its existing bindings. No Linux UE host build was run because there was no qualifying native change or timing matrix.
## TN/VS graph translation size
The active TN `GenerationParams` block has 47 fields; VS `VerticalShaftParams` has 11. Each also has 15 passage settings. Both have `CoreGeometry.GeneratorRecipe=0` and empty `Rooms`, `Tunnels`, and `Stamps` arrays. Native cave/lattice authoring requires at least one explicit room and one edge, with geometry, links, and route data. There is no adapter translating those legacy generator blocks into graph records. This is a substantial procedural migration, not a small recipe mapping, so I did not build it this round.
## Verification
- Fast tier: PASS, 304.0 s, 84 runs and 273 checks; includes four-pose dispatch output.
- Passage tile seams: compiled-analytic and native FI candidate both PASS at the FI owner pose.
- Owner walk/shell comparison: default PASS; native candidate FAIL as detailed above.
- Build stamp: `766b94ca7638475975b0345e5907eebb96158360c384f5d916c78eccbb1aa815`.
@@ -0,0 +1,84 @@
#!/usr/bin/env python3
"""Build three standalone liminal SurfaceWorld fixtures from the owner input."""
from __future__ import annotations
import argparse
import json
import os
from pathlib import Path
ROOT = Path(__file__).resolve().parents[4]
OWNER = Path(os.environ.get("VOXELFORGE_OWNER_DATA",
ROOT / "Standalone/data/owner_world.json"))
OUT_DEFAULT = Path(os.environ.get("VOXELFORGE_VERIFY_OUT", ROOT / "Saved/Linux/l141"))
FLAT_FIELD = {
"version": 1,
"kind": "flatField",
"minimum_arena_clearance_m": 0.0,
}
def main() -> None:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--out", type=Path, default=OUT_DEFAULT / "fixtures")
args = parser.parse_args()
args.out.mkdir(parents=True, exist_ok=True)
base = json.loads(OWNER.read_text(encoding="utf-8"))
flat = dict(base)
flat["surface_profile_override"] = dict(FLAT_FIELD)
flat["motif_family_override"] = {
"version": 1,
"strate_index": 0,
"placement_policy": "seed,strate,stable_id",
"motifs": [
{
"stable_id": "liminal/oversized-familiar-monolith-v1",
"kind": "cappedCylinder",
"radius_m": 1.6,
"height_m": 26.0,
"route_side_offset_m": 42.0,
"placement_radius_m": 0.0,
"fillet_radius_m": 0.6,
"blend_width_m": 1.2,
"minimum_spacing_m": 0.0,
"yaw_quarter_turns": 0,
"attachment": "seated_floor",
},
],
}
hills = dict(base)
hills["surface_profile_override"] = {
"version": 1,
"kind": "periodicHills",
"amplitude_x_m": 2.2,
"amplitude_y_m": 2.2,
"wavelength_x_m": 80.0,
"wavelength_y_m": 80.0,
"minimum_arena_clearance_m": 0.0,
}
road = dict(base)
road["surface_profile_override"] = dict(FLAT_FIELD)
road["liminal_road_override"] = {
"stable_id": "liminal/raised-road-v1",
"strate_index": 0,
"position_xy_m": [240.0, 180.0],
"half_extents_m": [32.5, 3.0, 0.75],
"deck_height_above_field_m": 22.0,
"yaw_quarter_turns": 0,
}
for name, fixture in (("flatField-monolith", flat),
("periodicHills", hills),
("raised-road", road)):
path = args.out / f"liminal-{name}.json"
path.write_text(json.dumps(fixture, indent=2) + "\n", encoding="utf-8")
print(f"[L141Fixture] name={name} file={path} status=PASS")
if __name__ == "__main__":
main()
@@ -0,0 +1,389 @@
#!/usr/bin/env python3
"""Run L141 prototype determinism checks and create eye-level/wide captures."""
from __future__ import annotations
import argparse
import hashlib
import json
import math
import os
from pathlib import Path
import re
import subprocess
import sys
import time
ROOT = Path(__file__).resolve().parents[4]
OUT_DEFAULT = Path(os.environ.get("VOXELFORGE_VERIFY_OUT", ROOT / "Saved/Linux/l141"))
CAPTURE_DEFAULT = Path(__file__).resolve().parent / "captures"
LIMIT = ["taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--"]
Q_PER_METRE = 1024.0
FOG_COLOR = "0.66,0.73,0.77"
sys.path.insert(0, str(ROOT / "Standalone/Tools/verify"))
from runner import bounded_run, current_stamp, first_stamp
def fmt(values) -> str:
return ",".join(f"{value:.6f}" for value in values)
def sha256(path: Path) -> str:
digest = hashlib.sha256()
with path.open("rb") as stream:
for block in iter(lambda: stream.read(1024 * 1024), b""):
digest.update(block)
return digest.hexdigest()
def run_step(name: str, command: list[object], log: Path, *, env: dict[str, str],
stamped: bool = False, timeout_seconds: int = 1740) -> str:
expected_stamp = current_stamp() if stamped else None
if stamped:
binary = Path(str(command[0]))
probe = bounded_run([str(binary), "--print-source-stamp"], timeout=15)
if probe is None or probe.returncode != 0 or first_stamp(probe.stdout or "") != expected_stamp:
raise RuntimeError(f"{name} refused a stale executable: {binary}")
started = time.monotonic()
log.parent.mkdir(parents=True, exist_ok=True)
with log.open("w", encoding="utf-8") as stream:
result = subprocess.run([*LIMIT, f"timeout", f"{timeout_seconds}s",
*map(str, command)], cwd=ROOT, env=env,
stdout=stream, stderr=subprocess.STDOUT,
timeout=timeout_seconds + 5, check=False)
elapsed = time.monotonic() - started
output = log.read_text(encoding="utf-8", errors="replace")
print(f"[L141Run] step={name} elapsed_s={elapsed:.3f} exit={result.returncode} log={log}",
flush=True)
if stamped and (first_stamp(output) != expected_stamp or current_stamp() != expected_stamp):
raise RuntimeError(f"{name} source stamp mismatch; see {log}")
if result.returncode != 0:
raise RuntimeError(f"{name} failed; see {log}")
return output
def route_frame(manifest_path: Path) -> tuple[tuple[float, float, float],
tuple[float, float, float]]:
manifest = json.loads(manifest_path.read_text(encoding="utf-8"))
strata = [entry for entry in manifest["plan"]["strates"]
if entry.get("route") and len(entry["route"]) >= 2]
if not strata:
raise RuntimeError(f"no planned SurfaceWorld route in {manifest_path}")
route = strata[0]["route"]
points = [tuple(float(value) / Q_PER_METRE for value in item["position_q"])
for item in route]
lengths = [math.dist(a, b) for a, b in zip(points, points[1:])]
total = sum(lengths)
if total <= 1.0e-6:
raise RuntimeError(f"degenerate planned route in {manifest_path}")
def at(distance: float) -> tuple[float, float, float]:
remaining = max(0.0, min(total, distance))
for index, (a, b, length) in enumerate(zip(points, points[1:], lengths)):
if remaining <= length or index == len(lengths) - 1:
if length <= 1.0e-9:
return b
t = remaining / length
return tuple(a[axis] + (b[axis] - a[axis]) * t for axis in range(3))
remaining -= length
return points[-1]
center = at(total * 0.5)
before, after = at(total * 0.5 - 1.0), at(total * 0.5 + 1.0)
dx, dy = after[0] - before[0], after[1] - before[1]
length = math.hypot(dx, dy)
if length <= 1.0e-9:
raise RuntimeError(f"degenerate route tangent in {manifest_path}")
return center, (dx / length, dy / length, 0.0)
def camera_angles(camera, target) -> tuple[float, float]:
dx, dy, dz = (target[index] - camera[index] for index in range(3))
return math.degrees(math.atan2(dx, dy)), math.degrees(math.atan2(dz, math.hypot(dx, dy)))
def point_toward(camera, target) -> tuple[float, ...]:
yaw, pitch = camera_angles(camera, target)
return (*camera, yaw, pitch)
def stamp(layout: dict, stable_id: str) -> dict:
for record in layout.get("stamps", []):
if record.get("stable_id") == stable_id:
return record
raise RuntimeError(f"missing resolved stamp {stable_id}")
def make_views(name: str, manifest_path: Path, layout_path: Path):
manifest = json.loads(manifest_path.read_text(encoding="utf-8"))
layout = json.loads(layout_path.read_text(encoding="utf-8"))
center, tangent = route_frame(manifest_path)
tx, ty, _ = tangent
nx, ny = -ty, tx
base_height = manifest["recipe"]["surface_profile"]["h0_q"] / Q_PER_METRE
if name == "flatField-monolith":
monolith = stamp(layout, "liminal/oversized-familiar-monolith-v1")
sx, sy, _ = (value / 1.0e6 for value in monolith["position_um"])
floor = monolith["floor_um"] / 1.0e6
eye_camera = (sx - tx * 36.0, sy - ty * 36.0, floor + 1.6)
eye_target = (sx, sy, floor + 10.5)
wide_camera = (sx - tx * 42.0 - nx * 18.0,
sy - ty * 42.0 - ny * 18.0, floor + 42.0)
wide_target = (sx, sy, floor + 8.0)
return {
"eye": (eye_camera, eye_target, 20),
"wide": (wide_camera, wide_target, 24),
"height_center": floor,
"height_range": 38.0,
}
if name == "periodicHills":
# Route points are capsule centers: +0.72 m places the view at 1.60 m above ground.
eye_camera = (center[0], center[1], center[2] + 0.72)
eye_target = (center[0] - tx * 45.0, center[1] - ty * 45.0,
center[2] + 0.72)
wide_camera = (center[0] - tx * 20.0 - nx * 20.0,
center[1] - ty * 20.0 - ny * 20.0, center[2] + 34.0)
wide_target = (center[0] - tx * 45.0, center[1] - ty * 45.0,
center[2] + 0.72)
return {
"eye": (eye_camera, eye_target, 20),
"wide": (wide_camera, wide_target, 28),
"height_center": base_height,
"height_range": 5.0,
}
road = stamp(layout, "liminal/raised-road-v1")
rx, ry, rz = (value / 1.0e6 for value in road["position_um"])
half_length, half_width, half_thickness = (
value / 1.0e6 for value in road["half_extents_um"])
deck = rz + half_thickness
eye_camera = (rx - half_length + 14.0, ry, deck + 1.6)
eye_target = (rx + half_length, ry, base_height)
wide_camera = (rx, ry - 28.0, deck + 24.0)
wide_target = (rx + 4.0, ry, base_height + 4.0)
return {
"eye": (eye_camera, eye_target, 24),
"wide": (wide_camera, wide_target, 26),
"height_center": base_height + 11.0,
"height_range": 32.0,
"road_deck": deck,
"road_width": 2.0 * half_width,
}
def headless_command(binary: Path, fixture: Path, camera, mesh: Path,
manifest: Path, layout: Path, workers: int,
clip_radius: int, *, hash_tiles: bool = False,
audit_road: bool = False, max_level: int = 0) -> list[object]:
command: list[object] = [binary, fixture, f"--workers={workers}",
"--seed=0", "--world-assembler-prototype", "--stream-benchmark", "--stream-pipeline",
"--force-generate", f"--clip-radius={clip_radius}",
f"--max-clip-level={max_level}",
f"--max-level={max_level}", "--render-distance-chunks=0",
f"--camera={fmt(point_toward(camera, (camera[0], camera[1] + 1.0, camera[2])))}",
f"--mesh-export={mesh}", f"--world-assembler-manifest-output={manifest}",
f"--resolved-layout-output={layout}"]
if hash_tiles:
command.append("--stream-hash-tiles")
if audit_road:
command.append("--audit-liminal-road-walk")
return command
def determinism_digest(output: str, manifest_path: Path,
layout_path: Path) -> tuple[str, str, str]:
tile_hashes = sorted(line for line in output.splitlines()
if line.startswith("[PipelineTileHash] "))
if not manifest_path.is_file() or not layout_path.is_file() or not tile_hashes:
raise RuntimeError("determinism run omitted manifest, layout or per-tile hashes")
manifest = json.loads(manifest_path.read_text(encoding="utf-8"))
layout = json.loads(layout_path.read_text(encoding="utf-8"))
manifest_digest = (manifest["content_hash"],manifest["recipe"]["content_hash"],
manifest["plan"]["content_hash"])
return ("|".join(manifest_digest),layout["stable_identity"],"\n".join(tile_hashes))
def run_determinism(name: str, fixture: Path, view, *, binaries: dict[str, Path],
out: Path, env: dict[str, str]) -> None:
camera, _, _ = view["eye"]
clip_radius = 1
max_clip = 0
baseline = None
cells = 0
for compiler, workers in ((compiler, workers)
for compiler in ("clang", "gcc")
for workers in (1, 8, 12)):
tag = f"{name}-{compiler}-w{workers}"
run_dir = out / "determinism" / tag
run_dir.mkdir(parents=True, exist_ok=True)
mesh = run_dir / "feature.vfmesh"
manifest = run_dir / "manifest.json"
layout = run_dir / "layout.json"
command = headless_command(binaries[compiler], fixture,camera,mesh,manifest,
layout,workers,max_clip,hash_tiles=True)
output = run_step(tag,command,out/"logs"/f"determinism-{tag}.log",
env=env,stamped=True)
digest = determinism_digest(output,manifest,layout)
if baseline is None:
baseline = digest
elif digest != baseline:
raise RuntimeError(f"{name} diverged at {compiler} W{workers}; see determinism logs")
cells += 1
print(f"[L141Determinism] fixture={name} compiler_worker_cells={cells} identical=yes status=PASS",
flush=True)
def export_and_capture(name: str, fixture: Path, views: dict, *,
headless: Path, renderer: Path, out: Path,
artifact_dir: Path, env: dict[str, str]) -> None:
for view_name in ("eye", "wide"):
camera, target, clip_radius = views[view_name]
clip_radius = min(clip_radius,7)
stem = f"{name}-{view_name}"
mesh = out / "capture-meshes" / f"{stem}.vfmesh"
manifest = out / "capture-manifests" / f"{stem}.json"
layout = out / "capture-layouts" / f"{stem}.json"
png = out / "capture-png" / f"{stem}.png"
image = artifact_dir / f"{stem}.jpg"
for path in (mesh,manifest,layout,png,image):
path.parent.mkdir(parents=True,exist_ok=True)
command = headless_command(headless,fixture,camera,mesh,manifest,layout,12,
clip_radius,max_level=0)
output = run_step(f"capture-{stem}-export",command,
out/"logs"/f"capture-{stem}-export.log",env=env,stamped=True)
if not mesh.is_file() or mesh.stat().st_size == 0:
raise RuntimeError(f"{stem} produced an empty mesh")
yaw, pitch = camera_angles(camera,target)
height_center = views["height_center"]
height_range = views["height_range"]
renderer_command = [renderer,mesh,png,"--size=1600x900","--fov-deg=72",
f"--camera-m={fmt(camera)}",f"--yaw-deg={yaw:.6f}",
f"--pitch-deg={pitch:.6f}","--tile-skirts=off","--shade=readable",
"--headlamp=off","--height-tint=on",f"--height-center-m={height_center:.6f}",
f"--height-range-m={height_range:.6f}","--light-direction=-0.42,-0.58,0.70",
"--fog=on","--fog-start-m=30","--fog-end-m=105",f"--fog-color={FOG_COLOR}"]
run_step(f"capture-{stem}-render",renderer_command,
out/"logs"/f"capture-{stem}-render.log",env=env,stamped=True)
run_step(f"capture-{stem}-jpeg",["ffmpeg","-nostdin","-hide_banner","-loglevel",
"error","-y","-i",png,"-frames:v","1","-q:v","4",image],
out/"logs"/f"capture-{stem}-jpeg.log",env=env)
quality = run_step(f"capture-{stem}-quality",
[sys.executable,ROOT/"Standalone/Tools/verify/capture_quality.py",image],
out/"logs"/f"capture-{stem}-quality.log",env=env)
if "[CaptureQuality]" not in quality or not image.is_file() \
or image.stat().st_size > 300_000:
raise RuntimeError(f"{stem} capture failed quality or size checks")
eye_height = "1.600m" if view_name == "eye" else "wide"
print(f"[L141Capture] fixture={name} view={view_name} eye_height={eye_height} "
f"camera_m=({fmt(camera)}) target_m=({fmt(target)}) bytes={image.stat().st_size} "
f"sha256={sha256(image)} status=PASS",flush=True)
def run_road_walk_audit(fixture: Path, view, *, headless: Path,
out: Path, env: dict[str, str]) -> None:
camera = view["eye"][0]
run_dir = out / "road-walk-audit"
run_dir.mkdir(parents=True,exist_ok=True)
output = run_step("road-walk-audit",headless_command(headless,fixture,camera,
run_dir/"audit.vfmesh",run_dir/"manifest.json",run_dir/"layout.json",12,1,
audit_road=True),out/"logs"/"road-walk-audit.log",env=env,stamped=True)
if not re.search(r"\[LiminalRoadWalkAudit\].*status=PASS",output):
raise RuntimeError("raised road failed the Core capsule walk audit")
def measure_near_ready(fixture: Path, views: dict, *, headless: Path,
out: Path, env: dict[str, str]) -> None:
uptime = subprocess.run(["uptime"],cwd=ROOT,capture_output=True,text=True,check=True).stdout.strip()
load_match = re.search(r"load average:\s*([0-9.]+)",uptime)
if not load_match or float(load_match.group(1)) >= 1.5:
raise RuntimeError(f"near-ready timing requires a quiet machine: {uptime}")
print(f"[L141TimingEnvironment] window=one W12 run after one warmup uptime='{uptime}' "
f"status=PASS",flush=True)
camera = views["eye"][0]
warm_dir = out / "near-ready" / "warmup"
timed_dir = out / "near-ready" / "measured"
warm_dir.mkdir(parents=True,exist_ok=True)
timed_dir.mkdir(parents=True,exist_ok=True)
def command(directory: Path) -> list[object]:
return [headless,fixture,"--workers=12","--world-assembler-prototype",
"--seed=0","--stream-benchmark","--stream-pipeline","--force-generate",
"--clip-radius=1","--max-clip-level=2","--max-level=2",
"--render-distance-chunks=0",
f"--camera={fmt(point_toward(camera,(camera[0],camera[1]+1.0,camera[2])))}",
f"--world-assembler-manifest-output={directory/'manifest.json'}",
f"--resolved-layout-output={directory/'layout.json'}"]
run_step("near-ready-warmup",command(warm_dir),
out/"logs"/"near-ready-warmup.log",env=env,stamped=True)
output = run_step("near-ready-measured",command(timed_dir),
out/"logs"/"near-ready-measured.log",env=env,stamped=True)
match = re.search(r"^\[WorldAssemblerNearLODPipelineReady\] lods=0-2 "
r"tiles=(\d+)/(\d+) cold_ready_s=([0-9.]+)$",output,re.M)
if not match or match.group(1)!=match.group(2):
raise RuntimeError("near-ready run did not complete the full LOD 0-2 set")
print(f"[L141NearReady] window=one W12 run after one warmup clip_radius=1 "
f"tiles={match.group(1)}/{match.group(2)} cold_ready_s={match.group(3)} status=PASS",
flush=True)
def main() -> int:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--out", type=Path, default=OUT_DEFAULT)
parser.add_argument("--artifact-dir", type=Path, default=CAPTURE_DEFAULT)
parser.add_argument("--headless-clang", type=Path, required=True)
parser.add_argument("--headless-gcc", type=Path, required=True)
parser.add_argument("--renderer", type=Path, required=True)
args = parser.parse_args()
out = args.out.resolve()
artifact_dir = args.artifact_dir.resolve()
fixture_dir = out / "fixtures"
for directory in (out,fixture_dir,artifact_dir):
directory.mkdir(parents=True,exist_ok=True)
env = os.environ.copy()
env["VOXELFORGE_VERIFY_OUT"] = str(out)
env["VOXELFORGE_OWNER_DATA"] = str(ROOT/"Standalone/data/owner_world.json")
env["LP_NUM_THREADS"] = "12"
env["XDG_CACHE_HOME"] = str(out/"xdg-cache")
run_step("build-fixtures",[sys.executable,
ROOT/"Standalone/Research/WorldAssemblerM3/Linux141/BuildL141Fixtures.py",
f"--out={fixture_dir}"],out/"logs"/"build-fixtures.log",env=env)
binaries = {"clang":args.headless_clang.resolve(),"gcc":args.headless_gcc.resolve()}
fixtures = {
"flatField-monolith":fixture_dir/"liminal-flatField-monolith.json",
"periodicHills":fixture_dir/"liminal-periodicHills.json",
"raised-road":fixture_dir/"liminal-raised-road.json",
}
probed = {}
for name,fixture in fixtures.items():
probe_dir=out/"plan-probes"/name
probe_dir.mkdir(parents=True,exist_ok=True)
camera=(0.0,0.0,-500.0)
output=run_step(f"plan-probe-{name}",headless_command(binaries["clang"],fixture,
camera,probe_dir/"probe.vfmesh",probe_dir/"manifest.json",
probe_dir/"layout.json",12,1),out/"logs"/f"plan-probe-{name}.log",
env=env,stamped=True)
if "[WorldAssemblerFullManifest]" not in output:
raise RuntimeError(f"{name} probe omitted its full plan manifest")
probed[name]=make_views(name,probe_dir/"manifest.json",probe_dir/"layout.json")
for name,fixture in fixtures.items():
run_determinism(name,fixture,probed[name],binaries=binaries,out=out,env=env)
run_road_walk_audit(fixtures["raised-road"],probed["raised-road"],
headless=binaries["clang"],out=out,env=env)
for name,fixture in fixtures.items():
export_and_capture(name,fixture,probed[name],headless=binaries["clang"],
renderer=args.renderer.resolve(),out=out,artifact_dir=artifact_dir,env=env)
measure_near_ready(fixtures["raised-road"],probed["raised-road"],
headless=binaries["clang"],out=out,env=env)
return 0
if __name__ == "__main__":
try:
raise SystemExit(main())
except Exception as error:
print(f"[L141Capture] status=FAIL error={error}",file=sys.stderr,flush=True)
raise SystemExit(1)
@@ -0,0 +1,40 @@
# L141 — first liminal layer
![flatField monolith, eye level](captures/flatField-monolith-eye.jpg)
![periodicHills, eye level](captures/periodicHills-eye.jpg)
![raised road, eye level](captures/raised-road-eye.jpg)
![flatField monolith, wide](captures/flatField-monolith-wide.jpg)
![periodicHills, wide](captures/periodicHills-wide.jpg)
![raised road, wide](captures/raised-road-wide.jpg)
The standalone fixtures and six captures are ready for review. The flat field has one oversized capped-cylinder monolith. The road is a 65 m `fillDais` platform, 6 m wide, with its deck 22 m above a flat field. Fog supplies the road's cloud-sea backdrop in these standalone images.
The `periodicHills` fixture uses the validated 80 m periods and 2.2 m amplitudes on both axes. Its field repeats exactly, but these captures show one broad rise rather than hills repeating to the horizon. The validated period is longer than the 56 m eye-level capture radius; the wider full-detail capture exceeded Core's 160-million-node interval bound. Smaller periods fail the existing profile validator. A capture extent that trims vertical tiles independently from horizontal tiles is the next useful step; this round leaves the Core profile limits unchanged.
## Changes
- Reused Core's `flatField`, `periodicHills`, `fillMonolith`, and `fillDais` support. Added standalone fixture inputs and runners in `BuildL141Fixtures.py` and `CaptureL141.py`.
- Added `liminal_road_override` as a standalone adapter to the existing free-placement `fillDais` stamp, plus `--audit-liminal-road-walk`. The walk audit samples the Core field with the existing capsule sampler and checks width and grade.
- Added optional distance fog to `LinuxOffscreenCapture` for the screenshots. The fog is capture-only; Unreal cloud rendering remains Unreal-side.
- No evaluator change or Unreal `Source/` change. Owner output hashes match their pinned L130/v227 canonical rows in the fast tier.
## Measurements
- Determinism: each fixture matched across Clang and GCC at W1, W8, and W12 (six cells per fixture). The matrix used LOD0, clip radius 1; each cell compares recipe/plan hashes, resolved-layout identity, and per-tile hashes. Individual logs are in `Saved/Linux/l141/logs/determinism-*.log`.
- Raised-road capsule walk: 127 stations, 8,001 capsule samples, zero blocked samples, zero unsupported stations, 6.000 m width against a 0.680 m capsule diameter, and 0.000° grade. See `Saved/Linux/l141/logs/road-walk-audit.log`.
- Near-ready: one W12 LOD0–2 sample after one warm-up, clip radius 1, 139/139 tiles. The measured `cold_ready_s` was **0.173886 s**. The window was one run after one warm-up; `uptime` showed a 1-minute load average of 1.31 and no other build was running. See `Saved/Linux/l141/logs/near-ready-measured.log`.
- Each capture is 1600×900 and passed `capture_quality.py`. Eye views place the camera 1.6 m above the field or road deck. Camera coordinates and image hashes are recorded in the capture runner output; export and render logs are under `Saved/Linux/l141/logs/`.
## Checks
- Clang 19 and GCC standalone builds passed with FP contraction off, four jobs, and source stamp `0a2828c398aa62870690667901d44f2daf5b1a5547b9640da6dbb01df721af8b`.
- `python3 Standalone/Tools/verify/verify.py fast --out Saved/Linux/l141 --overall-timeout 1740` passed in 285.7 s. Owner SurfaceWorld and FloatingIslands W1/W12 canonical hashes matched the L130/v227 baselines.
- Fixture determinism, dedicated road walk audit, six standalone captures, and all six image-quality checks passed.
- Python bytecode compilation and `git diff --check` passed.
- An exploratory broad `--audit-resolved-layout-passages` invocation also ran unrelated passage ripple checks and reported 2/3 passage ripple records passing, with `passage/1-2/0` failing. The focused liminal road audit passes; no legacy threshold was changed.
- No Unreal build was run because no Unreal `Source/` file changed. No timing matrix was requested or run.
## Remaining risk
The hill screenshots do not yet show multiple full repeats to the horizon. The profile itself is exactly periodic; the standalone capture volume is too short at the current full-detail safety bound. The raised road is geometric and walk-audited, while its clouds are represented by fog in the capture renderer.
Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

@@ -0,0 +1,113 @@
#!/usr/bin/env python3
"""Build the L142 liminal pictures and walk-audit controls."""
from __future__ import annotations
import argparse
import json
import os
from pathlib import Path
ROOT = Path(__file__).resolve().parents[4]
OWNER = Path(os.environ.get("VOXELFORGE_OWNER_DATA",
ROOT / "Standalone/data/owner_world.json"))
OUT_DEFAULT = Path(os.environ.get("VOXELFORGE_VERIFY_OUT", ROOT / "Saved/Linux/l142"))
FLAT_FIELD = {
"version": 1,
"kind": "flatField",
"minimum_arena_clearance_m": 0.0,
}
def main() -> None:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--out", type=Path, default=OUT_DEFAULT / "fixtures")
args = parser.parse_args()
args.out.mkdir(parents=True, exist_ok=True)
base = json.loads(OWNER.read_text(encoding="utf-8"))
monolith = dict(base)
monolith["surface_profile_override"] = dict(FLAT_FIELD)
monolith["motif_family_override"] = {
"version": 1,
"strate_index": 0,
"placement_policy": "seed,strate,stable_id",
"motifs": [{
"stable_id": "liminal/oversized-familiar-monolith-v1",
"kind": "cappedCylinder",
"radius_m": 1.6,
"height_m": 26.0,
"route_side_offset_m": 42.0,
"placement_radius_m": 0.0,
"fillet_radius_m": 0.6,
"blend_width_m": 1.2,
"minimum_spacing_m": 0.0,
"yaw_quarter_turns": 0,
"attachment": "seated_floor",
}],
}
hills = dict(base)
hills["surface_profile_override"] = {
"version": 1,
"kind": "periodicHills",
"amplitude_x_m": 2.2,
"amplitude_y_m": 2.2,
"wavelength_x_m": 80.0,
"wavelength_y_m": 80.0,
"minimum_arena_clearance_m": 0.0,
}
road_override = {
"stable_id": "liminal/road-clouds-v2",
"strate_index": 0,
"start_xy_m": [120.0, 340.0],
"path_length_m": 360.0,
"curve_control_offset_m": 84.0,
"deck_height_above_field_m": 44.0,
"rise_control_m": 22.0,
"half_width_m": 4.0,
"half_thickness_m": 1.0,
"sample_spacing_m": 2.0,
"support_spacing_m": 24.0,
"support_radius_m": 0.55,
}
road = dict(base)
road["surface_profile_override"] = dict(FLAT_FIELD)
road["liminal_road_override"] = dict(road_override)
short_control = dict(base)
short_control["surface_profile_override"] = dict(FLAT_FIELD)
short_override = dict(road_override)
short_override["path_length_m"] = 180.0
short_control["liminal_road_override"] = short_override
pillars = dict(base)
pillars["surface_profile_override"] = dict(FLAT_FIELD)
pillars["liminal_pillar_grid_override"] = {
"stable_id": "liminal/horizon-pillar-grid-v1",
"strate_index": 0,
"center_xy_m": [700.0, 800.0],
"rows": 15,
"columns": 15,
"spacing_m": 76.0,
"radius_m": 5.5,
"height_m": 40.0,
}
fixtures = (
("flatField-monolith", monolith),
("periodicHills", hills),
("road-in-clouds", road),
("road-short-control", short_control),
("pillar-grid", pillars),
)
for name, fixture in fixtures:
path = args.out / f"liminal-{name}.json"
path.write_text(json.dumps(fixture, indent=2) + "\n", encoding="utf-8")
print(f"[L142Fixture] name={name} file={path} status=PASS")
if __name__ == "__main__":
main()
@@ -0,0 +1,433 @@
#!/usr/bin/env python3
"""Run L142 liminal determinism checks, walk audits and multi-LOD captures."""
from __future__ import annotations
import argparse
import hashlib
import json
import math
import os
from pathlib import Path
import re
import subprocess
import sys
import time
ROOT = Path(__file__).resolve().parents[4]
OUT_DEFAULT = Path(os.environ.get("VOXELFORGE_VERIFY_OUT", ROOT / "Saved/Linux/l142"))
CAPTURE_DEFAULT = Path(__file__).resolve().parent / "captures"
LIMIT = ["taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--"]
Q_PER_METRE = 1024.0
FOG_COLOR = "0.66,0.73,0.77"
sys.path.insert(0, str(ROOT / "Standalone/Tools/verify"))
from runner import bounded_run, current_stamp, first_stamp
def fmt(values) -> str:
return ",".join(f"{value:.6f}" for value in values)
def sha256(path: Path) -> str:
digest = hashlib.sha256()
with path.open("rb") as stream:
for block in iter(lambda: stream.read(1024 * 1024), b""):
digest.update(block)
return digest.hexdigest()
def run_step(name: str, command: list[object], log: Path, *, env: dict[str, str],
stamped: bool = False, timeout_seconds: int = 1740,
expected_exit: int = 0) -> str:
expected_stamp = current_stamp() if stamped else None
if stamped:
binary = Path(str(command[0]))
probe = bounded_run([str(binary), "--print-source-stamp"], timeout=15)
if probe is None or probe.returncode != 0 or first_stamp(probe.stdout or "") != expected_stamp:
raise RuntimeError(f"{name} refused a stale executable: {binary}")
started = time.monotonic()
log.parent.mkdir(parents=True, exist_ok=True)
with log.open("w", encoding="utf-8") as stream:
result = subprocess.run([*LIMIT, f"timeout", f"{timeout_seconds}s",
*map(str, command)], cwd=ROOT, env=env,
stdout=stream, stderr=subprocess.STDOUT,
timeout=timeout_seconds + 5, check=False)
elapsed = time.monotonic() - started
output = log.read_text(encoding="utf-8", errors="replace")
print(f"[L142Run] step={name} elapsed_s={elapsed:.3f} exit={result.returncode} log={log}",
flush=True)
if stamped and (first_stamp(output) != expected_stamp or current_stamp() != expected_stamp):
raise RuntimeError(f"{name} source stamp mismatch; see {log}")
if result.returncode != expected_exit:
raise RuntimeError(f"{name} exit={result.returncode}, expected={expected_exit}; see {log}")
return output
def route_frame(manifest_path: Path) -> tuple[tuple[float, float, float],
tuple[float, float, float]]:
manifest = json.loads(manifest_path.read_text(encoding="utf-8"))
strata = [entry for entry in manifest["plan"]["strates"]
if entry.get("route") and len(entry["route"]) >= 2]
if not strata:
raise RuntimeError(f"no planned SurfaceWorld route in {manifest_path}")
route = strata[0]["route"]
points = [tuple(float(value) / Q_PER_METRE for value in item["position_q"])
for item in route]
lengths = [math.dist(a, b) for a, b in zip(points, points[1:])]
total = sum(lengths)
if total <= 1.0e-6:
raise RuntimeError(f"degenerate planned route in {manifest_path}")
def at(distance: float) -> tuple[float, float, float]:
remaining = max(0.0, min(total, distance))
for index, (a, b, length) in enumerate(zip(points, points[1:], lengths)):
if remaining <= length or index == len(lengths) - 1:
if length <= 1.0e-9:
return b
t = remaining / length
return tuple(a[axis] + (b[axis] - a[axis]) * t for axis in range(3))
remaining -= length
return points[-1]
center = at(total * 0.5)
before, after = at(total * 0.5 - 1.0), at(total * 0.5 + 1.0)
dx, dy = after[0] - before[0], after[1] - before[1]
length = math.hypot(dx, dy)
if length <= 1.0e-9:
raise RuntimeError(f"degenerate route tangent in {manifest_path}")
return center, (dx / length, dy / length, 0.0)
def camera_angles(camera, target) -> tuple[float, float]:
dx, dy, dz = (target[index] - camera[index] for index in range(3))
return math.degrees(math.atan2(dx, dy)), math.degrees(math.atan2(dz, math.hypot(dx, dy)))
def point_toward(camera, target) -> tuple[float, ...]:
yaw, pitch = camera_angles(camera, target)
return (*camera, yaw, pitch)
def stamp(layout: dict, stable_id: str) -> dict:
for record in layout.get("stamps", []):
if record.get("stable_id") == stable_id:
return record
raise RuntimeError(f"missing resolved stamp {stable_id}")
def make_views(name: str, manifest_path: Path, layout_path: Path):
manifest = json.loads(manifest_path.read_text(encoding="utf-8"))
layout = json.loads(layout_path.read_text(encoding="utf-8"))
center, tangent = route_frame(manifest_path)
tx, ty, _ = tangent
nx, ny = -ty, tx
base_height = manifest["recipe"]["surface_profile"]["h0_q"] / Q_PER_METRE
if name == "flatField-monolith":
monolith = stamp(layout, "liminal/oversized-familiar-monolith-v1")
sx, sy, _ = (value / 1.0e6 for value in monolith["position_um"])
floor = monolith["floor_um"] / 1.0e6
eye_camera = (sx - tx * 36.0, sy - ty * 36.0, floor + 1.6)
eye_target = (sx, sy, floor + 10.5)
wide_camera = (sx - tx * 42.0 - nx * 18.0,
sy - ty * 42.0 - ny * 18.0, floor + 42.0)
wide_target = (sx, sy, floor + 8.0)
return {
"eye": (eye_camera, eye_target, 20),
"wide": (wide_camera, wide_target, 24),
"height_center": floor,
"height_range": 38.0,
}
if name == "periodicHills":
# Route points are capsule centers: +0.72 m places the view at 1.60 m above ground.
eye_camera = (center[0], center[1], center[2] + 0.72)
eye_target = (center[0] - tx * 360.0, center[1] - ty * 360.0,
center[2] + 0.72)
wide_camera = (center[0] - tx * 36.0 - nx * 28.0,
center[1] - ty * 36.0 - ny * 28.0, center[2] + 30.0)
wide_target = (center[0] - tx * 310.0, center[1] - ty * 310.0,
center[2] + 0.72)
return {
"eye": (eye_camera, eye_target, 20),
"wide": (wide_camera, wide_target, 28),
"height_center": base_height,
"height_range": 6.0,
}
if name == "road-in-clouds":
deck = sorted((row for row in layout.get("stamps", [])
if row.get("stable_id", "").startswith("liminal/road-clouds-v2/deck/")),
key=lambda row: row["stable_id"])
if len(deck) < 2:
raise RuntimeError("road layout has no resolved swept platform chain")
points = [tuple(value / 1.0e6 for value in row["position_um"])
for row in deck]
tops = [point[2] + row["half_extents_um"][2] / 1.0e6
for point, row in zip(points, deck)]
index = max(1, len(points) // 12)
camera_dx = points[index + 1][0] - points[index - 1][0]
camera_dy = points[index + 1][1] - points[index - 1][1]
camera_tangent_length = math.hypot(camera_dx, camera_dy)
camera_tx, camera_ty = (camera_dx / camera_tangent_length,
camera_dy / camera_tangent_length)
camera_nx, camera_ny = -camera_ty, camera_tx
eye_camera = (points[index][0] + camera_nx * 3.2,
points[index][1] + camera_ny * 3.2, tops[index] + 1.6)
eye_target = (points[index][0] + camera_tx * 90.0 + camera_nx * 60.0,
points[index][1] + camera_ty * 90.0 + camera_ny * 60.0,
tops[index] - 44.0)
middle = len(points) // 2
dx = points[middle + 1][0] - points[middle - 1][0]
dy = points[middle + 1][1] - points[middle - 1][1]
tangent_length = math.hypot(dx, dy)
tx, ty = dx / tangent_length, dy / tangent_length
nx, ny = -ty, tx
wide_target_index = min(len(points) - 1, middle + 30)
wide_camera = (points[middle][0] - tx * 35.0 + nx * 30.0,
points[middle][1] - ty * 35.0 + ny * 30.0,
tops[middle] + 25.0)
wide_target = (points[wide_target_index][0], points[wide_target_index][1],
tops[wide_target_index] - 5.0)
return {
"eye": (eye_camera, eye_target, 3),
"wide": (wide_camera, wide_target, 3),
"height_center": base_height + 23.0,
"height_range": 60.0,
"road_deck": tops[middle],
"road_width": 2.0 * deck[middle]["half_extents_um"][1] / 1.0e6,
}
if name == "pillar-grid":
pillars = [row for row in layout.get("stamps", [])
if row.get("stable_id", "").startswith("liminal/horizon-pillar-grid-v1/pillar/")]
if len(pillars) < 9:
raise RuntimeError("pillar-grid layout has too few resolved supports")
xs = [row["position_um"][0] / 1.0e6 for row in pillars]
ys = [row["position_um"][1] / 1.0e6 for row in pillars]
floor = min((row["position_um"][2] - row["half_extents_um"][2]) / 1.0e6
for row in pillars)
cx, cy = (min(xs) + max(xs)) * 0.5, (min(ys) + max(ys)) * 0.5
eye_camera = (min(xs) - 78.0, cy, floor + 1.6)
eye_target = (max(xs) + 90.0, cy, floor + 1.6)
wide_camera = (cx - 280.0, cy - 420.0, floor + 230.0)
wide_target = (cx, cy, floor + 6.0)
return {
"eye": (eye_camera, eye_target, 3),
"wide": (wide_camera, wide_target, 3),
"height_center": floor + 12.0,
"height_range": 42.0,
}
raise RuntimeError(f"no capture framing for fixture {name}")
def headless_command(binary: Path, fixture: Path, camera, mesh: Path,
manifest: Path, layout: Path, workers: int,
clip_radius: int, *, hash_tiles: bool = False,
audit_road: bool = False, max_level: int = 0,
far_lods: bool = False,
max_clip_override: int | None = None) -> list[object]:
max_clip_level = (max_clip_override if max_clip_override is not None else
8 if far_lods else max_level)
command: list[object] = [binary, fixture, f"--workers={workers}",
"--seed=0", "--world-assembler-prototype", "--stream-benchmark", "--stream-pipeline",
"--force-generate", f"--clip-radius={clip_radius}",
f"--max-clip-level={max_clip_level}",
f"--max-level={max_level}", "--render-distance-chunks=0",
f"--camera={fmt(point_toward(camera, (camera[0], camera[1] + 1.0, camera[2])))}",
f"--mesh-export={mesh}", f"--world-assembler-manifest-output={manifest}",
f"--resolved-layout-output={layout}"]
if hash_tiles:
command.append("--stream-hash-tiles")
if audit_road:
command.append("--audit-liminal-road-walk")
return command
def determinism_digest(output: str, manifest_path: Path,
layout_path: Path) -> tuple[str, str, str]:
tile_hashes = sorted(line for line in output.splitlines()
if line.startswith("[PipelineTileHash] "))
if not manifest_path.is_file() or not layout_path.is_file() or not tile_hashes:
raise RuntimeError("determinism run omitted manifest, layout or per-tile hashes")
manifest = json.loads(manifest_path.read_text(encoding="utf-8"))
layout = json.loads(layout_path.read_text(encoding="utf-8"))
manifest_digest = (manifest["content_hash"],manifest["recipe"]["content_hash"],
manifest["plan"]["content_hash"])
return ("|".join(manifest_digest),layout["stable_identity"],"\n".join(tile_hashes))
def run_determinism(name: str, fixture: Path, view, *, binaries: dict[str, Path],
out: Path, env: dict[str, str]) -> None:
camera, _, _ = view["eye"]
clip_radius = 1
max_clip = 0
baseline = None
cells = 0
for compiler, workers in ((compiler, workers)
for compiler in ("clang", "gcc")
for workers in (1, 8, 12)):
tag = f"{name}-{compiler}-w{workers}"
run_dir = out / "determinism" / tag
run_dir.mkdir(parents=True, exist_ok=True)
mesh = run_dir / "feature.vfmesh"
manifest = run_dir / "manifest.json"
layout = run_dir / "layout.json"
command = headless_command(binaries[compiler], fixture,camera,mesh,manifest,
layout,workers,max_clip,hash_tiles=True)
output = run_step(tag,command,out/"logs"/f"determinism-{tag}.log",
env=env,stamped=True)
digest = determinism_digest(output,manifest,layout)
if baseline is None:
baseline = digest
elif digest != baseline:
raise RuntimeError(f"{name} diverged at {compiler} W{workers}; see determinism logs")
cells += 1
print(f"[L142Determinism] fixture={name} compiler_worker_cells={cells} identical=yes status=PASS",
flush=True)
def export_and_capture(name: str, fixture: Path, views: dict, *,
headless: Path, renderer: Path, out: Path,
artifact_dir: Path, env: dict[str, str]) -> None:
for view_name in ("eye", "wide"):
camera, target, clip_radius = views[view_name]
clip_radius = min(clip_radius,3)
stem = f"{name}-{view_name}"
mesh = out / "capture-meshes" / f"{stem}.vfmesh"
manifest = out / "capture-manifests" / f"{stem}.json"
layout = out / "capture-layouts" / f"{stem}.json"
png = out / "capture-png" / f"{stem}.png"
image = artifact_dir / f"{stem}.jpg"
for path in (mesh,manifest,layout,png,image):
path.parent.mkdir(parents=True,exist_ok=True)
command = headless_command(headless,fixture,camera,mesh,manifest,layout,12,
clip_radius,max_level=-1,far_lods=True,
max_clip_override=(2 if name == "road-in-clouds" and view_name == "wide"
else 3 if name == "road-in-clouds" else None))
output = run_step(f"capture-{stem}-export",command,
out/"logs"/f"capture-{stem}-export.log",env=env,stamped=True)
if not mesh.is_file() or mesh.stat().st_size == 0:
raise RuntimeError(f"{stem} produced an empty mesh")
yaw, pitch = camera_angles(camera,target)
height_center = views["height_center"]
height_range = views["height_range"]
if name == "road-in-clouds":
fog_start,fog_end,fog_color=(24,260,"0.88,0.93,0.95")
elif name == "pillar-grid":
fog_start,fog_end,fog_color=220,1250,"0.82,0.88,0.91"
elif name == "periodicHills":
fog_start,fog_end,fog_color=210,1000,"0.78,0.84,0.88"
else:
fog_start,fog_end,fog_color=30,105,FOG_COLOR
renderer_command = [renderer,mesh,png,"--size=1600x900","--fov-deg=72",
f"--camera-m={fmt(camera)}",f"--yaw-deg={yaw:.6f}",
f"--pitch-deg={pitch:.6f}","--tile-skirts=on","--shade=readable",
"--headlamp=off","--height-tint=on",f"--height-center-m={height_center:.6f}",
f"--height-range-m={height_range:.6f}","--light-direction=-0.42,-0.58,0.70",
"--fog=on",f"--fog-start-m={fog_start}",f"--fog-end-m={fog_end}",
f"--fog-color={fog_color}"]
run_step(f"capture-{stem}-render",renderer_command,
out/"logs"/f"capture-{stem}-render.log",env=env,stamped=True)
run_step(f"capture-{stem}-jpeg",["ffmpeg","-nostdin","-hide_banner","-loglevel",
"error","-y","-i",png,"-frames:v","1","-q:v","4",image],
out/"logs"/f"capture-{stem}-jpeg.log",env=env)
quality = run_step(f"capture-{stem}-quality",
[sys.executable,ROOT/"Standalone/Tools/verify/capture_quality.py",image],
out/"logs"/f"capture-{stem}-quality.log",env=env)
if "[CaptureQuality]" not in quality or not image.is_file() \
or image.stat().st_size > 300_000:
raise RuntimeError(f"{stem} capture failed quality or size checks")
eye_height = "1.600m" if view_name == "eye" else "wide"
print(f"[L142Capture] fixture={name} view={view_name} eye_height={eye_height} "
f"camera_m=({fmt(camera)}) target_m=({fmt(target)}) bytes={image.stat().st_size} "
f"sha256={sha256(image)} status=PASS",flush=True)
def run_road_walk_audit(fixture: Path, view, *, headless: Path,
out: Path, env: dict[str, str]) -> None:
camera = view["eye"][0]
run_dir = out / "road-walk-audit"
run_dir.mkdir(parents=True,exist_ok=True)
output = run_step("road-walk-audit",headless_command(headless,fixture,camera,
run_dir/"audit.vfmesh",run_dir/"manifest.json",run_dir/"layout.json",12,1,
audit_road=True),out/"logs"/"road-walk-audit.log",env=env,stamped=True)
if not re.search(r"\[LiminalRoadWalkAudit\].*status=PASS",output):
raise RuntimeError("raised road failed the Core capsule walk audit")
def run_road_short_negative_control(fixture: Path, view, *, headless: Path,
out: Path, env: dict[str, str]) -> None:
camera = view["eye"][0]
run_dir = out / "road-short-negative-control"
run_dir.mkdir(parents=True,exist_ok=True)
output = run_step("road-short-negative-control",
headless_command(headless,fixture,camera,run_dir/"control.vfmesh",
run_dir/"manifest.json",run_dir/"layout.json",12,1,audit_road=True),
out/"logs"/"road-short-negative-control.log",env=env,stamped=True,
expected_exit=14)
match = re.search(r"\[LiminalRoadWalkAudit\].*path_length_m=([0-9.]+).*status=FAIL",output)
if not match or float(match.group(1)) >= 300.0:
raise RuntimeError("short-road negative control did not falsify the length gate")
print(f"[L142RoadNegativeControl] path_length_m={match.group(1)} "
"expected=FAIL status=PASS",flush=True)
def main() -> int:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--out", type=Path, default=OUT_DEFAULT)
parser.add_argument("--artifact-dir", type=Path, default=CAPTURE_DEFAULT)
parser.add_argument("--headless-clang", type=Path, required=True)
parser.add_argument("--headless-gcc", type=Path, required=True)
parser.add_argument("--renderer", type=Path, required=True)
args = parser.parse_args()
out = args.out.resolve()
artifact_dir = args.artifact_dir.resolve()
fixture_dir = out / "fixtures"
for directory in (out,fixture_dir,artifact_dir):
directory.mkdir(parents=True,exist_ok=True)
env = os.environ.copy()
env["VOXELFORGE_VERIFY_OUT"] = str(out)
env["VOXELFORGE_OWNER_DATA"] = str(ROOT/"Standalone/data/owner_world.json")
env["LP_NUM_THREADS"] = "12"
env["XDG_CACHE_HOME"] = str(out/"xdg-cache")
run_step("build-fixtures",[sys.executable,
ROOT/"Standalone/Research/WorldAssemblerM3/Linux142/BuildL142Fixtures.py",
f"--out={fixture_dir}"],out/"logs"/"build-fixtures.log",env=env)
binaries = {"clang":args.headless_clang.resolve(),"gcc":args.headless_gcc.resolve()}
fixtures = {
"flatField-monolith":fixture_dir/"liminal-flatField-monolith.json",
"periodicHills":fixture_dir/"liminal-periodicHills.json",
"road-in-clouds":fixture_dir/"liminal-road-in-clouds.json",
"pillar-grid":fixture_dir/"liminal-pillar-grid.json",
}
probed = {}
for name,fixture in fixtures.items():
probe_dir=out/"plan-probes"/name
probe_dir.mkdir(parents=True,exist_ok=True)
camera=(0.0,0.0,-500.0)
output=run_step(f"plan-probe-{name}",headless_command(binaries["clang"],fixture,
camera,probe_dir/"probe.vfmesh",probe_dir/"manifest.json",
probe_dir/"layout.json",12,1),out/"logs"/f"plan-probe-{name}.log",
env=env,stamped=True)
if "[WorldAssemblerFullManifest]" not in output:
raise RuntimeError(f"{name} probe omitted its full plan manifest")
probed[name]=make_views(name,probe_dir/"manifest.json",probe_dir/"layout.json")
for name,fixture in fixtures.items():
run_determinism(name,fixture,probed[name],binaries=binaries,out=out,env=env)
run_road_walk_audit(fixtures["road-in-clouds"],probed["road-in-clouds"],
headless=binaries["clang"],out=out,env=env)
run_road_short_negative_control(fixture_dir/"liminal-road-short-control.json",
probed["road-in-clouds"],headless=binaries["clang"],out=out,env=env)
for name,fixture in fixtures.items():
export_and_capture(name,fixture,probed[name],headless=binaries["clang"],
renderer=args.renderer.resolve(),out=out,artifact_dir=artifact_dir,env=env)
return 0
if __name__ == "__main__":
try:
raise SystemExit(main())
except Exception as error:
print(f"[L142Capture] status=FAIL error={error}",file=sys.stderr,flush=True)
raise SystemExit(1)
@@ -0,0 +1,46 @@
# L142 — liminal pass 2
| Hills: eye height | Hills: wide |
|---|---|
| ![Periodic hills from eye height](captures/periodicHills-eye.jpg) | ![Periodic hills to the horizon](captures/periodicHills-wide.jpg) |
| Road: eye height | Road: wide |
|---|---|
| ![Road edge over the cloud floor](captures/road-in-clouds-eye.jpg) | ![Swept road deck and supports above the cloud floor](captures/road-in-clouds-wide.jpg) |
| Pillar grid: eye height | Pillar grid: wide |
|---|---|
| ![Pillars repeating along the horizon](captures/pillar-grid-eye.jpg) | ![Pillar grid from above](captures/pillar-grid-wide.jpg) |
| Monolith: eye height | Monolith: wide |
|---|---|
| ![The retained monolith slice at eye height](captures/flatField-monolith-eye.jpg) | ![The retained monolith slice wide](captures/flatField-monolith-wide.jpg) |
## Result
The wide hill capture shows the validated 80 m repeating profile continuing across the horizon. The capture now streams LOD 0–8; the profile period and validator are unchanged.
The road is a cubic swept path made from overlapping solid deck segments, not a chain of platform stamps. The earlier platform chain produced top steps; the swept deck passes the surface-sampled walk audit. Its wide view is capped at LOD 2 to keep the deck legible, so that frame shows a local section; the full route length is measured by the audit.
The R47 addition is a 15×15 grid of identical pillars, spaced 76 m apart across a 1,064 m span. The monolith eye and wide views are retained as the first liminal slice.
## Measurements
- **Road:** 376.827 m horizontal path length, 8.000 m width, and 12.061° maximum sampled surface grade against the 15° limit. The deck rises and falls along the cubic profile. It has 17 supports at about 24 m spacing; the flat cloud floor is 44 m below the deck centerline (about 45 m below the walking surface), with pale fog in both views.
- **Walk audit:** 901 surface stations at no more than 0.5 m spacing; 56,763 capsule samples; 0 blocked samples, 0 unsupported samples across 5,871 support probes, 0 grade failures, and 0 missed surface probes. The 180 m short-road control measured 210.341 m and failed the 300 m gate as expected.
- **Capture quality:** all eight fixtures/views passed the image-quality gate at 1600×900. Hills and pillars stream through LOD 8; road eye and wide views use caps 3 and 2 respectively.
- **Determinism:** the monolith, hills, road, and pillar fixtures each matched across Clang and GCC at W1, W8, and W12 (six compiler/worker cells per fixture), on source stamp `72f239e9534faa27e3796fe29207403b190558403841aeebc87d8e75e98e34c7`.
## Checks
- Clang 19 and GCC builds passed with floating-point contraction off, four build jobs, and the L142 source stamp.
- `Standalone/Tools/verify/verify.py fast --out Saved/Linux/l142 --overall-timeout 1740` passed. Both current owner fixtures produced all 12 canonical hash rows matching the pinned L130-v227 baseline; W1 and W12 also matched each other.
- The fast summary retains non-gating differences against older L46/L53 diagnostic baselines; the current pinned L130 canonical checks pass.
- The L142 capture runner passed the walk audit, the short-road negative control, all four determinism comparisons, and all eight image-quality checks. Final logs are in `Saved/Linux/l142/logs/`.
- No Unreal build or performance timing matrix was run. No Unreal `Source/` files changed. The inherited single-run near-ready timing step was removed from this picture-and-geometry runner rather than treated as a timing result.
## Remaining limits
The road wide capture frames a local section at LOD 2 to retain a continuous deck; the 376.827 m length is established by the full-route walk audit. Captures use the standalone Linux renderer rather than an Unreal viewport.
Changed Unreal `Source/` files: none.
Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

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