fix(streaming): player entity no longer disappears on landblock unload
ROOT CAUSE: MarkPersistent(chosen.Id) stored the SERVER GUID (e.g. 0x5000000A) but RemoveLandblock checked entity.Id which is the LOCAL sequential counter (e.g. 42). Different number spaces → never matched → persistent rescue never triggered → player entity lost on unload. Fix: - Added WorldEntity.ServerGuid field (0 for dat-hydrated scenery) - Live entity spawn sets ServerGuid = spawn.Guid - RemoveLandblock checks entity.ServerGuid against _persistentGuids - MarkPersistent still stores the server GUID (correct) This bug has been reported across multiple sessions as "character disappears when walking far." The neverCullLandblockId fix only prevented frustum culling but didn't prevent the entity from being removed from the render list entirely. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
adf626367e
commit
c32cef7e87
3 changed files with 8 additions and 1 deletions
|
|
@ -767,6 +767,7 @@ public sealed class GameWindow : IDisposable
|
|||
var entity = new AcDream.Core.World.WorldEntity
|
||||
{
|
||||
Id = _liveEntityIdCounter++,
|
||||
ServerGuid = spawn.Guid,
|
||||
SourceGfxObjOrSetupId = spawn.SetupTableId.Value,
|
||||
Position = worldPos,
|
||||
Rotation = rot,
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ public sealed class GpuWorldState
|
|||
{
|
||||
foreach (var entity in lb.Entities)
|
||||
{
|
||||
if (_persistentGuids.Contains(entity.Id))
|
||||
if (entity.ServerGuid != 0 && _persistentGuids.Contains(entity.ServerGuid))
|
||||
_persistentRescued.Add(entity);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,12 @@ namespace AcDream.Core.World;
|
|||
public sealed class WorldEntity
|
||||
{
|
||||
public required uint Id { get; init; }
|
||||
/// <summary>
|
||||
/// Server-assigned GUID (from CreateObject). Zero for dat-hydrated
|
||||
/// scenery/static entities that don't come from the server.
|
||||
/// Used by GpuWorldState for persistent-entity rescue on landblock unload.
|
||||
/// </summary>
|
||||
public uint ServerGuid { get; init; }
|
||||
public required uint SourceGfxObjOrSetupId { get; init; }
|
||||
/// <summary>
|
||||
/// World-space position. Settable so Phase 6.7 position-update events
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue