Isolate faction loadout random streams

This commit is contained in:
Meta Vens 2026-07-11 20:38:48 +01:00
commit 0f07aaafb5
4 changed files with 43 additions and 12 deletions

View file

@ -300,8 +300,8 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
capacitor.HardpointType = "Internal";
var faction = new AetheriaRuntimeCorporation("forge", "Forge", "F", "", "", "", 1, 1,
[new AetheriaRuntimeCorporationAllegiance("forge", 1)]);
var foreign = new AetheriaRuntimeCorporation("foreign", "Foreign", "X", "", "", "", 1, 1,
[new AetheriaRuntimeCorporationAllegiance("foreign", 1)]);
var foreign = new AetheriaRuntimeCorporation("foreign", "Foreign", "X", "", "", "", 1, 2,
[new AetheriaRuntimeCorporationAllegiance("foreign", 1), new AetheriaRuntimeCorporationAllegiance("forge", 0.5)]);
var catalog = new AetheriaRuntimeCatalogSnapshot(
[availableHull, unavailableHull, stationHull, cockpit, wrongController, weapon, cargo, docking, capacitor],
[faction, foreign], Array.Empty<AetheriaRuntimeNameFile>());
@ -311,6 +311,17 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
var first = new AetheriaDaemonLoadoutGenerator(catalog, 42, 0, homes, adjacency).Build("ship", "forge", []);
var second = new AetheriaDaemonLoadoutGenerator(catalog, 42, 0, homes, adjacency).Build("ship", "forge", []);
var station = new AetheriaDaemonLoadoutGenerator(catalog, 84, 0, homes, adjacency).Build("station", "forge", []);
var uninterruptedForge = new AetheriaDaemonLoadoutGenerator(catalog, 101, 0, homes, adjacency);
var interleavedForge = new AetheriaDaemonLoadoutGenerator(catalog, 101, 0, homes, adjacency);
var foreignStream = new AetheriaDaemonLoadoutGenerator(catalog, 202, 1, homes, adjacency);
var uninterruptedSequence = new[]
{
uninterruptedForge.Build("ship", "forge", []),
uninterruptedForge.Build("ship", "forge", [])
};
var interleavedFirst = interleavedForge.Build("ship", "forge", []);
foreignStream.Build("ship", "foreign", []);
var interleavedSecond = interleavedForge.Build("ship", "forge", []);
RequireEqual("available-hull", first.HullItemKey,
"loadout generation must exclude manufacturers outside the faction allegiance graph");
@ -336,8 +347,16 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
"stations must fit docking, cargo, capacitor, and turret-controller roles before inventory generation");
Require(station.Cargo.Length == 4 && station.Cargo.All(value => value.Item.ItemKey != "cheap-foreign-hull"),
"station inventory draws must be packed to cargo capacity and exclude unavailable manufacturers");
Require(LoadoutKeys(uninterruptedSequence[0]).SequenceEqual(LoadoutKeys(interleavedFirst)) &&
LoadoutKeys(uninterruptedSequence[1]).SequenceEqual(LoadoutKeys(interleavedSecond)),
"generation in another faction stream must not perturb this faction's continuing loadout sequence");
}
private static IEnumerable<string> LoadoutKeys(AetheriaDaemonLoadout loadout) =>
new[] { loadout.HullItemKey }
.Concat(loadout.Equipment.Select(value => value.ItemKey))
.Concat(loadout.Cargo.Select(value => value.Item.ItemKey));
private static AetheriaRuntimeBehaviorValue PerformanceStat(double value) => new(
"performance-stat",
"",

View file

@ -21,18 +21,27 @@ internal static class AetheriaDaemonZoneGenerator
.OrderBy(value => value, StringComparer.Ordinal)
.ToArray();
var homeZones = corporationKeys.ToDictionary(value => value, _ => 0, StringComparer.Ordinal);
var loadouts = new AetheriaDaemonLoadoutGenerator(
catalog,
GenerationSeed,
0,
homeZones,
new Dictionary<int, IReadOnlyList<int>> { [0] = Array.Empty<int>() });
var availabilityFactions = new Dictionary<string, string>(StringComparer.Ordinal)
{
["player"] = corporationKeys.ElementAtOrDefault(0) ?? "",
["raider"] = corporationKeys.ElementAtOrDefault(1) ?? corporationKeys.ElementAtOrDefault(0) ?? "",
["neutral"] = corporationKeys.ElementAtOrDefault(2) ?? corporationKeys.ElementAtOrDefault(0) ?? ""
};
var rootRandom = new CultMath.Random(GenerationSeed);
var adjacency = new Dictionary<int, IReadOnlyList<int>> { [0] = Array.Empty<int>() };
var loadouts = availabilityFactions.Values
.Where(value => !string.IsNullOrWhiteSpace(value))
.Distinct(StringComparer.Ordinal)
.OrderBy(value => value, StringComparer.Ordinal)
.ToDictionary(
value => value,
_ => new AetheriaDaemonLoadoutGenerator(
catalog,
(uint)rootRandom.NextInt(1, int.MaxValue),
0,
homeZones,
adjacency),
StringComparer.Ordinal);
var entities = GenerateEntities(loadouts, availabilityFactions);
var entityKeys = Enumerable.Range(0, entities.Length)
.Select(index => EntityKey(0, index))
@ -187,7 +196,7 @@ internal static class AetheriaDaemonZoneGenerator
}
private static AetheriaEntitySnapshot[] GenerateEntities(
AetheriaDaemonLoadoutGenerator loadouts,
IReadOnlyDictionary<string, AetheriaDaemonLoadoutGenerator> loadouts,
IReadOnlyDictionary<string, string> availabilityFactions)
{
var keys = Enumerable.Range(0, 12)
@ -218,7 +227,7 @@ internal static class AetheriaDaemonZoneGenerator
}
private static AetheriaEntitySnapshot Entity(
AetheriaDaemonLoadoutGenerator loadouts,
IReadOnlyDictionary<string, AetheriaDaemonLoadoutGenerator> loadouts,
IReadOnlyDictionary<string, string> availabilityFactions,
string name,
string kind,
@ -232,7 +241,8 @@ internal static class AetheriaDaemonZoneGenerator
string[] contactKeys,
string[] cargo)
{
var loadout = loadouts.Build(kind, availabilityFactions[faction], cargo);
var availabilityFaction = availabilityFactions[faction];
var loadout = loadouts[availabilityFaction].Build(kind, availabilityFaction, cargo);
return new AetheriaEntitySnapshot
{
Name = name,

View file

@ -1239,6 +1239,8 @@ static void RequireDaemonPlayableRunGenerationAuthority(string root)
"internal static class AetheriaDaemonZoneGenerator",
"new AetheriaDaemonLoadoutGenerator(",
"GenerateEntities(loadouts, availabilityFactions)",
"var rootRandom = new CultMath.Random(GenerationSeed)",
"(uint)rootRandom.NextInt(1, int.MaxValue)",
"Math.Pow(item.Price, _priceExponent)",
"Distance(_zoneIndex, _homeZones[item.ManufacturerKey])",
"FitsHardpoint(candidate, hardpoint)",

View file

@ -17,7 +17,7 @@ validation proves contract shape, not wiring, exclusivity, lowering, or parity.
|---|---|---|---|---|---|---|
| Run/session state | `ServerShared`, `ActionGameManager` | Aetheria daemon/CultCache | provider/session advertisement | all clients | owner-exists; wired; projected; not proven | restart and multi-client convergence |
| Entity identity/loadout | `ServerShared/Entity*` | daemon | typed entity and inventory surfaces | EveUnity/Electron | owner-exists; wired; projected; not proven | loadout round trip and reconnect |
| 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, hardpoints require exact type/cell/rotation fit and controller role, and cargo/capacitor plus station docking equipment must fit remaining hull space; stations draw up to sixteen faction-available equipment rows and pack largest-first into the selected cargo bay's actual interior shape; every generated entity persists an immutable source/selection receipt that reaches Eve as `loadout.item` semantics; Terminus explicitly maps combat-role factions to catalog availability corporations | multi-zone generated-world parity and exact faction-local stream/call-order parity |
| 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, hardpoints require exact type/cell/rotation fit and controller role, and cargo/capacitor plus station docking equipment must fit remaining hull space; stations draw up to sixteen faction-available equipment rows and pack largest-first into the selected cargo bay's actual interior shape; zone generation derives one continuing deterministic RNG stream per availability corporation, so cross-faction calls cannot perturb another faction; every generated entity persists an immutable source/selection receipt that reaches Eve as `loadout.item` semantics; Terminus explicitly maps combat-role factions to catalog availability corporations | multi-zone generated-world parity and exact root-to-zone stream sequencing against the fossil |
| Flight intent | `Ship`, `Thruster`, `AetherDrive`, input paths | daemon intent + Ymir physics | analog movement/look/tractor | EveUnity input driver | movement intents feed Ymir-owned body integration; authored thrust allocation, torque, energy and heat remain simplified | prove original drive/equipment behavior ordering and runtime interpolation |
| Collision | Unity physics and entity handlers | Ymir | collision/result facts | visual interpolation only | Ymir.Core world stepping wired for entity bodies, radial fields and contacts; missing-owner negative proof passes | publish authoritative collision events and prove Unity cannot write transforms back |
| Targeting/contacts | sensors + `ActionGameManager` | daemon | contact/target semantics | target HUD and indicators | simplified owner wired/projected; daemon weapon lock now acquires and decays from facing, elapsed time, and observer-local contact confidence instead of granting an immediate perfect lock | target-switch reset, angular decay, visibility/nearest/explicit cases, and runtime lock feedback |