Generate tutorial zone names in daemon
This commit is contained in:
parent
1e02aee692
commit
d57d933d79
4 changed files with 130 additions and 7 deletions
|
|
@ -72,7 +72,12 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
private static void TutorialTopologyIsDeterministicConnectedAndRoleOwned()
|
||||
{
|
||||
AetheriaDaemonTutorialFactionInput Faction(string shortName, int influence = 2) =>
|
||||
new($"faction.{shortName.ToLowerInvariant()}", shortName, shortName, influence);
|
||||
new($"faction.{shortName.ToLowerInvariant()}", shortName, shortName, influence)
|
||||
{
|
||||
TrainingNames = Enumerable.Range(0, 512).Select(index =>
|
||||
$"{(char)('a' + index % 26)}{(char)('a' + index / 26 % 26)}{(char)('a' + index / 676 % 26)}{shortName.ToLowerInvariant()}")
|
||||
.ToArray()
|
||||
};
|
||||
var factions = new[]
|
||||
{
|
||||
Faction("Miss"),
|
||||
|
|
@ -86,6 +91,9 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
|
|||
var second = AetheriaDaemonTutorialTopologyGenerator.GenerateFossil(factions, 0xA37E_2026u);
|
||||
RequireEqual(64, first.Zones.Count,
|
||||
"the daemon tutorial must retain the authored 64-zone topology size");
|
||||
Require(first.Zones.All(zone => !string.IsNullOrWhiteSpace(zone.Name)) &&
|
||||
first.Zones.Select(zone => zone.Name).Distinct(StringComparer.Ordinal).Count() == first.Zones.Count,
|
||||
"daemon tutorial naming must produce one stable unique catalog name per zone");
|
||||
Require(first.Zones.Select(zone => (zone.X, zone.Y, string.Join(',', zone.AdjacentZoneIndices)))
|
||||
.SequenceEqual(second.Zones.Select(zone => (zone.X, zone.Y, string.Join(',', zone.AdjacentZoneIndices)))),
|
||||
"tutorial topology must be deterministic for a fixed daemon seed and density field");
|
||||
|
|
|
|||
|
|
@ -4,7 +4,10 @@ public sealed record AetheriaDaemonTutorialFactionInput(
|
|||
string CorporationKey,
|
||||
string Name,
|
||||
string ShortName,
|
||||
int InfluenceDistance);
|
||||
int InfluenceDistance)
|
||||
{
|
||||
public IReadOnlyList<string> TrainingNames { get; init; } = Array.Empty<string>();
|
||||
}
|
||||
|
||||
public sealed record AetheriaDaemonTutorialTopologySettings(
|
||||
int ZoneCount,
|
||||
|
|
@ -27,6 +30,7 @@ public sealed record AetheriaDaemonTutorialTopologySettings(
|
|||
|
||||
public sealed record AetheriaDaemonTutorialZoneTopology(
|
||||
int ZoneIndex,
|
||||
string Name,
|
||||
float X,
|
||||
float Y,
|
||||
IReadOnlyList<int> AdjacentZoneIndices,
|
||||
|
|
@ -115,11 +119,17 @@ public static class AetheriaDaemonTutorialTopologyGenerator
|
|||
string.Equals(value.CorporationKey, name, StringComparison.OrdinalIgnoreCase));
|
||||
if (match == null || string.IsNullOrWhiteSpace(match.CorporationKey))
|
||||
throw new InvalidDataException($"Tutorial generation requires the authored faction '{name}'.");
|
||||
var nameFile = catalog.FindNameFile(match.GeonameFileKey);
|
||||
if (nameFile == null || nameFile.Names.Count == 0)
|
||||
throw new InvalidDataException($"Tutorial faction '{name}' has no typed geoname corpus.");
|
||||
return new AetheriaDaemonTutorialFactionInput(
|
||||
match.CorporationKey,
|
||||
match.Name ?? "",
|
||||
match.ShortName ?? "",
|
||||
match.InfluenceDistance);
|
||||
match.InfluenceDistance)
|
||||
{
|
||||
TrainingNames = nameFile.Names
|
||||
};
|
||||
}).ToArray();
|
||||
}
|
||||
|
||||
|
|
@ -178,9 +188,12 @@ public static class AetheriaDaemonTutorialTopologyGenerator
|
|||
.OrderBy(index => index)
|
||||
.ToArray();
|
||||
|
||||
var nameSeed = (uint)random.NextInt(1, int.MaxValue);
|
||||
var zoneNames = GenerateNames(roles.All, owners, nameSeed);
|
||||
var zones = Enumerable.Range(0, points.Length)
|
||||
.Select(index => new AetheriaDaemonTutorialZoneTopology(
|
||||
index,
|
||||
zoneNames[index],
|
||||
points[index].X,
|
||||
points[index].Y,
|
||||
Neighbors(index, links).OrderBy(value => value).ToArray(),
|
||||
|
|
@ -218,6 +231,44 @@ public static class AetheriaDaemonTutorialTopologyGenerator
|
|||
return new TutorialRoles(protagonist, antagonist, buffer, neutrals, quest, all);
|
||||
}
|
||||
|
||||
private static string[] GenerateNames(
|
||||
IReadOnlyList<AetheriaDaemonTutorialFactionInput> factions,
|
||||
IReadOnlyList<string> ownerKeys,
|
||||
uint seed)
|
||||
{
|
||||
var generators = new Dictionary<string, TutorialMarkovNameGenerator>(StringComparer.Ordinal);
|
||||
foreach (var faction in factions)
|
||||
{
|
||||
if (faction.TrainingNames.Count == 0)
|
||||
throw new InvalidDataException($"Tutorial faction '{faction.ShortName}' has no geoname training rows.");
|
||||
generators[faction.CorporationKey] = new TutorialMarkovNameGenerator(
|
||||
seed,
|
||||
faction.TrainingNames,
|
||||
order: 3,
|
||||
minimumLength: 5,
|
||||
maximumLength: 10);
|
||||
}
|
||||
|
||||
var catalogRandom = new CultMath.Random(seed);
|
||||
var used = new HashSet<string>(StringComparer.Ordinal);
|
||||
var output = new string[ownerKeys.Count];
|
||||
for (var zoneIndex = 0; zoneIndex < ownerKeys.Count; zoneIndex++)
|
||||
{
|
||||
var owner = ownerKeys[zoneIndex];
|
||||
if (owner.Length == 0)
|
||||
{
|
||||
string candidate;
|
||||
do candidate = $"EAC-{catalogRandom.NextInt(9999)}";
|
||||
while (!used.Add(candidate));
|
||||
output[zoneIndex] = candidate;
|
||||
continue;
|
||||
}
|
||||
|
||||
output[zoneIndex] = generators[owner].Next(used);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
private static Point[] GeneratePoints(
|
||||
int count,
|
||||
ref CultMath.Random random,
|
||||
|
|
@ -580,4 +631,67 @@ public static class AetheriaDaemonTutorialTopologyGenerator
|
|||
IReadOnlyList<AetheriaDaemonTutorialFactionInput> Neutrals,
|
||||
AetheriaDaemonTutorialFactionInput Quest,
|
||||
AetheriaDaemonTutorialFactionInput[] All);
|
||||
|
||||
private sealed class TutorialMarkovNameGenerator
|
||||
{
|
||||
private readonly Dictionary<string, List<char>> _chains = new(StringComparer.Ordinal);
|
||||
private readonly List<string> _samples = [];
|
||||
private readonly int _order;
|
||||
private readonly int _minimumLength;
|
||||
private readonly int _maximumLength;
|
||||
private CultMath.Random _random;
|
||||
|
||||
public TutorialMarkovNameGenerator(
|
||||
uint seed,
|
||||
IEnumerable<string> sampleNames,
|
||||
int order,
|
||||
int minimumLength,
|
||||
int maximumLength)
|
||||
{
|
||||
_random = new CultMath.Random(seed);
|
||||
_order = Math.Max(1, order);
|
||||
_minimumLength = Math.Max(1, minimumLength);
|
||||
_maximumLength = maximumLength;
|
||||
var names = new HashSet<string>(StringComparer.Ordinal);
|
||||
foreach (var line in sampleNames)
|
||||
foreach (var word in (line ?? "").ToUpperInvariant().Split(' ', ',', '.', '"'))
|
||||
if (word.Length >= _minimumLength) names.Add(word);
|
||||
|
||||
foreach (var line in names)
|
||||
foreach (var word in line.Split(' ', '\'', '(', ')'))
|
||||
{
|
||||
var lower = word.Trim().ToLowerInvariant();
|
||||
if (lower.Length >= _order + 1) _samples.Add(lower + "|");
|
||||
}
|
||||
foreach (var word in _samples)
|
||||
for (var letter = 0; letter < word.Length - _order; letter++)
|
||||
{
|
||||
var token = word.Substring(letter, _order);
|
||||
if (!_chains.TryGetValue(token, out var row))
|
||||
_chains[token] = row = [];
|
||||
row.Add(word[letter + _order]);
|
||||
}
|
||||
if (_samples.Count == 0)
|
||||
throw new InvalidDataException("Tutorial geoname corpus contains no usable Markov samples.");
|
||||
}
|
||||
|
||||
public string Next(ISet<string> used)
|
||||
{
|
||||
for (var attempt = 0; attempt < 1_000_000; attempt++)
|
||||
{
|
||||
var sample = _samples[_random.NextInt(0, _samples.Count)];
|
||||
var value = sample.Substring(0, _order);
|
||||
while (_chains.TryGetValue(value.Substring(value.Length - _order, _order), out var row))
|
||||
{
|
||||
var next = row[_random.NextInt(0, row.Count)];
|
||||
if (next == '|') break;
|
||||
value += next;
|
||||
}
|
||||
value = char.ToUpperInvariant(value[0]) + value.Substring(1);
|
||||
if (value.Length >= _minimumLength && value.Length <= _maximumLength && used.Add(value))
|
||||
return value;
|
||||
}
|
||||
throw new InvalidOperationException("Tutorial Markov corpus could not produce another unique zone name.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1115,10 +1115,11 @@ the Terminus proof arena cannot award completion.
|
|||
ten-octave simplex cloud-density field.
|
||||
- Outputs: a deterministic connected zone graph with stable positions,
|
||||
adjacency, faction presence/ownership, home zones, entrance, discovery set,
|
||||
and the selected cloud-noise position.
|
||||
selected cloud-noise position, and unique faction-trained Markov names.
|
||||
- Derived state: the sector map and eventual zone materialization consume this
|
||||
topology. Names, bodies, stations, ships, and Eve map rendering do not get to
|
||||
revise it.
|
||||
topology. Bodies, stations, ships, and Eve map rendering do not get to revise
|
||||
it; names are generated once inside the topology owner from typed geoname
|
||||
corpora because the fossil used them to seed later zone generation.
|
||||
- Forbidden writers: Unity `MainMenu`, `Galaxy`, `ZoneGenerator`, scene objects,
|
||||
and Eve clients cannot generate or repair tutorial topology.
|
||||
- Shared paths: generation and parity smoke use the same CultMath random stream,
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ validation proves contract shape, not wiring, exclusivity, lowering, or parity.
|
|||
|
||||
| Organ | Original authority/evidence | Target owner | Eve contract | Runtime lowering | Current status | Required proof |
|
||||
|---|---|---|---|---|---|---|
|
||||
| Run/session state | `ServerShared`, `ActionGameManager` | Aetheria daemon/CultCache | provider/session advertisement plus run lifecycle bindings | all clients | active/failed lifecycle is daemon-owned and restart-stable: controlled-entity destruction commits the fossil cause, terminal frame, one `run.failed` fact, releases control, rejects later gameplay commands, and freezes the world; Eve receives terminal presentation/input levers without becoming an owner. Terminus keeps persistent requested simulation rate distinct from effective rate: compressed batches inspect authoritative facts after each fixed step, stop at the causal damage/destruction/cargo/thermal/docking/weapon/wormhole/run event, pause effectively without erasing the request, and project the exact cause and executed-step count through Eve. Docked, travelling, fighting, mining, looting, and refitting remain derived world conditions rather than counterfeit durable phases. The distinct tutorial topology is now daemon-owned and deterministic: authored 64-zone weighted sampling, Delaunay/link pruning, six faction roles/homes, influence, unowned entrance, and initial discovery run on Unity-compatible CultMath simplex semantics. It is deliberately not selectable yet because fossil zone bodies/entities are not materialized; Terminus generation preserves `TutorialPassed` and cannot impersonate completion | tutorial zone materialization, New Game selection, and a source-backed completion rule (none survived in the fossil); full-daemon death/restart witness, broader attention taxonomy (contact, targeting, readiness, arrival, discovery, and failed orders), and multi-client convergence |
|
||||
| Run/session state | `ServerShared`, `ActionGameManager` | Aetheria daemon/CultCache | provider/session advertisement plus run lifecycle bindings | all clients | active/failed lifecycle is daemon-owned and restart-stable: controlled-entity destruction commits the fossil cause, terminal frame, one `run.failed` fact, releases control, rejects later gameplay commands, and freezes the world; Eve receives terminal presentation/input levers without becoming an owner. Terminus keeps persistent requested simulation rate distinct from effective rate: compressed batches inspect authoritative facts after each fixed step, stop at the causal damage/destruction/cargo/thermal/docking/weapon/wormhole/run event, pause effectively without erasing the request, and project the exact cause and executed-step count through Eve. Docked, travelling, fighting, mining, looting, and refitting remain derived world conditions rather than counterfeit durable phases. The distinct tutorial topology is now daemon-owned and deterministic: authored 64-zone weighted sampling, Delaunay/link pruning, six faction roles/homes, influence, unowned entrance, initial discovery, and faction-trained Markov zone names run on Unity-compatible CultMath simplex/random semantics. It is deliberately not selectable yet because fossil zone bodies/entities are not materialized; Terminus generation preserves `TutorialPassed` and cannot impersonate completion | tutorial zone materialization, New Game selection, and a source-backed completion rule (none survived in the fossil); full-daemon death/restart witness, broader attention taxonomy (contact, targeting, readiness, arrival, discovery, and failed orders), and multi-client convergence |
|
||||
| Entity identity/loadout | `ServerShared/Entity*` | daemon | typed entity and inventory surfaces | EveUnity/Electron | daemon-owned hull identity, exact installed placement/rotation and instance state, cargo stacks, weapon membership/held state, equipment wear, executable behavior state, weapon chronology, active-effect state, and loadout-generation provenance survive a hard CultCache close/reopen through the durable latest-frame checkpoint. An advertised generic Eve equip operation now translates into the typed daemon transaction before that checkpoint; its accepted placement survives restart and its consumed station-cargo source does not resurrect. Generic Eve rebuilds weapon and scalar thermostat controls from that restored truth; legacy per-entity documents are bootstrap inputs only when no live frame exists | live client refit witness and multi-client convergence |
|
||||
| Loadout generation | map/faction availability, item cost, hull hardpoints and role constraints | daemon using canonical galaxy, faction knowledge/economy and typed catalog | generated loadout plus provenance/availability facts | Eve inspection and refit surfaces | daemon now uses the fossil candidate filter and seeded weighted selection: manufacturer must be present and allied, ally weight decays by home-zone graph distance, price uses the authored exponent, and hardpoints require matching semantic type, rotated footprint containment, and controller role; the April 2021 catalog fossil restores the distinct common `Longinus`, rare AetherDrive-compatible `LonginusX`, and `Djinni` rows with their original IDs, shapes, hardpoints, prices, drag, and prefabs, plus missing Thruster rows required to fill their authored mounts; typed `rarity:rare` tags apply a 0.05 generation multiplier to `LonginusX` and AetherDrive equipment; the generator owns one mutable CultMath stream, fixing the readonly-struct defensive-copy bug that restarted every weighted draw; placement rotation survives durable state and reconnect; generation fills the largest compatible footprint before economic weighting; cargo/capacitor plus station docking equipment must fit remaining hull space; stations pack faction-available inventory largest-first; ordinary ships begin without invented scenario cargo; every generated entity persists a source/selection receipt that reaches Eve as `loadout.item` semantics | multi-zone generated-world parity and exact root-to-zone stream sequencing against the fossil |
|
||||
| Flight intent | `Ship`, `Thruster`, `AetherDrive`, `VelocityConversion`, `VelocityLimit`, input paths | daemon actuator simulation + Ymir integration | analog local helm/look/tractor plus actuator state | generic Eve input and scene lowerers | direct faction-speed velocity ownership is deleted; daemon persists local strafe/forward helm and desired look, allocates ordinary directional thruster banks by authored rotation, derives torque from hull/item placement, compensates lateral torque, gates execution through the shared energy ledger, deposits equipment-cell heat, publishes plume visibility and actuator state, applies hull drag, then runs operational velocity conversion with the fossil exponential damp equation and clamps the result through evaluated velocity limits before giving velocity/direction to Ymir. The evaluated limit remains in durable behavior state for reconnect and Eve inspection. Autonomous tasks translate world travel into the same local helm axes and issue look commands instead of mutating heading. AetherDrive rotor/coupling simulation is additive and explicitly non-default: common `Longinus` and `Djinni` hulls use ordinary thrusters; the rare `LonginusX` replaces those mounts with the single rare `Traction` AetherDrive path | hardpoint-transform direction parity, exact cross-equipment behavior execution ordering, CultMath/float32 parity harness, live production-frequency evidence, generic thrust/turn feedback lowering, and live handling screenshots |
|
||||
|
|
|
|||
Loading…
Reference in a new issue