You are the field ecologist: change hawks, heat, prey regrowth and the mob's rules, and see how a meerkat mob forages, keeps watch and uses its burrow through a desert day.
Close views run about 10 times faster than real time; the map view is a time-lapse. One desert day takes a few minutes. Day 1 starts with untouched patches, so intake is high until they are grazed down; later days show the regrowth balance.
Long-run intake rate against residence time for the current mob size and typical patch spacing. The marginal value theorem predicts the peak; the curve is computed by a separate time-stepped model.
Runs 5 simulated days for 0 to 4 sentinels with the current settings (a few seconds). Score = net energy minus 60 kJ per close call (illustrative exchange rate).
The science
Patch depletion. A patch holds S kJ of prey. Each of n foragers finds prey at a rate proportional to what is left, dS/dt = −a n S, so the group gain is G(t) = S₀ (1 − e−t/τ) with τ = 1/(a n): fast at first, slower as the patch thins out (diminishing returns). Here a = 2.67·10⁻⁵ s⁻¹, S₀ = 1500 kJ (illustrative round numbers). Patches regrow towards S₀ at a rate you set (dS/dt = ρ (S₀ − S)).
Marginal value theorem (Charnov 1976). To maximise the long-run intake rate R = G(t)/(T + t) over travel time T and residence time t, leave when the instantaneous rate has fallen to the long-run average: G′(t*) = G(t*)/(T + t*). For this patch shape that is eu = T/τ + u + 1 with u = t*/τ, solved by Newton iteration. The mob here estimates the long-run rate itself (a running average of past cycles), so it converges to the rule without being told the answer. "Fixed time" and "giving-up density" are the alternatives you can compare.
Sentinels and raptors. A raptor passes at the chosen rate; the alarm is raised in time with probability 1 − exp(−(κ s + 0.25)) for s sentinels (0.25 is the baseline vigilance of the foragers themselves; κ is an illustrative alertness). If the alarm is raised, the mob runs to the nearest bolt-hole and waits four minutes; if not, it is a close call: five minutes scattering and a small energy cost. Real predation risk and its costs are not measured here; close calls are a stand-in with an illustrative exchange rate, and the model never shows an animal being hurt. Sentinels rotate round-robin so everyone pays the same price; a sentinel does not forage in that bout.
Burrow thermal physics. Heat diffuses into the soil with diffusivity κ (dry sand about 5·10⁻⁷ m² s⁻¹, typical). A sinusoidal air temperature at the surface gives a damped, delayed wave T(z,t) = T̄ + A e−z/d cos(ω(t − t₀) − z/d) with damping depth d = √(2κ/ω), about 12 cm for a daily cycle. At the chamber depths in the cut-away (1 to 2 m) the day-night swing has dropped below a thousandth, so the burrow holds the mean temperature. The finite-difference solution in Experiment 3 is a separate numerical check of the formula.
Energy budget. Resting metabolic rate follows a Kleiber-type law BMR = 3.4 M0.75 W (2.7 W for 0.75 kg, typical value). Activity multiplies it (foraging 2.4×, walking 3×, sentinel 1.4×, fleeing 5×: illustrative). Below the lower critical temperature (26 °C here, illustrative) a meerkat pays extra heat, 0.17 W per °C, reduced by huddling (exposed surface factor 1 − 0.35 (1 − 1/n)). Body mass change uses 20 kJ per gram (illustrative).
Simplifications and honesty. One mob of 4 to 14 adults, no pups or babysitters, one raptor type, patches are points with a ring, prey are not individually simulated, the map is 400 m wide (real mobs roam kilometres), constants are round illustrative values or "typical" literature magnitudes that a reader should spot-check before quoting. Daylight is a fixed 06:12 to 18:12 window.
Blender 5.2 assets baked to GLB, Three.js r160, WebGL. Educational model, not a field study.