Remove file-backed run and zone readback
This commit is contained in:
parent
140b84f31b
commit
a81bfc439f
4 changed files with 44 additions and 637 deletions
|
|
@ -2791,8 +2791,7 @@ static void RequireTypedZoneStateSnapshotKeys(string root)
|
|||
var checkedFiles = new[]
|
||||
{
|
||||
Path.Combine(root, "Aetheria.State", "Documents", "AetheriaRuntimeStateDocuments.cs"),
|
||||
Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeCatalogSnapshot.cs"),
|
||||
Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeCatalogStore.cs")
|
||||
Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeSnapshotDocuments.cs")
|
||||
};
|
||||
|
||||
var forbiddenSymbols = new[]
|
||||
|
|
@ -2835,50 +2834,26 @@ static void RequireTypedZoneStateSnapshotKeys(string root)
|
|||
"public string ParentOrbitKey { get; set; } = \"\";",
|
||||
"public string BodyKey { get; set; } = \"\";"
|
||||
},
|
||||
[Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeCatalogSnapshot.cs")] = new[]
|
||||
[Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeSnapshotDocuments.cs")] = new[]
|
||||
{
|
||||
"public AetheriaRuntimeOrbitSnapshot(string orbitKey, string parentOrbitKey",
|
||||
"OrbitKey = orbitKey;",
|
||||
"ParentOrbitKey = parentOrbitKey;",
|
||||
"public string OrbitKey { get; }",
|
||||
"public string ParentOrbitKey { get; }",
|
||||
"BodyKey = bodyKey;",
|
||||
"OrbitKey = orbitKey;",
|
||||
"public string BodyKey { get; }",
|
||||
"public string OrbitKey { get; }",
|
||||
"GravityInfluenceCenterX = gravityInfluenceCenterX;",
|
||||
"GravityInfluenceCenterZ = gravityInfluenceCenterZ;",
|
||||
"GravityInfluenceRadius = gravityInfluenceRadius;",
|
||||
"GravityWellDepth = gravityWellDepth;",
|
||||
"GravityWaveRadius = gravityWaveRadius;",
|
||||
"GravityWaveDepth = gravityWaveDepth;",
|
||||
"GravityWaveSpeed = gravityWaveSpeed;",
|
||||
"GravityTerrainRadius = gravityTerrainRadius;",
|
||||
"GravityTerrainDepth = gravityTerrainDepth;",
|
||||
"GravityTerrainDepthExponent = gravityTerrainDepthExponent;",
|
||||
"GravityTerrainBoundaryFog = gravityTerrainBoundaryFog;",
|
||||
"GravityTerrainWaveFrequency = gravityTerrainWaveFrequency;"
|
||||
},
|
||||
[Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeCatalogStore.cs")] = new[]
|
||||
{
|
||||
"var orbitKey = ReadFieldString(ref reader, orbitFields, 0);",
|
||||
"var parentOrbitKey = ReadFieldString(ref reader, orbitFields, 1);",
|
||||
"var bodyKey = ReadFieldString(ref reader, bodyFields, 0);",
|
||||
"var orbitKey = ReadFieldString(ref reader, bodyFields, 3);",
|
||||
"var gravityInfluenceCenterX = ReadFieldDouble(ref reader, bodyFields, 13, double.NaN);",
|
||||
"var gravityInfluenceCenterZ = ReadFieldDouble(ref reader, bodyFields, 14, double.NaN);",
|
||||
"var gravityInfluenceRadius = ReadFieldDouble(ref reader, bodyFields, 15);",
|
||||
"var gravityWellDepth = ReadFieldDouble(ref reader, bodyFields, 16);",
|
||||
"var gravityWaveRadius = ReadFieldDouble(ref reader, bodyFields, 17);",
|
||||
"var gravityWaveDepth = ReadFieldDouble(ref reader, bodyFields, 18);",
|
||||
"var gravityWaveSpeed = ReadFieldDouble(ref reader, bodyFields, 19);",
|
||||
"var gravityTerrainRadius = ReadFieldDouble(ref reader, fields, 9);",
|
||||
"var gravityTerrainDepth = ReadFieldDouble(ref reader, fields, 10);",
|
||||
"var gravityTerrainDepthExponent = ReadFieldDouble(ref reader, fields, 11, 1.0);",
|
||||
"var gravityTerrainBoundaryFog = ReadFieldDouble(ref reader, fields, 12);",
|
||||
"var gravityTerrainWaveFrequency = ReadFieldDouble(ref reader, fields, 13, 1.0);",
|
||||
"new AetheriaRuntimeOrbitSnapshot(",
|
||||
"new AetheriaRuntimeBodySnapshot("
|
||||
"public sealed class AetheriaRuntimeZoneSnapshotCommit",
|
||||
"public sealed class AetheriaRuntimeOrbitSnapshotCommit",
|
||||
"public sealed class AetheriaRuntimeBodySnapshotCommit",
|
||||
"public string OrbitKey { get; set; } = \"\";",
|
||||
"public string ParentOrbitKey { get; set; } = \"\";",
|
||||
"public string BodyKey { get; set; } = \"\";",
|
||||
"public double GravityInfluenceCenterX { get; set; }",
|
||||
"public double GravityInfluenceCenterZ { get; set; }",
|
||||
"public double GravityInfluenceRadius { get; set; }",
|
||||
"public double GravityWellDepth { get; set; }",
|
||||
"public double GravityWaveRadius { get; set; }",
|
||||
"public double GravityWaveDepth { get; set; }",
|
||||
"public double GravityWaveSpeed { get; set; }",
|
||||
"public double GravityTerrainRadius { get; set; }",
|
||||
"public double GravityTerrainDepth { get; set; }",
|
||||
"public double GravityTerrainDepthExponent { get; set; }",
|
||||
"public double GravityTerrainBoundaryFog { get; set; }",
|
||||
"public double GravityTerrainWaveFrequency { get; set; }"
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -2896,7 +2871,7 @@ static void RequireTypedZoneStateSnapshotKeys(string root)
|
|||
if (missingSymbols.Length > 0)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Typed zone-state documents and runtime catalog readers must expose orbit/body key ownership explicitly: " +
|
||||
"Typed zone-state documents and managed runtime snapshot commits must expose orbit/body key ownership explicitly: " +
|
||||
string.Join("; ", missingSymbols));
|
||||
}
|
||||
}
|
||||
|
|
@ -12808,8 +12783,6 @@ static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root)
|
|||
"ReadPlayerSettings",
|
||||
"ReadVerseHostSettings",
|
||||
"ReadLoadoutTemplates",
|
||||
"ReadRunStates",
|
||||
"ReadZoneStates",
|
||||
"ReadEveSurface",
|
||||
"TryReadDaemonGameSurface",
|
||||
"TryReadDaemonGameTuiSurface",
|
||||
|
|
@ -12860,10 +12833,17 @@ static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root)
|
|||
"Shared runtime state reader still exposes file-backed entity snapshot reads; use daemon zone-render EntitySnapshots documents.");
|
||||
}
|
||||
|
||||
if (runtimeStateReader.Contains("ReadRunStates", StringComparison.Ordinal) ||
|
||||
runtimeStateReader.Contains("ReadZoneStates", StringComparison.Ordinal))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Shared runtime state reader still exposes file-backed run/zone snapshot reads; use managed daemon frame and zone-render documents.");
|
||||
}
|
||||
|
||||
var runtimeCatalogStorePath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeCatalogStore.cs");
|
||||
var runtimeCatalogStore = File.Exists(runtimeCatalogStorePath)
|
||||
? File.ReadAllText(runtimeCatalogStorePath)
|
||||
: throw new InvalidOperationException("Cannot verify deleted entity snapshot catalog reader; AetheriaRuntimeCatalogStore.cs is missing.");
|
||||
: throw new InvalidOperationException("Cannot verify deleted file-backed runtime catalog readers; AetheriaRuntimeCatalogStore.cs is missing.");
|
||||
if (runtimeCatalogStore.Contains("ReadEntitySnapshots", StringComparison.Ordinal) ||
|
||||
runtimeCatalogStore.Contains("ReadEntitySnapshotPayload", StringComparison.Ordinal) ||
|
||||
runtimeCatalogStore.Contains("EntitySnapshotSchema", StringComparison.Ordinal))
|
||||
|
|
@ -12872,6 +12852,17 @@ static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root)
|
|||
"Runtime catalog store still exposes file-backed entity snapshot projection; daemon zone-render EntitySnapshots owns runtime entity lowering.");
|
||||
}
|
||||
|
||||
if (runtimeCatalogStore.Contains("ReadRunStates", StringComparison.Ordinal) ||
|
||||
runtimeCatalogStore.Contains("ReadZoneStates", StringComparison.Ordinal) ||
|
||||
runtimeCatalogStore.Contains("ReadRunStatePayload", StringComparison.Ordinal) ||
|
||||
runtimeCatalogStore.Contains("ReadZoneStatePayload", StringComparison.Ordinal) ||
|
||||
runtimeCatalogStore.Contains("RunStateSchema", StringComparison.Ordinal) ||
|
||||
runtimeCatalogStore.Contains("ZoneStateSchema", StringComparison.Ordinal))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Runtime catalog store still exposes file-backed run/zone snapshot projection; managed daemon checkpoint and zone-render documents own runtime state lowering.");
|
||||
}
|
||||
|
||||
if (!unityPackageProject.Contains("AetheriaRuntimeStateReader.cs", StringComparison.Ordinal))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
|
|
@ -14430,19 +14421,11 @@ static void RequireDroppedPickupCheckpointState(string root)
|
|||
"DroppedPickups",
|
||||
"public double Temperature { get; set; }"
|
||||
},
|
||||
[Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeCatalogStore.cs")] = new[]
|
||||
[Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeSnapshotDocuments.cs")] = new[]
|
||||
{
|
||||
"ReadZoneStatePayload(record.Key, record.Payload)",
|
||||
"ReadFieldDroppedPickups",
|
||||
"AetheriaRuntimeDroppedPickupSnapshot",
|
||||
"var temperature = ReadFieldDouble(ref reader"
|
||||
},
|
||||
[Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeCatalogSnapshot.cs")] = new[]
|
||||
{
|
||||
"public string RecordKey",
|
||||
"AetheriaRuntimeDroppedPickupSnapshot",
|
||||
"public IReadOnlyList<AetheriaRuntimeDroppedPickupSnapshot> DroppedPickups",
|
||||
"public double Temperature { get; }"
|
||||
"AetheriaRuntimeDroppedPickupCommit",
|
||||
"public IReadOnlyList<AetheriaRuntimeDroppedPickupCommit> DroppedPickups",
|
||||
"public double Temperature { get; set; }"
|
||||
},
|
||||
[Path.Combine(root, "Assets", "Scripts", "Gameplay", "ActionGameManager.cs")] = new[]
|
||||
{
|
||||
|
|
|
|||
|
|
@ -786,138 +786,6 @@ namespace GameCult.Aetheria.State.Verse
|
|||
public IReadOnlyList<AetheriaRuntimeLoadoutItemSlotSnapshot> Items { get; }
|
||||
}
|
||||
|
||||
public sealed class AetheriaRuntimeRunStateSnapshot
|
||||
{
|
||||
public AetheriaRuntimeRunStateSnapshot(
|
||||
string runId,
|
||||
bool isTutorial,
|
||||
int entranceZoneIndex,
|
||||
int exitZoneIndex,
|
||||
int currentZoneIndex,
|
||||
string currentEntityKey,
|
||||
IReadOnlyList<int> discoveredZoneIndices,
|
||||
IReadOnlyList<string> zoneKeys,
|
||||
IReadOnlyList<AetheriaRuntimeFactionRelationshipSnapshot> factionRelationships,
|
||||
string updatedAtUtc,
|
||||
uint generationSeed)
|
||||
{
|
||||
RunId = runId;
|
||||
IsTutorial = isTutorial;
|
||||
EntranceZoneIndex = entranceZoneIndex;
|
||||
ExitZoneIndex = exitZoneIndex;
|
||||
CurrentZoneIndex = currentZoneIndex;
|
||||
CurrentEntityKey = currentEntityKey;
|
||||
DiscoveredZoneIndices = discoveredZoneIndices;
|
||||
ZoneKeys = zoneKeys;
|
||||
FactionRelationships = factionRelationships;
|
||||
UpdatedAtUtc = updatedAtUtc;
|
||||
GenerationSeed = generationSeed;
|
||||
}
|
||||
|
||||
public string RunId { get; }
|
||||
public bool IsTutorial { get; }
|
||||
public int EntranceZoneIndex { get; }
|
||||
public int ExitZoneIndex { get; }
|
||||
public int CurrentZoneIndex { get; }
|
||||
public string CurrentEntityKey { get; }
|
||||
public IReadOnlyList<int> DiscoveredZoneIndices { get; }
|
||||
public IReadOnlyList<string> ZoneKeys { get; }
|
||||
public IReadOnlyList<AetheriaRuntimeFactionRelationshipSnapshot> FactionRelationships { get; }
|
||||
public string UpdatedAtUtc { get; }
|
||||
public uint GenerationSeed { get; }
|
||||
}
|
||||
|
||||
public sealed class AetheriaRuntimeZoneStateSnapshot
|
||||
{
|
||||
public AetheriaRuntimeZoneStateSnapshot(
|
||||
string recordKey,
|
||||
string name,
|
||||
double positionX,
|
||||
double positionY,
|
||||
IReadOnlyList<int> adjacentZoneIndices,
|
||||
IReadOnlyList<int> factionIndices,
|
||||
int ownerFactionIndex,
|
||||
IReadOnlyList<string> entityKeys,
|
||||
IReadOnlyList<AetheriaRuntimeOrbitSnapshot> orbits,
|
||||
IReadOnlyList<AetheriaRuntimeBodySnapshot> bodies,
|
||||
IReadOnlyList<AetheriaRuntimeDroppedPickupSnapshot> droppedPickups,
|
||||
double gravityTerrainRadius,
|
||||
double gravityTerrainDepth,
|
||||
double gravityTerrainDepthExponent,
|
||||
double gravityTerrainBoundaryFog,
|
||||
double gravityTerrainWaveFrequency,
|
||||
double simulationTimeSeconds)
|
||||
{
|
||||
RecordKey = recordKey;
|
||||
Name = name;
|
||||
PositionX = positionX;
|
||||
PositionY = positionY;
|
||||
AdjacentZoneIndices = adjacentZoneIndices;
|
||||
FactionIndices = factionIndices;
|
||||
OwnerFactionIndex = ownerFactionIndex;
|
||||
EntityKeys = entityKeys;
|
||||
Orbits = orbits;
|
||||
Bodies = bodies;
|
||||
DroppedPickups = droppedPickups;
|
||||
GravityTerrainRadius = gravityTerrainRadius;
|
||||
GravityTerrainDepth = gravityTerrainDepth;
|
||||
GravityTerrainDepthExponent = gravityTerrainDepthExponent;
|
||||
GravityTerrainBoundaryFog = gravityTerrainBoundaryFog;
|
||||
GravityTerrainWaveFrequency = gravityTerrainWaveFrequency;
|
||||
SimulationTimeSeconds = simulationTimeSeconds;
|
||||
}
|
||||
|
||||
public string RecordKey { get; }
|
||||
public string Name { get; }
|
||||
public double PositionX { get; }
|
||||
public double PositionY { get; }
|
||||
public IReadOnlyList<int> AdjacentZoneIndices { get; }
|
||||
public IReadOnlyList<int> FactionIndices { get; }
|
||||
public int OwnerFactionIndex { get; }
|
||||
public IReadOnlyList<string> EntityKeys { get; }
|
||||
public IReadOnlyList<AetheriaRuntimeOrbitSnapshot> Orbits { get; }
|
||||
public IReadOnlyList<AetheriaRuntimeBodySnapshot> Bodies { get; }
|
||||
public IReadOnlyList<AetheriaRuntimeDroppedPickupSnapshot> DroppedPickups { get; }
|
||||
public double GravityTerrainRadius { get; }
|
||||
public double GravityTerrainDepth { get; }
|
||||
public double GravityTerrainDepthExponent { get; }
|
||||
public double GravityTerrainBoundaryFog { get; }
|
||||
public double GravityTerrainWaveFrequency { get; }
|
||||
public double SimulationTimeSeconds { get; }
|
||||
}
|
||||
|
||||
public sealed class AetheriaRuntimeDroppedPickupSnapshot
|
||||
{
|
||||
public AetheriaRuntimeDroppedPickupSnapshot(
|
||||
int pickupIndex,
|
||||
double positionX,
|
||||
double positionY,
|
||||
double positionZ,
|
||||
double velocityX,
|
||||
double velocityY,
|
||||
double velocityZ,
|
||||
AetheriaRuntimeLoadoutItemSnapshot item)
|
||||
{
|
||||
PickupIndex = pickupIndex;
|
||||
PositionX = positionX;
|
||||
PositionY = positionY;
|
||||
PositionZ = positionZ;
|
||||
VelocityX = velocityX;
|
||||
VelocityY = velocityY;
|
||||
VelocityZ = velocityZ;
|
||||
Item = item;
|
||||
}
|
||||
|
||||
public int PickupIndex { get; }
|
||||
public double PositionX { get; }
|
||||
public double PositionY { get; }
|
||||
public double PositionZ { get; }
|
||||
public double VelocityX { get; }
|
||||
public double VelocityY { get; }
|
||||
public double VelocityZ { get; }
|
||||
public AetheriaRuntimeLoadoutItemSnapshot Item { get; }
|
||||
}
|
||||
|
||||
public sealed class AetheriaRuntimeEntitySnapshot
|
||||
{
|
||||
public AetheriaRuntimeEntitySnapshot(
|
||||
|
|
@ -1050,99 +918,6 @@ namespace GameCult.Aetheria.State.Verse
|
|||
public bool Visible { get; }
|
||||
}
|
||||
|
||||
public sealed class AetheriaRuntimeFactionRelationshipSnapshot
|
||||
{
|
||||
public AetheriaRuntimeFactionRelationshipSnapshot(string factionKey, string relationship, double standing)
|
||||
{
|
||||
FactionKey = factionKey;
|
||||
Relationship = relationship;
|
||||
Standing = standing;
|
||||
}
|
||||
|
||||
public string FactionKey { get; }
|
||||
public string Relationship { get; }
|
||||
public double Standing { get; }
|
||||
}
|
||||
|
||||
public sealed class AetheriaRuntimeOrbitSnapshot
|
||||
{
|
||||
public AetheriaRuntimeOrbitSnapshot(string orbitKey, string parentOrbitKey, double distance, double phase, double fixedPositionX, double fixedPositionY)
|
||||
{
|
||||
OrbitKey = orbitKey;
|
||||
ParentOrbitKey = parentOrbitKey;
|
||||
Distance = distance;
|
||||
Phase = phase;
|
||||
FixedPositionX = fixedPositionX;
|
||||
FixedPositionY = fixedPositionY;
|
||||
}
|
||||
|
||||
public string OrbitKey { get; }
|
||||
public string ParentOrbitKey { get; }
|
||||
public double Distance { get; }
|
||||
public double Phase { get; }
|
||||
public double FixedPositionX { get; }
|
||||
public double FixedPositionY { get; }
|
||||
}
|
||||
|
||||
public sealed class AetheriaRuntimeBodySnapshot
|
||||
{
|
||||
public AetheriaRuntimeBodySnapshot(
|
||||
string bodyKey,
|
||||
string kind,
|
||||
string name,
|
||||
string orbitKey,
|
||||
double mass,
|
||||
int resourceCount,
|
||||
int asteroidCount,
|
||||
int damagedAsteroidCount,
|
||||
int respawningAsteroidCount,
|
||||
int asteroidMiningAccumulatorCount,
|
||||
double gravityInfluenceCenterX,
|
||||
double gravityInfluenceCenterZ,
|
||||
double gravityInfluenceRadius,
|
||||
double gravityWellDepth,
|
||||
double gravityWaveRadius,
|
||||
double gravityWaveDepth,
|
||||
double gravityWaveSpeed)
|
||||
{
|
||||
BodyKey = bodyKey;
|
||||
Kind = kind;
|
||||
Name = name;
|
||||
OrbitKey = orbitKey;
|
||||
Mass = mass;
|
||||
ResourceCount = resourceCount;
|
||||
AsteroidCount = asteroidCount;
|
||||
DamagedAsteroidCount = damagedAsteroidCount;
|
||||
RespawningAsteroidCount = respawningAsteroidCount;
|
||||
AsteroidMiningAccumulatorCount = asteroidMiningAccumulatorCount;
|
||||
GravityInfluenceCenterX = gravityInfluenceCenterX;
|
||||
GravityInfluenceCenterZ = gravityInfluenceCenterZ;
|
||||
GravityInfluenceRadius = gravityInfluenceRadius;
|
||||
GravityWellDepth = gravityWellDepth;
|
||||
GravityWaveRadius = gravityWaveRadius;
|
||||
GravityWaveDepth = gravityWaveDepth;
|
||||
GravityWaveSpeed = gravityWaveSpeed;
|
||||
}
|
||||
|
||||
public string BodyKey { get; }
|
||||
public string Kind { get; }
|
||||
public string Name { get; }
|
||||
public string OrbitKey { get; }
|
||||
public double Mass { get; }
|
||||
public int ResourceCount { get; }
|
||||
public int AsteroidCount { get; }
|
||||
public int DamagedAsteroidCount { get; }
|
||||
public int RespawningAsteroidCount { get; }
|
||||
public int AsteroidMiningAccumulatorCount { get; }
|
||||
public double GravityInfluenceCenterX { get; }
|
||||
public double GravityInfluenceCenterZ { get; }
|
||||
public double GravityInfluenceRadius { get; }
|
||||
public double GravityWellDepth { get; }
|
||||
public double GravityWaveRadius { get; }
|
||||
public double GravityWaveDepth { get; }
|
||||
public double GravityWaveSpeed { get; }
|
||||
}
|
||||
|
||||
public sealed class AetheriaRuntimeEntityItemSlotSnapshot
|
||||
{
|
||||
public AetheriaRuntimeEntityItemSlotSnapshot(
|
||||
|
|
|
|||
|
|
@ -21,8 +21,6 @@ namespace GameCult.Aetheria.State.Verse
|
|||
private const string PlayerSettingsSchema = "aetheria.player_settings";
|
||||
private const string VerseHostSettingsSchema = "aetheria.verse_host_settings";
|
||||
private const string LoadoutTemplateSchema = "aetheria.loadout_template";
|
||||
private const string RunStateSchema = "aetheria.run_state";
|
||||
private const string ZoneStateSchema = "aetheria.zone_state";
|
||||
private const string TradeValuePolicyKey = "global:aetheria.trade_value_policy.v1";
|
||||
private const string PlayerSettingsKey = "global:aetheria.player_settings.v1";
|
||||
private const string VerseHostSettingsKey = "global:aetheria.verse_host_settings.v1";
|
||||
|
|
@ -359,44 +357,6 @@ namespace GameCult.Aetheria.State.Verse
|
|||
.ToArray();
|
||||
}
|
||||
|
||||
public static IReadOnlyList<AetheriaRuntimeRunStateSnapshot> ReadRunStates(string stateFilePath)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(stateFilePath))
|
||||
throw new ArgumentException("State file path must be non-empty.", nameof(stateFilePath));
|
||||
|
||||
var catalog = ReadSchemaCatalog(stateFilePath);
|
||||
var runs = new List<AetheriaRuntimeRunStateSnapshot>();
|
||||
foreach (var record in ReadRecords(stateFilePath))
|
||||
{
|
||||
if (!catalog.TryGetValue(record.SchemaId, out var schemaName) ||
|
||||
schemaName != RunStateSchema)
|
||||
continue;
|
||||
|
||||
runs.Add(ReadRunStatePayload(record.Payload));
|
||||
}
|
||||
|
||||
return runs.OrderBy(run => run.RunId, StringComparer.Ordinal).ToArray();
|
||||
}
|
||||
|
||||
public static IReadOnlyList<AetheriaRuntimeZoneStateSnapshot> ReadZoneStates(string stateFilePath)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(stateFilePath))
|
||||
throw new ArgumentException("State file path must be non-empty.", nameof(stateFilePath));
|
||||
|
||||
var catalog = ReadSchemaCatalog(stateFilePath);
|
||||
var zones = new List<AetheriaRuntimeZoneStateSnapshot>();
|
||||
foreach (var record in ReadRecords(stateFilePath))
|
||||
{
|
||||
if (!catalog.TryGetValue(record.SchemaId, out var schemaName) ||
|
||||
schemaName != ZoneStateSchema)
|
||||
continue;
|
||||
|
||||
zones.Add(ReadZoneStatePayload(record.Key, record.Payload));
|
||||
}
|
||||
|
||||
return zones.OrderBy(zone => zone.Name, StringComparer.Ordinal).ToArray();
|
||||
}
|
||||
|
||||
private static Dictionary<string, string> ReadSchemaCatalog(string stateFilePath)
|
||||
{
|
||||
if (!File.Exists(stateFilePath))
|
||||
|
|
@ -1131,110 +1091,6 @@ namespace GameCult.Aetheria.State.Verse
|
|||
updatedAtUtc);
|
||||
}
|
||||
|
||||
private static AetheriaRuntimeRunStateSnapshot ReadRunStatePayload(byte[] payload)
|
||||
{
|
||||
var reader = new MessagePackReader(payload);
|
||||
var fields = reader.ReadArrayHeader();
|
||||
var runId = ReadFieldString(ref reader, fields, 0);
|
||||
var isTutorial = ReadFieldBool(ref reader, fields, 1);
|
||||
var entranceZoneIndex = ReadFieldInt32(ref reader, fields, 2);
|
||||
var exitZoneIndex = ReadFieldInt32(ref reader, fields, 3);
|
||||
var currentZoneIndex = ReadFieldInt32(ref reader, fields, 4);
|
||||
var legacyCurrentZoneEntityIndex = ReadFieldInt32(ref reader, fields, 5, -1);
|
||||
var discoveredZoneIndices = ReadFieldInt32Array(ref reader, fields, 6);
|
||||
var zoneKeys = ReadFieldStringArray(ref reader, fields, 7);
|
||||
SkipField(ref reader, fields, 8);
|
||||
var factionRelationships = ReadFieldFactionRelationships(ref reader, fields, 9);
|
||||
var updatedAtUtc = ReadFieldString(ref reader, fields, 10);
|
||||
var generationSeed = ReadFieldUInt32(ref reader, fields, 11);
|
||||
var currentEntityKey = ReadFieldString(ref reader, fields, 12);
|
||||
if (string.IsNullOrWhiteSpace(currentEntityKey))
|
||||
{
|
||||
currentEntityKey = LegacyCurrentEntityKey(runId, currentZoneIndex, legacyCurrentZoneEntityIndex);
|
||||
}
|
||||
|
||||
SkipRemaining(ref reader, fields, 13);
|
||||
return new AetheriaRuntimeRunStateSnapshot(
|
||||
runId,
|
||||
isTutorial,
|
||||
entranceZoneIndex,
|
||||
exitZoneIndex,
|
||||
currentZoneIndex,
|
||||
currentEntityKey,
|
||||
discoveredZoneIndices,
|
||||
zoneKeys,
|
||||
factionRelationships,
|
||||
updatedAtUtc,
|
||||
generationSeed);
|
||||
}
|
||||
|
||||
private static AetheriaRuntimeZoneStateSnapshot ReadZoneStatePayload(string recordKey, byte[] payload)
|
||||
{
|
||||
var reader = new MessagePackReader(payload);
|
||||
var fields = reader.ReadArrayHeader();
|
||||
var name = ReadFieldString(ref reader, fields, 0);
|
||||
var position = ReadFieldVector2(ref reader, fields, 1);
|
||||
var adjacentZoneIndices = ReadFieldInt32Array(ref reader, fields, 2);
|
||||
var factionIndices = ReadFieldInt32Array(ref reader, fields, 3);
|
||||
var ownerFactionIndex = ReadFieldInt32(ref reader, fields, 4);
|
||||
var entityKeys = ReadFieldStringArray(ref reader, fields, 5);
|
||||
var orbits = ReadFieldOrbitSnapshots(ref reader, fields, 6);
|
||||
var bodies = ReadFieldBodySnapshots(ref reader, fields, 7);
|
||||
var droppedPickups = ReadFieldDroppedPickups(ref reader, fields, 8);
|
||||
var gravityTerrainRadius = ReadFieldDouble(ref reader, fields, 9);
|
||||
var gravityTerrainDepth = ReadFieldDouble(ref reader, fields, 10);
|
||||
var gravityTerrainDepthExponent = ReadFieldDouble(ref reader, fields, 11, 1.0);
|
||||
var gravityTerrainBoundaryFog = ReadFieldDouble(ref reader, fields, 12);
|
||||
var gravityTerrainWaveFrequency = ReadFieldDouble(ref reader, fields, 13, 1.0);
|
||||
var simulationTimeSeconds = ReadFieldDouble(ref reader, fields, 14);
|
||||
SkipRemaining(ref reader, fields, 15);
|
||||
return new AetheriaRuntimeZoneStateSnapshot(
|
||||
recordKey,
|
||||
name,
|
||||
position.X,
|
||||
position.Y,
|
||||
adjacentZoneIndices,
|
||||
factionIndices,
|
||||
ownerFactionIndex,
|
||||
entityKeys,
|
||||
orbits,
|
||||
bodies,
|
||||
droppedPickups,
|
||||
gravityTerrainRadius,
|
||||
gravityTerrainDepth,
|
||||
gravityTerrainDepthExponent,
|
||||
gravityTerrainBoundaryFog,
|
||||
gravityTerrainWaveFrequency,
|
||||
simulationTimeSeconds);
|
||||
}
|
||||
|
||||
private static IReadOnlyList<AetheriaRuntimeDroppedPickupSnapshot> ReadFieldDroppedPickups(ref MessagePackReader reader, int fields, int index)
|
||||
{
|
||||
if (index >= fields) return Array.Empty<AetheriaRuntimeDroppedPickupSnapshot>();
|
||||
var count = reader.ReadArrayHeader();
|
||||
var pickups = new AetheriaRuntimeDroppedPickupSnapshot[count];
|
||||
for (var pickup = 0; pickup < count; pickup++)
|
||||
{
|
||||
var pickupFields = reader.ReadArrayHeader();
|
||||
var pickupIndex = pickupFields > 0 ? ReadFieldInt32(ref reader, pickupFields, 0) : -1;
|
||||
var position = ReadFieldVector3(ref reader, pickupFields, 1);
|
||||
var velocity = ReadFieldVector3(ref reader, pickupFields, 2);
|
||||
var item = ReadFieldLoadoutItem(ref reader, pickupFields, 3);
|
||||
SkipRemaining(ref reader, pickupFields, 4);
|
||||
pickups[pickup] = new AetheriaRuntimeDroppedPickupSnapshot(
|
||||
pickupIndex,
|
||||
position.X,
|
||||
position.Y,
|
||||
position.Z,
|
||||
velocity.X,
|
||||
velocity.Y,
|
||||
velocity.Z,
|
||||
item);
|
||||
}
|
||||
|
||||
return pickups;
|
||||
}
|
||||
|
||||
private static IReadOnlyList<AetheriaRuntimeEntityContactSnapshot> ReadFieldEntityContacts(ref MessagePackReader reader, int fields, int index)
|
||||
{
|
||||
if (index >= fields) return Array.Empty<AetheriaRuntimeEntityContactSnapshot>();
|
||||
|
|
@ -1254,155 +1110,6 @@ namespace GameCult.Aetheria.State.Verse
|
|||
return contacts;
|
||||
}
|
||||
|
||||
private static Vector2Value ReadFieldVector2(ref MessagePackReader reader, int fields, int index)
|
||||
{
|
||||
if (index >= fields) return new Vector2Value(0, 0);
|
||||
var vectorFields = reader.ReadArrayHeader();
|
||||
var x = ReadFieldDouble(ref reader, vectorFields, 0);
|
||||
var y = ReadFieldDouble(ref reader, vectorFields, 1);
|
||||
SkipRemaining(ref reader, vectorFields, 2);
|
||||
return new Vector2Value(x, y);
|
||||
}
|
||||
|
||||
private static Vector3Value ReadFieldVector3(ref MessagePackReader reader, int fields, int index)
|
||||
{
|
||||
if (index >= fields) return new Vector3Value(0, 0, 0);
|
||||
var vectorFields = reader.ReadArrayHeader();
|
||||
var x = ReadFieldDouble(ref reader, vectorFields, 0);
|
||||
var y = ReadFieldDouble(ref reader, vectorFields, 1);
|
||||
var z = ReadFieldDouble(ref reader, vectorFields, 2);
|
||||
SkipRemaining(ref reader, vectorFields, 3);
|
||||
return new Vector3Value(x, y, z);
|
||||
}
|
||||
|
||||
private static IReadOnlyList<AetheriaRuntimeFactionRelationshipSnapshot> ReadFieldFactionRelationships(ref MessagePackReader reader, int fields, int index)
|
||||
{
|
||||
if (index >= fields) return Array.Empty<AetheriaRuntimeFactionRelationshipSnapshot>();
|
||||
var count = reader.ReadArrayHeader();
|
||||
var relationships = new AetheriaRuntimeFactionRelationshipSnapshot[count];
|
||||
for (var relationshipIndex = 0; relationshipIndex < count; relationshipIndex++)
|
||||
{
|
||||
var relationshipFields = reader.ReadArrayHeader();
|
||||
var factionKey = ReadFieldString(ref reader, relationshipFields, 0);
|
||||
var relationship = ReadFieldString(ref reader, relationshipFields, 1);
|
||||
var standing = ReadFieldDouble(ref reader, relationshipFields, 2);
|
||||
SkipRemaining(ref reader, relationshipFields, 3);
|
||||
relationships[relationshipIndex] = new AetheriaRuntimeFactionRelationshipSnapshot(factionKey, relationship, standing);
|
||||
}
|
||||
|
||||
return relationships;
|
||||
}
|
||||
|
||||
private static IReadOnlyList<AetheriaRuntimeOrbitSnapshot> ReadFieldOrbitSnapshots(ref MessagePackReader reader, int fields, int index)
|
||||
{
|
||||
if (index >= fields) return Array.Empty<AetheriaRuntimeOrbitSnapshot>();
|
||||
var count = reader.ReadArrayHeader();
|
||||
var orbits = new AetheriaRuntimeOrbitSnapshot[count];
|
||||
for (var orbit = 0; orbit < count; orbit++)
|
||||
{
|
||||
var orbitFields = reader.ReadArrayHeader();
|
||||
var orbitKey = ReadFieldString(ref reader, orbitFields, 0);
|
||||
var parentOrbitKey = ReadFieldString(ref reader, orbitFields, 1);
|
||||
var distance = ReadFieldDouble(ref reader, orbitFields, 2);
|
||||
var phase = ReadFieldDouble(ref reader, orbitFields, 3);
|
||||
var fixedPosition = ReadFieldVector2(ref reader, orbitFields, 4);
|
||||
SkipRemaining(ref reader, orbitFields, 5);
|
||||
orbits[orbit] = new AetheriaRuntimeOrbitSnapshot(
|
||||
orbitKey,
|
||||
parentOrbitKey,
|
||||
distance,
|
||||
phase,
|
||||
fixedPosition.X,
|
||||
fixedPosition.Y);
|
||||
}
|
||||
|
||||
return orbits;
|
||||
}
|
||||
|
||||
private static IReadOnlyList<AetheriaRuntimeBodySnapshot> ReadFieldBodySnapshots(ref MessagePackReader reader, int fields, int index)
|
||||
{
|
||||
if (index >= fields) return Array.Empty<AetheriaRuntimeBodySnapshot>();
|
||||
var count = reader.ReadArrayHeader();
|
||||
var bodies = new AetheriaRuntimeBodySnapshot[count];
|
||||
for (var body = 0; body < count; body++)
|
||||
{
|
||||
var bodyFields = reader.ReadArrayHeader();
|
||||
var bodyKey = ReadFieldString(ref reader, bodyFields, 0);
|
||||
var kind = ReadFieldString(ref reader, bodyFields, 1);
|
||||
var name = ReadFieldString(ref reader, bodyFields, 2);
|
||||
var orbitKey = ReadFieldString(ref reader, bodyFields, 3);
|
||||
var mass = ReadFieldDouble(ref reader, bodyFields, 4);
|
||||
var resourceCount = CountAndSkipFieldArray(ref reader, bodyFields, 5);
|
||||
SkipFields(ref reader, bodyFields, 6, 10);
|
||||
var asteroidSummary = ReadFieldAsteroidSummary(ref reader, bodyFields, 10);
|
||||
SkipFields(ref reader, bodyFields, 11, 13);
|
||||
var gravityInfluenceCenterX = ReadFieldDouble(ref reader, bodyFields, 13, double.NaN);
|
||||
var gravityInfluenceCenterZ = ReadFieldDouble(ref reader, bodyFields, 14, double.NaN);
|
||||
var gravityInfluenceRadius = ReadFieldDouble(ref reader, bodyFields, 15);
|
||||
var gravityWellDepth = ReadFieldDouble(ref reader, bodyFields, 16);
|
||||
var gravityWaveRadius = ReadFieldDouble(ref reader, bodyFields, 17);
|
||||
var gravityWaveDepth = ReadFieldDouble(ref reader, bodyFields, 18);
|
||||
var gravityWaveSpeed = ReadFieldDouble(ref reader, bodyFields, 19);
|
||||
SkipRemaining(ref reader, bodyFields, 20);
|
||||
bodies[body] = new AetheriaRuntimeBodySnapshot(
|
||||
bodyKey,
|
||||
kind,
|
||||
name,
|
||||
orbitKey,
|
||||
mass,
|
||||
resourceCount,
|
||||
asteroidSummary.Count,
|
||||
asteroidSummary.DamagedCount,
|
||||
asteroidSummary.RespawningCount,
|
||||
asteroidSummary.MiningAccumulatorCount,
|
||||
gravityInfluenceCenterX,
|
||||
gravityInfluenceCenterZ,
|
||||
gravityInfluenceRadius,
|
||||
gravityWellDepth,
|
||||
gravityWaveRadius,
|
||||
gravityWaveDepth,
|
||||
gravityWaveSpeed);
|
||||
}
|
||||
|
||||
return bodies;
|
||||
}
|
||||
|
||||
private static AsteroidSummary ReadFieldAsteroidSummary(ref MessagePackReader reader, int fields, int index)
|
||||
{
|
||||
if (index >= fields) return new AsteroidSummary(0, 0, 0, 0);
|
||||
var count = reader.ReadArrayHeader();
|
||||
var damagedCount = 0;
|
||||
var respawningCount = 0;
|
||||
var miningAccumulatorCount = 0;
|
||||
for (var asteroid = 0; asteroid < count; asteroid++)
|
||||
{
|
||||
var asteroidFields = reader.ReadArrayHeader();
|
||||
SkipFields(ref reader, asteroidFields, 0, 4);
|
||||
if (ReadFieldDouble(ref reader, asteroidFields, 4) > 0) damagedCount++;
|
||||
if (ReadFieldDouble(ref reader, asteroidFields, 5) > 0) respawningCount++;
|
||||
miningAccumulatorCount += CountAndSkipFieldArray(ref reader, asteroidFields, 6);
|
||||
SkipRemaining(ref reader, asteroidFields, 7);
|
||||
}
|
||||
|
||||
return new AsteroidSummary(count, damagedCount, respawningCount, miningAccumulatorCount);
|
||||
}
|
||||
|
||||
private readonly struct AsteroidSummary
|
||||
{
|
||||
public AsteroidSummary(int count, int damagedCount, int respawningCount, int miningAccumulatorCount)
|
||||
{
|
||||
Count = count;
|
||||
DamagedCount = damagedCount;
|
||||
RespawningCount = respawningCount;
|
||||
MiningAccumulatorCount = miningAccumulatorCount;
|
||||
}
|
||||
|
||||
public int Count { get; }
|
||||
public int DamagedCount { get; }
|
||||
public int RespawningCount { get; }
|
||||
public int MiningAccumulatorCount { get; }
|
||||
}
|
||||
|
||||
private static IReadOnlyList<AetheriaRuntimeEntityItemSlotSnapshot> ReadFieldEntityItemSlots(ref MessagePackReader reader, int fields, int index)
|
||||
{
|
||||
if (index >= fields) return Array.Empty<AetheriaRuntimeEntityItemSlotSnapshot>();
|
||||
|
|
@ -2417,16 +2124,6 @@ namespace GameCult.Aetheria.State.Verse
|
|||
: $"aetheria.item_definition:legacy:{legacyItemId.Trim()}";
|
||||
}
|
||||
|
||||
private static string LegacyCurrentEntityKey(string runId, int zoneIndex, int entityIndex)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(runId) || zoneIndex < 0 || entityIndex < 0)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
return $"global:aetheria.run_state.{runId}.zone.{zoneIndex}.entity.{entityIndex}.v1";
|
||||
}
|
||||
|
||||
private static string CorporationKey(string legacyCorporationId)
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(legacyCorporationId)
|
||||
|
|
@ -2458,15 +2155,6 @@ namespace GameCult.Aetheria.State.Verse
|
|||
reader.Skip();
|
||||
}
|
||||
|
||||
private static int CountAndSkipFieldArray(ref MessagePackReader reader, int fields, int index)
|
||||
{
|
||||
if (index >= fields) return 0;
|
||||
var count = reader.ReadArrayHeader();
|
||||
for (var item = 0; item < count; item++)
|
||||
reader.Skip();
|
||||
return count;
|
||||
}
|
||||
|
||||
private static void SkipRemaining(ref MessagePackReader reader, int fields, int firstUnhandledIndex)
|
||||
{
|
||||
for (var field = firstUnhandledIndex; field < fields; field++)
|
||||
|
|
@ -2595,35 +2283,6 @@ namespace GameCult.Aetheria.State.Verse
|
|||
public IReadOnlyList<string> ActionBarInputs { get; }
|
||||
}
|
||||
|
||||
private readonly struct Vector2Value
|
||||
{
|
||||
public Vector2Value(double x, double y)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
}
|
||||
|
||||
public double X { get; }
|
||||
|
||||
public double Y { get; }
|
||||
}
|
||||
|
||||
private readonly struct Vector3Value
|
||||
{
|
||||
public Vector3Value(double x, double y, double z)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
Z = z;
|
||||
}
|
||||
|
||||
public double X { get; }
|
||||
|
||||
public double Y { get; }
|
||||
|
||||
public double Z { get; }
|
||||
}
|
||||
|
||||
private readonly struct GridCoord
|
||||
{
|
||||
public GridCoord(int x, int y)
|
||||
|
|
|
|||
|
|
@ -37,16 +37,6 @@ namespace GameCult.Aetheria.State.Verse
|
|||
return AetheriaRuntimeCatalogStore.ReadLoadoutTemplates(stateFilePath);
|
||||
}
|
||||
|
||||
public static IReadOnlyList<AetheriaRuntimeRunStateSnapshot> ReadRunStates(string stateFilePath)
|
||||
{
|
||||
return AetheriaRuntimeCatalogStore.ReadRunStates(stateFilePath);
|
||||
}
|
||||
|
||||
public static IReadOnlyList<AetheriaRuntimeZoneStateSnapshot> ReadZoneStates(string stateFilePath)
|
||||
{
|
||||
return AetheriaRuntimeCatalogStore.ReadZoneStates(stateFilePath);
|
||||
}
|
||||
|
||||
public static bool TryReadDaemonFrame(string stateFilePath, out AetheriaRuntimeDaemonFrameDocument frame)
|
||||
{
|
||||
return AetheriaRuntimeDaemonFrameStore.TryReadFrame(stateFilePath, out frame);
|
||||
|
|
|
|||
Loading…
Reference in a new issue