What you're seeing
A corridor with two streams of people: one walking right, one walking left, started thoroughly mixed together. Nobody is steering the crowd, and no walker is told to get in line. Yet within a few seconds the jumble untangles itself into lanes — horizontal bands that are each almost entirely one colour, one direction. People going the same way fall in behind one another; people going opposite ways stop trying to push through the same strip of floor. The lane-order readout climbs from near zero (fully mixed) toward one (cleanly segregated), and the crowd's average forward speed rises as the head-on collisions disappear.
The rule
Each pedestrian follows just two impulses, every instant:
- Head for your goal. A driving force relaxes your velocity toward
your preferred walking speed in your goal direction — written
(v0·e − v) / τ, with relaxation time τ ≈ 0.5 s. - Keep your distance. From everyone nearby comes a repulsive force
that grows exponentially as they get closer —
A·exp((r − d)/B)pushing you directly away, wheredis the centre-to-centre distance andrthe sum of the two radii. The same exponential push comes from the walls. Optionally the push is anisotropic — weaker from people behind you than in front — which sharpens the lanes.
That is the whole model: a destination and a personal-space bubble. There is no alignment, no copying, no leader, no rule that says "form a line." This is the crucial contrast with the Atlas's flocking models — Boids and the Vicsek model — where order comes from each agent matching its neighbours' heading. Here the agents actively want to go opposite ways; the order has to emerge from avoidance alone.
Why it matters
Self-organized lane formation is a textbook case of order emerging from purely local avoidance. The lanes are not planned, enforced, or signposted — they appear because tucking in behind someone going your way is cheaper than colliding head-on with someone coming the other way. Once a walker slips into a same-direction stream it meets fewer oncoming people, so it slows down less, so it tends to stay there; the configuration is self-reinforcing. The remarkable part is that this leaderless traffic solution raises the whole crowd's flow: the system finds, on its own, an arrangement that is better for everyone than the head-on scramble it started from. Crank the density up and you get more lanes, each thinner — the number of lanes grows with how crowded and wide the corridor is.
The same social-force model also reproduces darker, real crowd behaviour. At a bottleneck — a doorway, a gate, a narrowing — the flow stops being smooth: people pile into a pressure arch around the opening and the crowd passes through in intermittent bursts. In the fuller model (Helbing, Farkas & Vicsek 2000), with added body-contact and friction forces, pushing harder to get out can actually make everyone slower — the famous "faster-is-slower" effect — because the harder bodies jam against each other and clog the gap. Both effects matter directly for designing doorways, stairwells, and exits, and for understanding how crowds move under pressure.
In the wild
Counterflow lanes are easy to spot once you know to look: on a busy sidewalk, in a train-station concourse, at a pedestrian crossing the moment the light changes, two opposing streams quietly sort into one-way bands. Ants on a foraging trail show an analogous sorting of inbound and outbound traffic. And the engineering of corridors, stairwells, and exits for stadiums, transit hubs, and pilgrimage sites leans on exactly this family of models to predict where flow will be smooth and where it will jam.
It is worth being honest about what this model is. The social-force model is one useful caricature among several, not the last word. Cellular and "floor-field" models discretize the space into a grid; vision-based models (Moussaïd, Helbing & Theraulaz, 2011) have walkers choose a heading from what they can actually see, and arguably fit real pedestrian trajectories better than force-based steering does. The lane-formation result itself is robust and observed across model families and in real crowds, so that is solid. But the original "escape panic" framing of crowd disasters has been heavily critiqued: real crowd accidents are usually driven by sheer density and crowd-pressure, and by poor information and signage — not by people behaving irrationally or "panicking." Those events deserve to be treated as engineering and organisational failures, not as mobs losing their heads.
Try this
- Hit randomize and just watch: a random colour mix peels into alternating orange and teal bands, and the mean forward speed in the readout climbs as the lanes lock in.
- Raise the density and watch more, thinner lanes form — push it high enough and the sorting struggles, with stubborn pockets of gridlock where the streams refuse to separate.
- Turn anisotropy off and on. With it off (the push is equal in every direction) the lanes are mushier; with it on (you mostly avoid people in front of you) they sharpen.
- Switch to the Bottleneck scene and watch the crowd arch around the gap and pass through in bursts. Push the desired speed up and notice the opening clogs harder rather than clearing faster — the intuition behind "faster-is-slower."
References
- Helbing, D. & Molnár, P. (1995). "Social force model for pedestrian dynamics." Physical Review E 51(5), 4282–4286.
- Helbing, D., Farkas, I. & Vicsek, T. (2000). "Simulating dynamical features of escape panic." Nature 407, 487–490.
- Helbing, D., Buzna, L., Johansson, A. & Werner, T. (2005). "Self-organized pedestrian crowd dynamics: Experiments, simulations, and design solutions." Transportation Science 39(1), 1–24.
- Moussaïd, M., Helbing, D. & Theraulaz, G. (2011). "How simple rules determine pedestrian behavior and crowd disasters." PNAS 108(17), 6884–6888.