🚶 Pedestrian Flow

| |
Evacuated: 0
Remaining:
Flow rate: /s
Avg speed:
Mode: Normal

🚶 Pedestrian Flow — Social Force Model

A Social Force Model simulation where agents navigate toward exits while avoiding collisions. Toggle panic mode to observe clogging at narrow doors — the counter-intuitive 'faster-is-slower' effect.

🔬 What It Demonstrates

Dirk Helbing's Social Force Model treats each pedestrian as a particle subject to three forces: a desired-velocity force toward the exit, repulsive forces from other pedestrians, and repulsive forces from walls. In panic, desired speed increases but clogging decreases overall flow.

🎮 How to Use

Watch agents stream toward the exit in normal mode. Toggle panic — desired speed doubles but arch-shaped clogs form at the door, reducing throughput. Add a column obstacle near the exit to see how it paradoxically improves flow.

💡 Did You Know?

Adding a pillar in front of a narrow exit counter-intuitively improves evacuation flow by breaking the arch-shaped clog. This finding by Helbing et al. (2000) has influenced building codes worldwide.

About the Social Force Model

This simulation models crowd evacuation using Dirk Helbing's Social Force Model. Each pedestrian is treated as a self-driven particle that experiences three superimposed forces: a desired-velocity force pulling it toward the exit, an exponentially decaying repulsion from neighbouring agents, and a repulsion from walls. Velocities are updated each frame, agents accumulate near the doorway, and those crossing the opening are counted as evacuated.

The Agents slider sets how many people start in the room (20 to 200) and the Door width slider controls the exit opening (20 to 100 pixels). Panic mode raises each agent's desired speed from 1.2 to 2.8, which counter-intuitively reduces throughput by forming clogging arches at the bottleneck. This faster-is-slower effect informs real-world building codes, exit sizing, and emergency egress planning.

Frequently Asked Questions

What is the Social Force Model?

It is a continuous model of pedestrian motion proposed by Dirk Helbing and Peter Molnar in 1995. Each person is treated as a particle driven by a desired direction while being repelled by other people and obstacles. The sum of these forces accelerates each agent every time step, producing realistic crowd behaviour without any explicit decision-making rules.

How does the simulation decide where agents move?

Each agent computes a unit vector pointing toward the centre of the exit and applies a desired-velocity force of the form (desired direction times desired speed minus current velocity) divided by a relaxation time. Social and wall repulsions are then added, the resulting force updates the velocity, and the velocity is capped before the position advances. Agents that pass through the door opening are removed and tallied.

What do the two sliders do?

The Agents slider sets the initial crowd size, from 20 up to 200 people in steps of 10. The Door width slider sets the size of the single exit opening, from 20 to 100 pixels. Changing either value resets the room and redistributes the agents, letting you compare how density and bottleneck width affect evacuation time.

What is panic mode and the faster-is-slower effect?

Panic mode increases each agent's desired speed from 1.2 to 2.8 pixels per frame. Although every individual tries to move faster, the higher pressure at the doorway packs agents into a self-blocking arch, so the overall flow rate drops. This counter-intuitive outcome is the well-documented faster-is-slower effect seen in real evacuation disasters.

What are the key parameters in the model?

The simulation uses a relaxation time of 35 frames, a social force magnitude of 0.35 with a decay length of 14 pixels, and a wall force magnitude of 0.55 with a decay length of 10 pixels. Agents have a radius of 7 pixels, and speed is capped at 1.8 times the current desired speed. Overlapping agents also feel an extra body-contact push.

Why do clogging arches form at the exit?

When many agents push toward a narrow opening, their bodies wedge together into a stable arch, much like grains jamming in a hopper. The arch temporarily blocks the door, releasing people in intermittent bursts rather than a steady stream. Higher desired speeds in panic make these arches form more readily, lowering the average flow.

How is the flow rate measured?

Every time an agent crosses the exit the current frame number is recorded in a rolling history. The info bar shows how many of those crossings happened within the last 60 frames, giving an approximate evacuations-per-second figure at 60 frames per second. The bar also reports the number evacuated, the number remaining, and the average agent speed.

Is this simulation physically accurate?

It captures the qualitative essence of the Social Force Model and reproduces emergent crowd phenomena such as bottleneck clogging and the faster-is-slower effect. However, it is a simplified two-dimensional demonstration with tuned pixel-scale constants rather than calibrated metric units, so it is intended for education and intuition rather than for certified evacuation engineering.

Why would placing a pillar near the exit help?

Helbing and colleagues showed in 2000 that an obstacle just in front of a narrow door can break the symmetric clogging arch, redirecting the pressure and smoothing the outflow. The result is a higher average evacuation rate despite the obstacle reducing the available space, a finding that has influenced real building design.

Where is this kind of model used in the real world?

Social Force Models underpin commercial crowd-simulation software used to plan stadiums, transport hubs, concert venues, and emergency egress routes. Engineers use them to estimate evacuation times, identify dangerous bottlenecks, and test layout changes before construction, helping to prevent crowd crushes and improve public safety.