From 7910d51e7a163d57b8ea65448e004b21e5f58896 Mon Sep 17 00:00:00 2001 From: Erik Date: Mon, 25 May 2026 12:40:58 +0200 Subject: [PATCH] =?UTF-8?q?diag(phys):=20A6.P5=20[cellset-build]=20probe?= =?UTF-8?q?=20=E2=80=94=20log=20BuildCellSetAndPickContaining=20output?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit One [cellset-build] line per call when ACDREAM_PROBE_CELLSET=1: seed cell, sphere world XY, candidate count, full candidate id list. Used to prove the cellSet for the player's start cell doesn't include the door's outdoor cell across the over-penetration tick. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/AcDream.Core/Physics/CellTransit.cs | 5 ++++ .../Physics/PhysicsDiagnostics.cs | 29 +++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/src/AcDream.Core/Physics/CellTransit.cs b/src/AcDream.Core/Physics/CellTransit.cs index 900157b..bdacceb 100644 --- a/src/AcDream.Core/Physics/CellTransit.cs +++ b/src/AcDream.Core/Physics/CellTransit.cs @@ -494,6 +494,11 @@ public static class CellTransit } } + if (PhysicsDiagnostics.ProbeCellSetEnabled) + { + PhysicsDiagnostics.LogCellSetBuild(currentCellId, worldSphereCenter, candidates); + } + // Containment test: for each candidate, transform worldSphereCenter to // local and test PointInsideCellBsp. foreach (uint candId in candidates) diff --git a/src/AcDream.Core/Physics/PhysicsDiagnostics.cs b/src/AcDream.Core/Physics/PhysicsDiagnostics.cs index bb9008d..260ed07 100644 --- a/src/AcDream.Core/Physics/PhysicsDiagnostics.cs +++ b/src/AcDream.Core/Physics/PhysicsDiagnostics.cs @@ -69,6 +69,35 @@ public static class PhysicsDiagnostics public static bool ProbeBuildingEnabled { get; set; } = Environment.GetEnvironmentVariable("ACDREAM_PROBE_BUILDING") == "1"; + /// + /// A6.P5 (2026-05-25) — dump the cellSet that + /// BuildCellSetAndPickContaining produces. One line per call: + /// seed cell, sphere world XY, candidate count, and the full candidate + /// list (hex). Pair with [bsp-test] / [resolve] to see + /// whether the door's outdoor cell is reachable from the player's + /// current indoor cell via the portal-walk. + /// + public static bool ProbeCellSetEnabled { get; set; } + = Environment.GetEnvironmentVariable("ACDREAM_PROBE_CELLSET") == "1"; + + public static void LogCellSetBuild( + uint seedCellId, + System.Numerics.Vector3 sphereCenter, + System.Collections.Generic.IReadOnlyCollection cellSet) + { + if (!ProbeCellSetEnabled) return; + var ids = new System.Text.StringBuilder(); + bool first = true; + foreach (uint id in cellSet) + { + if (!first) ids.Append(','); + ids.Append(System.FormattableString.Invariant($"0x{id:X8}")); + first = false; + } + Console.WriteLine(System.FormattableString.Invariant( + $"[cellset-build] seed=0x{seedCellId:X8} sphere=({sphereCenter.X:F3},{sphereCenter.Y:F3},{sphereCenter.Z:F3}) count={cellSet.Count} ids={ids}")); + } + /// /// L.2d slice 1 (2026-05-13). Diagnostic side-channel: the /// that