chore: strip world-load deep-dive diagnostic probes

Removes the scenery-frame, building-reach, and stream-resid probes added during the
world-load/FPS deep-dive (all root-caused + fixed). Gated-off diagnostics only; no
behavior change. The fixes they found remain.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-06-23 00:23:15 +02:00
parent 9945d46280
commit 92e95bea53
4 changed files with 0 additions and 242 deletions

View file

@ -805,18 +805,6 @@ public sealed class GameWindow : IDisposable
private int _liveCenterY;
private uint _liveEntityIdCounter = 1_000_000u; // well above any dat-hydrated id
// Trees-in-sky probe (2026-06-22 — REMOVABLE apparatus, see
// PhysicsDiagnostics.ProbeSceneryFrameEnabled). The streaming worker records
// here, per landblock, the _liveCenter it baked scenery against at BUILD time;
// ApplyLoadedTerrainLocked reads it back to compare against the APPLY-time
// center. Written/read only when the probe is on, so this stays empty in
// normal play.
private readonly System.Collections.Concurrent.ConcurrentDictionary<uint, (int Cx, int Cy)>
_sceneryBuildCenterByLandblock = new();
// Floating-terrain probe throttle (REMOVABLE, see PhysicsDiagnostics.ProbeStreamResidEnabled).
private int _residAuditTick;
// K-fix1 (2026-04-26): cached at startup so per-frame branches are
// single-flag reads instead of env-var lookups. True iff
// ACDREAM_LIVE=1 was set when the window came up.
@ -6039,13 +6027,6 @@ public sealed class GameWindow : IDisposable
(lbY - _liveCenterY) * 192f,
0f);
// Trees-in-sky probe (REMOVABLE): stamp the streaming center this scenery
// was baked against. ApplyLoadedTerrainLocked compares it to the apply-time
// center; a delta is the frame split that floats trees. Capture is the exact
// _liveCenter used in lbOffset above (the worker-thread read).
if (AcDream.Core.Physics.PhysicsDiagnostics.ProbeSceneryFrameEnabled)
_sceneryBuildCenterByLandblock[lb.LandblockId] = (_liveCenterX, _liveCenterY);
// Per-landblock id namespace. Landblock IDs are formatted 0xXXYYFFFF
// where XX = landblock X coord (bits 24-31), YY = Y coord (bits 16-23).
// Both must go into our ID so landblocks don't collide.
@ -6055,7 +6036,6 @@ public sealed class GameWindow : IDisposable
uint lbYByte = (lb.LandblockId >> 16) & 0xFFu;
uint sceneryIdBase = 0x80000000u | (lbXByte << 16) | (lbYByte << 8);
uint localIndex = 0;
bool loggedStaleZ = false; // trees-in-sky probe: one [scenery-z-stale] line per lb
foreach (var spawn in spawns)
{
@ -6134,20 +6114,6 @@ public sealed class GameWindow : IDisposable
float groundZ = SampleTerrainZ(lb.Heightmap, _heightTable, localX, localY);
float finalZ = groundZ + spawn.LocalPosition.Z;
// Trees-in-sky probe (REMOVABLE — strip after verification). Proves the fix:
// compute what the OLD global physics query WOULD have returned and compare
// to the own-heightmap groundZ we now use. A large divergence is the stale-
// neighbor altitude the old code floated scenery to — and no longer does.
if (!loggedStaleZ
&& AcDream.Core.Physics.PhysicsDiagnostics.ProbeSceneryFrameEnabled
&& _physicsEngine.SampleTerrainZ(worldPx, worldPy) is { } wouldBePhysicsZ
&& System.MathF.Abs(wouldBePhysicsZ - groundZ) > 5f)
{
AcDream.Core.Physics.PhysicsDiagnostics.LogSceneryZStale(
lb.LandblockId, worldPx, worldPy, wouldBePhysicsZ, groundZ);
loggedStaleZ = true;
}
// Issue #48 diagnostic. One log line per (spawn, rendered-mesh)
// disambiguates H1 (BaseLoc.Z / mesh-zMin per-species), H2
// (physics-vs-bilinear sampler drift), and H3 (DIDDegrade slot 0).
@ -6698,33 +6664,6 @@ public sealed class GameWindow : IDisposable
(lbY - _liveCenterY) * 192f,
0f);
// Trees-in-sky probe (REMOVABLE): compare the streaming center this
// landblock's SCENERY was baked against (worker, build time) to the center
// its TERRAIN is being placed against here (render, apply time). A non-zero
// deltaLB is the frame split that floats scenery off its terrain.
if (AcDream.Core.Physics.PhysicsDiagnostics.ProbeSceneryFrameEnabled)
{
var bc = _sceneryBuildCenterByLandblock.TryGetValue(lb.LandblockId, out var c)
? c : (_liveCenterX, _liveCenterY);
AcDream.Core.Physics.PhysicsDiagnostics.LogSceneryFrame(
lb.LandblockId, bc.Item1, bc.Item2, _liveCenterX, _liveCenterY);
_sceneryBuildCenterByLandblock.TryRemove(lb.LandblockId, out _);
}
// Floating-terrain probe (REMOVABLE): this landblock is being APPLIED at the
// current center; if its Chebyshev distance from the center exceeds the streaming
// window, it's an in-flight load from a PREVIOUS center applying against the new
// one — it will render far off at the horizon (a floating "terrain trace").
if (AcDream.Core.Physics.PhysicsDiagnostics.ProbeStreamResidEnabled
&& _streamingController is not null)
{
int applyCheby = System.Math.Max(
System.Math.Abs(lbX - _liveCenterX), System.Math.Abs(lbY - _liveCenterY));
if (applyCheby > _streamingController.FarRadius)
AcDream.Core.Physics.PhysicsDiagnostics.LogApplyOob(
lb.LandblockId, applyCheby, _streamingController.FarRadius, origin.X, origin.Y);
}
// Phase A.5 T15/T16: route through AddLandblockWithMesh — the named
// two-tier entry point. Delegates to AddLandblock internally; both
// paths share one GPU upload path.
@ -7673,25 +7612,6 @@ public sealed class GameWindow : IDisposable
foreach (var entity in rescued)
_worldState.AppendLiveEntity(centerLb, entity);
}
// Floating-terrain probe (REMOVABLE): ~2×/sec, list resident landblocks sitting
// OUTSIDE the streaming window (Chebyshev > FarRadius from the current center) —
// stale old-location terrain that never unloaded. Same thread as the Tick above,
// so LoadedLandblockIds is stable. Zero cost when the probe is off.
if (AcDream.Core.Physics.PhysicsDiagnostics.ProbeStreamResidEnabled
&& (++_residAuditTick % 30 == 0))
{
var oob = new List<uint>();
foreach (var id in _worldState.LoadedLandblockIds)
{
int lx = (int)((id >> 24) & 0xFFu), ly = (int)((id >> 16) & 0xFFu);
if (System.Math.Max(System.Math.Abs(lx - _liveCenterX), System.Math.Abs(ly - _liveCenterY))
> _streamingController.FarRadius)
oob.Add(id);
}
AcDream.Core.Physics.PhysicsDiagnostics.LogResidentAudit(
_liveCenterX, _liveCenterY, _worldState.LoadedLandblockIds.Count, oob);
}
}
// Drain pending live-session traffic AFTER streaming so any incoming