From 8cdd4d0b37c2e1abb32f9e0a39e7c15becc85f81 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 13 Jun 2026 10:54:08 +0100 Subject: [PATCH] Move Galaxy off legacy catalog reader --- .voidbot/state/aetheria.cc | Bin 24688 -> 24807 bytes Assets/Scripts/ServerShared/Galaxy.cs | 22 +++++++++++----------- Assets/Scripts/UI/MainMenu.cs | 4 ++-- docs/aetheria-perfect-machine-map.md | 20 +++++++++++++------- 4 files changed, 26 insertions(+), 20 deletions(-) diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index 24c46fd7bbd3f8817cd1e79b26e7c4268badf5b6..dade458d4ef899c2123de05981949a48aec4865b 100644 GIT binary patch delta 1371 zcmZvcJ!}+L5XW;iI5r3pA(Ie^k161YkbUF>-x-1sALio}I|Tw4?#8>bdoO#H zBM>6JNz*f3M1MDSmhU~S ztTTz{w6UP{8vA)9RtdU}q6JhKk^!OYS;y}=1$5{0xEG4BSM#V-fXWBUS+zOt68;L5 z!=)vb(%%omeCBqUT>1E-az>CneeDbc+CYF_)`!i5DU1jLA<4F20fky1m2iC^waO}r z(WWok%}J+AAzBX{Da+4a{gwXOgbnM2l%Qia!j_89>qPlz`gzLXCYQB#MI&?E+cH|3 z7ixuzYb~No2#Sb?td^@}S!tt_u$L=dN?k|{Yds-12uz}!;3j+>as8l|e`I|u&%uBw6jPhp4=sHdiUIZ$4@cMvnSpb93hs$2Q^m+)13Vrj2hameH1MS0w*0 z!s$OV`v)(k-;eLRkV7%F0U5sq8J`^(9_=P2H|`h;UY$yBPwgF??{r2!E)2)mFqy`a zyT*#ONZ;+)hghyi7S%G-JoMq98Ot>d6}!hbxvdGw1XVnB4pZtH@hWTI4%Sb8`pL$v zI!y&P#xWtUBU2;uRont_v2vU`AVbO{`&~91Mog#>dRa0w1O?5*^$O+4D3o@po?J%X z!F~aKt+mG|r1ov4e=bd?ySrcRDNj{=>rNU B?#2KB delta 1213 zcmZWpJ!lj`6!wx362T}M4NB05T(mjQ+{H*@A%sN3p^>0QA*m*_Z}%4GX4ctR%?2T; zrIk!+=^qM0U_mTIlfquHQtYk#?FHZN-iAcGt!To>p91ks}Kx!qOXy8>aPUB3lbdbTt> zu*)GO+=#e(_n}7j(rXzO9P3Du@tr$YuAko=b)xH{CPf6QF-sVQ?7#R|Hd|k5 z`(A-9F6Bwe(I@j~n+>-5jMKBC2uzq)^9r zy&FI6`_BD6?d?*xzd8r(_PMvkDyiqIM0IxC?{liCj?}URbL-0O;^K(?FgK74US01k J&YY;t{{?@suo?gW diff --git a/Assets/Scripts/ServerShared/Galaxy.cs b/Assets/Scripts/ServerShared/Galaxy.cs index b697dd53d..af7742a46 100644 --- a/Assets/Scripts/ServerShared/Galaxy.cs +++ b/Assets/Scripts/ServerShared/Galaxy.cs @@ -32,7 +32,7 @@ public class Galaxy private HashSet _containedFactions; private GalaxyZone[] _exitPath; private Dictionary _nameGenerators = new Dictionary(); - private readonly ILegacyCatalogReader _catalog; + private readonly ItemManager _itemManager; public GalaxyZone[] ExitPath { @@ -48,16 +48,16 @@ public class Galaxy SectorGenerationSettings settings, SectorBackgroundSettings background, NameGeneratorSettings nameGeneratorSettings, - ILegacyCatalogReader catalog, + ItemManager itemManager, Action log, Action progressCallback = null, uint seed = 0) { - _catalog = catalog; + _itemManager = itemManager; IsPrelude = false; Background = background; Log = log; - var factions = catalog.GetAll(); + var factions = itemManager.GetCatalogEntries(); var random = new Random(seed == 0 ? (uint) (DateTime.Now.Ticks % uint.MaxValue) : seed); Factions = factions.OrderBy(x => random.NextFloat()).Take(settings.MegaCount).ToArray(); foreach (var f in Factions) FactionRelationships[f] = FactionRelationship.Neutral; @@ -81,7 +81,7 @@ public class Galaxy CalculateFactionInfluence(progressCallback); - GenerateNames(catalog, nameGeneratorSettings, ref random, progressCallback); + GenerateNames(itemManager, nameGeneratorSettings, ref random, progressCallback); progressCallback?.Invoke("Done!"); if(progressCallback!=null) Thread.Sleep(500); // Inserting Delay to make it seem like it's doing more work lmao @@ -89,21 +89,21 @@ public class Galaxy public Faction ResolveFaction(string name) { - return _catalog.GetAll().FirstOrDefault(f => f.Name.StartsWith(name, StringComparison.InvariantCultureIgnoreCase)); + return _itemManager.GetCatalogEntries().FirstOrDefault(f => f.Name.StartsWith(name, StringComparison.InvariantCultureIgnoreCase)); } public Galaxy( TutorialGenerationSettings settings, SectorBackgroundSettings background, NameGeneratorSettings nameGeneratorSettings, - ILegacyCatalogReader catalog, + ItemManager itemManager, PlayerSettings playerSettings, DirectoryInfo narrativeDirectory, Action log, Action progressCallback = null, uint seed = 0) { - _catalog = catalog; + _itemManager = itemManager; IsPrelude = true; Background = background; @@ -189,7 +189,7 @@ public class Galaxy CalculateFactionInfluence(progressCallback); - GenerateNames(catalog, nameGeneratorSettings, ref random, progressCallback); + GenerateNames(itemManager, nameGeneratorSettings, ref random, progressCallback); // progressCallback?.Invoke("Weaving Narrative"); // var processor = new StoryProcessor(playerSettings, narrativeDirectory, this, ref random, Log); @@ -280,7 +280,7 @@ public class Galaxy } } - private void GenerateNames(ILegacyCatalogReader catalog, + private void GenerateNames(ItemManager itemManager, NameGeneratorSettings nameGeneratorSettings, ref Random random, Action progressCallback = null) @@ -290,7 +290,7 @@ public class Galaxy progressCallback?.Invoke($"Feeding Markov Chains: {i + 1} / {Factions.Length}"); //if(progressCallback!=null) Thread.Sleep(250); // Inserting Delay to make it seem like it's doing more work lmao var faction = Factions[i]; - _nameGenerators[faction] = new MarkovNameGenerator(ref random, catalog.Get(faction.GeonameFile).Names, nameGeneratorSettings); + _nameGenerators[faction] = new MarkovNameGenerator(ref random, itemManager.GetCatalogEntry(faction.GeonameFile).Names, nameGeneratorSettings); } // Generate zone name using the owner's name generator, otherwise assign catalogue ID diff --git a/Assets/Scripts/UI/MainMenu.cs b/Assets/Scripts/UI/MainMenu.cs index b4361293c..5c4e4172b 100644 --- a/Assets/Scripts/UI/MainMenu.cs +++ b/Assets/Scripts/UI/MainMenu.cs @@ -117,7 +117,7 @@ public class MainMenu : MonoBehaviour Settings.SectorGenerationSettings, Settings.SectorBackgroundSettings, Settings.NameGeneratorSettings, - ActionGameManager.LegacyCatalog, + ActionGameManager.ItemManager, Debug.Log, setState); Observable.NextFrame().Subscribe(_ => @@ -143,7 +143,7 @@ public class MainMenu : MonoBehaviour Settings.TutorialGenerationSettings, Settings.TutorialBackgroundSettings, Settings.NameGeneratorSettings, - ActionGameManager.LegacyCatalog, + ActionGameManager.ItemManager, ActionGameManager.PlayerSettings, ActionGameManager.GameDataDirectory.CreateSubdirectory("Narrative"), Debug.Log, diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index b16929714..3b2333ff1 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -77,6 +77,11 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. `GetCatalogEntries` methods. This does not remove the legacy reader under the hood; it prevents old catalog authority from leaking into every caller that only needs a domain lookup. +- `Galaxy` generation no longer accepts `ILegacyCatalogReader`. Sector and + tutorial generation receive `ItemManager` and use the same narrow catalog + lookup port for factions and name files. `ActionGameManager.LegacyCatalog` + now feeds only `ItemManager` boot; menu/generation paths no longer receive + the legacy reader directly. - `DatabaseLink.Value` can resolve legacy links only after `LegacyCatalogBoundary` binds the pull-only catalog cache. Legacy catalog construction no longer grabs global `DatabaseLinkBase` authority. @@ -183,11 +188,12 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. old MessagePack catalog reads, and `LegacyCatalogBoundary` is the only named owner for opening the old catalog and binding legacy `DatabaseLink` resolution until catalog migration lands. Runtime code receives narrow - `ItemManager` catalog methods where gameplay only needs lookups; `ItemManager` - and `Galaxy` still receive `ILegacyCatalogReader` until typed runtime catalog - boot replaces them. `Aetheria.State.Unity` owns a read-only typed catalog - facade for future Unity consumers; it does not write state or own simulation. - The legacy cache no longer has a public mutation surface. + `ItemManager` catalog methods where gameplay only needs lookups. `ItemManager` + still receives `ILegacyCatalogReader` until typed runtime catalog boot + replaces it; `Galaxy` has been moved off the legacy reader and now consumes + `ItemManager`. `Aetheria.State.Unity` owns a read-only typed catalog facade + for future Unity consumers; it does not write state or own simulation. The + legacy cache no longer has a public mutation surface. - Inputs: Unity gameplay code, legacy catalog files, typed state documents, and CultMesh server state. - Outputs: `Aetheria.State` emits `.cc` state and CultMesh documents. Legacy @@ -228,8 +234,8 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. - Shared paths: gameplay input, editor edits, import/deep-load, replication, simulation ticks, and tests all call the same typed state service. - Deletion line: after catalog migration smokes pass, replace - `ActionGameManager.LegacyCatalog`/`ItemManager`/`Galaxy` boot with the typed - runtime catalog package, then delete or quarantine the remaining + `ActionGameManager.LegacyCatalog`/`ItemManager` boot with the typed runtime + catalog package, then delete or quarantine the remaining `LegacyCatalogCache`/`DatabaseEntry` runtime catalog dependency and remove old MessagePack backing store classes from live Unity source.