Revert "fix(world): AP-48 client-side visibility cull (FPS sink across portal-hops)"
This reverts commit e5b2d15b63.
This commit is contained in:
parent
e5b2d15b63
commit
8fbde99441
4 changed files with 1 additions and 268 deletions
|
|
@ -840,13 +840,6 @@ public sealed class GameWindow : IDisposable
|
|||
/// keys the render list; this parallel dictionary keys by server guid.
|
||||
/// </summary>
|
||||
private readonly Dictionary<uint, AcDream.Core.World.WorldEntity> _entitiesByServerGuid = new();
|
||||
|
||||
// AP-48: client-side visibility cull (holtburger liveness.rs port) — prunes world
|
||||
// entities the player left far behind so the tables don't accumulate every town's
|
||||
// objects across portal-hops (which sank FPS). 1 Hz; the player + held/equipped items
|
||||
// are excluded (see TickEntityCull).
|
||||
private readonly AcDream.App.World.EntityVisibilityCuller _entityCuller = new();
|
||||
private double _cullAccum;
|
||||
/// <summary>
|
||||
/// Latest <see cref="AcDream.Core.Net.WorldSession.EntitySpawn"/> for each
|
||||
/// guid. Captured at the end of <see cref="OnLiveEntitySpawnedLocked"/> so
|
||||
|
|
@ -3835,61 +3828,8 @@ public sealed class GameWindow : IDisposable
|
|||
}
|
||||
}
|
||||
|
||||
// AP-48 cull wiring (logic lives in EntityVisibilityCuller). Snapshots the world
|
||||
// entities + player, asks the culler who has been >384m AND outside the 3×3 landblock
|
||||
// neighborhood for 25s, and tears each down through the existing pruner. Throttled to
|
||||
// 1 Hz (holtburger runs it per world tick; per-frame is wasteful). Skipped during a
|
||||
// teleport hold (the player WorldEntity.Position is frozen). Held/equipped/contained
|
||||
// items never enter _entitiesByServerGuid (OnLiveEntitySpawnedLocked early-returns on a
|
||||
// null world position), so the cull is structurally incapable of touching them; the
|
||||
// ClientObjectTable weenie row is dropped only for genuinely world-placed objects.
|
||||
private void TickEntityCull(double dt)
|
||||
{
|
||||
_cullAccum += dt;
|
||||
if (_cullAccum < 1.0) return;
|
||||
_cullAccum = 0.0;
|
||||
|
||||
if (_playerController is { State: AcDream.App.Input.PlayerState.PortalSpace }) return;
|
||||
if (!_entitiesByServerGuid.TryGetValue(_playerServerGuid, out var pe)) return;
|
||||
|
||||
uint plb = pe.ParentCellId ?? 0u;
|
||||
var player = new AcDream.App.World.EntityCullInfo(
|
||||
_playerServerGuid, pe.Position,
|
||||
(int)((plb >> 24) & 0xFFu), (int)((plb >> 16) & 0xFFu), plb != 0u);
|
||||
|
||||
// Snapshot first (the eviction below mutates _entitiesByServerGuid).
|
||||
var snapshot = new System.Collections.Generic.List<AcDream.App.World.EntityCullInfo>(
|
||||
_entitiesByServerGuid.Count);
|
||||
foreach (var kv in _entitiesByServerGuid)
|
||||
{
|
||||
uint elb = kv.Value.ParentCellId ?? 0u;
|
||||
snapshot.Add(new AcDream.App.World.EntityCullInfo(
|
||||
kv.Key, kv.Value.Position,
|
||||
(int)((elb >> 24) & 0xFFu), (int)((elb >> 16) & 0xFFu), elb != 0u));
|
||||
}
|
||||
|
||||
double now = (System.DateTime.UtcNow - System.DateTime.UnixEpoch).TotalSeconds;
|
||||
var evicted = _entityCuller.Tick(snapshot, player, now);
|
||||
foreach (var guid in evicted)
|
||||
{
|
||||
var row = Objects.Get(guid);
|
||||
RemoveLiveEntityByServerGuid(guid);
|
||||
// has_nonworld_retention parity: keep the weenie row if it's held/equipped (a far
|
||||
// ground item open in a container view); drop it only for world-placed objects.
|
||||
if (row is null || (row.ContainerId == 0u && row.WielderId == 0u))
|
||||
Objects.Remove(guid);
|
||||
}
|
||||
}
|
||||
|
||||
private bool RemoveLiveEntityByServerGuid(uint serverGuid)
|
||||
{
|
||||
// AP-48: clear any armed cull deadline for this guid BEFORE the early-return, so a
|
||||
// guid that was culled (and is no longer in _entitiesByServerGuid) but is then
|
||||
// re-created by the server starts fresh — never inherits a stale, already-expired
|
||||
// deadline that would evict it on the next cull tick. Mirrors holtburger's
|
||||
// clear-on-upsert/delete.
|
||||
_entityCuller.Forget(serverGuid);
|
||||
|
||||
if (!_entitiesByServerGuid.TryGetValue(serverGuid, out var existingEntity))
|
||||
return false;
|
||||
|
||||
|
|
@ -7644,10 +7584,6 @@ public sealed class GameWindow : IDisposable
|
|||
// Step 2: routed through the controller; functionally identical.
|
||||
_liveSessionController?.Tick();
|
||||
|
||||
// AP-48: 1 Hz visibility cull. Runs after the live-session drain so the player's
|
||||
// WorldEntity.Position/ParentCellId reflect this frame's UpdatePosition.
|
||||
TickEntityCull(dt);
|
||||
|
||||
// Retail teleport transit. Runs AFTER streaming (which priority-applies the
|
||||
// destination landblock this frame) and the live-session drain, so a destination
|
||||
// that became resident this frame materializes the same frame. The TAS holds at
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue