What is Miasma?
Miasma is an interactive spatial epidemic simulator. Instead of integrating ordinary differential equations on a well-mixed population, it runs a stochastic cellular automaton on a hex-tiled two-dimensional manifold whose topology you choose. Each occupied cell holds one of eight compartments — Susceptible, Exposed, Infectious, Recovered, Deceased, Vaccinated, Maternal-immunity, or Z — with Latent, Chronic-carrier, and Infectious-corpse flags plus Hospitalized/Quarantined status overlays. The result is a system where you can see how the same disease parameters produce dramatically different outbreaks depending on the geometry of the contact network.
Compartmental models
The compartmental tradition begins with Kermack and McKendrick's 1927 paper, which partitioned a population into Susceptible, Infectious, and Removed and derived the threshold condition that the modern basic reproduction number R0 formalizes. The SIR core has since been extended in many directions — adding latency (E), demography (births, deaths), vaccination (V), maternal immunity (M), and waning. Miasma's SEIRDV core with M/L/C/F flags and H/Q status overlays is a synthesis of these extensions, made tractable by running each compartment as a discrete state on a finite lattice. The Model tab draws it as the textbook figure of a compartmental model: each compartment a node carrying its count, each transition an arrow whose weight is the number crossing it each day, with every rate set from the part of the figure it belongs to. Beyond canonical SEIR, recovered and vaccinated cells can be infected again: each cell remembers the antigens it has met, and its protection against a strain falls off with antigenic distance, so reinfection and breakthrough favor strains that have drifted from what the population remembers.
Latent and chronic carriers
Two of the flag overlays correspond to disease classes the canonical SEIR model handles awkwardly. The latent flag (L) marks an exposed cell whose progression to infectious goes through a slow reactivation rate rather than the normal incubation period — a fraction of fresh exposures latch latent on contact, configurable per preset. Tuberculosis is the canonical case: the World Health Organization estimates roughly a quarter of the global population carries latent TB, with only a small per-capita per-year reactivation rate, producing a long-tailed epidemic that the standard E compartment cannot capture. The chronic-carrier flag (C) marks a recovered cell that still transmits at a reduced multiplier of the baseline transmission rate — the right shape for hantavirus-like reservoir dynamics where some recoveries do not clear the infection. Both flags are gated on per-preset seeding probabilities (l_seed and c_seed) so the underlying SEIR model is recoverable by setting them to zero.
Why spatial structure matters
Well-mixed (mass-action) models assume every individual can contact every other with equal probability. Real contact networks have geometry. In Miasma, infection only crosses between cells that are neighbors on the lattice, so outbreaks propagate as traveling waves rather than synchronous global infections. Wave fronts have a characteristic speed; the effective reproduction number behind a front is lower than R0 because part of the neighborhood is already immune; final size is generally smaller than the mass-action prediction; and stochastic extinction at low densities becomes possible even when R0 exceeds 1.
Topology
The world is a regular hexagon of cells, and a surface is a way of gluing its three pairs of opposite edges. The plane glues nothing: every edge is a shore and outbreaks die there. The torus glues every pair straight, giving a boundary-free, orientable, flat surface. The Klein bottle twists two pairs and keeps one straight, so it is non-orientable: a wave that goes around can come back mirror-reflected. The real projective plane twists all three; its Euler characteristic is 1, so it cannot be flat, and the curvature sits at cone points on the hexagon's corners. On a lattice of hexagonal cells the Klein bottle cannot be flat either: the hexagon of cells tiles the plane by translation in exactly two mirror-image ways, and no reflection maps either tiling to itself, so any defect-free gluing is a torus. Miasma's Klein bottle therefore carries two cone points, one of 240° and one of 480°, and is flat everywhere else. The plate draws each gluing as a topology textbook draws a fundamental polygon: chevrons on glued edges, one, two or three per pair, agreeing for a straight gluing and opposed for a twist, and faded copies of the world beyond each glued edge under that edge's gluing. Comparing the same disease across surfaces isolates the contribution of geometry alone.
Multi-strain dynamics
Beyond a single pathogen, Miasma supports multi-strain populations with antigenic drift, immunity by antigenic distance, and competition for susceptibles. Every strain sits at a position on a torus of antigenic space eight units around, where one unit is the distance at which cross-immunity falls by 1/e; mutations step through it, mostly a little and occasionally a long jump, and a recombinant takes its parents' midpoint. Each cell remembers up to four antigens it has met, so reinfection and vaccine breakthrough favor drifted strains, and within a coinfected host the strain that is more transmissible or better at escaping that host's memory gains ground. On the plate a strain's hatch angle and colour are its antigenic position, so related strains look alike, even in grayscale by angle alone. The Strains tab draws the antigenic map, the key to those marks, and a time-scaled phylogeny: each strain is a branch from the day it emerged, joined to its parent on that day, with line weight showing its current prevalence. A vaccine is matched to one strain and loses ground as the virus drifts; the tab can re-match it.
The Z compartment: two readings
The Z compartment is interpretation-agnostic. The same state machine reads as two different stories depending on which spawn pathway is active and where the encounter-outcome dials sit. Macroscopic: a zombie pandemic. Cells are people. Infectious corpses reanimate (the F flag is the bridge — only F-flagged deaths can convert to Z, at rate dz_dead per tick). When a zombie meets a human, a single bucketed roll resolves the outcome — clean kill (target → D), kill-with-infection (target → D + F-corpse), expose alive (target → E), or unopposed conversion (target → Z). A separate per-encounter roll handles whether the zombie itself dies in the fight (z_die_fighting), so mutual destruction is on the table. Zombies have a finite lifespan via z_die_natural — decomposition catches up. Microscopic: oncoviral cellular transformation. Cells are cells. The L flag carries the oncovirus latently in the host genome after S→E exposure, and at a small per-tick rate (l_transform) a latently-infected cell transforms into a malignant clone (→ Z). Transformed cells expand by contact-driven conversion (z_convert_unopposed dominates because cells don't fight back). Immune surveillance is represented by a small nonzero z_die_fighting — NK cells and cytotoxic T cells clearing transformed cells. Transformed cells are immortal (telomerase reactivation), so z_die_natural is zero; crowding-driven exhaustion stays on to capture necrotic-core formation in tumor masses where the interior loses access to oxygen. The two readings emerge from the same code with no toggles renamed and no special-case branches — the parameters are the whole story. Intermediate configurations produce intermediate readings, which is often the most pedagogically interesting region.
Six experiments
Six presets, each an experiment with one knob, a phenomenon to look for and a number measured live in the figure caption. They are the atlas's plates, listed in the Experiments tab, and each knob sits under the plate as a ruler ticked where theory, or the calibration survey, puts its thresholds. Threshold: below a critical transmission rate an outbreak stays a finite cluster, and just above it the front is ragged and holed; the caption compares β with the critical value from bond percolation on the triangular lattice. Herd immunity: random vaccine coverage stops a wave at about half when contacts are only between neighbours, near the triangular lattice's site-percolation threshold, far below the 82% that the mean-field formula 1 − 1/R₀ gives for the same disease. Antigenic drift: seasonal waves, each led by variants that have drifted from what hosts remember, with a phylogeny that keeps deepening. Spillover: emergence. A chronically infected rodent reservoir starts every human chain, and the knob is human transmissibility, ticked where a branching process would let chains grow without bound and where lattice percolation would; the caption gives the chains' mean size, the largest still growing and the reservoir's share of cases, and a figure plots the chains by size. Immunoediting: an oncovirus seeds transformed cells, each founding a clone, and immune surveillance eliminates, holds or loses them (the microscopic Z reading); at equilibrium the sizes of the clones it clears follow the −3/2 power law of a critical branching process. Zombie apocalypse: infectious corpses rise and the living fight back (the macroscopic Z reading). Each was calibrated across at least ten stochastic runs on the default 24,031-cell lattice; the Sandbox keeps every mechanic at its default for free play.
The atlas
The map is drawn as a plate from a nineteenth-century epidemiological atlas, in the line of John Snow's 1854 cholera map. The disease is the red, solid for infectious cells and pale for exposed ones; recovered cells are stipple, vaccinated cells are hatching, deaths are small crosses, and susceptible cells are graphite dots, so the plate survives grayscale. Isochrones contour the day each wave reached each cell every eight days, labeled every twenty-four, and fade as they age, so the plate keeps the outbreak's history while later waves write over it. A Reference cartouche and a scale bar sit on the plate. Seven views project the same state: compartments, strains (hatch angle and colour from antigenic position; a coinfected cell is hatched with each strain it carries, as heavily as that strain's load), descent, age, health, hospital and quarantine status, and immunity to a chosen strain, the last three as single-ink ramps. Descent draws who infected whom: every infection keeps its source, and each is a stroke from source to case, as heavy as the infections descended through it, red while the case is live and fading with age, so a wave reads like a drainage map. The Immunoediting preset's state view is an H&E-stained section, with nuclear size and stain marking normal, latent, infected, transformed and necrotic cells. The Counts tab carries Florence Nightingale's rose of 1858: ten-day wedges whose areas count exposures, recoveries, deaths and, in the Z presets, new zombies or transformed cells. Below it, a Hovmöller diagram plots infections along the world's centre row, marked A and A′ on the plate, against the last two years: a travelling front is a slanted line whose slope is its speed, and seasons are horizontal bands. In the strain view the plate also traces the selected lineage as a route through its ancestors' birthplaces. A third figure plots the chains of infection by size on logarithmic axes, with the −3/2 slope of a critical branching process as a guide.
Interventions
The intervention brushes let you paint five modes onto the manifold: seed (place strain α infections), vaccinate (S/E/R/M → V), quarantine (status overlay reducing transmission both ways), sanitize (clear infections and corpses), and cull (force-kill cells, including the zombie compartment). Brush radius scales 1/7/19 hexes, and every stroke goes onto an undo stack until the simulation advances; once time moves, undo is cleared so paint history never rewinds evolved disease state. The geometry of intervention matters: contiguous immune blocks at the herd-immunity threshold suppress outbreaks more reliably than the same fraction scattered randomly, because contiguous immunity blocks percolation paths. The simulator exposes this geometric dependence directly.
Learning outcomes
After using Miasma, students should be able to: define compartments and transitions in an SEIRDV-class model and connect them to per-tick transition probabilities; derive the basic reproduction number R0 and the herd-immunity threshold 1 − 1/R0; distinguish deterministic mass-action dynamics from stochastic spatial dynamics and predict where the two diverge; explain how lattice topology — boundary, orientability, antipodal identification — alters wave propagation and final size; describe multi-strain competition under partial cross-immunity; and evaluate the geometric efficacy of different vaccination patterns at the same coverage.
Prerequisites
Basic probability (rates, expected values, Poisson processes) and elementary linear algebra. Familiarity with differential equations is helpful for connecting the discrete-time spatial model to the continuous SIR ODEs but is not required — the simulator introduces both views.
References
W. O. Kermack and A. G. McKendrick, "A contribution to the mathematical theory of epidemics", Proc. R. Soc. A (1927). H. W. Hethcote, "The Mathematics of Infectious Diseases", SIAM Review 42(4):599–653 (2000). M. J. Keeling and K. T. D. Eames, "Networks and epidemic models", J. R. Soc. Interface 2(4):295–307 (2005). R. M. Anderson and R. M. May, Infectious Diseases of Humans: Dynamics and Control (Oxford University Press, 1991).
Accessibility
Miasma's colophon, view picker, experiment list, knob, brush rail, surface picker, margin tabs, the parts of the model diagram, sliders, switches, and documented paint-mode shortcuts are keyboard-operable. The plate exposes its purpose via aria-label, but placing brush strokes on particular cells still requires a pointer or touch; phylogeny row selection is also pointer-driven. Controls carry ARIA labels, compartment counts, status counts, the animal census, observed Re and Re by count are reported as text in the margin, and a live figure caption under the plate states the day and the current counts. Every state on the plate is a pattern as well as a color. The theme toggle switches between light and dark presentations. Known hazards: continuous change on the lattice during outbreaks, faster at high speed. With reduced motion set, Miasma opens paused on a finished plate; users sensitive to motion can also lower the speed or step the simulation one day at a time.
See also: Worldline for particle physics, Lumen for cellular biochemistry, Shoals for options trading.