Persist faction relationships in run checkpoints
This commit is contained in:
parent
0115d8048a
commit
e0a39b2fce
8 changed files with 73 additions and 6 deletions
Binary file not shown.
|
|
@ -182,6 +182,15 @@ try
|
||||||
BehaviorIndex = 1
|
BehaviorIndex = 1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
FactionRelationships = new[]
|
||||||
|
{
|
||||||
|
new AetheriaRuntimeFactionRelationshipCommit
|
||||||
|
{
|
||||||
|
CorporationLegacyId = "smoke:faction",
|
||||||
|
Relationship = "Friendly",
|
||||||
|
Standing = 3
|
||||||
|
}
|
||||||
|
},
|
||||||
Zones = new[]
|
Zones = new[]
|
||||||
{
|
{
|
||||||
new AetheriaRuntimeZoneSnapshotCommit
|
new AetheriaRuntimeZoneSnapshotCommit
|
||||||
|
|
@ -256,6 +265,10 @@ try
|
||||||
run.ActionBarBindings[1].TargetKey == "aetheria.item_definition:legacy:smoke:weapon" &&
|
run.ActionBarBindings[1].TargetKey == "aetheria.item_definition:legacy:smoke:weapon" &&
|
||||||
run.ActionBarBindings[1].EquipmentIndex == 0 &&
|
run.ActionBarBindings[1].EquipmentIndex == 0 &&
|
||||||
run.ActionBarBindings[1].BehaviorIndex == 1 &&
|
run.ActionBarBindings[1].BehaviorIndex == 1 &&
|
||||||
|
run.FactionRelationships.Length == 1 &&
|
||||||
|
run.FactionRelationships[0].FactionKey == "aetheria.corporation:legacy:smoke:faction" &&
|
||||||
|
run.FactionRelationships[0].Relationship == "Friendly" &&
|
||||||
|
run.FactionRelationships[0].Standing == 3 &&
|
||||||
zone?.EntityKeys.Length == 1 &&
|
zone?.EntityKeys.Length == 1 &&
|
||||||
entity?.Equipment.Length == 1 &&
|
entity?.Equipment.Length == 1 &&
|
||||||
entity.WeaponGroups.Length == 1 &&
|
entity.WeaponGroups.Length == 1 &&
|
||||||
|
|
@ -311,5 +324,5 @@ Console.WriteLine($"Behavior payload sample: {behaviorHost.Name} {behaviorPayloa
|
||||||
Console.WriteLine($"Behavior sample: {behaviorKind}");
|
Console.WriteLine($"Behavior sample: {behaviorKind}");
|
||||||
Console.WriteLine($"Eve surface: {surface.Surface.Id}");
|
Console.WriteLine($"Eve surface: {surface.Surface.Id}");
|
||||||
Console.WriteLine($"Package Eve surfaces: {packageSurfaces.Count}");
|
Console.WriteLine($"Package Eve surfaces: {packageSurfaces.Count}");
|
||||||
Console.WriteLine("Runtime state commit log smoke: settings, action-bar bindings, and run zone/entity snapshots queued, applied, and cleared");
|
Console.WriteLine("Runtime state commit log smoke: settings, action-bar bindings, faction relationships, and run zone/entity snapshots queued, applied, and cleared");
|
||||||
Console.WriteLine("Runtime Eve command log smoke: surface command queued separately from state commits");
|
Console.WriteLine("Runtime Eve command log smoke: surface command queued separately from state commits");
|
||||||
|
|
|
||||||
|
|
@ -226,6 +226,7 @@ public static class AetheriaRuntimeCommitLogApplier
|
||||||
CurrentZoneEntityIndex = checkpoint.CurrentZoneEntityIndex,
|
CurrentZoneEntityIndex = checkpoint.CurrentZoneEntityIndex,
|
||||||
DiscoveredZoneIndices = ToIntArray(checkpoint.DiscoveredZoneIndices),
|
DiscoveredZoneIndices = ToIntArray(checkpoint.DiscoveredZoneIndices),
|
||||||
ActionBarBindings = ToActionBarBindings(checkpoint.ActionBarBindings),
|
ActionBarBindings = ToActionBarBindings(checkpoint.ActionBarBindings),
|
||||||
|
FactionRelationships = ToFactionRelationships(checkpoint.FactionRelationships),
|
||||||
UpdatedAtUtc = updatedAtUtc
|
UpdatedAtUtc = updatedAtUtc
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -328,6 +329,19 @@ public static class AetheriaRuntimeCommitLogApplier
|
||||||
.ToArray();
|
.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static AetheriaFactionRelationshipState[] ToFactionRelationships(
|
||||||
|
IReadOnlyList<AetheriaRuntimeFactionRelationshipCommit>? relationships)
|
||||||
|
{
|
||||||
|
return (relationships ?? Array.Empty<AetheriaRuntimeFactionRelationshipCommit>())
|
||||||
|
.Select(relationship => new AetheriaFactionRelationshipState
|
||||||
|
{
|
||||||
|
FactionKey = ReferenceKey("aetheria.corporation", relationship.CorporationLegacyId ?? ""),
|
||||||
|
Relationship = relationship.Relationship ?? "",
|
||||||
|
Standing = relationship.Standing
|
||||||
|
})
|
||||||
|
.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
private static CultRecordKey LoadoutKey(string name)
|
private static CultRecordKey LoadoutKey(string name)
|
||||||
{
|
{
|
||||||
return new CultRecordKey($"global:aetheria.loadout_template.{StableToken(name)}.v1");
|
return new CultRecordKey($"global:aetheria.loadout_template.{StableToken(name)}.v1");
|
||||||
|
|
|
||||||
|
|
@ -358,6 +358,9 @@ public sealed class AetheriaFactionRelationshipState
|
||||||
public string FactionKey { get; set; } = "";
|
public string FactionKey { get; set; } = "";
|
||||||
|
|
||||||
[Key(1)]
|
[Key(1)]
|
||||||
|
public string Relationship { get; set; } = "";
|
||||||
|
|
||||||
|
[Key(2)]
|
||||||
public double Standing { get; set; }
|
public double Standing { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@ run state, zone state, entity snapshots, item slots, weapon groups, action-bar
|
||||||
bindings, and stat grids. Runtime checkpoints include current action-bar
|
bindings, and stat grids. Runtime checkpoints include current action-bar
|
||||||
bindings as stable typed targets: input control path, binding kind, item
|
bindings as stable typed targets: input control path, binding kind, item
|
||||||
definition reference, equipment index, behavior index, or weapon-group index.
|
definition reference, equipment index, behavior index, or weapon-group index.
|
||||||
|
They also include current faction relationship rows as typed corporation
|
||||||
|
references plus relationship tokens and numeric standings.
|
||||||
Player settings include player name, tutorial flag,
|
Player settings include player name, tutorial flag,
|
||||||
story-file hash cursors, gameplay formatting, graphics preferences, input
|
story-file hash cursors, gameplay formatting, graphics preferences, input
|
||||||
binding overrides, and action-bar inputs. Do not preserve `SavedGame`, Unity
|
binding overrides, and action-bar inputs. Do not preserve `SavedGame`, Unity
|
||||||
|
|
@ -105,9 +107,10 @@ Typed corporation documents include the legacy short name, the true description
|
||||||
field from key 3, name-file and boss-hull legacy IDs, influence distance,
|
field from key 3, name-file and boss-hull legacy IDs, influence distance,
|
||||||
allegiance count, full allegiance edges, and music bank IDs. Corporation
|
allegiance count, full allegiance edges, and music bank IDs. Corporation
|
||||||
documents are `aetheria.corporation.v2` records because runtime generation
|
documents are `aetheria.corporation.v2` records because runtime generation
|
||||||
needs actual allegiance weights, not only display counts. Runtime object graphs,
|
needs actual allegiance weights, not only display counts. Runtime checkpoints
|
||||||
typed behavior factory construction, and simulation state remain legacy until
|
now persist session faction relationships into typed run state, but broader
|
||||||
dedicated typed runtime documents exist.
|
runtime object graphs, typed behavior factory construction, and simulation
|
||||||
|
state remain legacy until dedicated typed runtime documents exist.
|
||||||
Typed name-file documents are `aetheria.name_file.v2` records. They carry the
|
Typed name-file documents are `aetheria.name_file.v2` records. They carry the
|
||||||
legacy ID, display name, count, compact sample names for surfaces, and the full
|
legacy ID, display name, count, compact sample names for surfaces, and the full
|
||||||
name array needed to move `Galaxy`/Markov name generation off legacy
|
name array needed to move `Galaxy`/Markov name generation off legacy
|
||||||
|
|
|
||||||
|
|
@ -423,6 +423,7 @@ public class ActionGameManager : MonoBehaviour
|
||||||
.OrderBy(index => index)
|
.OrderBy(index => index)
|
||||||
.ToArray() ?? Array.Empty<int>(),
|
.ToArray() ?? Array.Empty<int>(),
|
||||||
ActionBarBindings = ProjectActionBarBindings(),
|
ActionBarBindings = ProjectActionBarBindings(),
|
||||||
|
FactionRelationships = ProjectFactionRelationships(),
|
||||||
Zones = Zone == null ? Array.Empty<AetheriaRuntimeZoneSnapshotCommit>() : new[] { ProjectZoneSnapshot(Zone) }
|
Zones = Zone == null ? Array.Empty<AetheriaRuntimeZoneSnapshotCommit>() : new[] { ProjectZoneSnapshot(Zone) }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -467,6 +468,20 @@ public class ActionGameManager : MonoBehaviour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private AetheriaRuntimeFactionRelationshipCommit[] ProjectFactionRelationships()
|
||||||
|
{
|
||||||
|
return CurrentGalaxy?.FactionRelationships?
|
||||||
|
.Where(pair => pair.Key != null)
|
||||||
|
.OrderBy(pair => pair.Key.ID)
|
||||||
|
.Select(pair => new AetheriaRuntimeFactionRelationshipCommit
|
||||||
|
{
|
||||||
|
CorporationLegacyId = pair.Key.ID == Guid.Empty ? "" : pair.Key.ID.ToString("D"),
|
||||||
|
Relationship = pair.Value.ToString(),
|
||||||
|
Standing = (int)pair.Value
|
||||||
|
})
|
||||||
|
.ToArray() ?? Array.Empty<AetheriaRuntimeFactionRelationshipCommit>();
|
||||||
|
}
|
||||||
|
|
||||||
private AetheriaRuntimeZoneSnapshotCommit ProjectZoneSnapshot(Zone zone)
|
private AetheriaRuntimeZoneSnapshotCommit ProjectZoneSnapshot(Zone zone)
|
||||||
{
|
{
|
||||||
var galaxyZone = zone.GalaxyZone;
|
var galaxyZone = zone.GalaxyZone;
|
||||||
|
|
|
||||||
|
|
@ -235,6 +235,9 @@ namespace GameCult.Aetheria.State.Unity
|
||||||
|
|
||||||
[Key(8)]
|
[Key(8)]
|
||||||
public IReadOnlyList<AetheriaRuntimeActionBarBindingCommit> ActionBarBindings { get; set; } = Array.Empty<AetheriaRuntimeActionBarBindingCommit>();
|
public IReadOnlyList<AetheriaRuntimeActionBarBindingCommit> ActionBarBindings { get; set; } = Array.Empty<AetheriaRuntimeActionBarBindingCommit>();
|
||||||
|
|
||||||
|
[Key(9)]
|
||||||
|
public IReadOnlyList<AetheriaRuntimeFactionRelationshipCommit> FactionRelationships { get; set; } = Array.Empty<AetheriaRuntimeFactionRelationshipCommit>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[MessagePackObject]
|
[MessagePackObject]
|
||||||
|
|
@ -259,6 +262,19 @@ namespace GameCult.Aetheria.State.Unity
|
||||||
public int WeaponGroup { get; set; } = -1;
|
public int WeaponGroup { get; set; } = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[MessagePackObject]
|
||||||
|
public sealed class AetheriaRuntimeFactionRelationshipCommit
|
||||||
|
{
|
||||||
|
[Key(0)]
|
||||||
|
public string CorporationLegacyId { get; set; } = "";
|
||||||
|
|
||||||
|
[Key(1)]
|
||||||
|
public string Relationship { get; set; } = "";
|
||||||
|
|
||||||
|
[Key(2)]
|
||||||
|
public double Standing { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
[MessagePackObject]
|
[MessagePackObject]
|
||||||
public sealed class AetheriaRuntimeZoneSnapshotCommit
|
public sealed class AetheriaRuntimeZoneSnapshotCommit
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -119,8 +119,8 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
|
||||||
a zone referencing an entity snapshot, and an entity snapshot carrying
|
a zone referencing an entity snapshot, and an entity snapshot carrying
|
||||||
position, direction, faction, hull, equipment slots, weapon groups, and a stat
|
position, direction, faction, hull, equipment slots, weapon groups, and a stat
|
||||||
grid. This proves the `.zone` replacement graph is durable typed state. Unity
|
grid. This proves the `.zone` replacement graph is durable typed state. Unity
|
||||||
now queues current-zone/current-entity-collection snapshots and current
|
now queues current-zone/current-entity-collection snapshots, current
|
||||||
action-bar bindings through the
|
action-bar bindings, and current faction relationship rows through the
|
||||||
runtime commit log during run checkpoints; `RuntimeZoneBlueprint` and
|
runtime commit log during run checkpoints; `RuntimeZoneBlueprint` and
|
||||||
`RuntimeEntityBlueprint` remain runtime construction/loadout projections
|
`RuntimeEntityBlueprint` remain runtime construction/loadout projections
|
||||||
rather than durable file formats. Runtime blueprint restore now iterates typed
|
rather than durable file formats. Runtime blueprint restore now iterates typed
|
||||||
|
|
@ -722,6 +722,9 @@ First Aetheria surfaces to publish:
|
||||||
- Done: extend run checkpoint commits and smoke coverage to carry typed
|
- Done: extend run checkpoint commits and smoke coverage to carry typed
|
||||||
action-bar bindings into `AetheriaRunState` as stable input-control and
|
action-bar bindings into `AetheriaRunState` as stable input-control and
|
||||||
target references instead of UI or behavior-object payloads.
|
target references instead of UI or behavior-object payloads.
|
||||||
|
- Done: extend run checkpoint commits and smoke coverage to carry typed
|
||||||
|
faction relationship rows into `AetheriaRunState` as corporation
|
||||||
|
references, relationship tokens, and numeric standings.
|
||||||
- Remaining: add typed documents/mappers for runtime object graphs,
|
- Remaining: add typed documents/mappers for runtime object graphs,
|
||||||
typed behavior factory construction, simulation state, and any catalog
|
typed behavior factory construction, simulation state, and any catalog
|
||||||
fields not covered by the stable scalar/fingerprint/payload pass.
|
fields not covered by the stable scalar/fingerprint/payload pass.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue