Drops roll on the run's seed: Zone.DropSeed feeds the loot and mine dice
DropSeed = CombatSeed ^ Mix(Galaxy.Seed), derived at construction. A zone with no galaxy, or a restored seed of 0, keeps its dice bit for bit; CombatSeed still roots shot, patrol and range-sample dice. RunSeedFixture builds a test zone's galaxy through RunSave.Commit and the Continue constructor. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
020dc58a81
commit
f23d3c6542
6 changed files with 98 additions and 11 deletions
|
|
@ -775,7 +775,7 @@ public static class FireControl
|
|||
// Lays a mine for a mine layer: freezes the payload as evaluated now (stats, the item's blast radius, the
|
||||
// layer and its faction) and hands the body to Zone.Lay, the one adder. It launches at the shooter's velocity
|
||||
// plus the mount direction turned by a dice angle within +-Spread/2, times Velocity; the dice are the mine's
|
||||
// own (zone seed, MineStream, body id), so no other roll is perturbed. No target, no PendingShot, no price:
|
||||
// own (the zone's DropSeed, MineStream, body id), so no other roll is perturbed. No target, no PendingShot, no price:
|
||||
// InstantWeapon has already paid. A layer whose item has no blast radius lays nothing.
|
||||
public static void Lay(Weapon weapon, EquippedItem item, Entity source)
|
||||
{
|
||||
|
|
@ -789,7 +789,7 @@ public static class FireControl
|
|||
|
||||
var id = zone.NextBodyId();
|
||||
var half = weapon.Spread / 2f;
|
||||
var angle = radians(SimulationDice.For(zone.CombatSeed, SimulationDice.MineStream, id.Value).NextFloat(-half, half));
|
||||
var angle = radians(SimulationDice.For(zone.DropSeed, SimulationDice.MineStream, id.Value).NextFloat(-half, half));
|
||||
var s = sin(angle);
|
||||
var c = cos(angle);
|
||||
var mount = MountDirection(item).xz;
|
||||
|
|
|
|||
|
|
@ -126,11 +126,15 @@ public class Zone
|
|||
// of touching a shared stream.
|
||||
public uint CombatSeed { get; }
|
||||
|
||||
// The zone's drop dice (loot and mine scatter): CombatSeed mixed with its run's seed (ruling loot-seed-in-save), so a
|
||||
// new game drops differently and a reloaded save repeats. Mix(0) is 0, so a zone with no galaxy rolls on CombatSeed.
|
||||
public uint DropSeed { get; }
|
||||
|
||||
// The one source of floating item and mine ids: zone-scoped, from 1, never reused. Runtime state, not saved.
|
||||
private uint _lastBodyId;
|
||||
public FloatingBodyId NextBodyId() => new FloatingBodyId(++_lastBodyId);
|
||||
|
||||
// The death ordinal of the loot dice: the nth death in this zone rolls on SimulationDice.For(CombatSeed, LootStream, n).
|
||||
// The death ordinal of the loot dice: the nth death in this zone rolls on SimulationDice.For(DropSeed, LootStream, n).
|
||||
private uint _deaths;
|
||||
|
||||
// The zone-scoped agent ordinal, from 1, never reused: the key of a pilot's own dice.
|
||||
|
|
@ -152,6 +156,7 @@ public class Zone
|
|||
Settings = settings;
|
||||
_orbitPositionAt = OrbitPositionAt;
|
||||
CombatSeed = galaxyZone?.Name.StableHash() ?? 1337u;
|
||||
DropSeed = CombatSeed ^ SimulationDice.Mix(galaxy?.Seed ?? 0u);
|
||||
var cache = itemManager.ItemData;
|
||||
|
||||
// Cut 5, 5.6 (docs/fire-control-cut.md, Soul finding 7; operator ruling Q3): death removes the ship,
|
||||
|
|
@ -452,7 +457,7 @@ public class Zone
|
|||
private void DropLoot(Entity dead)
|
||||
{
|
||||
var settings = _itemManager.GameplaySettings;
|
||||
var random = SimulationDice.For(CombatSeed, SimulationDice.LootStream, ++_deaths);
|
||||
var random = SimulationDice.For(DropSeed, SimulationDice.LootStream, ++_deaths);
|
||||
var at = new float2(dead.Position.x, dead.Position.z);
|
||||
float2 Heading() { var angle = random.NextFloat() * 2f * PI; return float2(cos(angle), sin(angle)); }
|
||||
foreach (var equipped in dead.Equipment.ToArray())
|
||||
|
|
|
|||
Loading…
Reference in a new issue