Persist faction relationships in run checkpoints

This commit is contained in:
Meta Vens 2026-06-14 12:02:47 +01:00
commit e0a39b2fce
8 changed files with 73 additions and 6 deletions

Binary file not shown.

View file

@ -182,6 +182,15 @@ try
BehaviorIndex = 1
}
},
FactionRelationships = new[]
{
new AetheriaRuntimeFactionRelationshipCommit
{
CorporationLegacyId = "smoke:faction",
Relationship = "Friendly",
Standing = 3
}
},
Zones = new[]
{
new AetheriaRuntimeZoneSnapshotCommit
@ -256,6 +265,10 @@ try
run.ActionBarBindings[1].TargetKey == "aetheria.item_definition:legacy:smoke:weapon" &&
run.ActionBarBindings[1].EquipmentIndex == 0 &&
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 &&
entity?.Equipment.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($"Eve surface: {surface.Surface.Id}");
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");

View file

@ -226,6 +226,7 @@ public static class AetheriaRuntimeCommitLogApplier
CurrentZoneEntityIndex = checkpoint.CurrentZoneEntityIndex,
DiscoveredZoneIndices = ToIntArray(checkpoint.DiscoveredZoneIndices),
ActionBarBindings = ToActionBarBindings(checkpoint.ActionBarBindings),
FactionRelationships = ToFactionRelationships(checkpoint.FactionRelationships),
UpdatedAtUtc = updatedAtUtc
};
@ -328,6 +329,19 @@ public static class AetheriaRuntimeCommitLogApplier
.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)
{
return new CultRecordKey($"global:aetheria.loadout_template.{StableToken(name)}.v1");

View file

@ -358,6 +358,9 @@ public sealed class AetheriaFactionRelationshipState
public string FactionKey { get; set; } = "";
[Key(1)]
public string Relationship { get; set; } = "";
[Key(2)]
public double Standing { get; set; }
}

View file

@ -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 as stable typed targets: input control path, binding kind, item
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,
story-file hash cursors, gameplay formatting, graphics preferences, input
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,
allegiance count, full allegiance edges, and music bank IDs. Corporation
documents are `aetheria.corporation.v2` records because runtime generation
needs actual allegiance weights, not only display counts. Runtime object graphs,
typed behavior factory construction, and simulation state remain legacy until
dedicated typed runtime documents exist.
needs actual allegiance weights, not only display counts. Runtime checkpoints
now persist session faction relationships into typed run state, but broader
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
legacy ID, display name, count, compact sample names for surfaces, and the full
name array needed to move `Galaxy`/Markov name generation off legacy

View file

@ -423,6 +423,7 @@ public class ActionGameManager : MonoBehaviour
.OrderBy(index => index)
.ToArray() ?? Array.Empty<int>(),
ActionBarBindings = ProjectActionBarBindings(),
FactionRelationships = ProjectFactionRelationships(),
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)
{
var galaxyZone = zone.GalaxyZone;

View file

@ -235,6 +235,9 @@ namespace GameCult.Aetheria.State.Unity
[Key(8)]
public IReadOnlyList<AetheriaRuntimeActionBarBindingCommit> ActionBarBindings { get; set; } = Array.Empty<AetheriaRuntimeActionBarBindingCommit>();
[Key(9)]
public IReadOnlyList<AetheriaRuntimeFactionRelationshipCommit> FactionRelationships { get; set; } = Array.Empty<AetheriaRuntimeFactionRelationshipCommit>();
}
[MessagePackObject]
@ -259,6 +262,19 @@ namespace GameCult.Aetheria.State.Unity
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]
public sealed class AetheriaRuntimeZoneSnapshotCommit
{

View file

@ -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
position, direction, faction, hull, equipment slots, weapon groups, and a stat
grid. This proves the `.zone` replacement graph is durable typed state. Unity
now queues current-zone/current-entity-collection snapshots and current
action-bar bindings through the
now queues current-zone/current-entity-collection snapshots, current
action-bar bindings, and current faction relationship rows through the
runtime commit log during run checkpoints; `RuntimeZoneBlueprint` and
`RuntimeEntityBlueprint` remain runtime construction/loadout projections
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
action-bar bindings into `AetheriaRunState` as stable input-control and
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,
typed behavior factory construction, simulation state, and any catalog
fields not covered by the stable scalar/fingerprint/payload pass.