Delete the Markov name generator, its data and settings, NameFile and GeonameFile
The NameFile records went with commit 2's apply, so the type, Faction key 9 (left as a retired-key comment), NameGeneratorSettings and its parameter on Galaxy and GalaxyStage, the Settings.asset block, the Name Tools editor window, the Geonames resources, the purge leg of place-names and the minor-power and Pirates commands' name-file lookups all go. The Pirates missing-name-file test pins a retired rule and goes with it. Factions shows a places count where the geonames column was. Unity compile owed at merge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
0a6bbdde13
commit
1d689adfa6
55 changed files with 45 additions and 1879 deletions
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0f3e518a4c9bcc2469abe6cebdcb3691
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Resources/Geonames/Australia.csv
(Stored with Git LFS)
BIN
Assets/Resources/Geonames/Australia.csv
(Stored with Git LFS)
Binary file not shown.
|
|
|
@ -1,7 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8ba25d5d0ecee31408c7ce7460b4e015
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Resources/Geonames/Congo.csv
(Stored with Git LFS)
BIN
Assets/Resources/Geonames/Congo.csv
(Stored with Git LFS)
Binary file not shown.
|
|
|
@ -1,7 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1e43b383bf860524986a6947496776d0
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Resources/Geonames/Germany.csv
(Stored with Git LFS)
BIN
Assets/Resources/Geonames/Germany.csv
(Stored with Git LFS)
Binary file not shown.
|
|
|
@ -1,7 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ed470b8eb6cc68c4485ddc05d5a17ca1
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Resources/Geonames/India.csv
(Stored with Git LFS)
BIN
Assets/Resources/Geonames/India.csv
(Stored with Git LFS)
Binary file not shown.
|
|
|
@ -1,7 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ca62f6d649360184aaa975c2716dfb27
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Resources/Geonames/Iran.csv
(Stored with Git LFS)
BIN
Assets/Resources/Geonames/Iran.csv
(Stored with Git LFS)
Binary file not shown.
|
|
|
@ -1,7 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e2d60c7158f6a01418d78e46c5845729
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Resources/Geonames/Japan.csv
(Stored with Git LFS)
BIN
Assets/Resources/Geonames/Japan.csv
(Stored with Git LFS)
Binary file not shown.
|
|
|
@ -1,7 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5dd450a6f5ec92d49871674b33509135
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Resources/Geonames/Mexico.csv
(Stored with Git LFS)
BIN
Assets/Resources/Geonames/Mexico.csv
(Stored with Git LFS)
Binary file not shown.
|
|
|
@ -1,7 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b75e17ea31f6a62488628bf9605bd48c
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Resources/Geonames/Russia.csv
(Stored with Git LFS)
BIN
Assets/Resources/Geonames/Russia.csv
(Stored with Git LFS)
Binary file not shown.
|
|
|
@ -1,7 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5c1aee30ccf3a1e44bddeb4d550edbf0
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Resources/Geonames/Swahili.csv
(Stored with Git LFS)
BIN
Assets/Resources/Geonames/Swahili.csv
(Stored with Git LFS)
Binary file not shown.
|
|
|
@ -1,7 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 63e21276398c8b0449e01d97a088add1
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Resources/Geonames/Thailand.csv
(Stored with Git LFS)
BIN
Assets/Resources/Geonames/Thailand.csv
(Stored with Git LFS)
Binary file not shown.
|
|
|
@ -1,7 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2923f8bd3a2f0fb4084f64138e6d793d
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Resources/Geonames/USA.csv
(Stored with Git LFS)
BIN
Assets/Resources/Geonames/USA.csv
(Stored with Git LFS)
Binary file not shown.
|
|
|
@ -1,7 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a06c0e26f73d51f489303deadad77030
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,7 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 790ef350f8658b04480e0645919a21fa
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Resources/Geonames/pleiades.csv
(Stored with Git LFS)
BIN
Assets/Resources/Geonames/pleiades.csv
(Stored with Git LFS)
Binary file not shown.
|
|
|
@ -1,7 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b532694a5ec3cc6458d42aa2835537b5
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Resources/Settings.asset
(Stored with Git LFS)
BIN
Assets/Resources/Settings.asset
(Stored with Git LFS)
Binary file not shown.
|
|
@ -1,93 +0,0 @@
|
|||
using System.Buffers.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using MessagePack;
|
||||
using CultMath;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using Random = CultMath.Random;
|
||||
|
||||
public class NameTools : EditorWindow
|
||||
{
|
||||
public int NameGeneratorMinLength = 5;
|
||||
public int NameGeneratorMaxLength = 10;
|
||||
public int NameGeneratorOrder = 4;
|
||||
private int minWordLength = 4;
|
||||
private TextAsset nameFile;
|
||||
private MarkovNameGenerator _nameGenerator;
|
||||
private bool _stripNumberTokens;
|
||||
|
||||
|
||||
// Add menu named "My Window" to the Window menu
|
||||
[MenuItem("Window/Aetheria/Name Tools")]
|
||||
static void Init()
|
||||
{
|
||||
// Get existing open window or if none, make a new one:
|
||||
NameTools window = (NameTools)EditorWindow.GetWindow(typeof(NameTools));
|
||||
window.Show();
|
||||
}
|
||||
|
||||
bool HasNonASCIIChars(string str)
|
||||
{
|
||||
return (System.Text.Encoding.UTF8.GetByteCount(str) != str.Length);
|
||||
}
|
||||
|
||||
void OnGUI()
|
||||
{
|
||||
|
||||
nameFile = (TextAsset) EditorGUILayout.ObjectField("Name File", nameFile, typeof(TextAsset), false);
|
||||
minWordLength = EditorGUILayout.IntField("Minimum File Word Length", minWordLength);
|
||||
NameGeneratorMinLength = EditorGUILayout.IntField("Generated Minimum Word Length", NameGeneratorMinLength);
|
||||
NameGeneratorMaxLength = EditorGUILayout.IntField("Generated Maximum Word Length", NameGeneratorMaxLength);
|
||||
NameGeneratorOrder = EditorGUILayout.IntField("Generator Order", NameGeneratorOrder);
|
||||
_stripNumberTokens = GUILayout.Toggle(_stripNumberTokens, "Strip Number Tokens");
|
||||
|
||||
if (GUILayout.Button("Clean Name File"))
|
||||
{
|
||||
var lines = nameFile.text.Split('\n');
|
||||
using StreamWriter outputFile = new StreamWriter(Path.Combine(Application.dataPath, nameFile.name + ".csv"));
|
||||
var names = new HashSet<string>();
|
||||
foreach (var line in lines)
|
||||
{
|
||||
var tokens = line.Split(',', ' ');
|
||||
foreach (var t in tokens)
|
||||
{
|
||||
if (!HasNonASCIIChars(t))
|
||||
{
|
||||
var s = new string(t.Where(c => char.IsLetter(c) || c == '-' || c == '`' || c == '\'').ToArray()).Trim().Trim('`','-');
|
||||
if(s.Length >= minWordLength && !names.Contains(s))
|
||||
{
|
||||
names.Add(s);
|
||||
outputFile.WriteLine(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Process Name File") && nameFile != null)
|
||||
{
|
||||
var names = new HashSet<string>();
|
||||
var lines = nameFile.text.Split('\n');
|
||||
foreach (var line in lines)
|
||||
{
|
||||
foreach(var word in line.ToUpperInvariant().Split(' ', ',', '.', '"'))
|
||||
if (word.Length >= minWordLength && !names.Contains(word))
|
||||
names.Add(word);
|
||||
}
|
||||
Debug.Log($"Found {lines.Length} lines, with {names.Count} unique names!");
|
||||
var random = new Random(1337);
|
||||
_nameGenerator = new MarkovNameGenerator(ref random, names, NameGeneratorOrder, NameGeneratorMinLength, NameGeneratorMaxLength);
|
||||
}
|
||||
|
||||
if (_nameGenerator != null)
|
||||
{
|
||||
if (GUILayout.Button("Generate Name"))
|
||||
{
|
||||
Debug.Log(_nameGenerator.NextName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 88b5f578fe63a904b997331630e61416
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -22,7 +22,6 @@ public class GameSettings : ScriptableObject
|
|||
public float MinimapAsteroidSize = 3;
|
||||
public float MinimapIconSize = 1f / 32;
|
||||
public float PlanetRotationSpeed = 1;
|
||||
public NameGeneratorSettings NameGeneratorSettings;
|
||||
public TutorialGenerationSettings TutorialGenerationSettings;
|
||||
public SectorBackgroundSettings TutorialBackgroundSettings;
|
||||
public SectorBackgroundSettings SectorBackgroundSettings;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -78,9 +77,3 @@ public class FactionPlace
|
|||
public string Name;
|
||||
}
|
||||
|
||||
[CultDocument("aetheria.namefile", "1"), Inspectable, MessagePackObject]
|
||||
public class NameFile
|
||||
{
|
||||
[CultName, Key(1)] public string Name;
|
||||
[Key(2)] public string[] Names;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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; }
|
||||
|
|
@ -95,7 +94,6 @@ public class Galaxy
|
|||
public Galaxy(
|
||||
SectorGenerationSettings settings,
|
||||
SectorBackgroundSettings background,
|
||||
NameGeneratorSettings nameGeneratorSettings,
|
||||
CultCache cache,
|
||||
Action<string> log,
|
||||
Action<string> progressCallback = null,
|
||||
|
|
@ -161,7 +159,6 @@ public class Galaxy
|
|||
public Galaxy(
|
||||
TutorialGenerationSettings settings,
|
||||
SectorBackgroundSettings background,
|
||||
NameGeneratorSettings nameGeneratorSettings,
|
||||
CultCache cache,
|
||||
PlayerSettings playerSettings,
|
||||
DirectoryInfo narrativeDirectory,
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
@ -45,14 +45,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
|
||||
{
|
||||
|
|
|
|||
|
|
@ -177,7 +177,6 @@ public class MainMenu : MonoBehaviour
|
|||
Settings.SectorBackgroundSettings,
|
||||
Settings.TutorialGenerationSettings,
|
||||
Settings.TutorialBackgroundSettings,
|
||||
Settings.NameGeneratorSettings,
|
||||
ActionGameManager.CultCache,
|
||||
ActionGameManager.PlayerSettings,
|
||||
ActionGameManager.GameDataDirectory.CreateSubdirectory("Narrative"),
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public sealed class ChildrenWithinReachTests : IClassFixture<ChildrenWithinReach
|
|||
var authored = AuthoredSettings.Load(RunStartTests.FindRepoRoot());
|
||||
var galaxy = new Galaxy(authored.Read<TutorialGenerationSettings>("TutorialGenerationSettings"),
|
||||
authored.Read<SectorBackgroundSettings>("TutorialBackgroundSettings"),
|
||||
authored.Read<NameGeneratorSettings>("NameGeneratorSettings"), cache, new PlayerSettings(),
|
||||
cache, new PlayerSettings(),
|
||||
Directory.CreateDirectory(Path.Combine(dir, "Narrative")), _ => { }, null, seed);
|
||||
var items = new ItemManager(cache, new ProvenanceLedger(), authored.Read<GameplaySettings>("GameplaySettings"), _ => { });
|
||||
var planetSettings = authored.Read<PlanetSettings>("PlanetSettings");
|
||||
|
|
|
|||
|
|
@ -280,8 +280,7 @@ public sealed class ConsumableSupplyTests : IDisposable
|
|||
|
||||
var authored = AuthoredSettings.Load(repo);
|
||||
var galaxy = new Galaxy(authored.Read<TutorialGenerationSettings>("TutorialGenerationSettings"),
|
||||
authored.Read<SectorBackgroundSettings>("TutorialBackgroundSettings"), authored.Read<NameGeneratorSettings>("NameGeneratorSettings"),
|
||||
cache, new PlayerSettings(), Directory.CreateDirectory(Path.Combine(_root, "Narrative")), _ => { }, null, 1);
|
||||
authored.Read<SectorBackgroundSettings>("TutorialBackgroundSettings"), cache, new PlayerSettings(), Directory.CreateDirectory(Path.Combine(_root, "Narrative")), _ => { }, null, 1);
|
||||
var items = new ItemManager(cache, new ProvenanceLedger(), authored.Read<GameplaySettings>("GameplaySettings"), _ => { });
|
||||
|
||||
int stations = 0, ships = 0;
|
||||
|
|
|
|||
|
|
@ -814,7 +814,7 @@ public sealed partial class MiningCut3Tests : IDisposable
|
|||
try
|
||||
{
|
||||
galaxy = new Galaxy(RestoredHullsTests.TutorialGalaxySettings(), RestoredHullsTests.TutorialBackgroundSettings(),
|
||||
RestoredHullsTests.TutorialNameSettings(), cache, new PlayerSettings(), new DirectoryInfo(dir), _ => { }, null, seed);
|
||||
cache, new PlayerSettings(), new DirectoryInfo(dir), _ => { }, null, seed);
|
||||
}
|
||||
catch (Exception) { continue; } // Galaxy's own seed-dependent flakiness (RestoredHullsTests)
|
||||
var items = new ItemManager(cache, new ProvenanceLedger(), GameSettings(), _ => { });
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ public sealed class MinorPowersTests : IDisposable
|
|||
foreach (var shortName in Minor)
|
||||
{
|
||||
var faction = Assert.Single(factions, f => f.ShortName == shortName);
|
||||
Assert.NotNull(cache.Get(faction.GeonameFile));
|
||||
Assert.NotEmpty(faction.Places);
|
||||
Assert.True(faction.InfluenceDistance > 0, shortName);
|
||||
var named = faction.Allegiance.Keys.Select(k => k.Key).ToArray();
|
||||
var expected = factions.Where(f => f != faction && f.ShortName != "Pirates").Select(f => cache.RefOf(f).Key).ToArray();
|
||||
|
|
|
|||
|
|
@ -253,7 +253,7 @@ public sealed class OrbitsFromFieldTests : IDisposable
|
|||
var authored = AuthoredSettings.Load(RunStartTests.FindRepoRoot());
|
||||
var tutorial = authored.Read<TutorialGenerationSettings>("TutorialGenerationSettings");
|
||||
var galaxy = new Galaxy(tutorial, authored.Read<SectorBackgroundSettings>("TutorialBackgroundSettings"),
|
||||
authored.Read<NameGeneratorSettings>("NameGeneratorSettings"), cache, new PlayerSettings(),
|
||||
cache, new PlayerSettings(),
|
||||
Directory.CreateDirectory(Path.Combine(dir, "Narrative")), _ => { }, null, seed);
|
||||
var items = new ItemManager(cache, new ProvenanceLedger(), authored.Read<GameplaySettings>("GameplaySettings"), _ => { });
|
||||
var pack = ZoneGenerator.GenerateZone(items, authored.Read<ZoneGenerationSettings>("ZoneSettings"), authored.Read<PlanetSettings>("PlanetSettings"), galaxy, galaxy.Entrance,
|
||||
|
|
|
|||
|
|
@ -82,7 +82,6 @@ public sealed class PiratesFactionCommandTests : IDisposable
|
|||
var db = AetherDb.Open(root: _root);
|
||||
try
|
||||
{
|
||||
Assert.Equal("pleiades", db.Cache.Get(faction.GeonameFile).Name);
|
||||
var expected = new (string Design, string Name, string Description)[]
|
||||
{
|
||||
("Autocannon", "🫳🔫", "Serial number filed off. Still shoots."),
|
||||
|
|
@ -172,17 +171,4 @@ public sealed class PiratesFactionCommandTests : IDisposable
|
|||
Assert.Throws<InvalidOperationException>(() => Program.PiratesFaction(apply: true, root: _root));
|
||||
Assert.Empty(Read().Pirates);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_missing_name_file_refuses_and_lands_nothing()
|
||||
{
|
||||
var db = AetherDb.Open(catalogWritable: true, root: _root);
|
||||
var pleiades = db.Cache.GetAll<NameFile>().Single(file => file.Name == "pleiades");
|
||||
Assert.True(db.Cache.Remove(db.Cache.RefOf(pleiades).Key));
|
||||
db.Cache.FlushAsync().Wait();
|
||||
db.Cache.Dispose();
|
||||
|
||||
Assert.Throws<InvalidOperationException>(() => Program.PiratesFaction(apply: true, root: _root));
|
||||
Assert.Empty(Read().Pirates);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ public sealed partial class RunStartTests
|
|||
var others = _cache.GetAll<Faction>().Where(faction => faction != pirates).Select(faction => _cache.RefOf(faction)).ToArray();
|
||||
Assert.NotEmpty(others);
|
||||
Assert.All(others, other => Assert.True(pirates.Allegiance.ContainsKey(other)));
|
||||
Assert.NotNull(_cache.Get(pirates.GeonameFile));
|
||||
Assert.NotEmpty(pirates.Places);
|
||||
|
||||
var products = PiratesProducts();
|
||||
Assert.Equal(8, products.Length);
|
||||
|
|
|
|||
|
|
@ -31,9 +31,9 @@ public sealed class PlaceNamesTests : IDisposable
|
|||
|
||||
private static Galaxy Build(CultCache cache, bool prelude, uint seed) => prelude
|
||||
? new Galaxy(Authored.Read<TutorialGenerationSettings>("TutorialGenerationSettings"), Authored.Read<SectorBackgroundSettings>("TutorialBackgroundSettings"),
|
||||
Authored.Read<NameGeneratorSettings>("NameGeneratorSettings"), cache, new PlayerSettings(), new DirectoryInfo(Path.GetTempPath()), _ => { }, null, seed)
|
||||
cache, new PlayerSettings(), new DirectoryInfo(Path.GetTempPath()), _ => { }, null, seed)
|
||||
: new Galaxy(Authored.Read<SectorGenerationSettings>("SectorGenerationSettings"), Authored.Read<SectorBackgroundSettings>("SectorBackgroundSettings"),
|
||||
Authored.Read<NameGeneratorSettings>("NameGeneratorSettings"), cache, _ => { }, null, seed);
|
||||
cache, _ => { }, null, seed);
|
||||
|
||||
// A prelude galaxy sometimes refuses to generate for a seed (RestoredHullsTests calls it Galaxy's own seed-dependent
|
||||
// flakiness); those seeds are skipped, and a test that depends on how many built says so.
|
||||
|
|
|
|||
|
|
@ -91,9 +91,6 @@ public sealed class RestoredHullsTests
|
|||
NoisePosition = 536.5106f, CloudExponent = 10, CloudAmplitude = .01f,
|
||||
};
|
||||
|
||||
internal static NameGeneratorSettings TutorialNameSettings() =>
|
||||
new NameGeneratorSettings { NameGeneratorMinLength = 5, NameGeneratorMaxLength = 10, NameGeneratorOrder = 3 };
|
||||
|
||||
// A station's orbit is a copy of its source planet's own (Parent, Distance) (ZoneGenerator.CreateLagrangeOrbit),
|
||||
// so it always matches that one planet. It matches MORE than one planet only when the source planet shares its
|
||||
// distance with a sibling under the same parent -- exactly what ZoneGenerator's potentialLagrangePoints filter
|
||||
|
|
@ -153,8 +150,7 @@ public sealed class RestoredHullsTests
|
|||
var items = new ItemManager(cache, new ProvenanceLedger(), Settings(), _ => { });
|
||||
for (var seed = 1u; seed <= 64u; seed++)
|
||||
{
|
||||
var galaxy = new Galaxy(TutorialGalaxySettings(), TutorialBackgroundSettings(), TutorialNameSettings(),
|
||||
cache, new PlayerSettings(), new DirectoryInfo(Path.GetTempPath()), _ => { }, null, seed);
|
||||
var galaxy = new Galaxy(TutorialGalaxySettings(), TutorialBackgroundSettings(), cache, new PlayerSettings(), new DirectoryInfo(Path.GetTempPath()), _ => { }, null, seed);
|
||||
foreach (var zone in galaxy.Zones.Where(z => !ReferenceEquals(z, galaxy.Entrance)))
|
||||
{
|
||||
var orbits = ParentedPlanetOrbits(cache, ZoneGenerator.GenerateZone(items, TutorialZoneSettings(), AuthoredPlanetSettings(), galaxy, zone, isTutorial: false, ambient: false));
|
||||
|
|
@ -366,7 +362,6 @@ public sealed class RestoredHullsTests
|
|||
var zoneSettings = TutorialZoneSettings();
|
||||
var tutorialSettings = TutorialGalaxySettings();
|
||||
var background = TutorialBackgroundSettings();
|
||||
var names = TutorialNameSettings();
|
||||
var gameData = TestCatalog.Repo;
|
||||
var sawGenuineLagrangeOrbit = false;
|
||||
for (uint seed = 1; seed <= 25; seed++)
|
||||
|
|
@ -375,7 +370,7 @@ public sealed class RestoredHullsTests
|
|||
try
|
||||
{
|
||||
using var cache = OpenReadOnlyRealCatalogWithScratchRun(gameData, scratchRun);
|
||||
var galaxy = new Galaxy(tutorialSettings, background, names, cache, new PlayerSettings(), new DirectoryInfo(Path.GetTempPath()), _ => { }, null, seed);
|
||||
var galaxy = new Galaxy(tutorialSettings, background, cache, new PlayerSettings(), new DirectoryInfo(Path.GetTempPath()), _ => { }, null, seed);
|
||||
|
||||
var items = new ItemManager(cache, new ProvenanceLedger(), Settings(), _ => { });
|
||||
var pack = ZoneGenerator.GenerateZone(items, zoneSettings, AuthoredPlanetSettings(), galaxy, galaxy.Entrance, isTutorial: true);
|
||||
|
|
@ -407,7 +402,6 @@ public sealed class RestoredHullsTests
|
|||
var zoneSettings = TutorialZoneSettings();
|
||||
var tutorialSettings = TutorialGalaxySettings();
|
||||
var background = TutorialBackgroundSettings();
|
||||
var names = TutorialNameSettings();
|
||||
var gameData = TestCatalog.Repo;
|
||||
var sawGenuineCandidate = false;
|
||||
for (uint seed = 1; seed <= 25; seed++)
|
||||
|
|
@ -416,7 +410,7 @@ public sealed class RestoredHullsTests
|
|||
try
|
||||
{
|
||||
using var cache = OpenReadOnlyRealCatalogWithScratchRun(gameData, scratchRun);
|
||||
var galaxy = new Galaxy(tutorialSettings, background, names, cache, new PlayerSettings(), new DirectoryInfo(Path.GetTempPath()), _ => { }, null, seed);
|
||||
var galaxy = new Galaxy(tutorialSettings, background, cache, new PlayerSettings(), new DirectoryInfo(Path.GetTempPath()), _ => { }, null, seed);
|
||||
|
||||
var items = new ItemManager(cache, new ProvenanceLedger(), Settings(), _ => { });
|
||||
var pack = ZoneGenerator.GenerateZone(items, zoneSettings, AuthoredPlanetSettings(), galaxy, galaxy.Entrance, isTutorial: true);
|
||||
|
|
@ -454,8 +448,7 @@ public sealed class RestoredHullsTests
|
|||
try
|
||||
{
|
||||
using var cache = OpenReadOnlyRealCatalogWithScratchRun(gameData, scratchRun);
|
||||
var galaxy = new Galaxy(TutorialGalaxySettings(), TutorialBackgroundSettings(), TutorialNameSettings(),
|
||||
cache, new PlayerSettings(), new DirectoryInfo(Path.GetTempPath()), _ => { }, null, seed: 1u);
|
||||
var galaxy = new Galaxy(TutorialGalaxySettings(), TutorialBackgroundSettings(), cache, new PlayerSettings(), new DirectoryInfo(Path.GetTempPath()), _ => { }, null, seed: 1u);
|
||||
var items = new ItemManager(cache, new ProvenanceLedger(), Settings(), _ => { });
|
||||
|
||||
var zoneSettings = TutorialZoneSettings();
|
||||
|
|
@ -490,8 +483,7 @@ public sealed class RestoredHullsTests
|
|||
try
|
||||
{
|
||||
using var cache = OpenReadOnlyRealCatalogWithScratchRun(gameData, scratchRun);
|
||||
var galaxy = new Galaxy(TutorialGalaxySettings(), TutorialBackgroundSettings(), TutorialNameSettings(),
|
||||
cache, new PlayerSettings(), new DirectoryInfo(Path.GetTempPath()), _ => { }, null, seed: 1u);
|
||||
var galaxy = new Galaxy(TutorialGalaxySettings(), TutorialBackgroundSettings(), cache, new PlayerSettings(), new DirectoryInfo(Path.GetTempPath()), _ => { }, null, seed: 1u);
|
||||
var items = new ItemManager(cache, new ProvenanceLedger(), Settings(), _ => { });
|
||||
|
||||
var zoneSettings = TutorialZoneSettings();
|
||||
|
|
@ -532,7 +524,6 @@ public sealed class RestoredHullsTests
|
|||
var zoneSettings = TutorialZoneSettings();
|
||||
var tutorialSettings = TutorialGalaxySettings();
|
||||
var background = TutorialBackgroundSettings();
|
||||
var names = TutorialNameSettings();
|
||||
var gameData = TestCatalog.Repo;
|
||||
|
||||
var checkedAny = false;
|
||||
|
|
@ -542,7 +533,7 @@ public sealed class RestoredHullsTests
|
|||
try
|
||||
{
|
||||
using var cache = OpenReadOnlyRealCatalogWithScratchRun(gameData, scratchRun);
|
||||
var galaxy = new Galaxy(tutorialSettings, background, names, cache, new PlayerSettings(), new DirectoryInfo(Path.GetTempPath()), _ => { }, null, seed);
|
||||
var galaxy = new Galaxy(tutorialSettings, background, cache, new PlayerSettings(), new DirectoryInfo(Path.GetTempPath()), _ => { }, null, seed);
|
||||
|
||||
var items = new ItemManager(cache, new ProvenanceLedger(), Settings(), _ => { });
|
||||
var pack = ZoneGenerator.GenerateZone(items, zoneSettings, AuthoredPlanetSettings(), galaxy, galaxy.Entrance, isTutorial: true);
|
||||
|
|
@ -677,8 +668,7 @@ public sealed class RestoredHullsTests
|
|||
// real zone from a real galaxy (e.g. one already known to have no Lagrange candidate) and make it the Entrance.
|
||||
private static Galaxy BuildGalaxyWithForcedEntrance(CultCache cache, uint seed, string entranceZoneName)
|
||||
{
|
||||
var galaxy = new Galaxy(TutorialGalaxySettings(), TutorialBackgroundSettings(), TutorialNameSettings(),
|
||||
cache, new PlayerSettings(), new DirectoryInfo(Path.GetTempPath()), _ => { }, null, seed);
|
||||
var galaxy = new Galaxy(TutorialGalaxySettings(), TutorialBackgroundSettings(), cache, new PlayerSettings(), new DirectoryInfo(Path.GetTempPath()), _ => { }, null, seed);
|
||||
var target = galaxy.Zones.Single(z => z.Name == entranceZoneName);
|
||||
|
||||
var factions = galaxy.Factions;
|
||||
|
|
@ -789,8 +779,7 @@ public sealed class RestoredHullsTests
|
|||
try
|
||||
{
|
||||
using var cache = OpenReadOnlyRealCatalogWithScratchRun(gameData, scratchRun);
|
||||
var galaxy = new Galaxy(TutorialGalaxySettings(), TutorialBackgroundSettings(), TutorialNameSettings(),
|
||||
cache, new PlayerSettings(), new DirectoryInfo(Path.GetTempPath()), _ => { }, null, seed: 1u);
|
||||
var galaxy = new Galaxy(TutorialGalaxySettings(), TutorialBackgroundSettings(), cache, new PlayerSettings(), new DirectoryInfo(Path.GetTempPath()), _ => { }, null, seed: 1u);
|
||||
var items = new ItemManager(cache, new ProvenanceLedger(), Settings(), _ => { });
|
||||
|
||||
int StationCount(GalaxyZone zone, bool isTutorial) =>
|
||||
|
|
@ -830,8 +819,7 @@ public sealed class RestoredHullsTests
|
|||
try
|
||||
{
|
||||
using var cache = OpenReadOnlyRealCatalogWithScratchRun(gameData, scratchRun);
|
||||
var galaxy = new Galaxy(TutorialGalaxySettings(), TutorialBackgroundSettings(), TutorialNameSettings(),
|
||||
cache, new PlayerSettings(), new DirectoryInfo(Path.GetTempPath()), _ => { }, null, seed: 1u);
|
||||
var galaxy = new Galaxy(TutorialGalaxySettings(), TutorialBackgroundSettings(), cache, new PlayerSettings(), new DirectoryInfo(Path.GetTempPath()), _ => { }, null, seed: 1u);
|
||||
var items = new ItemManager(cache, new ProvenanceLedger(), Settings(), _ => { });
|
||||
|
||||
var pack = ZoneGenerator.GenerateZone(items, TutorialZoneSettings(), AuthoredPlanetSettings(), galaxy, galaxy.Entrance, isTutorial: true);
|
||||
|
|
@ -866,8 +854,7 @@ public sealed class RestoredHullsTests
|
|||
// Must fail if that guard is dropped for real.
|
||||
private static Galaxy BuildGalaxyWithBoostedPresence(CultCache cache, uint seed, string zoneName)
|
||||
{
|
||||
var galaxy = new Galaxy(TutorialGalaxySettings(), TutorialBackgroundSettings(), TutorialNameSettings(),
|
||||
cache, new PlayerSettings(), new DirectoryInfo(Path.GetTempPath()), _ => { }, null, seed);
|
||||
var galaxy = new Galaxy(TutorialGalaxySettings(), TutorialBackgroundSettings(), cache, new PlayerSettings(), new DirectoryInfo(Path.GetTempPath()), _ => { }, null, seed);
|
||||
var target = galaxy.Zones.Single(z => z.Name == zoneName);
|
||||
|
||||
var factions = galaxy.Factions;
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ public sealed partial class RunStartTests : IDisposable
|
|||
_planetSettings = authored.Read<PlanetSettings>("PlanetSettings");
|
||||
var tutorial = _tutorialSettings = authored.Read<TutorialGenerationSettings>("TutorialGenerationSettings");
|
||||
_galaxy = new Galaxy(tutorial, authored.Read<SectorBackgroundSettings>("TutorialBackgroundSettings"),
|
||||
authored.Read<NameGeneratorSettings>("NameGeneratorSettings"), _cache, new PlayerSettings(),
|
||||
_cache, new PlayerSettings(),
|
||||
Directory.CreateDirectory(Path.Combine(_root, "Narrative")), _ => { }, null, GalaxySeed);
|
||||
_items = new ItemManager(_cache, new ProvenanceLedger(), authored.Read<GameplaySettings>("GameplaySettings"), _ => { });
|
||||
_protagonist = _galaxy.ResolveFaction(tutorial.ProtagonistFaction);
|
||||
|
|
@ -122,7 +122,7 @@ public sealed partial class RunStartTests : IDisposable
|
|||
var authored = AuthoredSettings.Load(FindRepoRoot());
|
||||
return new Galaxy(authored.Read<SectorGenerationSettings>("SectorGenerationSettings"),
|
||||
authored.Read<SectorBackgroundSettings>("SectorBackgroundSettings"),
|
||||
authored.Read<NameGeneratorSettings>("NameGeneratorSettings"), _cache, _ => { }, null, GalaxySeed);
|
||||
_cache, _ => { }, null, GalaxySeed);
|
||||
}
|
||||
|
||||
// Every item a station carries, equipped or stocked, with the product it was made as.
|
||||
|
|
|
|||
|
|
@ -55,7 +55,6 @@ public sealed partial class RunStartTests
|
|||
authored.Read<SectorBackgroundSettings>("SectorBackgroundSettings"),
|
||||
authored.Read<TutorialGenerationSettings>("TutorialGenerationSettings"),
|
||||
authored.Read<SectorBackgroundSettings>("TutorialBackgroundSettings"),
|
||||
authored.Read<NameGeneratorSettings>("NameGeneratorSettings"),
|
||||
_cache, new PlayerSettings(), Directory.CreateDirectory(Path.Combine(_root, "Narrative")), _ => { }, null, clock);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ public sealed class StationPlacementTests : IDisposable
|
|||
var settings = authored.Read<GameplaySettings>("GameplaySettings");
|
||||
var galaxy = new Galaxy(authored.Read<TutorialGenerationSettings>("TutorialGenerationSettings"),
|
||||
authored.Read<SectorBackgroundSettings>("TutorialBackgroundSettings"),
|
||||
authored.Read<NameGeneratorSettings>("NameGeneratorSettings"), cache, new PlayerSettings(),
|
||||
cache, new PlayerSettings(),
|
||||
Directory.CreateDirectory(Path.Combine(dir, "Narrative")), _ => { }, null, seed);
|
||||
var items = new ItemManager(cache, new ProvenanceLedger(), settings, _ => { });
|
||||
stock?.Invoke(items);
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ public sealed class SunsNeverGreenTests : IDisposable
|
|||
var authored = AuthoredSettings.Load(RunStartTests.FindRepoRoot());
|
||||
var tutorial = authored.Read<TutorialGenerationSettings>("TutorialGenerationSettings");
|
||||
var galaxy = new Galaxy(tutorial, authored.Read<SectorBackgroundSettings>("TutorialBackgroundSettings"),
|
||||
authored.Read<NameGeneratorSettings>("NameGeneratorSettings"), cache, new PlayerSettings(),
|
||||
cache, new PlayerSettings(),
|
||||
Directory.CreateDirectory(Path.Combine(dir, "Narrative")), _ => { }, null, seed);
|
||||
var items = new ItemManager(cache, new ProvenanceLedger(), authored.Read<GameplaySettings>("GameplaySettings"), _ => { });
|
||||
var zoneSettings = authored.Read<ZoneGenerationSettings>("ZoneSettings");
|
||||
|
|
|
|||
|
|
@ -19,23 +19,22 @@ public static class MinorPowerFactionsCommand
|
|||
{
|
||||
// Own: the weights this faction names for the other minor powers; every other faction but the Pirates gets Default.
|
||||
// Gain: the weight every existing faction (bar the Pirates and Miss Terri's) gains toward this faction.
|
||||
// Geonames is the name file the faction draws place names from (question minor-power-geonames: the nearest existing file).
|
||||
internal sealed record Def(string Name, string ShortName, string Description, float3 Primary, float3 Secondary,
|
||||
string Geonames, int Influence, float Gain, float Default, (string ShortName, float Weight)[] Own);
|
||||
int Influence, float Gain, float Default, (string ShortName, float Weight)[] Own);
|
||||
|
||||
internal static readonly Def[] Factions =
|
||||
{
|
||||
new("Aya Collective", "Aya",
|
||||
"A federation of communes, clinics and repair crews. Its equipment comes with the drawings, so the people it protects can keep it running.",
|
||||
new float3(.72f, .36f, .22f), new float3(.12f, .36f, .25f), "Congo", 3, .3f, .3f,
|
||||
new float3(.72f, .36f, .22f), new float3(.12f, .36f, .25f), 3, .3f, .3f,
|
||||
new[] { ("Forge", 1f), ("Megiddo", .5f) }),
|
||||
new("Megiddo", "Megiddo",
|
||||
"A defended fleet that holds its boundary until the question is answered. Others buy its protection without sharing its faith.",
|
||||
new float3(.07f, .09f, .15f), new float3(.90f, .85f, .74f), "pleiades", 4, .3f, .2f,
|
||||
new float3(.07f, .09f, .15f), new float3(.90f, .85f, .74f), 4, .3f, .2f,
|
||||
new[] { ("Aya", .5f), ("Forge", .5f) }),
|
||||
new("Orbital Forge", "Forge",
|
||||
"Belt engineers who hollow asteroids into homes and yards. Their standards leave room to adapt them, and their drawings travel further than their ships.",
|
||||
new float3(.42f, .30f, .22f), new float3(.30f, .38f, .52f), "pleiades", 3, .5f, .5f,
|
||||
new float3(.42f, .30f, .22f), new float3(.30f, .38f, .52f), 3, .5f, .5f,
|
||||
Array.Empty<(string, float)>()),
|
||||
};
|
||||
|
||||
|
|
@ -51,17 +50,14 @@ public static class MinorPowerFactionsCommand
|
|||
var apply = args.Contains("apply");
|
||||
var db = AetherDb.Open(catalogWritable: apply, root: root);
|
||||
var existing = db.Cache.GetAll<Faction>().ToArray();
|
||||
var nameFiles = db.Cache.GetAll<NameFile>().ToArray();
|
||||
|
||||
// Refuse before any write: a name or short name held by a faction under another key, and a missing name file.
|
||||
// Refuse before any write: a name or short name held by a faction under another key.
|
||||
foreach (var def in Factions)
|
||||
{
|
||||
var key = KeyOf(def);
|
||||
foreach (var other in existing.Where(f => f.Name == def.Name || f.ShortName == def.ShortName))
|
||||
if (!db.Cache.RefOf(other).Key.Equals(key))
|
||||
throw new InvalidOperationException("Faction Name or ShortName: held by a faction under another key (conflict).");
|
||||
if (nameFiles.Count(n => n.Name == def.Geonames) != 1)
|
||||
throw new InvalidOperationException("Faction GeonameFile: expected exactly one name file (missing).");
|
||||
}
|
||||
|
||||
var minorKeys = Factions.ToDictionary(d => d.ShortName, KeyOf);
|
||||
|
|
@ -80,7 +76,7 @@ public static class MinorPowerFactionsCommand
|
|||
}
|
||||
|
||||
foreach (var def in created)
|
||||
Console.WriteLine($"New faction \"{def.Name}\" ({def.ShortName}): influence {def.Influence}, names \"{def.Geonames}\", colours ({def.Primary.x:0.00}, {def.Primary.y:0.00}, {def.Primary.z:0.00}) / ({def.Secondary.x:0.00}, {def.Secondary.y:0.00}, {def.Secondary.z:0.00})\n {def.Description}\n allegiance: {string.Join(", ", def.Own.Select(o => $"{o.ShortName} {o.Weight:0.##}"))} others {def.Default:0.##}");
|
||||
Console.WriteLine($"New faction \"{def.Name}\" ({def.ShortName}): influence {def.Influence}, colours ({def.Primary.x:0.00}, {def.Primary.y:0.00}, {def.Primary.z:0.00}) / ({def.Secondary.x:0.00}, {def.Secondary.y:0.00}, {def.Secondary.z:0.00})\n {def.Description}\n allegiance: {string.Join(", ", def.Own.Select(o => $"{o.ShortName} {o.Weight:0.##}"))} others {def.Default:0.##}");
|
||||
foreach (var (holder, missing) in gains)
|
||||
Console.WriteLine($" {holder.ShortName} gains {string.Join(", ", missing.Select(d => $"{d.ShortName} {d.Gain:0.##}"))}");
|
||||
|
||||
|
|
@ -101,7 +97,7 @@ public static class MinorPowerFactionsCommand
|
|||
{
|
||||
Name = def.Name, ShortName = def.ShortName, Description = def.Description,
|
||||
PrimaryColor = def.Primary, SecondaryColor = def.Secondary,
|
||||
GeonameFile = db.Cache.RefOf(nameFiles.Single(n => n.Name == def.Geonames)), InfluenceDistance = def.Influence,
|
||||
InfluenceDistance = def.Influence,
|
||||
};
|
||||
foreach (var reference in everyone) faction.Allegiance[reference] = def.Default;
|
||||
foreach (var other in Factions.Where(o => o != def))
|
||||
|
|
|
|||
|
|
@ -88,8 +88,6 @@ public static class PlaceNamesCommand
|
|||
|
||||
var rows = table.ToDictionary(r => r.RecordKey, StringComparer.Ordinal);
|
||||
var changed = table.Where(r => !keyOf[r.RecordKey].Places.Select(p => p.Name).SequenceEqual(r.Names)).ToArray();
|
||||
var nameFiles = db.Cache.GetAll<NameFile>().ToArray();
|
||||
var geoned = factions.Where(f => f.GeonameFile.IsSet()).ToArray();
|
||||
|
||||
foreach (var faction in factions.OrderBy(f => f.Name, StringComparer.Ordinal))
|
||||
{
|
||||
|
|
@ -100,10 +98,7 @@ public static class PlaceNamesCommand
|
|||
}
|
||||
Console.WriteLine($"{faction.Name}: {row.Names.Length} places, capital {row.Names[0]}, {(changed.Contains(row) ? "changed" : "unchanged")}");
|
||||
}
|
||||
if (nameFiles.Length != 0 || geoned.Length != 0)
|
||||
Console.WriteLine($"Retired Markov data: {nameFiles.Length} name files, {geoned.Length} geoname links.");
|
||||
|
||||
if (changed.Length == 0 && nameFiles.Length == 0 && geoned.Length == 0)
|
||||
if (changed.Length == 0)
|
||||
{
|
||||
Console.WriteLine("nothing to do");
|
||||
return 0;
|
||||
|
|
@ -116,15 +111,12 @@ public static class PlaceNamesCommand
|
|||
|
||||
if (!db.Cache.Commit(batch =>
|
||||
{
|
||||
// Commit 1 only: the Markov data goes while its type still exists; commit 3 deletes the type and this leg.
|
||||
foreach (var faction in factions.Where(f => geoned.Contains(f) || changed.Any(r => r.RecordKey == db.Cache.RefOf(f).Key.Value)))
|
||||
foreach (var row in changed)
|
||||
{
|
||||
if (rows.TryGetValue(db.Cache.RefOf(faction).Key.Value, out var row))
|
||||
faction.Places = row.Names.Select(n => new FactionPlace { Name = n }).ToArray();
|
||||
faction.GeonameFile = default;
|
||||
var faction = keyOf[row.RecordKey];
|
||||
faction.Places = row.Names.Select(n => new FactionPlace { Name = n }).ToArray();
|
||||
batch.Upsert(typeof(Faction), faction, db.Cache.RefOf(faction).Key);
|
||||
}
|
||||
foreach (var file in nameFiles) batch.Remove(db.Cache.RefOf(file).Key);
|
||||
}))
|
||||
throw new InvalidOperationException("The catalog changed while place names were being authored; nothing was written. Run it again.");
|
||||
Console.WriteLine($"\nAuthored {changed.Length} place lists in Aetheria.cc");
|
||||
|
|
|
|||
|
|
@ -544,7 +544,6 @@ public static class Program
|
|||
|
||||
var tutorial = authored.Read<TutorialGenerationSettings>("TutorialGenerationSettings");
|
||||
var background = authored.Read<SectorBackgroundSettings>("TutorialBackgroundSettings");
|
||||
var names = authored.Read<NameGeneratorSettings>("NameGeneratorSettings");
|
||||
var zones = authored.Read<ZoneGenerationSettings>("ZoneSettings");
|
||||
var gameplay = authored.Read<GameplaySettings>("GameplaySettings");
|
||||
|
||||
|
|
@ -554,7 +553,6 @@ public static class Program
|
|||
$"{tutorial.ZoneCount} zones, link density {tutorial.LinkDensity}");
|
||||
Console.WriteLine($"background: frequency {background.NoiseFrequency}, amplitude {background.NoiseAmplitude}, " +
|
||||
$"cloud exponent {background.CloudExponent}, density at centre {background.CloudDensity(new float2(.5f)):0.000}");
|
||||
Console.WriteLine($"names: order {names.NameGeneratorOrder}, length {names.NameGeneratorMinLength}-{names.NameGeneratorMaxLength}");
|
||||
Console.WriteLine($"zones: sun mass {zones.SunMass}, planet mass {zones.PlanetMass}, satellite passes {zones.SatellitePasses}, " +
|
||||
$"belt probability {zones.BeltProbability}");
|
||||
Console.WriteLine($" zone radius curve {zones.ZoneRadius?.Minimum}-{zones.ZoneRadius?.Maximum} exponent {zones.ZoneRadius?.Exponent}");
|
||||
|
|
@ -696,23 +694,22 @@ public static class Program
|
|||
return false;
|
||||
}
|
||||
|
||||
// Each faction's generation-critical links. Galaxy.GenerateNames dereferences the geoname file without a
|
||||
// guard, so an unset link there stops galaxy generation outright.
|
||||
// Each faction's generation-critical links and the size of its curated place list. An empty list is not broken:
|
||||
// Galaxy.NamePlaces falls back to catalogue designations for a faction without one.
|
||||
private static int Factions()
|
||||
{
|
||||
var db = AetherDb.Open();
|
||||
var products = db.Cache.GetAll<FactionProductData>().ToArray();
|
||||
Console.WriteLine($"{"faction",-26} {"short",-13} {"geonames",-22} {"boss hull",-14} {"influence",-9} {"doctrine",-10} products");
|
||||
Console.WriteLine($"{"faction",-26} {"short",-13} {"places",-22} {"boss hull",-14} {"influence",-9} {"doctrine",-10} products");
|
||||
var broken = 0;
|
||||
foreach (var faction in db.Cache.GetAll<Faction>().OrderBy(f => f.Name))
|
||||
{
|
||||
var key = db.Cache.RefOf(faction).Key;
|
||||
var geonames = faction.GeonameFile.IsSet() ? "set" : "UNSET";
|
||||
var boss = !faction.BossHull.IsSet()
|
||||
? "none"
|
||||
: db.Cache.Get(faction.BossHull)?.Name ?? "DANGLING";
|
||||
if (geonames == "UNSET" || boss == "DANGLING") broken++;
|
||||
Console.WriteLine($"{faction.Name,-26} {faction.ShortName,-13} {geonames,-22} {boss,-14} {faction.InfluenceDistance,-9} {(faction.Doctrine == null ? "none" : faction.Doctrine.EngageOn.ToString()),-10} " +
|
||||
if (boss == "DANGLING") broken++;
|
||||
Console.WriteLine($"{faction.Name,-26} {faction.ShortName,-13} {faction.Places.Length,-22} {boss,-14} {faction.InfluenceDistance,-9} {(faction.Doctrine == null ? "none" : faction.Doctrine.EngageOn.ToString()),-10} " +
|
||||
products.Count(p => p.Manufacturer.Key.Equals(key)));
|
||||
}
|
||||
Console.WriteLine($"\n{broken} factions carry a link that would break generation");
|
||||
|
|
@ -2305,9 +2302,6 @@ public static class Program
|
|||
|
||||
string CodePoints(string text) => string.Join(" ", text.EnumerateRunes().Select(r => $"U+{r.Value:X4}"));
|
||||
|
||||
var nameFile = db.Cache.GetAll<NameFile>().FirstOrDefault(n => n.Name == "pleiades");
|
||||
if (nameFile == null) throw new InvalidOperationException("No name file named \"pleiades\".");
|
||||
|
||||
var others = db.Cache.GetAll<Faction>().ToArray();
|
||||
var pirates = new Faction
|
||||
{
|
||||
|
|
@ -2316,7 +2310,6 @@ public static class Program
|
|||
Description = "A loose coalition of crews and hidden docks moving people and goods outside official control. No command, no common law: possession has a maintenance schedule.",
|
||||
PrimaryColor = new float3(.42f, .40f, .37f),
|
||||
SecondaryColor = new float3(1f, .45f, .05f),
|
||||
GeonameFile = db.Cache.RefOf(nameFile),
|
||||
InfluenceDistance = 3,
|
||||
};
|
||||
foreach (var other in AllegianceGaps(db, pirates, others)) pirates.Allegiance[db.Cache.RefOf(other)] = 1f;
|
||||
|
|
@ -2340,7 +2333,7 @@ public static class Program
|
|||
Roles: (design.Roles ?? new List<ItemRole>()).Select(role => new ProductRole { Role = role.Name, Mean = PirateProfile.Mean, StandardDeviation = PirateProfile.Dev }).ToList());
|
||||
}).ToArray();
|
||||
|
||||
Console.WriteLine($"New faction \"{pirates.Name}\": influence {pirates.InfluenceDistance}, names \"{nameFile.Name}\", allegiance 1.0 to {pirates.Allegiance.Count} factions.");
|
||||
Console.WriteLine($"New faction \"{pirates.Name}\": influence {pirates.InfluenceDistance}, allegiance 1.0 to {pirates.Allegiance.Count} factions.");
|
||||
Console.WriteLine($" colours: primary ({pirates.PrimaryColor.x:0.00}, {pirates.PrimaryColor.y:0.00}, {pirates.PrimaryColor.z:0.00}) primer grey, secondary ({pirates.SecondaryColor.x:0.00}, {pirates.SecondaryColor.y:0.00}, {pirates.SecondaryColor.z:0.00}) hazard orange");
|
||||
Console.WriteLine($" {pirates.Description}");
|
||||
Console.WriteLine($"\nNew products ({products.Length}):");
|
||||
|
|
|
|||
Loading…
Reference in a new issue