Initial commit: Theriapolis baseline at port/godot branch point
Captures the pre-Godot-port state of the codebase. This is the rollback anchor for the Godot port (M0 of theriapolis-rpg-implementation-plan-godot-port.md). All Phase 0 through Phase 6.5 work is included; Phase 7 is in flight. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
namespace Theriapolis.Core.Util;
|
||||
|
||||
/// <summary>
|
||||
/// Simple syllable-based settlement name generator.
|
||||
/// Names are deterministic from the RNG stream passed in.
|
||||
/// </summary>
|
||||
public static class NameGenerator
|
||||
{
|
||||
// Prefixes keyed roughly by biome/region character
|
||||
private static readonly string[] ForestPrefixes =
|
||||
{ "Mill", "Wood", "Ash", "Elm", "Oak", "Dark", "Green", "Birch", "Briar", "Hollow" };
|
||||
private static readonly string[] GrasslandPrefixes =
|
||||
{ "Flat", "Wind", "Broad", "Long", "Wide", "Open", "West", "East", "South", "High" };
|
||||
private static readonly string[] MountainPrefixes =
|
||||
{ "Stone", "Iron", "Crag", "Peak", "High", "Cold", "Hard", "Grey", "Frost", "Ridge" };
|
||||
private static readonly string[] CoastPrefixes =
|
||||
{ "Port", "Bay", "Salt", "Shore", "Wave", "Tide", "Sea", "Gull", "Haven", "Cove" };
|
||||
private static readonly string[] IndustrialPrefixes =
|
||||
{ "Iron", "Coal", "Forge", "Mill", "Steel", "Smoke", "Works", "Rail", "Ash", "Soot" };
|
||||
private static readonly string[] DefaultPrefixes =
|
||||
{ "North", "South", "East", "West", "New", "Old", "Cross", "Red", "Black", "White" };
|
||||
|
||||
private static readonly string[] Roots =
|
||||
{
|
||||
"haven", "feld", "ford", "bridge", "bury", "ton", "wick", "croft", "moor", "vale",
|
||||
"thorpe", "worth", "stead", "gate", "well", "lea", "marsh", "brook", "heath", "down",
|
||||
"field", "wood", "ridge", "cliff", "holm", "beck", "burn", "shaw", "thwaite", "garth",
|
||||
};
|
||||
|
||||
private static readonly string[] Suffixes =
|
||||
{ "", "", "", "ville", "ton", "burg", "berg", "port", "ford", "cross", "hall", "keep" };
|
||||
|
||||
/// <summary>
|
||||
/// Generate a settlement name from the given RNG and biome character.
|
||||
/// The biome parameter is the macro cell's biome type string.
|
||||
/// </summary>
|
||||
public static string Generate(SeededRng rng, string biomeType)
|
||||
{
|
||||
var prefixes = biomeType.ToLowerInvariant() switch
|
||||
{
|
||||
var b when b.Contains("forest") => ForestPrefixes,
|
||||
var b when b.Contains("grassland") => GrasslandPrefixes,
|
||||
var b when b.Contains("mountain") => MountainPrefixes,
|
||||
var b when b.Contains("coast") => CoastPrefixes,
|
||||
var b when b.Contains("industrial") => IndustrialPrefixes,
|
||||
var b when b.Contains("subtropical") => CoastPrefixes,
|
||||
var b when b.Contains("wetland") => ForestPrefixes,
|
||||
_ => DefaultPrefixes,
|
||||
};
|
||||
|
||||
string prefix = prefixes[rng.NextInt(prefixes.Length)];
|
||||
string root = Roots[rng.NextInt(Roots.Length)];
|
||||
string suffix = Suffixes[rng.NextInt(Suffixes.Length)];
|
||||
|
||||
// Avoid awkward concatenations (e.g., "Millmill")
|
||||
if (root.StartsWith(prefix.ToLowerInvariant()))
|
||||
prefix = DefaultPrefixes[rng.NextInt(DefaultPrefixes.Length)];
|
||||
|
||||
return prefix + root + suffix;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user