wip(assembler): M1 round 4 PARTIAL -- stopped at owner's request (GPU coil whine at night)

Unverified mid-round state (cliff plates / horizon slab / routes in progress). Resume from here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MmSoF64BbRFmk9C3p1VsBJ
This commit is contained in:
Fr0zkaandClaude Opus 5.5 committed 2026-10-09 02:12:39 +02:00
1 parent 2c20f9eaea
commit 20c6d86f0e
11 files changed
+839 -47

No files matched your search

+234 -5
View File
@@ -7878,6 +7878,152 @@ float3 Lit=Rock*(Ambient+0.88*Diffuse)+float3(0.50,0.69,0.82)*Head*0.75;
return hash?hash:1;
}
bool BuildFiniteStrateRoute(VoxelForgeCore::WorldAssemblyRecipeV1& recipe,
VoxelForgeCore::WorldAssemblyStratumPlanV1& stratum,std::uint64_t& tested,
std::uint64_t& gradeRejected,std::uint64_t& sweepRejected,std::string& error)
{
using namespace VoxelForgeCore;
constexpr std::int64_t PlayerRadiusQ=348; // 0.34 m in Core's 0.25 m voxel scale.
constexpr std::int64_t PlayerHeightQ=1802; // 1.76 m in Core's 0.25 m voxel scale.
constexpr std::int64_t HalfHeightQ=PlayerHeightQ/2;
constexpr std::int64_t StepQ=128; // 0.5 Core voxel, finer than the density lattice.
constexpr std::int64_t ProbeRadiusQ=174;
constexpr std::int64_t SupportDepthQ=256;
constexpr std::int64_t GradeQ16=17560; // tan(15 degrees), rounded upward.
constexpr std::int64_t RouteRadiusQ=4*WorldAssemblySubvoxelsPerVoxel;
struct Direction {std::int32_t x,y;};
constexpr std::array<Direction,8> directions{{
{65536,0},{46341,46341},{0,65536},{-46341,46341},
{-65536,0},{-46341,-46341},{0,-65536},{46341,-46341}}};
struct Candidate
{
std::int64_t score=0;
std::int32_t centerX=0,centerY=0,direction=0;
std::vector<WorldAssemblyRoutePointV1> points;
};
auto& constraints=stratum.routeConstraints;
constraints.version=1;
constraints.capsuleRadiusSubvoxels=PlayerRadiusQ;
constraints.capsuleHeightSubvoxels=PlayerHeightQ;
constraints.maximumGradeQ16=GradeQ16;
constraints.sweepSpacingSubvoxels=StepQ;
constraints.supportProbeRadiusSubvoxels=ProbeRadiusQ;
constraints.supportSearchDepthSubvoxels=SupportDepthQ;
constraints.minimumClearanceSubvoxels=8;
constraints.minimumSupportProbes=3;
const Heightfield2D finalField(recipe,stratum);
if(!finalField.isValid())
{error="route planner received an invalid final composed field";return false;}
std::vector<Candidate> candidates;
constexpr std::int32_t halfLength=128;
constexpr std::int32_t waypointSpacing=8;
for(std::int32_t centerY=-256;centerY<=256;centerY+=64)
for(std::int32_t centerX=-256;centerX<=256;centerX+=64)
for(std::int32_t directionIndex=0;directionIndex<static_cast<std::int32_t>(directions.size());++directionIndex)
{
Candidate candidate;
candidate.centerX=centerX;candidate.centerY=centerY;candidate.direction=directionIndex;
candidate.points.reserve(33);
std::int64_t previousGround=0,previousX=0,previousY=0;
bool gradePass=true;
for(std::int32_t index=0;index<=32;++index)
{
const std::int64_t along=(index-16)*waypointSpacing;
const std::int64_t x=centerX+std::llround(
static_cast<double>(along)*directions[directionIndex].x/65536.0);
const std::int64_t y=centerY+std::llround(
static_cast<double>(along)*directions[directionIndex].y/65536.0);
const auto column=finalField.point(WorldAssemblyFixed(static_cast<double>(x)),
WorldAssemblyFixed(static_cast<double>(y)),0);
const std::int64_t horizontalQ=static_cast<std::int64_t>(std::llround(
std::hypot(static_cast<double>(x-previousX),static_cast<double>(y-previousY))
*WorldAssemblySubvoxelsPerVoxel));
if(index>0)
{
const std::int64_t riseQ=std::abs(column.groundHeightSubvoxels-previousGround);
if(horizontalQ==0||riseQ*65536>horizontalQ*GradeQ16)
{gradePass=false;break;}
candidate.score+=riseQ*65536/std::max<std::int64_t>(1,horizontalQ);
}
WorldAssemblyRoutePointV1 point;
point.positionSubvoxels={WorldAssemblyFixed(static_cast<double>(x)),
WorldAssemblyFixed(static_cast<double>(y)),column.groundHeightSubvoxels+HalfHeightQ};
point.radiusSubvoxels=RouteRadiusQ;
point.stableFeatureId=WorldAssemblyFeatureId(recipe.seed,
static_cast<std::int64_t>(x),static_cast<std::int64_t>(y),
0x52540000u+static_cast<std::uint32_t>(index));
candidate.points.push_back(point);
previousGround=column.groundHeightSubvoxels;previousX=x;previousY=y;
}
++tested;
if(gradePass)candidates.push_back(std::move(candidate));
else ++gradeRejected;
}
std::stable_sort(candidates.begin(),candidates.end(),[](const Candidate& a,const Candidate& b)
{
if(a.score!=b.score)return a.score<b.score;
if(a.centerY!=b.centerY)return a.centerY<b.centerY;
if(a.centerX!=b.centerX)return a.centerX<b.centerX;
return a.direction<b.direction;
});
std::uint64_t sweepAttempt=0,repairAttempt=0;
VoxelForgeCore::WorldAssemblyRouteAuditResult lastAudit{};
for(auto& candidate:candidates)
{
stratum.route=candidate.points;
std::int64_t liftQ=0;
constexpr std::int64_t RepairStepQ=64;
constexpr std::int64_t MaximumRepairLiftQ=SupportDepthQ-RepairStepQ;
for(;;)
{
if(liftQ>0)
for(std::size_t pointIndex=0;pointIndex<stratum.route.size();++pointIndex)
stratum.route[pointIndex].positionSubvoxels[2]
=candidate.points[pointIndex].positionSubvoxels[2]+liftQ;
const Heightfield2D candidateField(recipe,stratum);
const auto audit=AuditHeightfieldRoute(candidateField);
lastAudit=audit;
if(audit.passed)
{
if(liftQ>0)
std::printf("[WorldAssemblerRouteRepaired] uniform_lift_q=%lld support_limit_q=%lld\n",
static_cast<long long>(liftQ),static_cast<long long>(SupportDepthQ));
return true;
}
if(audit.blockedCapsuleSamples==0||liftQ>=MaximumRepairLiftQ)break;
const std::int64_t needed=std::max<std::int64_t>(1,
constraints.minimumClearanceSubvoxels-audit.minimumClearanceSubvoxels);
const std::int64_t steps=(needed+RepairStepQ-1)/RepairStepQ;
const std::int64_t nextLift=std::max(liftQ+RepairStepQ,liftQ+steps*RepairStepQ);
if(nextLift>MaximumRepairLiftQ)break;
liftQ=nextLift;
++repairAttempt;
}
if(sweepAttempt<3)
std::printf("[WorldAssemblerRouteCandidateRejected] ordinal=%llu blocked=%llu unsupported=%llu grade_failures=%llu minimum_clearance_q=%lld\n",
static_cast<unsigned long long>(sweepAttempt),
static_cast<unsigned long long>(lastAudit.blockedCapsuleSamples),
static_cast<unsigned long long>(lastAudit.unsupportedCenterSamples),
static_cast<unsigned long long>(lastAudit.gradeFailures),
static_cast<long long>(lastAudit.minimumClearanceSubvoxels));
++sweepAttempt;
++sweepRejected;
}
std::printf("[WorldAssemblerRouteSearchFailed] tested=%llu grade_rejected=%llu sweepable_candidates=%llu sweep_rejected=%llu last_blocked=%llu last_unsupported=%llu last_grade_failures=%llu\n",
static_cast<unsigned long long>(tested),static_cast<unsigned long long>(gradeRejected),
static_cast<unsigned long long>(candidates.size()),static_cast<unsigned long long>(sweepRejected),
static_cast<unsigned long long>(lastAudit.blockedCapsuleSamples),
static_cast<unsigned long long>(lastAudit.unsupportedCenterSamples),
static_cast<unsigned long long>(lastAudit.gradeFailures));
std::printf("[WorldAssemblerRouteRepairSummary] repair_attempts=%llu\n",
static_cast<unsigned long long>(repairAttempt));
stratum.route.clear();
error="finite-strate route candidates failed the composed-field capsule and support sweep";
return false;
}
bool AttachRound1WorldAssemblyPrototype(FStandaloneOwnerWorld& owner,VFJson::Value& root,
std::string& error,const std::string& manifestOutputPath)
{
@@ -8067,9 +8213,25 @@ float3 Lit=Rock*(Ambient+0.88*Diffuse)+float3(0.50,0.69,0.82)*Head*0.75;
stratum.features.push_back(shelf);
}
}
std::uint64_t routeCandidates=0,routeGradeRejected=0,routeSweepRejected=0;
if(!BuildFiniteStrateRoute(recipe,stratum,routeCandidates,routeGradeRejected,
routeSweepRejected,error))return false;
std::printf("[WorldAssemblerRoutePlan] candidates=%llu grade_rejected=%llu sweep_rejected=%llu accepted_points=%zu capsule_m=0.34x1.76 corridor_radius_vox=4 support_probe_points=5 minimum_support_probes=%u status=PASS\n",
static_cast<unsigned long long>(routeCandidates),
static_cast<unsigned long long>(routeGradeRejected),
static_cast<unsigned long long>(routeSweepRejected),stratum.route.size(),
stratum.routeConstraints.minimumSupportProbes);
manifest.plan.strates.push_back(std::move(stratum));
if(!manifest.finalize(error))return false;
const std::string manifestText=manifest.ToJson();
const auto roundTrip=VoxelForgeCore::WorldAssemblyManifest::FromJson(manifestText,error);
if(!roundTrip||!roundTrip->validate(error)||roundTrip->ToJson()!=manifestText
||roundTrip->contentHash!=manifest.contentHash)
{if(error.empty())error="world assembly canonical plan serialization did not round-trip";return false;}
std::printf("[WorldAssemblerPlanSerialization] bytes=%zu canonical_round_trip=true route_points=%zu plan_hash=%016llx manifest_hash=%016llx status=PASS\n",
manifestText.size(),manifest.plan.strates.front().route.size(),
static_cast<unsigned long long>(manifest.plan.contentHash),
static_cast<unsigned long long>(manifest.contentHash));
if(!manifestOutputPath.empty())
{
const std::filesystem::path outputPath(manifestOutputPath);
@@ -8134,6 +8296,55 @@ float3 Lit=Rock*(Ambient+0.88*Diffuse)+float3(0.50,0.69,0.82)*Head*0.75;
static_cast<unsigned long long>(bounds.exceptionPointSamples),
bounds.negativeControlDetected?"true":"false",bounds.passed?"PASS":"FAIL");
const auto shelfThickness=VoxelForgeCore::AuditHeightfieldShelfThickness(block);
std::printf("[WorldAssemblerShelfThicknessAudit] features=%llu columns=%llu active_columns=%llu negative_runs=%llu minimum_observed_vox=%.3f sub_voxel_runs=%llu sub_voxel_columns=%llu legacy_sub_voxel_runs=%llu legacy_sub_voxel_control_columns=%llu negative_control_detected=%s status=%s\n",
static_cast<unsigned long long>(shelfThickness.featuresTested),
static_cast<unsigned long long>(shelfThickness.columnsTested),
static_cast<unsigned long long>(shelfThickness.activeColumns),
static_cast<unsigned long long>(shelfThickness.negativeRuns),
static_cast<double>(shelfThickness.minimumObservedThicknessSubvoxels)
/VoxelForgeCore::WorldAssemblySubvoxelsPerVoxel,
static_cast<unsigned long long>(shelfThickness.subVoxelRuns),
static_cast<unsigned long long>(shelfThickness.subVoxelColumns),
static_cast<unsigned long long>(shelfThickness.legacySubVoxelRuns),
static_cast<unsigned long long>(shelfThickness.legacySubVoxelColumns),
shelfThickness.negativeControlDetected?"true":"false",
shelfThickness.passed?"PASS":"FAIL");
std::printf("[WorldAssemblerShelfMinimumColumn] x_vox=%.3f y_vox=%.3f ground_z_vox=%.3f run_bottom_z_vox=%.3f run_top_z_vox=%.3f\n",
static_cast<double>(shelfThickness.minimumThicknessColumnXSubvoxels)
/VoxelForgeCore::WorldAssemblySubvoxelsPerVoxel,
static_cast<double>(shelfThickness.minimumThicknessColumnYSubvoxels)
/VoxelForgeCore::WorldAssemblySubvoxelsPerVoxel,
static_cast<double>(shelfThickness.minimumThicknessGroundSubvoxels)
/VoxelForgeCore::WorldAssemblySubvoxelsPerVoxel,
static_cast<double>(shelfThickness.minimumThicknessBottomSubvoxels)
/VoxelForgeCore::WorldAssemblySubvoxelsPerVoxel,
static_cast<double>(shelfThickness.minimumThicknessTopSubvoxels)
/VoxelForgeCore::WorldAssemblySubvoxelsPerVoxel);
const auto routeAudit=VoxelForgeCore::AuditHeightfieldRoute(block);
auto raisedRoutePlan=plan;
for(auto& point:raisedRoutePlan.route)
point.positionSubvoxels[2]+=16*VoxelForgeCore::WorldAssemblySubvoxelsPerVoxel;
const VoxelForgeCore::Heightfield2D raisedRouteBlock(manifest->recipe,raisedRoutePlan);
const auto raisedRouteAudit=VoxelForgeCore::AuditHeightfieldRoute(raisedRouteBlock);
const bool routeSupportNegativeControl=!raisedRouteAudit.passed
&&raisedRouteAudit.unsupportedCenterSamples>0;
std::printf("[WorldAssemblerRouteSweep] points=%zu segments=%llu swept_centers=%llu capsule_field_samples=%llu blocked_samples=%llu support_probes=%llu unsupported_centers=%llu grade_failures=%llu minimum_clearance_q=%lld maximum_support_depth_q=%lld unsupported_control_centers=%llu negative_control_detected=%s collision_readiness=%s status=%s\n",
plan.route.size(),static_cast<unsigned long long>(routeAudit.segmentsTested),
static_cast<unsigned long long>(routeAudit.centerSamples),
static_cast<unsigned long long>(routeAudit.capsuleFieldSamples),
static_cast<unsigned long long>(routeAudit.blockedCapsuleSamples),
static_cast<unsigned long long>(routeAudit.supportProbeSamples),
static_cast<unsigned long long>(routeAudit.unsupportedCenterSamples),
static_cast<unsigned long long>(routeAudit.gradeFailures),
static_cast<long long>(routeAudit.minimumClearanceSubvoxels),
static_cast<long long>(routeAudit.maximumSupportDepthSubvoxels),
static_cast<unsigned long long>(raisedRouteAudit.unsupportedCenterSamples),
routeSupportNegativeControl?"true":"false",
routeAudit.passed?"analytic_field_sweep_ready":"blocked",
routeAudit.passed&&routeSupportNegativeControl?"PASS":"FAIL");
bool cliffRegressionPassing=false;
const auto cliffIt=std::find_if(plan.features.begin(),plan.features.end(),
[](const auto& feature){return feature.type==4;});
@@ -8496,12 +8707,26 @@ float3 Lit=Rock*(Ambient+0.88*Diffuse)+float3(0.50,0.69,0.82)*Head*0.75;
coreQueryMaximumError=std::max(coreQueryMaximumError,std::abs(expected-actual));
++coreQuerySamples;
}
for(const auto& routePoint:plan.route)
{
const auto& position=routePoint.positionSubvoxels;
const double x=static_cast<double>(position[0])/VoxelForgeCore::WorldAssemblySubvoxelsPerVoxel;
const double y=static_cast<double>(position[1])/VoxelForgeCore::WorldAssemblySubvoxelsPerVoxel;
const double z=static_cast<double>(position[2])/VoxelForgeCore::WorldAssemblySubvoxelsPerVoxel;
const double expected=static_cast<double>(block.point(position[0],position[1],position[2])
.densitySubvoxels)/VoxelForgeCore::WorldAssemblySubvoxelsPerVoxel;
const double actual=coreWorld.densityAt({x,y,z});
coreQueryMaximumError=std::max(coreQueryMaximumError,std::abs(expected-actual));
++coreQuerySamples;
}
}
const bool coreQueryPass=coreCompiled&&coreQuerySamples==45&&coreQueryMaximumError<=1.0/256.0;
std::printf("[WorldAssemblerCoreQuery] compiled=%s compile_ms=%.3f samples=%llu max_abs_error=%.8f render_meshes_generated=0 readiness=%s status=%s error=%s\n",
const std::uint64_t expectedCoreQuerySamples=45+plan.route.size();
const bool coreQueryPass=coreCompiled&&coreQuerySamples==expectedCoreQuerySamples
&&coreQueryMaximumError<=1.0/256.0;
std::printf("[WorldAssemblerServerFieldQuery] role=server_api_path=World::densityAt compiled=%s compile_ms=%.3f samples=%llu route_waypoints=%zu max_abs_error=%.8f render_meshes_generated=0 local_field_query=%s collision_mesh_cooking=not_in_standalone_core status=%s error=%s\n",
coreCompiled?"true":"false",coreCompileMs,
static_cast<unsigned long long>(coreQuerySamples),coreQueryMaximumError,
coreQueryPass?"field_ready_without_meshes":"unavailable",coreQueryPass?"PASS":"FAIL",
static_cast<unsigned long long>(coreQuerySamples),plan.route.size(),coreQueryMaximumError,
coreQueryPass?"ready_without_meshes":"unavailable",coreQueryPass?"PASS":"FAIL",
coreError.empty()?"none":coreError.c_str());
if(!captureDirectory.empty())
{
@@ -8582,7 +8807,11 @@ float3 Lit=Rock*(Ambient+0.88*Diffuse)+float3(0.50,0.69,0.82)*Head*0.75;
ownerSaved&&nativeSaved?"PASS":"FAIL");
}
std::printf("[WorldAssemblerFullViewTiming] status=NOT_MEASURED_IN_AUDIT_MODE; capture_viewer_runs_report_separately\n");
return bounds.passed&&cliffRegressionPassing&&seamClassificationPassing
std::printf("[WorldAssemblerReadiness] local_field_query=%s analytic_collision_validation=%s physics_collision_cooking=deferred_to_Unreal_adapter render_mesh_readiness=reported_by_matched_view_runs\n",
coreQueryPass?"ready_without_render_meshes":"not_ready",
routeAudit.passed?"route_sweep_ready":"not_ready");
return bounds.passed&&shelfThickness.passed&&routeAudit.passed
&&routeSupportNegativeControl&&cliffRegressionPassing&&seamClassificationPassing
&&deterministic&&coreQueryPass?0:11;
}
}