wip(tunnels): continuous world-core sweep, slope in degrees, bounded winding -- NOT MERGED: +18-30% worker CPU, visuals unconfirmed

Tunnel round from the owner's playtest. Luna's ablations traced the ribs to the world-space tunnel-core stage: disabling it removes them, while terracing, detail ops, roughness, the support floor, lateral warp, radius jitter, winding and LOD do not. The per-span capsule union is replaced by a deterministic Catmull-Rom sweep. Winding and graph expansion are now gated on bTunnelFloorEnabled (they ran even with the floor off). TunnelFloorGentleSlopeThreshold is authored in degrees (0-90, min 1 deg, DetSinCos conversion, legacy tangent values migrated: 0.3 -> 16.7 deg). The route length is capped at 6 waves x 640 = 3840 voxels, so 0.1 deg loads instead of freezing (2048 collapsed canonical reach; 24576 used ~2 GB). Room-wall trimming is behind voxel.TunnelMouthTrim (default OFF): with it on, a 36 m gap disconnects the walk.

Canonical walk: 20,907 / 10,981, connected (was 20,830 / 10,909); exports identical with -voxel.CrtFma3=0; TilePostReachProof, DetSinCos and strate crossing pass. NOT merged because: one S/M pair vs the tip DLL shows worker CPU +17.8% static / +30.3% moving and worse p95; and the orchestrator's look at the before/after renders is inconclusive (camera not matched; regular grooves still visible in the after interior). Next: owner checks the look in game; if smooth, make the sweep cheap before merging; if not, drop the sweep and keep the degrees/bound/wind-gate parts.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MmSoF64BbRFmk9C3p1VsBJ
This commit is contained in:
Fr0zkaandClaude Opus 5 committed 2026-09-16 18:29:27 +02:00
1 parent bf9384a1d5
commit 0231072cc4
8 files changed
+1138 -248

No files matched your search

@@ -54,6 +54,47 @@ namespace VoxelPassageGeometry
// fallback threshold at which a room-to-room floor must become a terrace.
constexpr float PlayerWalkableFloorMaxGradient = 0.9656887748070738f; // tan(44 degrees)
// TunnelFloorGentleSlopeThreshold is authored as degrees. Zero is still a legal UI value,
// but the construction path uses this small positive floor so a malformed/overly strict
// value cannot turn the graph collect window into an unbounded switchback search.
constexpr float TunnelFloorGentleSlopeMinimumDegrees = 1.0f;
constexpr float TunnelFloorGentleSlopeMaximumDegrees = 90.0f;
// The route solver uses at most six half-waves. The canonical tunnel envelope is the default
// 360-voxel tunnel reach plus its endpoint correction; round that direct-run envelope up to
// 640 voxels, then derive the total cap from the same wave limit. This leaves room above the
// proven canonical route while keeping the 0.1-degree collect window finite and bounded.
constexpr int32 TunnelFloorMaximumWindWaves = 6;
constexpr float TunnelFloorMaximumSingleWaveRunVoxels = 640.0f;
constexpr float TunnelFloorMaximumRouteLengthVoxels =
static_cast<float>(TunnelFloorMaximumWindWaves)
* TunnelFloorMaximumSingleWaveRunVoxels;
FORCEINLINE float EffectiveTunnelFloorGentleSlopeDegrees(float AuthoredDegrees)
{
if (!VoxelMath::IsFinite(AuthoredDegrees))
{
return 44.0f;
}
return FMath::Clamp(
FMath::Max(AuthoredDegrees, TunnelFloorGentleSlopeMinimumDegrees),
TunnelFloorGentleSlopeMinimumDegrees,
TunnelFloorGentleSlopeMaximumDegrees);
}
FORCEINLINE float TunnelFloorGradientFromDegrees(float AuthoredDegrees)
{
const float Degrees = EffectiveTunnelFloorGentleSlopeDegrees(AuthoredDegrees);
float SinValue = 0.0f;
float CosValue = 0.0f;
VoxelMath::DetSinCos(
SinValue, CosValue, Degrees * (PI / 180.0f));
// At 90 degrees the mathematical tangent is unbounded. The route solver only needs a
// finite comparison, so preserve the ordering while keeping every downstream bound finite.
return FMath::Min(
FMath::Abs(SinValue) / FMath::Max(FMath::Abs(CosValue), 1.0e-3f),
4096.0f);
}
// The walkability contract is about the floor carried by the tube, not only its centreline.
// A tapered tube changes that floor by the radius delta, so the construction and the audit
// use this same conservative floor delta.