test(measure): VerticalShafts breaks the primordial law in 15 of 16 seeds
The margin is exonerated. Every earlier run excluded 8 voxels at each strate boundary, and voxels 4-8 of those are ordinary interior, not seal -- the same window mistake that produced "FlatPlain is 99.95% void" at margin 32. So the query was re-run at margin 0, 2, 4 and 8. All four stay negative; margin 0 includes the seal itself and still reports negative. (The implementation had clamped explicit margins to >= 1, which made the margin-0 check impossible; Codex found and fixed that.) Diagnosis -- this is not a near-miss wall: arrival LowerPoint (65.8, 95.8, -1047.25) departure UpperPoint (88.4, -104.6, -991.58) XY separation 201.7 voxels (~50 m), Z delta 55.7 arrival component 22,531 cells (22.0% of air) departure component 21,621 cells (21.1% of air) nearest approach between the two components: 135-179 voxels Two large, healthy, entirely separate shaft networks half a strate apart. Nothing to breach; the archetype has no lateral connection at all. 16-seed sweep: 1 pass, 15 fail. Not one unlucky world -- structural. So: descend into a VerticalShafts strate and you probably cannot reach its exit. This is the "live hole in the shipping game" COMPOSER-NOTES Tier 1 predicted, now measured instead of assumed. Stated precisely, because it names the fix: VF_SuggestLandingPoint makes each mouth land in open space, but NOTHING makes the two mouths of one strate land in the SAME open space. New: VF_DiagnoseConnectivity returns component sizes and the spatial separation between the two mouths' components, so a near-miss and a never-meant-to-connect read differently instead of both being "false". No generation change, no threshold tuning. The fix is a design decision. Build clean, 19 succeeded / 0 warnings / 0 failed. Sweeps 3.4 s + 6.9 s. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Bp7FxoQcSoiuhxjuLr6aBM
This commit is contained in:
1 parent
cd31dec869
commit
0bbfdeb7a7
4 files changed
+526
-27
No files matched your search
@@ -164,14 +164,14 @@ namespace VoxelStrateMeasurePrivate
|
||||
}
|
||||
else if (DoubleSealThickness <= static_cast<float>(INT32_MIN))
|
||||
{
|
||||
RequestedMargin = 1;
|
||||
RequestedMargin = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
RequestedMargin = FMath::CeilToInt(DoubleSealThickness);
|
||||
}
|
||||
}
|
||||
const int32 ResolvedMargin = FMath::Clamp(RequestedMargin, 1, MaxMargin);
|
||||
const int32 ResolvedMargin = FMath::Clamp(RequestedMargin, 0, MaxMargin);
|
||||
|
||||
const int64 InteriorMinZ = StrateBottomZ + static_cast<int64>(ResolvedMargin);
|
||||
const int64 InteriorMaxZ = StrateTopZ - static_cast<int64>(ResolvedMargin);
|
||||
@@ -803,6 +803,94 @@ namespace VoxelStrateMeasurePrivate
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
EVoxelConnectivityResult EvaluateConnectivityOnGrid(
|
||||
const UVoxelGenerator& Generator,
|
||||
const FSampleGrid& Grid,
|
||||
const FVector& AVoxel,
|
||||
const FVector& BVoxel,
|
||||
int32& OutStart,
|
||||
int32& OutGoal,
|
||||
bool& bOutStartSnapped,
|
||||
bool& bOutGoalSnapped)
|
||||
{
|
||||
OutStart = -1;
|
||||
OutGoal = -1;
|
||||
bOutStartSnapped = false;
|
||||
bOutGoalSnapped = false;
|
||||
|
||||
const EEndpointCellResult StartCell = ResolveEndpointCell(
|
||||
Grid, AVoxel, OutStart, bOutStartSnapped);
|
||||
const EEndpointCellResult GoalCell = ResolveEndpointCell(
|
||||
Grid, BVoxel, OutGoal, bOutGoalSnapped);
|
||||
if (StartCell == EEndpointCellResult::OutOfWindow
|
||||
|| GoalCell == EEndpointCellResult::OutOfWindow)
|
||||
{
|
||||
return EVoxelConnectivityResult::OutOfWindow;
|
||||
}
|
||||
if (StartCell == EEndpointCellResult::Solid)
|
||||
{
|
||||
return EVoxelConnectivityResult::StartCellSolid;
|
||||
}
|
||||
if (GoalCell == EEndpointCellResult::Solid)
|
||||
{
|
||||
return EVoxelConnectivityResult::GoalCellSolid;
|
||||
}
|
||||
|
||||
TArray<int32> Path;
|
||||
if (!FindCoarsePath(Grid, OutStart, OutGoal, Path))
|
||||
{
|
||||
return EVoxelConnectivityResult::NotConnectedAtThisResolution;
|
||||
}
|
||||
|
||||
// The coarse route is evidence, not a pass. Re-check this one BFS route at one-voxel
|
||||
// spacing in the original voxel field. A single solid sample is the dangerous coarse
|
||||
// false positive.
|
||||
if (!FullResolutionPathIsAir(Generator, Grid, AVoxel, BVoxel, Path))
|
||||
{
|
||||
return EVoxelConnectivityResult::CoarseLied;
|
||||
}
|
||||
return EVoxelConnectivityResult::Connected;
|
||||
}
|
||||
|
||||
float DistanceToComponent(
|
||||
const FSampleGrid& Grid,
|
||||
int32 StartCell,
|
||||
int32 TargetComponent,
|
||||
const TArray<int32>& Components)
|
||||
{
|
||||
if (Components[StartCell] == TargetComponent)
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
int32 StartX = 0;
|
||||
int32 StartY = 0;
|
||||
int32 StartZ = 0;
|
||||
DecodeIndex(Grid, StartCell, StartX, StartY, StartZ);
|
||||
int64 BestDistanceSquared = MAX_int64;
|
||||
for (int32 Index = 0; Index < Grid.CellCount; ++Index)
|
||||
{
|
||||
if (Components[Index] != TargetComponent)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
int32 X = 0;
|
||||
int32 Y = 0;
|
||||
int32 Z = 0;
|
||||
DecodeIndex(Grid, Index, X, Y, Z);
|
||||
const int64 DX = static_cast<int64>(X) - static_cast<int64>(StartX);
|
||||
const int64 DY = static_cast<int64>(Y) - static_cast<int64>(StartY);
|
||||
const int64 DZ = static_cast<int64>(Z) - static_cast<int64>(StartZ);
|
||||
const int64 DistanceSquared = DX * DX + DY * DY + DZ * DZ;
|
||||
BestDistanceSquared = FMath::Min(BestDistanceSquared, DistanceSquared);
|
||||
}
|
||||
|
||||
return BestDistanceSquared == MAX_int64
|
||||
? -1.0f
|
||||
: FMath::Sqrt(static_cast<float>(BestDistanceSquared));
|
||||
}
|
||||
}
|
||||
|
||||
FVoxelStrateMetrics VF_MeasureStrate(
|
||||
@@ -859,38 +947,109 @@ EVoxelConnectivityResult VF_AreConnected(
|
||||
|
||||
int32 Start = -1;
|
||||
int32 Goal = -1;
|
||||
const VoxelStrateMeasurePrivate::EEndpointCellResult StartCell =
|
||||
VoxelStrateMeasurePrivate::ResolveEndpointCell(
|
||||
Grid, AVoxel, Start, bOutStartSnapped);
|
||||
const VoxelStrateMeasurePrivate::EEndpointCellResult GoalCell =
|
||||
VoxelStrateMeasurePrivate::ResolveEndpointCell(
|
||||
Grid, BVoxel, Goal, bOutGoalSnapped);
|
||||
if (StartCell == VoxelStrateMeasurePrivate::EEndpointCellResult::OutOfWindow
|
||||
|| GoalCell == VoxelStrateMeasurePrivate::EEndpointCellResult::OutOfWindow)
|
||||
return VoxelStrateMeasurePrivate::EvaluateConnectivityOnGrid(
|
||||
Generator,
|
||||
Grid,
|
||||
AVoxel,
|
||||
BVoxel,
|
||||
Start,
|
||||
Goal,
|
||||
bOutStartSnapped,
|
||||
bOutGoalSnapped);
|
||||
}
|
||||
|
||||
FVoxelConnectivityDiagnostics VF_DiagnoseConnectivity(
|
||||
const UVoxelGenerator& Generator,
|
||||
const UVoxelStrateManager& Manager,
|
||||
int32 StrateIndex,
|
||||
const FVector& AVoxel,
|
||||
const FVector& BVoxel,
|
||||
const FVoxelStrateMeasureSettings& Settings)
|
||||
{
|
||||
FVoxelConnectivityDiagnostics Result;
|
||||
if (!FMath::IsFinite(AVoxel.X) || !FMath::IsFinite(AVoxel.Y) || !FMath::IsFinite(AVoxel.Z)
|
||||
|| !FMath::IsFinite(BVoxel.X) || !FMath::IsFinite(BVoxel.Y) || !FMath::IsFinite(BVoxel.Z))
|
||||
{
|
||||
return EVoxelConnectivityResult::OutOfWindow;
|
||||
return Result;
|
||||
}
|
||||
if (StartCell == VoxelStrateMeasurePrivate::EEndpointCellResult::Solid)
|
||||
|
||||
VoxelStrateMeasurePrivate::FSampleGrid Grid;
|
||||
FString RefusalReason;
|
||||
if (!VoxelStrateMeasurePrivate::BuildSampleGrid(
|
||||
Generator, Manager, StrateIndex, Settings, Grid, RefusalReason))
|
||||
{
|
||||
return Result;
|
||||
}
|
||||
|
||||
int32 Start = -1;
|
||||
int32 Goal = -1;
|
||||
Result.Result = VoxelStrateMeasurePrivate::EvaluateConnectivityOnGrid(
|
||||
Generator,
|
||||
Grid,
|
||||
AVoxel,
|
||||
BVoxel,
|
||||
Start,
|
||||
Goal,
|
||||
Result.bStartSnapped,
|
||||
Result.bGoalSnapped);
|
||||
Result.bValid = Result.Result != EVoxelConnectivityResult::OutOfWindow
|
||||
|| (Start >= 0 && Goal >= 0);
|
||||
if (Start < 0 || Goal < 0)
|
||||
{
|
||||
return EVoxelConnectivityResult::StartCellSolid;
|
||||
return Result;
|
||||
}
|
||||
if (GoalCell == VoxelStrateMeasurePrivate::EEndpointCellResult::Solid)
|
||||
|
||||
TArray<int32> Components;
|
||||
int32 NumComponents = 0;
|
||||
int64 LargestComponentCells = 0;
|
||||
int32 LargestComponentLowestCell = INDEX_NONE;
|
||||
int32 NumComponentsAtLeast1Pct = 0;
|
||||
int64 NumAir = 0;
|
||||
for (const uint8 bAir : Grid.Air)
|
||||
{
|
||||
NumAir += bAir != 0u ? 1 : 0;
|
||||
}
|
||||
FloodFillAir(
|
||||
Grid,
|
||||
Components,
|
||||
NumComponents,
|
||||
NumAir,
|
||||
LargestComponentCells,
|
||||
LargestComponentLowestCell,
|
||||
NumComponentsAtLeast1Pct);
|
||||
|
||||
const int32 StartComponent = Components[Start];
|
||||
const int32 GoalComponent = Components[Goal];
|
||||
if (StartComponent < 0 || GoalComponent < 0)
|
||||
{
|
||||
return EVoxelConnectivityResult::GoalCellSolid;
|
||||
return Result;
|
||||
}
|
||||
|
||||
TArray<int32> Path;
|
||||
if (!VoxelStrateMeasurePrivate::FindCoarsePath(Grid, Start, Goal, Path))
|
||||
TArray<int32> ComponentCells;
|
||||
ComponentCells.Init(0, NumComponents);
|
||||
for (const int32 Component : Components)
|
||||
{
|
||||
return EVoxelConnectivityResult::NotConnectedAtThisResolution;
|
||||
if (Component >= 0)
|
||||
{
|
||||
++ComponentCells[Component];
|
||||
}
|
||||
}
|
||||
|
||||
// The coarse route is evidence, not a pass. Re-check this one BFS route at one-voxel spacing
|
||||
// in the original voxel field. A single solid sample is the dangerous coarse false positive.
|
||||
if (!VoxelStrateMeasurePrivate::FullResolutionPathIsAir(
|
||||
Generator, Grid, AVoxel, BVoxel, Path))
|
||||
Result.NumAirCells = NumAir;
|
||||
Result.StartComponentCells = ComponentCells[StartComponent];
|
||||
Result.GoalComponentCells = ComponentCells[GoalComponent];
|
||||
if (NumAir > 0)
|
||||
{
|
||||
return EVoxelConnectivityResult::CoarseLied;
|
||||
Result.StartComponentShare = static_cast<float>(
|
||||
static_cast<double>(Result.StartComponentCells) / static_cast<double>(NumAir));
|
||||
Result.GoalComponentShare = static_cast<float>(
|
||||
static_cast<double>(Result.GoalComponentCells) / static_cast<double>(NumAir));
|
||||
}
|
||||
return EVoxelConnectivityResult::Connected;
|
||||
Result.StartToGoalComponentDistanceCells =
|
||||
VoxelStrateMeasurePrivate::DistanceToComponent(
|
||||
Grid, Start, GoalComponent, Components);
|
||||
Result.GoalToStartComponentDistanceCells =
|
||||
VoxelStrateMeasurePrivate::DistanceToComponent(
|
||||
Grid, Goal, StartComponent, Components);
|
||||
return Result;
|
||||
}
|
||||
Reference in new issue
Block a user