determinism-ledger: every ItemManager states its seed; scatter on the zone's dice

- ItemManager(uint seed, ...) refuses seed 0 and seeds Random from it.
- RunStart.ItemSeed(galaxy, step) is public (formula unchanged), refuses a
  zero result; named steps ArenaStep, StageStep, ContinueStep and NoRunSeed.
- Continue seeds the item stream from the saved run's seed (ContinueStep);
  a scene with no galaxy uses NoRunSeed.
- Zone's unpack scatter draws SimulationDice.For(CombatSeed, ScatterStream,
  1-based pack ordinal), never the item stream.
- Loadout's scratch manager and AetherDb's catalog command take fixed seeds;
  every test and Editor construction gains 1u (mechanical rewrite).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
soul 2026-10-21 19:01:41 +02:00
commit cc0c164574
85 changed files with 200 additions and 160 deletions

View file

@ -266,11 +266,18 @@ public class Zone
foreach (var wear in pack.ChunkWear)
_wear[new ChunkId(wear.Field, wear.Index)] = new ChunkWear { Damage = wear.Damage, BrokenUntil = wear.BrokenUntil };
var ordinal = 0u;
foreach (var entityPack in pack.Entities)
{
ordinal++;
var entity = EntitySerializer.Unpack(_itemManager, this, entityPack);
var ship = entity as Ship;
Admit(entity, piloted: ship is {IsPlayerShip: false});
// Generation placement, not admission: a ship packed at the origin is scattered across the zone, on the
// zone's own dice, so nothing drawn from the item stream can move it.
if (ship is {IsPlayerShip: false} && lengthsq(ship.Position) < 1)
ship.Position = SimulationDice.For(CombatSeed, SimulationDice.ScatterStream, ordinal)
.NextFloat3(float3(-pack.Radius * .5f), float3(pack.Radius * .5f));
}
// TODO: Associate planets with stored entities for planetary colonies