fix(G.3): collapse streaming to the single dungeon landblock indoors (#133 FPS)
Dungeon FPS sat at ~30 (frame ~33ms) because the 25x25 streaming window around the dungeon landblock pulled in ~129 NEIGHBORING landblocks + their thousands of torch/particle emitters, all drawn though never visible. In AC all dungeons are packed adjacent in the unused "ocean" map grid, so those neighbors are unrelated dungeons. The FPS timeline proved it: 247 fps at login (lb 0/0, ~10K entities) → 17 → 30 as landblocks streamed in (lb 0→129) — the cost tracked LANDBLOCK count, not entities. Retail-faithful: ACE LandblockManager.GetAdjacentIDs returns ZERO adjacents for a dungeon (`if (landblock.IsDungeon) return adjacents;`, Landblock.cs:577-582) — every dungeon is a self-contained landblock you never see out of. Fix: when the player stands in a sealed indoor cell (CurrCell.IsEnv && !SeenOutside — the same predicate that kills the sun/sky), collapse streaming to just the player's dungeon landblock and unload the neighbors. Building interiors (cottage/inn) have SeenOutside cells, so they are NOT gated and keep their surrounding terrain (the frozen building/cellar demo is unaffected). Unloading the neighbors also tears down their lights (removeTerrain → UnregisterOwner), shrinking LightManager._all from ~2227 toward retail's ≤40 — which directly helps the A7 lighting bake landing next. Mechanics (StreamingController): - Edge IN: ClearPendingLoads() cancels the in-flight 25x25 window (new streamer ClearLoads control job — worker drops queued Loads, keeps Unloads), unload every resident neighbor, pin a radius-0 StreamingRegion, (re)load the dungeon block if needed. - Stay collapsed: sweep any straggler that finished loading after the edge (a Load the worker had already dequeued before ClearLoads). - Edge OUT (portal/teleport to outdoors): rebuild the full two-tier window at the new center, unload anything stale. AP-36 added to the divergence register (the gate uses the cheap SeenOutside cell predicate as an approximation of ACE's full landblock IsDungeon classification). GameWindow also carries a TEMP ACDREAM_LOG_FPS=1 headless FPS line (strip after the A7 FPS+lighting verification). Build green; 58 streaming tests green (6 new dungeon-gate tests). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
007e287309
commit
56860501b6
6 changed files with 324 additions and 6 deletions
|
|
@ -1914,6 +1914,7 @@ public sealed class GameWindow : IDisposable
|
|||
state: _worldState,
|
||||
nearRadius: _nearRadius,
|
||||
farRadius: _farRadius,
|
||||
clearPendingLoads: _streamer.ClearPendingLoads,
|
||||
removeTerrain: id =>
|
||||
{
|
||||
// Phase G.2: release any LightSources attached to entities
|
||||
|
|
@ -6882,7 +6883,20 @@ public sealed class GameWindow : IDisposable
|
|||
observerCy = _liveCenterY + (int)System.Math.Floor(camPos.Y / 192f);
|
||||
}
|
||||
|
||||
_streamingController.Tick(observerCx, observerCy);
|
||||
// Dungeon gate (#133 FPS): when the player stands in a SEALED EnvCell
|
||||
// (indoor cell that doesn't see outside — the same predicate that kills
|
||||
// the sun/sky, playerInsideCell below), collapse streaming to the single
|
||||
// dungeon landblock. AC dungeons have no adjacent landblocks; the 25×25
|
||||
// window otherwise pulls in ~129 unrelated ocean-grid dungeons. Building
|
||||
// interiors (cottage/inn) have SeenOutside cells, so they are NOT gated
|
||||
// and keep their surrounding terrain.
|
||||
// Mirrors the playerInsideCell computation below (CurrCell → registry
|
||||
// LoadedCell.SeenOutside): true only for a sealed indoor cell.
|
||||
bool insideDungeon =
|
||||
_physicsEngine.DataCache?.CellGraph.CurrCell is AcDream.Core.World.Cells.EnvCell pcEnv
|
||||
&& _cellVisibility.TryGetCell(pcEnv.Id, out var pcReg)
|
||||
&& pcReg is { SeenOutside: false };
|
||||
_streamingController.Tick(observerCx, observerCy, insideDungeon);
|
||||
|
||||
// Re-inject persistent entities rescued from unloaded landblocks
|
||||
// into the current center landblock (the one the observer is in).
|
||||
|
|
@ -8418,6 +8432,11 @@ public sealed class GameWindow : IDisposable
|
|||
}
|
||||
_lastFps = fps;
|
||||
_lastFrameMs = avgFrameTime;
|
||||
// TEMP (A7 FPS measurement, strip after): headless FPS/frame-time so the
|
||||
// launch log can be correlated against the [WB-DIAG] draw stats.
|
||||
if (Environment.GetEnvironmentVariable("ACDREAM_LOG_FPS") == "1")
|
||||
Console.WriteLine(
|
||||
$"[FPS] {fps:F1} fps | {avgFrameTime:F2} ms | lb {visibleLandblocks}/{totalLandblocks} | ent {entityCount} anim {animatedCount}");
|
||||
_perfAccum = 0;
|
||||
_perfFrameCount = 0;
|
||||
}
|
||||
|
|
@ -10589,6 +10608,7 @@ public sealed class GameWindow : IDisposable
|
|||
state: _worldState,
|
||||
nearRadius: _nearRadius,
|
||||
farRadius: _farRadius,
|
||||
clearPendingLoads: _streamer.ClearPendingLoads,
|
||||
removeTerrain: id =>
|
||||
{
|
||||
if (_lightingSink is not null &&
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue