From e0a39b2fcebddbdfca58828f7fb331691aa3ace0 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 14 Jun 2026 12:02:47 +0100 Subject: [PATCH] Persist faction relationships in run checkpoints --- .voidbot/state/aetheria.cc | Bin 85796 -> 85721 bytes Aetheria.State.Unity.Smoke/Program.cs | 15 ++++++++++++++- .../AetheriaRuntimeCommitLogApplier.cs | 14 ++++++++++++++ .../AetheriaRuntimeStateDocuments.cs | 3 +++ Aetheria.State/README.md | 9 ++++++--- Assets/Scripts/Gameplay/ActionGameManager.cs | 15 +++++++++++++++ .../AetheriaRuntimeStateCommitDocument.cs | 16 ++++++++++++++++ docs/aetheria-perfect-machine-map.md | 7 +++++-- 8 files changed, 73 insertions(+), 6 deletions(-) diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index c481e856d7a8ee26c421e035f61bd50406f82975..5cb32befba9d7517f60eeac570a754dca6de45a8 100644 GIT binary patch delta 986 zcmZ`&&ubGw6n1N>)ryBwS`Z5l#6xHZN!vskK`5!!Ll2?BgS}05r^(panRR}o%_)d@ z)6*Vuu_6-jsst%Lh-Z~n!Gi`p_y>6C)l;3>ZIg=WY1wbz_rC9aZ(sY_aCd9?b$e(u zTgYS!GxO>EOskpwtTJIRFm!PyC)>|VKa3sJP$ zNG~B*5zbaHMfNFcBnUt5PBj5ZSc|`bIQ9_)-;f1xxd^z3C_r%)xeXv*>fcJm*D*^0 zVjeKvLPd=U>TTQLN)qjtX&KNYEX_kTVJl9on9`*aZ4y_Aq?$g zKjEKm(3$%FeEe#0AqXhJMpYXfe{fKpU%zW(*Otq^l}A!yVPZqDBnW1n+5Nz9r51Hk z$1;3;P#W)@OeVkDR;Vg}o+@?r4+@EqL$2ITCY&EP`WKVQw;n7ylYL-r-k#9c^SxHN sR;K7onmaqwnqGALeq}Bn9b0Q>(P`W#*ok?Y;CfA-=L(%)L2OZeO1}3{V+t_r1_4k1FvwptE{$L$OkM>4K>`*Bb2AFNQ z6ypV^puk0u3n%)xcea{>eDbG(DFkg;!9y^W0E=Lla?t23*islJJqVa_$Dl+FW55mi zP{egEcziK<=rFqioR08r$OAtfN|m@d1_gB42A8V!PhVwZ0d-X!CBq=~()Jkl4|a2H zk}4F2``98IGcyQWgOK1!;h+L3yb7!?O=#3QrjV2rLq+1icF`^ck_)3R5m|5u&DB|G< zk8jX*iOCR~OiT+Q_YABn=|@}l&)mkMgDoqGiztG}H%MU1oaACnb`cj+(MTfEom)Gg7#Yl&p$^9`pX@d zzqR7iBw(5nr4h-ljW<@U;k$zr(7(+Zbf`AsOvsrieY8B-dWGq9W^LOrM}I$dt^VvN z+p}}nZGF3Zvg173?;dWy#+eK83$6XmTW>qSbo1FBul<;_{Pw}@RHItVTh$J5HU@W2 MU$J&ibfB5FKMv@71^@s6 diff --git a/Aetheria.State.Unity.Smoke/Program.cs b/Aetheria.State.Unity.Smoke/Program.cs index e9e624a10..68558ba05 100644 --- a/Aetheria.State.Unity.Smoke/Program.cs +++ b/Aetheria.State.Unity.Smoke/Program.cs @@ -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"); diff --git a/Aetheria.State/AetheriaRuntimeCommitLogApplier.cs b/Aetheria.State/AetheriaRuntimeCommitLogApplier.cs index 633ec2b81..243aba673 100644 --- a/Aetheria.State/AetheriaRuntimeCommitLogApplier.cs +++ b/Aetheria.State/AetheriaRuntimeCommitLogApplier.cs @@ -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? relationships) + { + return (relationships ?? Array.Empty()) + .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"); diff --git a/Aetheria.State/Documents/AetheriaRuntimeStateDocuments.cs b/Aetheria.State/Documents/AetheriaRuntimeStateDocuments.cs index f24293c0d..bf438db3b 100644 --- a/Aetheria.State/Documents/AetheriaRuntimeStateDocuments.cs +++ b/Aetheria.State/Documents/AetheriaRuntimeStateDocuments.cs @@ -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; } } diff --git a/Aetheria.State/README.md b/Aetheria.State/README.md index 1629cfd2a..5439051da 100644 --- a/Aetheria.State/README.md +++ b/Aetheria.State/README.md @@ -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 diff --git a/Assets/Scripts/Gameplay/ActionGameManager.cs b/Assets/Scripts/Gameplay/ActionGameManager.cs index 06347c67c..6c365da27 100644 --- a/Assets/Scripts/Gameplay/ActionGameManager.cs +++ b/Assets/Scripts/Gameplay/ActionGameManager.cs @@ -423,6 +423,7 @@ public class ActionGameManager : MonoBehaviour .OrderBy(index => index) .ToArray() ?? Array.Empty(), ActionBarBindings = ProjectActionBarBindings(), + FactionRelationships = ProjectFactionRelationships(), Zones = Zone == null ? Array.Empty() : 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(); + } + private AetheriaRuntimeZoneSnapshotCommit ProjectZoneSnapshot(Zone zone) { var galaxyZone = zone.GalaxyZone; diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeStateCommitDocument.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeStateCommitDocument.cs index 3abbc2a8f..e3acfc375 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeStateCommitDocument.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeStateCommitDocument.cs @@ -235,6 +235,9 @@ namespace GameCult.Aetheria.State.Unity [Key(8)] public IReadOnlyList ActionBarBindings { get; set; } = Array.Empty(); + + [Key(9)] + public IReadOnlyList FactionRelationships { get; set; } = Array.Empty(); } [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 { diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index 25467d9bd..ded6cc76c 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -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.