refactor(runtime): acknowledge exact world host projections

This commit is contained in:
Erik 2026-07-26 18:27:41 +02:00
parent 73d0b54e38
commit 18d17d8bb1
17 changed files with 1677 additions and 72 deletions

View file

@ -128,6 +128,55 @@ public readonly record struct RuntimeDestinationReadiness(
&& IsCollisionReady));
}
[Flags]
public enum RuntimeWorldHostAcknowledgementStage
{
None = 0,
ProjectionRegistered = 1 << 0,
SimulationReleaseProjected = 1 << 1,
DestinationReservationReleased = 1 << 2,
TerminalProjected = 1 << 3,
}
/// <summary>
/// Exact identity of one graphical or direct host projection attached to a
/// Runtime reveal generation. It contains no presentation object.
/// </summary>
public readonly record struct RuntimeWorldHostProjectionToken(
long Generation,
uint DestinationCell)
{
public bool IsValid => Generation != 0 && DestinationCell != 0u;
}
public readonly record struct RuntimeWorldHostAcknowledgement(
RuntimeWorldHostProjectionToken Projection,
RuntimeWorldHostAcknowledgementStage Stage);
public readonly record struct RuntimeWorldHostProjectionSnapshot(
RuntimeWorldHostProjectionToken Token,
RuntimeWorldHostAcknowledgementStage PendingAcknowledgements,
bool ProjectionRegistered,
bool SimulationReleaseProjected,
bool DestinationReservationReleased,
bool IsSuperseding)
{
public int PendingAcknowledgementCount =>
Count(PendingAcknowledgements);
private static int Count(RuntimeWorldHostAcknowledgementStage stages)
{
int value = (int)stages;
int count = 0;
while (value != 0)
{
value &= value - 1;
count++;
}
return count;
}
}
public readonly record struct RuntimePortalSnapshot(
long Generation,
RuntimePortalKind Kind,
@ -166,6 +215,7 @@ public readonly record struct RuntimePortalSnapshot(
public interface IRuntimePortalView
{
RuntimePortalSnapshot Snapshot { get; }
RuntimeWorldTransitOwnershipSnapshot Ownership { get; }
}
public readonly record struct RuntimeStateCheckpoint(
@ -184,7 +234,9 @@ public readonly record struct RuntimeStateCheckpoint(
RuntimeActionSnapshot Actions,
RuntimeMovementSnapshot Movement,
RuntimeWorldEnvironmentSnapshot Environment,
RuntimePortalSnapshot Portal);
RuntimeWorldEnvironmentOwnershipSnapshot EnvironmentOwnership,
RuntimePortalSnapshot Portal,
RuntimeWorldTransitOwnershipSnapshot TransitOwnership);
public interface IGameRuntimeView
{