Skip to content

Game.Citizens.CitizenPseudoRandom

Assembly: Assembly-CSharp
Namespace: Game.Citizens

Type: public enum

Base: System.Enum (underlying type: System.UInt32)

Summary: CitizenPseudoRandom is an enum of fixed 32-bit unsigned integer keys used by the game as identifiers/seeds for deterministic pseudo-random behaviours of citizens. Each enum member represents a distinct pseudo-random stream or key for a particular citizen-related property (for example work-time offset, partner type, traffic comfort, etc.). Mods can use these constants when reproducing or deriving citizen-specific random values in a stable, save-friendly way.


Fields

  • WorkOffset = 305419896u
    Used to produce a per-citizen offset for work-related timing (e.g., start time jitter). Treat as a stable key/seed.

  • PartnerType = 305419897u
    Key for choosing or deriving a citizen's partner type in a deterministic way.

  • TrafficComfort = 305419905u
    Key used for determining a citizen's traffic comfort / tolerance pseudo-random value.

  • SleepOffset = 591751185u
    Key for producing a per-citizen sleep schedule offset.

  • StudyWillingness = 1176609278u
    Key used to determine willingness to study (education-related behaviour).

  • Death = 1177657855u
    Key used when generating death-related random outcomes (e.g., death timing/variants).

  • SpawnResident = 2432906522u
    Key used when spawning residents to vary spawn-related randomness.

Properties

  • None (enum members are constants).
    These values are meant to be read and used directly (cast to uint when needed).

Constructors

  • None (enum).

Methods

  • None (enum).
    Normal System.Enum methods are available (ToString, HasFlag, etc.), but there are no custom methods defined here.

Usage Example

// Example: derive a deterministic per-citizen float in [0,1) using Unity.Mathematics.Random
using Unity.Mathematics;

// Suppose you have a citizen id
uint citizenId = 12345u;

// Choose the pseudo-random key you need (e.g., WorkOffset)
uint key = (uint)Game.Citizens.CitizenPseudoRandom.WorkOffset;

// Combine the key with the citizen id to form a seed. The combination method can be any
// simple mixing operation that yields a stable uint for the pair.
uint seed = key ^ (citizenId * 2654435761u); // example mixing (Knuth multiplicative)

// Initialize Unity.Mathematics.Random with the seed
var rnd = new Unity.Mathematics.Random(seed);

// Get a deterministic random float for this citizen/key
float workStartOffset = rnd.NextFloat(); // value in [0,1)

// Use workStartOffset to offset work start time, etc.

Notes: - Cast enum members to uint to obtain the numeric key. - Combine the key with a citizen-specific identifier (citizen ID) to obtain a per-citizen seed so the produced random value is stable per-citizen and per-key. - These constants are stable values embedded in the game; use them to remain consistent with the game's own pseudo-random streams when modding.