🛡️ Immune Response Dynamics Simulation
Agent-based model of the immune response. Pathogens multiply and spread; neutrophils rush in first, then macrophages, T-cells, and antibodies clear the infection. Adjust virulence and immune strength.
About this simulation
This is an agent-based model of an infection: individual coloured dots — pathogens, neutrophils, macrophages, T-cells and antibodies — move, multiply and interact under simple local rules rather than a single global equation. The underlying dynamic follows a Lotka-Volterra-style predator-prey relationship (dP/dt = r·P·(1−P/K) − k_innate·N·P − k_adaptive·T·P·V), but you watch it unfold cell by cell rather than as an abstract curve. Three phases run in sequence: an immediate response in the first few hours, a slower innate phase over several days, and a delayed adaptive phase that can take over a week to ramp up — unless vaccination has already primed it.
🔬 What it shows
Red pathogen dots reproduce logistically up to a virulence-dependent ceiling while blue neutrophils, green macrophages, orange T-cells and yellow antibodies hunt them down at different speeds and kill rates. Neutrophils and macrophages recruit within the first hours; T-cells only begin appearing after roughly 180 simulated ticks, and antibodies after 240 ticks — or after just 60 ticks if vaccination is high enough.
🎮 How to use
Choose a preset — Bacterial, Viral, Vaccinated or Immunocompromised — or drag the Pathogen virulence, Immune strength and Vaccination sliders yourself, then hit Reset to restart with the new settings. Watch the fact-bar counts and the population-history graph to see whether the infection is cleared, contained, or overwhelms the host.
💡 Did you know?
Neutrophils make up roughly 50-70% of circulating white blood cells and are usually the first immune cells to reach a site of infection, often within minutes. Vaccination works by pre-training this same adaptive machinery: memory T-cells and B-cells can persist for decades, which is why a high Vaccination value here spawns T-cells almost immediately instead of waiting for day three.
Frequently asked questions
What do the coloured dots in the simulation represent?
Each dot is an individual agent: red dots are pathogens, blue are neutrophils, green are macrophages, orange are T-cells, and yellow are antibodies. They move around the field, and immune cells actively steer toward the nearest pathogen once it is within detection range, then have a chance to eliminate it on contact.
What does the Pathogen virulence slider actually change?
Virulence sets both the starting number of pathogens and the population ceiling they can reproduce up to (5 plus up to 95 more at maximum virulence), as well as their maximum movement speed. Higher virulence means the infection starts bigger, grows faster, and is harder for the immune system to keep contained.
How does the Vaccination slider change the simulation's timing?
At high vaccination levels the model pre-spawns T-cells at the very start (tick 10) instead of waiting until the adaptive phase begins around tick 180, and lets antibodies appear from tick 60 rather than tick 240. This mirrors how vaccines create memory cells in advance, so a real infection is met by a fast, targeted adaptive response instead of starting from zero.
Why do T-cells and antibodies appear later than neutrophils and macrophages?
The simulation reproduces the real timeline of an immune response: neutrophils are pre-existing and mobilise within hours, macrophages follow over the next few days, but T-cells and antibody-producing B-cells need time to be selected and expanded from the small pool of cells that recognise the specific pathogen — typically three to fourteen days in a real infection, represented here as several hundred simulated ticks.
What is the difference between the Bacterial, Viral and Immunocompromised presets?
The Bacterial preset uses moderate virulence and strong immune strength, resembling a typical bacterial infection cleared mainly by neutrophils and macrophages. The Viral preset raises virulence and lowers immune strength slightly, reflecting how viruses can replicate faster. The Immunocompromised preset keeps virulence moderate but cuts immune strength and vaccination sharply, so pathogens face far fewer, slower-arriving defenders and can more easily overwhelm the host.
Frequently Asked Questions
What is the difference between innate and adaptive immunity?
Innate immunity responds within minutes using pre-programmed pattern recognition that detects broad classes of pathogens. Adaptive immunity takes days to weeks but is highly specific, generates antibodies and T cells tailored to a particular pathogen, and creates immunological memory. The two systems communicate through cytokines and antigen presentation.
How do vaccines train the immune system?
Vaccines introduce antigens (inactivated pathogens, protein subunits, or mRNA encoding viral proteins) without causing disease. The adaptive immune system mounts a response, generating memory B and T cells. On future exposure to the real pathogen, these memory cells enable a much faster and stronger response that clears infection before disease develops.
What are cytokines and what role do they play?
Cytokines are signalling proteins secreted by immune cells to coordinate the immune response. Interleukins, interferons, and tumour necrosis factors (TNF) recruit and activate specific cell types, promote inflammation, trigger fever, and regulate the transition between innate and adaptive phases. A cytokine storm — excessive, uncontrolled cytokine release — can cause severe tissue damage.
What is an antigen and how is it recognised?
An antigen is any molecule (typically a protein or polysaccharide on a pathogen's surface) that can be specifically recognised by immune receptors. B cell receptors and antibodies bind three-dimensional surface epitopes; T cell receptors recognise peptide fragments presented by MHC molecules on the surface of cells.
How does the body prevent the immune system from attacking itself?
Central tolerance eliminates self-reactive lymphocytes during development in the thymus (T cells) and bone marrow (B cells) through a process of clonal deletion. Peripheral tolerance mechanisms — regulatory T cells, anergy induction, and inhibitory checkpoints — suppress any self-reactive cells that escape. Failures in these mechanisms lead to autoimmune diseases like lupus, rheumatoid arthritis, and type 1 diabetes.
Observe the interplay between pathogen virulence, immune strength, and vaccination rates as innate and adaptive cells battle infection or succumb to its effects in this dynamic simulation.
3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install