Merge faction-curated-place-names (7da0d414), --no-ff
Code from eureka/aetheria-release-faction-curated-place-names. Conflicts kept both sides: Faction holds Assembly (key 19) and Places (key 21); AetherDb dispatches assembly-from-maker, place-names and doctrine-catalog, and its usage names both; FlightTests counts the Faction wire at 22 slots (19 is Assembly, 21 is Places).
The two LFS files are the merge's resolution, replayed on the post-assembly bytes, never merged as text or by side.
GameData/Aetheria.cc, per h1's two-step replay: (1) AetherDb place-names apply built at the branch's commit 1 (740e1ee7, merged onto the assembly merge so key 19 survives), run on the post-assembly catalog: purges the Markov NameFile records while their type exists and authors 15 place lists; (2) place-names apply built at this merged tree, run on step 1's output: authors Miss Terri's list (1 list). Each step's second apply said nothing to do and left the bytes identical; the whole chain run twice from the assembly catalog gave bytes equal except the record write timestamps (masked, both hash alike). Decoded independently with cultcache-py: 16 factions, key 19 Assembly filled on the 15 makers (Ewan Hart has none), key 21 Places 20 names on all 16, key 9 nil on all, no namefile type among the 321 records.
Assets/Resources/Settings.asset: the post-assembly file (Rarity values removed) with the four NameGeneratorSettings lines removed (NameGeneratorSettings, MinLength 5, MaxLength 10, Order 3).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
55bda75ac3
57 changed files with 584 additions and 1891 deletions
|
|
@ -7,7 +7,7 @@ using GameCult.Caching.MessagePack;
|
|||
// Aetheria's stores: one home store per type, composed here and nowhere else.
|
||||
public static class AetheriaStores
|
||||
{
|
||||
public static readonly Type[] CatalogTypes = { typeof(ItemData), typeof(ShipAuthoring), typeof(Faction), typeof(FactionProductData), typeof(PersonalityAttribute), typeof(NameFile), typeof(InputLayout), typeof(Loadout), typeof(FieldKindData), typeof(VerseGrammar), typeof(VerseVerb) };
|
||||
public static readonly Type[] CatalogTypes = { typeof(ItemData), typeof(ShipAuthoring), typeof(Faction), typeof(FactionProductData), typeof(PersonalityAttribute), typeof(InputLayout), typeof(Loadout), typeof(FieldKindData), typeof(VerseGrammar), typeof(VerseVerb) };
|
||||
public static readonly Type[] RunTypes = { typeof(OrbitData), typeof(BodyData), typeof(SavedZone), typeof(SavedGame), typeof(ProvenanceLedger) };
|
||||
public static readonly Type[] PlayerTypes = { typeof(PlayerSettings) };
|
||||
|
||||
|
|
|
|||
|
|
@ -37,8 +37,7 @@ public class Faction
|
|||
[InspectableColor, JsonProperty("secondaryColor"), Key(8)]
|
||||
public float3 SecondaryColor;
|
||||
|
||||
[Inspectable, JsonProperty("nameFile"), Key(9)]
|
||||
public CultRecordRef<NameFile> GeonameFile;
|
||||
// Key 9 was the faction's name-file link, retired by ruling faction-curated-place-names; never reuse it.
|
||||
|
||||
[Inspectable, JsonProperty("bossHull"), Key(10)]
|
||||
public CultRecordRef<HullData> BossHull;
|
||||
|
|
@ -70,11 +69,23 @@ public class Faction
|
|||
// tune it in Studio after that. Key 16 is reserved for Relations and 18 for Livery.
|
||||
[Inspectable, JsonProperty("assembly"), Key(19)]
|
||||
public AssemblyDistribution Assembly;
|
||||
|
||||
// Curated place names in authored order; the home zone takes the first (ruling faction-curated-place-names).
|
||||
// Authored by AetherDb place-names, which restores the table on every apply.
|
||||
[Inspectable, JsonProperty("places"), Key(21)]
|
||||
public FactionPlace[] Places = Array.Empty<FactionPlace>();
|
||||
}
|
||||
|
||||
[CultDocument("aetheria.namefile", "1"), Inspectable, MessagePackObject]
|
||||
public class NameFile
|
||||
// Historical, narrative and strategic intent join as keys 2+ when economics-driven placement lands (ruling faction-curated-place-names).
|
||||
[MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
||||
public class FactionPlace
|
||||
{
|
||||
[CultName, Key(1)] public string Name;
|
||||
[Key(2)] public string[] Names;
|
||||
[Inspectable, JsonProperty("name"), Key(1)]
|
||||
public string Name;
|
||||
|
||||
// The one rule for a valid place name: trimmed, non-empty and not a catalogue designation (EAC-, any case). Galaxy.NamePlaces
|
||||
// treats an invalid entry as absent; AetherDb place-names refuses a table that holds one.
|
||||
public static bool IsValidName(string name) =>
|
||||
!string.IsNullOrEmpty(name) && name == name.Trim() && !name.StartsWith("EAC-", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ public class Galaxy
|
|||
public HashSet<GalaxyZone> DiscoveredZones = new HashSet<GalaxyZone>();
|
||||
|
||||
public SectorBackgroundSettings Background { get; }
|
||||
public NameGeneratorSettings NameGeneratorSettings { get; }
|
||||
public Faction[] Factions { get; }
|
||||
public GalaxyZone[] Zones { get; }
|
||||
public GalaxyZone Entrance { get; }
|
||||
|
|
@ -34,7 +33,6 @@ public class Galaxy
|
|||
public uint Seed { get; }
|
||||
|
||||
private GalaxyZone[] _exitPath;
|
||||
private Dictionary<Faction, MarkovNameGenerator> _nameGenerators = new Dictionary<Faction, MarkovNameGenerator>();
|
||||
private readonly CultCache _cache;
|
||||
|
||||
public GalaxyZone[] ExitPath
|
||||
|
|
@ -96,7 +94,6 @@ public class Galaxy
|
|||
public Galaxy(
|
||||
SectorGenerationSettings settings,
|
||||
SectorBackgroundSettings background,
|
||||
NameGeneratorSettings nameGeneratorSettings,
|
||||
CultCache cache,
|
||||
Action<string> log,
|
||||
Action<string> progressCallback = null,
|
||||
|
|
@ -131,7 +128,7 @@ public class Galaxy
|
|||
|
||||
CalculateFactionInfluence(progressCallback);
|
||||
|
||||
GenerateNames(cache, nameGeneratorSettings, ref random, progressCallback);
|
||||
NamePlaces(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
|
||||
|
|
@ -162,7 +159,6 @@ public class Galaxy
|
|||
public Galaxy(
|
||||
TutorialGenerationSettings settings,
|
||||
SectorBackgroundSettings background,
|
||||
NameGeneratorSettings nameGeneratorSettings,
|
||||
CultCache cache,
|
||||
PlayerSettings playerSettings,
|
||||
DirectoryInfo narrativeDirectory,
|
||||
|
|
@ -259,7 +255,7 @@ public class Galaxy
|
|||
|
||||
CalculateFactionInfluence(progressCallback);
|
||||
|
||||
GenerateNames(cache, nameGeneratorSettings, ref random, progressCallback);
|
||||
NamePlaces(ref random, progressCallback);
|
||||
|
||||
// progressCallback?.Invoke("Weaving Narrative");
|
||||
// var processor = new StoryProcessor(playerSettings, narrativeDirectory, this, ref random, Log);
|
||||
|
|
@ -350,31 +346,37 @@ public class Galaxy
|
|||
}
|
||||
}
|
||||
|
||||
private void GenerateNames(CultCache cache,
|
||||
NameGeneratorSettings nameGeneratorSettings,
|
||||
ref Random random,
|
||||
Action<string> progressCallback = null)
|
||||
// Each faction names the zones it owns from its own curated list (ruling faction-curated-place-names): nearest its
|
||||
// home first, so the home zone takes the capital, which is Places[0]. A zone left over when a list is spent, and every
|
||||
// zone nobody owns, takes a catalogue designation. A name is never used twice, ignoring case.
|
||||
internal void NamePlaces(ref Random random, Action<string> progressCallback = null)
|
||||
{
|
||||
var used = new HashSet<string>();
|
||||
for (var i = 0; i < Factions.Length; i++)
|
||||
progressCallback?.Invoke("Naming places");
|
||||
var used = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
foreach (var zone in Zones) zone.Name = null;
|
||||
|
||||
foreach (var faction in Factions)
|
||||
{
|
||||
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, cache.Get(faction.GeonameFile).Names, nameGeneratorSettings, used);
|
||||
if (!HomeZones.TryGetValue(faction, out var home)) continue;
|
||||
var places = (faction.Places ?? Array.Empty<FactionPlace>()).Select(p => p?.Name).Where(FactionPlace.IsValidName).ToArray();
|
||||
var next = 0;
|
||||
var owned = Zones.Select((zone, index) => (zone, index)).Where(z => z.zone.Owner == faction)
|
||||
.OrderBy(z => z.zone.Distance[home]).ThenBy(z => z.index);
|
||||
foreach (var (zone, _) in owned)
|
||||
{
|
||||
while (next < places.Length && used.Contains(places[next])) next++;
|
||||
if (next == places.Length) break;
|
||||
zone.Name = places[next];
|
||||
used.Add(places[next++]);
|
||||
}
|
||||
}
|
||||
|
||||
// Generate zone name using the owner's name generator, otherwise assign catalogue ID
|
||||
foreach (var zone in Zones)
|
||||
foreach (var zone in Zones.Where(z => z.Name == null))
|
||||
{
|
||||
if (zone.Owner != null)
|
||||
{
|
||||
zone.Name = _nameGenerators[zone.Owner].NextName.Trim();
|
||||
}
|
||||
else
|
||||
{
|
||||
zone.Name = $"EAC-{random.NextInt(9999).ToString()}";
|
||||
}
|
||||
string designation;
|
||||
do designation = $"EAC-{random.NextInt(9999)}";
|
||||
while (!used.Add(designation));
|
||||
zone.Name = designation;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ public sealed class GalaxyStage
|
|||
private readonly SectorBackgroundSettings _sectorBackground;
|
||||
private readonly TutorialGenerationSettings _prelude;
|
||||
private readonly SectorBackgroundSettings _preludeBackground;
|
||||
private readonly NameGeneratorSettings _names;
|
||||
private readonly CultCache _cache;
|
||||
private readonly PlayerSettings _playerSettings;
|
||||
private readonly DirectoryInfo _narrativeDirectory;
|
||||
|
|
@ -28,7 +27,6 @@ public sealed class GalaxyStage
|
|||
SectorBackgroundSettings sectorBackground,
|
||||
TutorialGenerationSettings prelude,
|
||||
SectorBackgroundSettings preludeBackground,
|
||||
NameGeneratorSettings names,
|
||||
CultCache cache,
|
||||
PlayerSettings playerSettings,
|
||||
DirectoryInfo narrativeDirectory,
|
||||
|
|
@ -40,7 +38,6 @@ public sealed class GalaxyStage
|
|||
_sectorBackground = sectorBackground;
|
||||
_prelude = prelude;
|
||||
_preludeBackground = preludeBackground;
|
||||
_names = names;
|
||||
_cache = cache;
|
||||
_playerSettings = playerSettings;
|
||||
_narrativeDirectory = narrativeDirectory;
|
||||
|
|
@ -64,7 +61,7 @@ public sealed class GalaxyStage
|
|||
var background = Copy(_sectorBackground);
|
||||
var random = new Random(Seed);
|
||||
background.NoisePosition = random.NextFloat() * 1000;
|
||||
return new Galaxy(_sector, background, _names, _cache, _log, _progress, Seed);
|
||||
return new Galaxy(_sector, background, _cache, _log, _progress, Seed);
|
||||
}
|
||||
|
||||
// A prelude galaxy: the tutorial settings and their fixed factions, centred in dense cloud.
|
||||
|
|
@ -81,7 +78,7 @@ public sealed class GalaxyStage
|
|||
background.NoisePosition = random.NextFloat() * 1000;
|
||||
_progress?.Invoke($"Finding Galaxy Position: iteration {iteration++}");
|
||||
} while (background.CloudDensity(float2(.5f)) < .5f);
|
||||
return new Galaxy(cast, background, _names, _cache, _playerSettings, _narrativeDirectory, _log, _progress, Seed);
|
||||
return new Galaxy(cast, background, _cache, _playerSettings, _narrativeDirectory, _log, _progress, Seed);
|
||||
}
|
||||
|
||||
private static SectorBackgroundSettings Copy(SectorBackgroundSettings settings) =>
|
||||
|
|
|
|||
|
|
@ -1,129 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using static CultMath.math;
|
||||
using Random = CultMath.Random;
|
||||
|
||||
//Generates random names based on the statistical weight of letter sequences
|
||||
//in a collection of sample names
|
||||
public class MarkovNameGenerator
|
||||
{
|
||||
private Dictionary<string, List<char>> _chains = new Dictionary<string, List<char>>();
|
||||
private List<string> _samples = new List<string>();
|
||||
// The names already given, shared by every generator that must not repeat another's: a galaxy passes one set to
|
||||
// all its factions' generators. Never process-wide, so one galaxy's names cannot change the next galaxy's.
|
||||
private readonly HashSet<string> _used;
|
||||
private int _order;
|
||||
private int _minLength;
|
||||
private int _maxLength;
|
||||
private Random _random;
|
||||
|
||||
public MarkovNameGenerator(ref Random random, IEnumerable<string> sampleNames, NameGeneratorSettings settings, HashSet<string> used)
|
||||
{
|
||||
_used = used;
|
||||
var names = new HashSet<string>();
|
||||
foreach (var line in sampleNames)
|
||||
{
|
||||
foreach(var word in line.ToUpperInvariant().Split(' ', ',', '.', '"'))
|
||||
if (word.Length >= settings.NameGeneratorMinLength && !names.Contains(word))
|
||||
names.Add(word);
|
||||
}
|
||||
|
||||
_random = random;
|
||||
|
||||
_order = max(1, settings.NameGeneratorOrder);
|
||||
_minLength = max(1, settings.NameGeneratorMinLength);
|
||||
_maxLength = settings.NameGeneratorMaxLength;
|
||||
|
||||
Initialize(names);
|
||||
}
|
||||
|
||||
public MarkovNameGenerator(ref Random random, IEnumerable<string> sampleNames, int order, int minLength, int maxLength)
|
||||
{
|
||||
_used = new HashSet<string>();
|
||||
_random = random;
|
||||
|
||||
_order = max(1, order);
|
||||
_minLength = max(1, minLength);
|
||||
_maxLength = maxLength;
|
||||
|
||||
Initialize(sampleNames);
|
||||
}
|
||||
|
||||
private void Initialize(IEnumerable<string> sampleNames)
|
||||
{
|
||||
//split comma delimited lines
|
||||
foreach (string line in sampleNames)
|
||||
{
|
||||
string[] tokens = line.Split(' ','\'','(',')');
|
||||
foreach (string word in tokens)
|
||||
{
|
||||
string upper = word.Trim().ToLowerInvariant();
|
||||
if (upper.Length < _order + 1)
|
||||
continue;
|
||||
_samples.Add(upper + '|'); // Add end character
|
||||
}
|
||||
}
|
||||
|
||||
//Build chains
|
||||
foreach (string word in _samples)
|
||||
{
|
||||
for (int letter = 0; letter < word.Length - _order; letter++)
|
||||
{
|
||||
string token = word.Substring(letter, _order);
|
||||
List<char> entry = null;
|
||||
if (_chains.ContainsKey(token))
|
||||
entry = _chains[token];
|
||||
else
|
||||
{
|
||||
entry = new List<char>();
|
||||
_chains[token] = entry;
|
||||
}
|
||||
entry.Add(word[letter + _order]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Get the next random name
|
||||
public string NextName
|
||||
{
|
||||
get
|
||||
{
|
||||
|
||||
string s = "";
|
||||
do
|
||||
{
|
||||
int n = _random.NextInt(0,_samples.Count);
|
||||
//int nameLength = _samples[n].Length;
|
||||
s = _samples[n].Substring(0, _order);//get a random token at the start of a sample word
|
||||
while (true)//(s.Length < nameLength)
|
||||
{
|
||||
string token = s.Substring(s.Length - _order, _order);
|
||||
char c = GetLetter(token);
|
||||
if (c != '?' && c != '|')
|
||||
s += c;//GetLetter(token);
|
||||
else
|
||||
break;
|
||||
}
|
||||
s = s.Substring(0, 1).ToUpper() + s.Substring(1);
|
||||
}
|
||||
while (_used.Contains(s) || s.Length < _minLength || s.Length > _maxLength);
|
||||
_used.Add(s);
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
//Get a random letter from the chain
|
||||
private char GetLetter(string token)
|
||||
{
|
||||
if (!_chains.ContainsKey(token))
|
||||
return '?';
|
||||
List<char> letters = _chains[token];
|
||||
int n = _random.NextInt(0,letters.Count);
|
||||
return letters[n];
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 33c3b119ccc9de447b8c8318b6f0d1af
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -44,14 +44,6 @@ public class GalaxyShapeSettings
|
|||
public float TwistExponent = 2;
|
||||
}
|
||||
|
||||
[Serializable, MessagePackObject(keyAsPropertyName:true), JsonObject]
|
||||
public class NameGeneratorSettings
|
||||
{
|
||||
public int NameGeneratorMinLength = 5;
|
||||
public int NameGeneratorMaxLength = 10;
|
||||
public int NameGeneratorOrder = 4;
|
||||
}
|
||||
|
||||
[Serializable, MessagePackObject(keyAsPropertyName:true), JsonObject]
|
||||
public class SectorBackgroundSettings
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue