Determinism and seeds
Why the same seed produces the same night on every device, and what that buys you.
Last updated:
Nothing in the simulation is truly random. Every choice the night makes — which incident arrives, when, against which machine, whether a flood is distributed — comes from a seeded pseudo-random generator. Give it the same seed and you get the same night, every time, on any device.
How it holds together
Two properties make it work. The simulation advances in fixed 250 ms steps, so the outcome never depends on frame rate or how fast your machine is. And the engine is forbidden — enforced by lint rules, not by convention — from calling the system clock or the platform's random number generator.
Random draws are also partitioned into separate streams per consumer. That means adding a feature which consumes randomness in one place does not shift the sequence everywhere else, so old nights keep replaying correctly.
What it gives you
The same night twice. You can replay a shift you lost and meet exactly the same incidents in the same order — which is the difference between practising and just playing again.
Saves that resume honestly. Because a save records the position of each random stream, resuming is not an approximation. The night continues where it was, not somewhere plausible.
Shareable shifts. On the web the seed can be supplied in the address as
?seed=, so a specific night can be handed to someone else exactly as you
played it.
Where seeds come from
In the campaign each night derives its seed from the run, so night four of one campaign is not night four of another. Endless mode draws a fresh seed per run unless you supply one.