feat(core): deterministic bounded SDF landmark stamps, off by default (L43); research R10

Stamp vocabulary v1 (carve ellipsoid/arch, fill pillar/dais) with smooth CSG and seeded relief; the
director resolves records (stable ID, strate, micrometre position, conservative bounds) from
hash(seed, strate, ID) with up to 512 candidates and rejects any that touch a passage mouth, walk corridor,
content face or ceiling/bedrock band; a stamp BVH skips tiles outside all bounds. No requests: canonical
JSON and owner hashes unchanged. --landmark-chamber-demo adds a SW chamber (buried; see review).
fast/medium/full PASS on clean builds. Research R10 (read-only): ore/resource channel design.
Review also records a pre-existing W1/W12 determinism mismatch at a non-spawn camera (L37+, not S14).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
This commit is contained in:
Fr0zkaandClaude Opus 5.5 committed 2026-10-23 21:50:56 +02:00
1 parent 497e974178
commit 422dd7761a
12 files changed
+1138 -2

No files matched your search

@@ -54,6 +54,7 @@ namespace
bool HasRenderDistanceOverride=false;
int RenderDistanceOverride=0;
bool FloatingIslandsRecipe=false;
bool LandmarkChamberDemo=false;
bool TlsProbeRequested=false;
int TlsProbeWorkers=0;
std::string TlsProbeTouch="none";
@@ -107,6 +108,91 @@ namespace
return true;
}
bool MakeLandmarkChamberDemoRequests(
const VoxelForgeCore::ResolvedLayoutSnapshotV3& layout,
std::int32_t seed,
std::vector<VoxelForgeCore::ResolvedLayoutStampRequestV1>& requests,
std::string& error)
{
using namespace VoxelForgeCore;
requests.clear();
const auto surface=std::find_if(layout.strates.begin(),layout.strates.end(),
[](const auto& value){return value.generatorKind=="SurfaceWorld";});
if(surface==layout.strates.end())
{error="landmark chamber demo needs a SurfaceWorld strate";return false;}
const auto passage=std::find_if(layout.passages.begin(),layout.passages.end(),
[&](const auto& value){return value.lowerStrateIndex==surface->strateIndex
&&value.controlPoints.size()>=2;});
if(passage==layout.passages.end())
{error="landmark chamber demo needs a passage arrival mouth in SurfaceWorld";return false;}
const std::size_t mouthIndex=std::min(passage->lowerMouthControlIndex,
passage->controlPoints.size()-1);
const auto& mouth=passage->controlPoints[mouthIndex].positionSubvoxels;
const std::size_t priorIndex=mouthIndex>0?mouthIndex-1:mouthIndex;
const auto& prior=passage->controlPoints[priorIndex].positionSubvoxels;
const double dx=static_cast<double>(mouth[0])-prior[0];
const double dy=static_cast<double>(mouth[1])-prior[1];
const double length=std::hypot(dx,dy);
if(!(length>0.0))
{error="landmark chamber demo passage arrival has no horizontal tangent";return false;}
const double sideX=-dy/length,sideY=dx/length;
const double micrometresPerSubvoxel=static_cast<double>(layout.coreVoxelSizeMicrometres)
/WorldAssemblySubvoxelsPerVoxel;
std::array<std::int64_t,3> arrivalMicrometres{};
for(std::size_t axis=0;axis<3;++axis)
arrivalMicrometres[axis]=static_cast<std::int64_t>(std::llround(
mouth[axis]*micrometresPerSubvoxel));
ResolvedLayoutStampRequestV1 chamber;
chamber.stableId="landmark/sw-arrival-chamber-v1";
chamber.strateIndex=surface->strateIndex;
chamber.kind=ResolvedSdfStampKindV1::carveEllipsoid;
chamber.anchorPositionMicrometres={
arrivalMicrometres[0]+static_cast<std::int64_t>(std::llround(sideX*28000000.0)),
arrivalMicrometres[1]+static_cast<std::int64_t>(std::llround(sideY*28000000.0)),
arrivalMicrometres[2]-14000000};
chamber.placementRadiusMicrometres=2000000;
chamber.halfExtentsMicrometres={8500000,7500000,6000000};
chamber.smoothWidthMicrometres=800000;
chamber.irregularityAmplitudeMicrometres=700000;
chamber.irregularityWavelengthMicrometres=4800000;
ResolvedLayoutStampRequestV1 dais;
dais.stableId="landmark/sw-arrival-chamber-dais-v1";
dais.strateIndex=surface->strateIndex;
dais.kind=ResolvedSdfStampKindV1::fillDais;
dais.anchorPositionMicrometres=chamber.anchorPositionMicrometres;
dais.anchorPositionMicrometres[2]-=2600000;
dais.placementRadiusMicrometres=1000000;
dais.halfExtentsMicrometres={3200000,2800000,900000};
dais.smoothWidthMicrometres=300000;
dais.irregularityAmplitudeMicrometres=180000;
dais.irregularityWavelengthMicrometres=2200000;
const double entranceDirectionX=sideX,entranceDirectionY=sideY;
ResolvedLayoutStampRequestV1 entrance;
entrance.stableId="landmark/sw-arrival-chamber-entrance-v1";
entrance.strateIndex=surface->strateIndex;
entrance.kind=ResolvedSdfStampKindV1::carveArch;
entrance.anchorPositionMicrometres={
chamber.anchorPositionMicrometres[0]
+static_cast<std::int64_t>(std::llround(entranceDirectionX*6500000.0)),
chamber.anchorPositionMicrometres[1]
+static_cast<std::int64_t>(std::llround(entranceDirectionY*6500000.0)),
chamber.anchorPositionMicrometres[2]};
entrance.placementRadiusMicrometres=1000000;
entrance.halfExtentsMicrometres={2600000,4200000,3200000};
entrance.smoothWidthMicrometres=350000;
entrance.irregularityAmplitudeMicrometres=250000;
entrance.irregularityWavelengthMicrometres=2600000;
if(std::abs(entranceDirectionX)>std::abs(entranceDirectionY))
entrance.yawQuarterTurns=entranceDirectionX>0.0?3:1;
else
entrance.yawQuarterTurns=entranceDirectionY>0.0?0:2;
requests={std::move(chamber),std::move(entrance),std::move(dais)};
(void)seed;
return true;
}
bool OverrideTransitions(VFJson::Value& root,int mode,int widthChunks,std::string& error)
{
auto* object=std::get_if<VFJson::Value::Object>(&root.Data);
@@ -159,6 +245,7 @@ namespace
" --mesh-export=FILE (write the exact generated tile meshes for offline rendering)\n"
" --profile-column-overlap --far-horizon-lod8-step=N --force-generate\n"
" --seed=N --recipe=surface-world|floating-islands\n"
" --landmark-chamber-demo (opt-in version-1 SDF chamber and entry arch)\n"
" --resolved-layout-output=FILE (canonical plan-time layout snapshot)\n"
" --resolved-layout-only (exit after plan and snapshot validation)\n"
" --audit-resolved-layout-boundaries (query Core at each recorded endpoint)\n"
@@ -223,6 +310,7 @@ namespace
else if(recipe=="floating-islands")options.FloatingIslandsRecipe=true;
else {std::fprintf(stderr,"Invalid --recipe value: %.*s\n",static_cast<int>(recipe.size()),recipe.data());return false;}
}
else if(arg=="--landmark-chamber-demo")options.LandmarkChamberDemo=true;
else if(arg.starts_with("--resolved-layout-output="))
options.ResolvedLayoutOutputPath=std::string(arg.substr(std::string_view("--resolved-layout-output=").size()));
else if(arg.starts_with("--seed="))
@@ -400,6 +488,42 @@ int main(int argc,char** argv)
if(!StandaloneWorldAssemblyPrototype::BuildResolvedLayoutSnapshot(
*ownerWorld,worldAssembly,variant,resolvedLayout,error))
{std::fprintf(stderr,"Resolved-layout snapshot failed: %s\n",error.c_str());return 2;}
if(options.LandmarkChamberDemo)
{
std::vector<VoxelForgeCore::ResolvedLayoutStampRequestV1> requests;
if(!MakeLandmarkChamberDemoRequests(resolvedLayout,seed,requests,error)
||!VoxelForgeCore::ResolveResolvedLayoutStampsV1(
resolvedLayout,seed,requests,error))
{std::fprintf(stderr,"Landmark chamber stamp resolution failed: %s\n",error.c_str());return 2;}
const auto audit=VoxelForgeCore::AuditResolvedLayoutStampPlacementV1(resolvedLayout);
std::printf("[ResolvedStampPlacementAudit] vocabulary=%u records=%zu route_control=rejected band_control=rejected controls=%u/%u status=%s\n",
resolvedLayout.stampVocabularyVersion,resolvedLayout.stamps.size(),
audit.negativeControlsRejected,audit.negativeControlsRun,
audit.passed?"PASS":"FAIL");
if(!audit.passed)
{std::fprintf(stderr,"Resolved stamp placement negative control failed.\n");return 2;}
for(const auto& stamp:resolvedLayout.stamps)
std::printf("[ResolvedSdfStamp] id=%s strate=%d kind=%u position_m=(%.3f,%.3f,%.3f) bounds_um=[%lld,%lld)x[%lld,%lld)x[%lld,%lld) extents_m=(%.2f,%.2f,%.2f) irregularity_m=%.2f/%.2f seed=%llu\n",
stamp.stableId.c_str(),stamp.strateIndex,static_cast<unsigned>(stamp.kind),
stamp.positionMicrometres[0]/1000000.0,
stamp.positionMicrometres[1]/1000000.0,
stamp.positionMicrometres[2]/1000000.0,
static_cast<long long>(stamp.boundsMinimumMicrometres[0]),
static_cast<long long>(stamp.boundsMaximumMicrometres[0]),
static_cast<long long>(stamp.boundsMinimumMicrometres[1]),
static_cast<long long>(stamp.boundsMaximumMicrometres[1]),
static_cast<long long>(stamp.boundsMinimumMicrometres[2]),
static_cast<long long>(stamp.boundsMaximumMicrometres[2]),
stamp.halfExtentsMicrometres[0]/1000000.0,
stamp.halfExtentsMicrometres[1]/1000000.0,
stamp.halfExtentsMicrometres[2]/1000000.0,
stamp.irregularityAmplitudeMicrometres/1000000.0,
stamp.irregularityWavelengthMicrometres/1000000.0,
static_cast<unsigned long long>(stamp.irregularitySeed));
std::printf("[LandmarkStampDemo] enabled=true seed=%d layout_id=%s passage_safe=true walk_route_clear=true version=%u deterministic_hash=seed,strate,stable_id status=PASS\n",
seed,resolvedLayout.stableIdentity.c_str(),
resolvedLayout.stampVocabularyVersion);
}
const std::string layoutJson=resolvedLayout.ToJson();
const auto roundTrip=VoxelForgeCore::ResolvedLayoutSnapshotV3::FromJson(layoutJson,error);
if(!roundTrip||roundTrip->ToJson()!=layoutJson||roundTrip->stableIdentity!=resolvedLayout.stableIdentity)