Split Aetheria client transport planes
This commit is contained in:
parent
908e83b83a
commit
028945aad6
9 changed files with 148 additions and 126 deletions
|
|
@ -21,7 +21,7 @@
|
|||
"org.gamecult.aetheria.eve-runtime": "file:org.gamecult.aetheria.eve-runtime",
|
||||
"org.gamecult.aetheria.state": "file:org.gamecult.aetheria.state",
|
||||
"org.gamecult.cultmath": "file:../../CultMath",
|
||||
"org.gamecult.cultlib": "https://github.com/GameCult/CultLib.git?path=/unity/org.gamecult.cultlib#cultlib-unity-v1.0.23",
|
||||
"org.gamecult.cultlib": "https://github.com/GameCult/CultLib.git?path=/unity/org.gamecult.cultlib#cultlib-unity-v1.0.34",
|
||||
"org.gamecult.eve.surface": "file:../../EveUnity/packages/org.gamecult.eve.surface",
|
||||
"org.gamecult.eve.plugin-fields": "https://github.com/GameCult/EvePlugins.git?path=/plugins/eve-plugin-fields/unity/org.gamecult.eve.plugin-fields#eve-plugin-fields-unity-v0.2.3",
|
||||
"org.gamecult.eve.unity-scene": "file:../../EveUnity/packages/org.gamecult.eve.unity-scene",
|
||||
|
|
|
|||
|
|
@ -17,22 +17,15 @@ namespace GameCult.Aetheria.State.Verse
|
|||
public AetheriaRuntimeDaemonSoaFrame(
|
||||
AetheriaRuntimeDaemonSoaViewDocument view,
|
||||
CultMeshFrameBodyWriteLease write,
|
||||
int byteLength,
|
||||
bool publishSharedMemory,
|
||||
bool publishNetwork)
|
||||
int byteLength)
|
||||
{
|
||||
View = view ?? throw new ArgumentNullException(nameof(view));
|
||||
_write = write ?? throw new ArgumentNullException(nameof(write));
|
||||
ByteLength = byteLength;
|
||||
PublishSharedMemory = publishSharedMemory;
|
||||
PublishNetwork = publishNetwork;
|
||||
}
|
||||
|
||||
public AetheriaRuntimeDaemonSoaViewDocument View { get; }
|
||||
public int ByteLength { get; }
|
||||
public bool PublishSharedMemory { get; }
|
||||
public bool PublishNetwork { get; }
|
||||
public ReadOnlySpan<byte> Span => (_write ?? throw new ObjectDisposedException(nameof(AetheriaRuntimeDaemonSoaFrame))).Span[..ByteLength];
|
||||
|
||||
public CultMeshBodyDescriptor Commit(DateTimeOffset nowUtc)
|
||||
{
|
||||
|
|
@ -81,18 +74,15 @@ namespace GameCult.Aetheria.State.Verse
|
|||
private const string EntityProxyMaterialUri = "cultmesh://aetheria/assets/daemon/entity_proxy/material";
|
||||
|
||||
private readonly CultMeshFrameBodyPublisher _localPublisher;
|
||||
private readonly CultMeshNetworkBodyStore _networkBodies;
|
||||
private readonly CultMeshBodyDemandTracker? _demand;
|
||||
private readonly Dictionary<string, int> _syntheticEntityIndices =
|
||||
new Dictionary<string, int>(StringComparer.Ordinal);
|
||||
private int _nextSyntheticEntityIndex = -2;
|
||||
|
||||
public AetheriaRuntimeDaemonSoaFramePublisher(
|
||||
CultMeshNetworkBodyStore networkBodies,
|
||||
long producerEpoch,
|
||||
CultMeshBodyDemandTracker? demand = null)
|
||||
{
|
||||
_networkBodies = networkBodies ?? throw new ArgumentNullException(nameof(networkBodies));
|
||||
_localPublisher = new CultMeshFrameBodyPublisher(
|
||||
BodyId, BodySchemaId, LayoutVersion, Capacity, producerEpoch,
|
||||
checked((int)EntityHotSlabLayout.Create(Capacity).TotalByteLength),
|
||||
|
|
@ -107,10 +97,8 @@ namespace GameCult.Aetheria.State.Verse
|
|||
if (frame == null)
|
||||
throw new ArgumentNullException(nameof(frame));
|
||||
var demand = _demand?.Plan(BodyId);
|
||||
if (demand != null && !demand.HasConsumers)
|
||||
if (demand != null && (!demand.HasConsumers || !demand.RequiresSharedMemory))
|
||||
return null;
|
||||
var publishSharedMemory = demand?.RequiresSharedMemory ?? true;
|
||||
var publishNetwork = demand?.RequiresNetwork ?? true;
|
||||
|
||||
var run = frame.Run ?? new AetheriaRuntimeRunCheckpointCommit();
|
||||
var zone = (run.Zones ?? Array.Empty<AetheriaRuntimeZoneSnapshotCommit>())
|
||||
|
|
@ -284,9 +272,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
return new AetheriaRuntimeDaemonSoaFrame(
|
||||
view,
|
||||
write,
|
||||
checked((int)layout.TotalByteLength),
|
||||
publishSharedMemory,
|
||||
publishNetwork);
|
||||
checked((int)layout.TotalByteLength));
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
@ -299,7 +285,6 @@ namespace GameCult.Aetheria.State.Verse
|
|||
{
|
||||
if (frame == null) throw new ArgumentNullException(nameof(frame));
|
||||
var now = DateTimeOffset.UtcNow;
|
||||
var networkBytes = frame.PublishNetwork ? frame.Span.ToArray() : null;
|
||||
var local = frame.Commit(now);
|
||||
var generation = new CultMeshBodyGeneration
|
||||
{
|
||||
|
|
@ -313,10 +298,6 @@ namespace GameCult.Aetheria.State.Verse
|
|||
Synchronization = local.Synchronization,
|
||||
LeaseExpiresAtUnixMs = local.LeaseExpiresAtUnixMs
|
||||
};
|
||||
var representations = new List<CultMeshBodyDescriptor>();
|
||||
if (frame.PublishSharedMemory) representations.Add(local);
|
||||
if (frame.PublishNetwork)
|
||||
representations.Add(_networkBodies.PublishOwned(generation, networkBytes!));
|
||||
var publication = new CultMeshBodyPublicationDocument
|
||||
{
|
||||
BodyId = BodyId,
|
||||
|
|
@ -329,7 +310,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
Sequence = local.Sequence,
|
||||
Synchronization = local.Synchronization,
|
||||
LivenessExpiresAtUnixMs = local.LeaseExpiresAtUnixMs,
|
||||
Representations = representations.ToArray()
|
||||
Representations = new[] { local }
|
||||
};
|
||||
new CultMeshBodyPublicationHandle(BodyId, publication.ProducerEpoch, publication.Sequence)
|
||||
.Validate(publication);
|
||||
|
|
|
|||
|
|
@ -313,11 +313,11 @@
|
|||
}
|
||||
},
|
||||
"org.gamecult.cultlib": {
|
||||
"version": "https://github.com/GameCult/CultLib.git?path=/unity/org.gamecult.cultlib#cultlib-unity-v1.0.23",
|
||||
"version": "https://github.com/GameCult/CultLib.git?path=/unity/org.gamecult.cultlib#cultlib-unity-v1.0.34",
|
||||
"depth": 0,
|
||||
"source": "git",
|
||||
"dependencies": {},
|
||||
"hash": "743fa3889ebef752178ce9982dc7c9c031cc22e9"
|
||||
"hash": "c148d891c1d8713285ae15b2f17b59c106fb9426"
|
||||
},
|
||||
"org.gamecult.cultmath": {
|
||||
"version": "file:../../CultMath",
|
||||
|
|
@ -347,7 +347,7 @@
|
|||
"depth": 0,
|
||||
"source": "local",
|
||||
"dependencies": {
|
||||
"org.gamecult.cultlib": "1.0.23",
|
||||
"org.gamecult.cultlib": "1.0.34",
|
||||
"org.gamecult.eve.plugin-fields": "0.2.3",
|
||||
"org.gamecult.eve.surface": "0.2.4",
|
||||
"com.unity.mathematics": "1.3.2",
|
||||
|
|
|
|||
Loading…
Reference in a new issue