Skip to content

HungerSystem

HungerSystem

Phase · priority Agency · 20
Reads hunger on Mortal nodes
Writes hunger (initialises it on first encounter)
Settings hunger_rate_per_day 100
Status designed · Phase 1 (#36)
PLAN §7.4.1, §5.5, §18.9
Player Needs

Drifts hunger upward in sim-time. The smallest system, and the canonical example of three rules: the rate lives in a key with its unit, the conversion happens at the point of use, and a missing attribute is initialised rather than assumed.

foreach (var npc in view.NodesWithComponent("Mortal"))
{
    if (!view.Has(npc, "hunger")) { yield return new SetAttributeIntent(npc, "hunger", s.StartingHunger); continue; }
    yield return new DeltaAttributeIntent(npc, "hunger", ctx.PerTick(s.HungerRatePerDay));
}

hunger is bounded 0–100 in the world schema. At 100, LifecycleSystem ends the NPC. Eating is not here — it is an action published by BaselineOptions and executed by ActionSystem (−meal_value 25 per meal). From Phase 2, NeedSystem turns hunger and the other drives into urgency attributes; in Phase 1 the publishers read hunger directly.

Hot-toggle: off, nobody gets hungrier; NPCs still eat if they are hungry now. Trace: one delta per NPC per tick; WhyChanged(kira, hunger, g) → "HungerSystem, +0.5".

History

Phase Change
1 Introduced; rate per day.

See also: GrowthSystem · LifecycleSystem