# Survival and Supply Drain

Food and water are the digger's second clock, running alongside the Maw. Both meters empty over time, and if either bottoms out the run ends. Every knob that shapes how fast they drain and how much surplus the player can bank lives in `balance.json` under `survival`, read once at startup by `SurvivalManager`. Each value has a hardcoded fallback in the script, but that only fires if the JSON key is missing, so the JSON is where you tune.

## In plain terms: the two meters

The digger carries two meters, food and water, each 0–100, both draining continuously. If either reaches 0 with no stored supply and no well left to draw on, the digger dies and the run is over. Everything on this page decides how fast that clock runs down and how much cushion the player can stack against it.

A "multiplier" is a number the drain rate gets multiplied by: 1.0 is the normal rate, 2.0 drains twice as fast, 0.15 drains at 15% of normal.

## The survival values

| Setting | Where it lives | Default | What it controls | Turn it up / down |
|---|---|---|---|---|
| `food_drain_per_second` | `balance.json` → `survival` | `0.04` | How many food points drain each second at the normal (not working, focused) rate. At `0.04`, a full 100 food meter empties in about 2,500 seconds (roughly 7 in-game days at `day_duration` 360) if untouched. | Higher = food pressure is constant and harsh. Lower = food is a minor concern. The single biggest food-difficulty dial. |
| `water_drain_per_second` | `balance.json` → `survival` | `0.04` | Same as above, for the water meter. Identical default, so food and water empty at the same base pace. | Higher = water becomes the binding constraint. Lower = water rarely matters. |
| `work_mult` | `balance.json` → `survival` | `2.0` | The multiplier applied to both drains while the digger is actively working (digging, gathering). At `2.0`, working burns supplies twice as fast. | Higher = long work sessions cost far more supplies; forces breaks. Lower = working is nearly free. |
| `idle_mult` | `balance.json` → `survival` | `0.15` | The multiplier applied to both drains while the game window is unfocused or closed (offline). At `0.15`, an idle/offline game drains at 15% of normal. This same multiplier also throttles the Maw's chew and hunger clock while backgrounded, so the whole game slows together when away. | Higher = idling / being offline is more punishing (less safe to walk away). Lower = the game is very forgiving when closed. Central to the idle-game feel. |
| `storage_cap` | `balance.json` → `survival` | `500.0` | The base capacity of the village's banked food and water stores — overflow past a full 100 meter banks into them from day one, no building required. It is also the cap on well water. Each built Silo/Water Tower upgrade adds another 500 on top in code. | Higher = players can bank much larger buffers against long absences or storms. Lower = surplus is capped tight, keeping supply tension high. |
| `well_trickle_rate` | `balance.json` → `survival` | `0.04` | How fast the well refills the water meter, in points per second, while it has water. It matches `water_drain_per_second` exactly, so a full well roughly offsets normal (non-working) water drain. | Higher = the well outpaces water drain and water stops mattering. Lower = the well only softens the loss rather than replacing a supply run. |

## How drain scales

The effective drain each moment is:

```
base drain (food or water) per second
  × delta (time elapsed)
  × work_mult   (only while actively working, else 1.0)
  × idle_mult   (only while the window is unfocused/offline, else 1.0)
  × cosmetic drain trait (some digger outfits slow food or water)
  × challenge drain modifier (some Challenges raise drain)
```

`work_mult` and `idle_mult` are the two ends of one axis. Working (focused) drains fastest, backgrounded or offline drains slowest, and plain focused-but-idle sits in the middle at the base rate. All of this is **per digger**. The village population eats and drinks on its own budget, tuned in the `village` section, and doesn't touch these rates.

## Storage, wells, and denied-task penalties

- **Surplus banking:** anything gathered past a full 100 meter banks into the
  village stores automatically — no building required. The stores are the
  village's larder (the daily village tick eats from them whether or not any
  building exists), and the elder chain's first task depends on gathering past
  full to raise the food tally. What the **Silo** and **Water Tower** add is
  the *reverse* flow — they continuously top the player's own meter back up
  from the stores — plus 500 extra capacity each. Without them the visible
  meter only reads what the digger carries.
- **The well** holds up to `storage_cap` of water and trickles it into the meter
  at `well_trickle_rate`. Because that rate equals base water drain, a stocked
  well covers ordinary drain but not the doubled drain while working.
- **Denied-task penalties** drain a percentage of *total* food or water (meter
  plus storage), so refusing a villager task is a real setback rather than a dent
  the silo instantly refills. Those percentages live with the tasks, not here.

## Offline behavior

Close the game and reopen it, and the catch-up sim runs the same formula with `idle_mult` folded in, so a closed game drains at exactly the slow rate the "idle" HUD estimate promised. The well trickles at full rate the whole time, and since offline drain is low, it usually covers water on its own. So when you want to tune how long a player can safely walk away, `idle_mult` and `storage_cap` are the pair to reach for: one sets the offline rate, the other sets the buffer.

## Safe to change / handle with care

- **`food_drain_per_second` / `water_drain_per_second` (`0.04` each)** — these
  set the entire survival clock. Because both default to the same value, changing
  only one makes that resource the binding constraint. A small raise shortens
  every run; test against how quickly players can realistically resupply.
- **`idle_mult` (`0.15`)** — it governs both offline survival *and* offline Maw
  progress. Raising it makes walking away riskier on both fronts at once; it is
  the most load-bearing idle-game knob here.
- **`storage_cap` (`500.0`)** — sets how big a safety buffer is possible.
  Raising it heavily can remove late-game supply tension entirely.
- **`work_mult` (`2.0`)** — a high value can make grinding sessions self-
  limiting (players starve mid-dig); a low value removes the cost of long digs.

## Related

- [Maw Threat and Escalation](/docs/underroot/maw-threat-and-escalation)
- [The Villager Economy](/docs/underroot/the-villager-economy)
- [Villager Tasks and Projects](/docs/underroot/villager-tasks-and-projects)
- [The Levers That Matter Most](/docs/underroot/the-levers-that-matter-most)
- [The Safe Change Workflow](/docs/underroot/the-safe-change-workflow)