Home▸Society & Economics▸Epidemic Spread (2D): Spatial SIR Model

Epidemic Spread (2D): Spatial SIR Model

A 2D spatial SIR (Susceptible-Infected-Recovered) simulation: agents wander a bounded arena and pass infection to nearby susceptible neighbours, with transmission rate, infectious period, mobility and vaccination coverage all adjustable in real time.

Society & Economics2DModerate60 FPS📱 Mobile-adapted⇄ 3D version
2d-epidemic-spread ↗ Open standalone

This 2D companion turns the SIR (Susceptible-Infected-Recovered) model into a spatial, agent-based simulation: instead of directly solving the textbook differential equations, wandering dots infect nearby susceptible neighbours on contact and recover after an average infectious period, and the aggregate Susceptible/Infected/Recovered counts trace out the same curves the equations predict. Transmission rate, infectious period, population mobility and vaccination coverage are all adjustable in real time, alongside a live S/I/R chart and a measured effective-R readout.

⚙ Under the hood

Agent-based spatial SIR model: per-contact infection probability, per-day recovery probability, vaccination pre-seeds the recovered pool, and effective R is measured live from each recovered agent's actual infection count.

SIR modelepidemiologyagent-basedherd immunityeffective R

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What model does this simulation use?

A spatial, agent-based version of the classic SIR (Susceptible-Infected-Recovered) epidemic model. Instead of solving the SIR differential equations directly, each agent wanders the arena and infects nearby susceptible agents with a per-contact probability, recovering after an average infectious period — the aggregate S, I and R counts trace out the same curves the equations predict.

What does the effective-R readout mean?

It is the measured average number of new infections caused by each agent who has already recovered, updated live. When it stays above 1 the outbreak is still growing; once it drops below 1 (often thanks to vaccination or reduced mobility), the epidemic is dying out — this is the practical definition of herd immunity.

How does vaccination coverage work here?

A matching share of the population starts the simulation already in the Recovered/immune state instead of Susceptible, directly shrinking the pool the disease can spread through — which is exactly how vaccination lowers effective R in the real SIR model.

What did you find?

Add reproduction steps (optional)