refactor(update): cut over the frame orchestrator
Reduce GameWindow.OnUpdate to one typed orchestration call and remove transitive window callbacks from teardown, liveness, teleport placement, live presentation, auto-entry, and entity packet routing. Preserve the frozen retail object/network order while making the production owner graph explicit and testable.
This commit is contained in:
parent
947c61d2d7
commit
e91f310279
18 changed files with 864 additions and 348 deletions
|
|
@ -1,6 +1,7 @@
|
|||
using AcDream.App.Combat;
|
||||
using AcDream.App.Input;
|
||||
using AcDream.App.Interaction;
|
||||
using AcDream.App.Net;
|
||||
using AcDream.App.Physics;
|
||||
using AcDream.App.Rendering;
|
||||
using AcDream.App.Rendering.Vfx;
|
||||
|
|
@ -50,18 +51,18 @@ internal sealed class LiveEntityNetworkUpdateController
|
|||
private readonly LiveWorldOriginState _origin;
|
||||
private readonly AcDream.App.Streaming.ILocalPlayerTeleportNetworkSink
|
||||
_localPlayerTeleport;
|
||||
private readonly Func<PlayerMovementController?> _playerControllerSource;
|
||||
private readonly ILocalPlayerControllerSource _playerControllerSource;
|
||||
private readonly LocalPlayerOutboundController _localPlayerOutbound;
|
||||
private readonly Func<EntityPhysicsHost?> _playerHostSource;
|
||||
private readonly Func<uint> _playerGuid;
|
||||
private readonly ILocalPlayerPhysicsHostSource _playerHostSource;
|
||||
private readonly ILocalPlayerIdentitySource _playerIdentity;
|
||||
private readonly IPhysicsScriptTimeSource _gameTime;
|
||||
private readonly Func<WorldSession?> _session;
|
||||
private readonly ILiveWorldSessionSource _session;
|
||||
private readonly LiveEntityInboundAuthorityGate _authorityGate;
|
||||
private readonly IMovementTruthDiagnosticSink _movementTruthDiagnostics;
|
||||
|
||||
private PlayerMovementController? _playerController => _playerControllerSource();
|
||||
private EntityPhysicsHost? _playerHost => _playerHostSource();
|
||||
private uint _playerServerGuid => _playerGuid();
|
||||
private PlayerMovementController? _playerController => _playerControllerSource.Controller;
|
||||
private EntityPhysicsHost? _playerHost => _playerHostSource.Host;
|
||||
private uint _playerServerGuid => _playerIdentity.ServerGuid;
|
||||
private double _physicsScriptGameTime => _gameTime.CurrentScriptTime;
|
||||
private IReadOnlyDictionary<uint, WorldEntity> _entitiesByServerGuid =>
|
||||
_liveEntities.MaterializedWorldEntities;
|
||||
|
|
@ -96,12 +97,12 @@ internal sealed class LiveEntityNetworkUpdateController
|
|||
CombatTargetController? combatTargetController,
|
||||
LiveWorldOriginState origin,
|
||||
AcDream.App.Streaming.ILocalPlayerTeleportNetworkSink localPlayerTeleport,
|
||||
Func<PlayerMovementController?> playerControllerSource,
|
||||
ILocalPlayerControllerSource playerControllerSource,
|
||||
LocalPlayerOutboundController localPlayerOutbound,
|
||||
Func<EntityPhysicsHost?> playerHostSource,
|
||||
Func<uint> playerGuid,
|
||||
ILocalPlayerPhysicsHostSource playerHostSource,
|
||||
ILocalPlayerIdentitySource playerIdentity,
|
||||
IPhysicsScriptTimeSource gameTime,
|
||||
Func<WorldSession?> session,
|
||||
ILiveWorldSessionSource session,
|
||||
Action<uint, AcceptedPhysicsTimestamps> publishTimestamps,
|
||||
IMovementTruthDiagnosticSink movementTruthDiagnostics)
|
||||
{
|
||||
|
|
@ -131,7 +132,7 @@ internal sealed class LiveEntityNetworkUpdateController
|
|||
_localPlayerOutbound = localPlayerOutbound
|
||||
?? throw new ArgumentNullException(nameof(localPlayerOutbound));
|
||||
_playerHostSource = playerHostSource ?? throw new ArgumentNullException(nameof(playerHostSource));
|
||||
_playerGuid = playerGuid ?? throw new ArgumentNullException(nameof(playerGuid));
|
||||
_playerIdentity = playerIdentity ?? throw new ArgumentNullException(nameof(playerIdentity));
|
||||
_gameTime = gameTime ?? throw new ArgumentNullException(nameof(gameTime));
|
||||
_session = session ?? throw new ArgumentNullException(nameof(session));
|
||||
_authorityGate = new LiveEntityInboundAuthorityGate(
|
||||
|
|
@ -1029,7 +1030,7 @@ internal sealed class LiveEntityNetworkUpdateController
|
|||
p.PositionY,
|
||||
p.PositionZ)),
|
||||
() => _localPlayerOutbound.SendImmediatePosition(
|
||||
_session(),
|
||||
_session.CurrentSession,
|
||||
_playerController)))
|
||||
return;
|
||||
|
||||
|
|
|
|||
49
src/AcDream.App/Physics/RemoteShadowPlacementSynchronizer.cs
Normal file
49
src/AcDream.App/Physics/RemoteShadowPlacementSynchronizer.cs
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
using AcDream.App.World;
|
||||
using AcDream.Core.Physics;
|
||||
using AcDream.Core.World;
|
||||
|
||||
namespace AcDream.App.Physics;
|
||||
|
||||
/// <summary>Synchronizes a resolved remote placement in the current live origin.</summary>
|
||||
internal sealed class RemoteShadowPlacementSynchronizer
|
||||
{
|
||||
private readonly RemotePhysicsUpdater _remotePhysics;
|
||||
private readonly LiveWorldOriginState _origin;
|
||||
|
||||
public RemoteShadowPlacementSynchronizer(
|
||||
RemotePhysicsUpdater remotePhysics,
|
||||
LiveWorldOriginState origin)
|
||||
{
|
||||
_remotePhysics = remotePhysics
|
||||
?? throw new ArgumentNullException(nameof(remotePhysics));
|
||||
_origin = origin ?? throw new ArgumentNullException(nameof(origin));
|
||||
}
|
||||
|
||||
public void Sync(WorldEntity entity, PhysicsBody body, uint cellId) =>
|
||||
_remotePhysics.SyncRemoteShadowToBody(
|
||||
entity.Id,
|
||||
body,
|
||||
_origin.CenterX,
|
||||
_origin.CenterY,
|
||||
cellId);
|
||||
}
|
||||
|
||||
/// <summary>Bridges remote placement ownership to live presentation state.</summary>
|
||||
internal sealed class RemoteTeleportPlacementPresentation
|
||||
{
|
||||
private readonly LiveEntityPresentationController _presentation;
|
||||
|
||||
public RemoteTeleportPlacementPresentation(
|
||||
LiveEntityPresentationController presentation) =>
|
||||
_presentation = presentation
|
||||
?? throw new ArgumentNullException(nameof(presentation));
|
||||
|
||||
public void Complete(uint serverGuid, ushort generation, bool deferShadowRestore) =>
|
||||
_presentation.CompleteAuthoritativePlacement(
|
||||
serverGuid,
|
||||
generation,
|
||||
deferShadowRestore);
|
||||
|
||||
public void Begin(uint serverGuid, ushort generation) =>
|
||||
_presentation.BeginAuthoritativePlacement(serverGuid, generation);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue