diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index fa4a22b57..c481e856d 100644 Binary files a/.voidbot/state/aetheria.cc and b/.voidbot/state/aetheria.cc differ diff --git a/Aetheria.State.Unity.Smoke/Program.cs b/Aetheria.State.Unity.Smoke/Program.cs index f9b74740d..e9e624a10 100644 --- a/Aetheria.State.Unity.Smoke/Program.cs +++ b/Aetheria.State.Unity.Smoke/Program.cs @@ -165,6 +165,23 @@ try CurrentZoneIndex = 0, CurrentZoneEntityIndex = 0, DiscoveredZoneIndices = new[] { 0 }, + ActionBarBindings = new[] + { + new AetheriaRuntimeActionBarBindingCommit + { + ControlPath = "/1", + Kind = "weapon_group", + WeaponGroup = 0 + }, + new AetheriaRuntimeActionBarBindingCommit + { + ControlPath = "/2", + Kind = "gear", + ItemDefinitionLegacyId = "smoke:weapon", + EquipmentIndex = 0, + BehaviorIndex = 1 + } + }, Zones = new[] { new AetheriaRuntimeZoneSnapshotCommit @@ -230,6 +247,15 @@ try settings?.PlayerName == "Unity smoke" && settings.Input.ActionBarInputs.Length == 1 && run?.ZoneKeys.Length == 1 && + run.ActionBarBindings.Length == 2 && + run.ActionBarBindings[0].ControlPath == "/1" && + run.ActionBarBindings[0].Kind == "weapon_group" && + run.ActionBarBindings[0].WeaponGroup == 0 && + run.ActionBarBindings[1].ControlPath == "/2" && + run.ActionBarBindings[1].Kind == "gear" && + run.ActionBarBindings[1].TargetKey == "aetheria.item_definition:legacy:smoke:weapon" && + run.ActionBarBindings[1].EquipmentIndex == 0 && + run.ActionBarBindings[1].BehaviorIndex == 1 && zone?.EntityKeys.Length == 1 && entity?.Equipment.Length == 1 && entity.WeaponGroups.Length == 1 && @@ -285,5 +311,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 and run zone/entity snapshots queued, applied, and cleared"); +Console.WriteLine("Runtime state commit log smoke: settings, action-bar bindings, 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 e334de14e..633ec2b81 100644 --- a/Aetheria.State/AetheriaRuntimeCommitLogApplier.cs +++ b/Aetheria.State/AetheriaRuntimeCommitLogApplier.cs @@ -225,6 +225,7 @@ public static class AetheriaRuntimeCommitLogApplier CurrentZoneIndex = checkpoint.CurrentZoneIndex, CurrentZoneEntityIndex = checkpoint.CurrentZoneEntityIndex, DiscoveredZoneIndices = ToIntArray(checkpoint.DiscoveredZoneIndices), + ActionBarBindings = ToActionBarBindings(checkpoint.ActionBarBindings), UpdatedAtUtc = updatedAtUtc }; @@ -311,6 +312,22 @@ public static class AetheriaRuntimeCommitLogApplier .ToArray(); } + private static AetheriaActionBarBinding[] ToActionBarBindings( + IReadOnlyList? bindings) + { + return (bindings ?? Array.Empty()) + .Select(binding => new AetheriaActionBarBinding + { + ControlPath = binding.ControlPath ?? "", + Kind = binding.Kind ?? "", + TargetKey = ReferenceKey("aetheria.item_definition", binding.ItemDefinitionLegacyId ?? ""), + EquipmentIndex = binding.EquipmentIndex, + BehaviorIndex = binding.BehaviorIndex, + WeaponGroup = binding.WeaponGroup + }) + .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 8f105d69c..f24293c0d 100644 --- a/Aetheria.State/Documents/AetheriaRuntimeStateDocuments.cs +++ b/Aetheria.State/Documents/AetheriaRuntimeStateDocuments.cs @@ -333,18 +333,21 @@ public sealed class AetheriaEntityStatGrid public sealed class AetheriaActionBarBinding { [Key(0)] - public string Kind { get; set; } = ""; + public string ControlPath { get; set; } = ""; [Key(1)] - public string TargetKey { get; set; } = ""; + public string Kind { get; set; } = ""; [Key(2)] - public int EquipmentIndex { get; set; } = -1; + public string TargetKey { get; set; } = ""; [Key(3)] - public int BehaviorIndex { get; set; } = -1; + public int EquipmentIndex { get; set; } = -1; [Key(4)] + public int BehaviorIndex { get; set; } = -1; + + [Key(5)] public int WeaponGroup { get; set; } = -1; } diff --git a/Aetheria.State/README.md b/Aetheria.State/README.md index 78b9d9e3b..1629cfd2a 100644 --- a/Aetheria.State/README.md +++ b/Aetheria.State/README.md @@ -13,7 +13,10 @@ are migration inputs only. The typed runtime state model is split into player settings, loadout templates, run state, zone state, entity snapshots, item slots, weapon groups, action-bar -bindings, and stat grids. Player settings include player name, tutorial flag, +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. +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 runtime settings projections, or runtime entity blueprints as opaque payloads in @@ -66,10 +69,12 @@ Dead legacy catalog roots for user records and galaxy map-layer resources have been deleted from live Unity source. Surviving runtime DTOs no longer carry legacy catalog group/table annotations; their remaining metadata is projection and inspection metadata for the typed runtime bridge. -Item instances now carry `RuntimeItemReference`, a narrow item-definition id. +Item instances now carry `RuntimeItemDefinitionReference`, a narrow +item-definition id. The old generic `RuntimeCatalogLink` abstraction, `ItemManager.GetData` -hydration path, and `RuntimeItemReference.Projection` cache have been deleted; -runtime item facts come from typed catalog rows. +hydration path, vague `ItemInstance.Data` identity field, and old +`RuntimeItemReference.Projection` cache have been deleted; runtime item facts +come from typed catalog rows. Loadout generation now applies typed catalog prefilters for item category, hardpoint type, shape fit, hull type, and behavior kind, then instantiates generated equipment directly from typed runtime rows. diff --git a/Assets/Scripts/Gameplay/ActionBarSlot.cs b/Assets/Scripts/Gameplay/ActionBarSlot.cs index b966a7311..fc3a0d1f8 100644 --- a/Assets/Scripts/Gameplay/ActionBarSlot.cs +++ b/Assets/Scripts/Gameplay/ActionBarSlot.cs @@ -17,6 +17,7 @@ public class ActionBarSlot : MonoBehaviour public ObservablePointerEnterTrigger PointerEnterTrigger; public ObservablePointerExitTrigger PointerExitTrigger; private ActionBarBinding binding; + public string ControlPath { get; set; } public ActionBarBinding Binding { @@ -96,6 +97,8 @@ public class ActionBarConsumableBinding : ActionBarBinding private Guid TargetLegacyId => Guid.TryParse(Target.LegacyId, out var legacyId) ? legacyId : Guid.Empty; + public string TargetItemDefinitionLegacyId => Target?.LegacyId ?? ""; + } public class ActionBarGearBinding : ActionBarBinding @@ -105,6 +108,19 @@ public class ActionBarGearBinding : ActionBarBinding public bool Active; + public int EquipmentIndex => Entity?.Equipment?.IndexOf(Item) ?? -1; + + public int BehaviorIndex => Item?.Behaviors == null ? -1 : Array.IndexOf(Item.Behaviors, Behavior); + + public string TargetItemDefinitionLegacyId + { + get + { + var itemId = Item?.EquippableItem?.ItemId ?? Guid.Empty; + return itemId == Guid.Empty ? "" : itemId.ToString("D"); + } + } + public ActionBarGearBinding(Entity entity, ActionBarSlot slot, EquippedItem item, IActivatedBehavior behavior) : base(entity, slot) { Item = item; diff --git a/Assets/Scripts/Gameplay/ActionGameManager.cs b/Assets/Scripts/Gameplay/ActionGameManager.cs index 86f17256f..06347c67c 100644 --- a/Assets/Scripts/Gameplay/ActionGameManager.cs +++ b/Assets/Scripts/Gameplay/ActionGameManager.cs @@ -422,10 +422,51 @@ public class ActionGameManager : MonoBehaviour .Where(index => index >= 0) .OrderBy(index => index) .ToArray() ?? Array.Empty(), + ActionBarBindings = ProjectActionBarBindings(), Zones = Zone == null ? Array.Empty() : new[] { ProjectZoneSnapshot(Zone) } }; } + private AetheriaRuntimeActionBarBindingCommit[] ProjectActionBarBindings() + { + return _actionBarSlots? + .Select(ProjectActionBarBinding) + .Where(binding => binding != null) + .ToArray() ?? Array.Empty(); + } + + private static AetheriaRuntimeActionBarBindingCommit ProjectActionBarBinding(ActionBarSlot slot) + { + switch (slot?.Binding) + { + case ActionBarConsumableBinding consumable: + return new AetheriaRuntimeActionBarBindingCommit + { + ControlPath = slot.ControlPath ?? "", + Kind = "consumable", + ItemDefinitionLegacyId = consumable.TargetItemDefinitionLegacyId + }; + case ActionBarGearBinding gear: + return new AetheriaRuntimeActionBarBindingCommit + { + ControlPath = slot.ControlPath ?? "", + Kind = "gear", + ItemDefinitionLegacyId = gear.TargetItemDefinitionLegacyId, + EquipmentIndex = gear.EquipmentIndex, + BehaviorIndex = gear.BehaviorIndex + }; + case ActionBarWeaponGroupBinding weaponGroup: + return new AetheriaRuntimeActionBarBindingCommit + { + ControlPath = slot.ControlPath ?? "", + Kind = "weapon_group", + WeaponGroup = weaponGroup.Group + }; + default: + return null; + } + } + private AetheriaRuntimeZoneSnapshotCommit ProjectZoneSnapshot(Zone zone) { var galaxyZone = zone.GalaxyZone; @@ -718,6 +759,7 @@ public class ActionGameManager : MonoBehaviour var action = new InputAction(binding: controlPath); _actionBarActions.Add(action); var slot = Instantiate(ActionBarSlot, ActionBar); + slot.ControlPath = controlPath; slot.Binding = null; _actionBarSlots.Add(slot); action.started += context => slot.Binding?.Activate(); diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeStateCommitDocument.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeStateCommitDocument.cs index c38305b6f..3abbc2a8f 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeStateCommitDocument.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeStateCommitDocument.cs @@ -232,6 +232,31 @@ namespace GameCult.Aetheria.State.Unity [Key(7)] public IReadOnlyList Zones { get; set; } = Array.Empty(); + + [Key(8)] + public IReadOnlyList ActionBarBindings { get; set; } = Array.Empty(); + } + + [MessagePackObject] + public sealed class AetheriaRuntimeActionBarBindingCommit + { + [Key(0)] + public string ControlPath { get; set; } = ""; + + [Key(1)] + public string Kind { get; set; } = ""; + + [Key(2)] + public string ItemDefinitionLegacyId { get; set; } = ""; + + [Key(3)] + public int EquipmentIndex { get; set; } = -1; + + [Key(4)] + public int BehaviorIndex { get; set; } = -1; + + [Key(5)] + public int WeaponGroup { get; set; } = -1; } [MessagePackObject] diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index 7fb2f5299..25467d9bd 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -54,7 +54,9 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. `Economy.Shared` wrapper have been removed from live source. The stale `StrategyGameManager.csbak` backup file and unused Unity asset MessagePack formatter classes have also been deleted, so the remaining direct - `MessagePackSerializer` calls are no longer present in live runtime source. + `MessagePackSerializer` calls are no longer present in live gameplay source; + the package-owned pending command lanes still use MessagePack as the current + CultCache binary transport for typed `.cc` command envelopes. - Local legacy catalog data remains in `GameData/AetherDB.msgpack` and `GameData/NameFile/*.msgpack` as migration inputs only. Unity gameplay no longer opens those MessagePack files at runtime. The old @@ -117,7 +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 through the + now queues current-zone/current-entity-collection snapshots and current + action-bar bindings 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 @@ -716,6 +719,9 @@ First Aetheria surfaces to publish: `.loadout` no longer lacks a durable Verse replacement. - Done: add typed node ports and smoke coverage for run -> zone -> entity snapshots so `.zone` no longer lacks a durable Verse replacement graph. + - 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. - 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. @@ -944,7 +950,9 @@ First Aetheria surfaces to publish: shapes. - Done: replace remaining item/behavior DTO MessagePack field metadata with `LegacyPayloadKeyAttribute`; no live `Assets/Scripts` source depends on - MessagePack, Newtonsoft, RethinkDB, or bespoke save-file serializer symbols. + Newtonsoft, RethinkDB, or bespoke save-file serializer symbols. Remaining + package-level MessagePack usage is the typed CultCache `.cc` transport + boundary, not a gameplay save format. - Done: delete dead `PlayerData` and `GalaxyMapLayerData` catalog roots, and remove legacy catalog group/table annotations from surviving runtime DTOs. - Done: move loadout generation's selected-item instantiation onto typed