The living world turns chaos into order by making large structures out of small units. The sublime coordination of a flock of birds or a school of fish—built iteratively from the twitches and bumps of single individuals—turns instinctive behaviors into something vast and graceful. It’s not just for show. A lone gazelle can’t evade a fast-moving lion anywhere near as well as a slippery, undulating herd.

With that in mind, take a look at this video of a truck barreling through protesters in Minneapolis in May. The densely packed protesters swirl out of the truck’s path, then close ranks back around it when the truck stops. For a few moments, the movements of the protesters look very much like a murmuration of starlings responding to an attacking falcon, or maybe little fish to a shark—parting like water in front of a boat, swirling in eddies around the invader, regrouping behind it. The protesters respond as a collective.

This is speculative, but roll with me a little: Individual persons move in unpredictable ways, but people—crowds—behave very much like any other collective group of living creatures. The motion of those groups switches from fluidic swirls around and through barriers to jammed-up particulate movement, in spontaneously self-organized formations that accomplish tasks like migration—or respond to predator-like behavior from things like vehicles and, yes, law enforcement moves. Think of “kettling”—walls of armored men closing in—or troops mounted on bikes or horses cutting across lines of demonstrators. And, like all living things, these groups adapt. Protesters adapt to police tactics, and the police respond, often with greater force. But maybe understanding this kind of distributed, collective behavior can provide some options beyond a violent response to peaceful protest.

Collectives of living things generally take one of three fundamental structures: a localized swarm (think bees or bats on the hunt), a sort of milling or orbiting around a central core (a school of anchovies), or a fluid-like flow in a direction (like this swarm of fire ants so big it showed up on weather radar).

Now imagine a public space like a park full of protesters, or a march down a boulevard. A crowd of people can take on any of those forms as well, from milling mass to parade. But like the phases of physical matter—gas, liquid, and solid—those structures can transition from one to the other. The changes aren’t exactly like classical phase transitions, like ice melting to water and then evaporating to steam, because those involve billions or trillions of individual atoms or molecules. But in groups of just a few dozen living things, similar changes do happen. Small and local interactions propagate with startling speed through the group, gumming up the works or making the whole collective move more smoothly.

“When you have energy in a system—like people pushing and pulling—there’s all sorts of phase transition-like behavior,” says Iain Couzin, director of the Max Planck Institute of Behavior at the University of Konstanz in Germany. “At the local interactions, as the change in density percolates out, the speed of individual movement changes.”

In animal groups, that propagating wave of change in behavior—like a flock changing direction—moves without the birds, bugs, or whatever thinking much about it. In fact, Couzin’s team has argued that a collective is smarter than any of its members, like a brain being better at thinking than a single neuron. Non-human animals make these phase changes work to their advantage. “If birds hear the screech of an eagle or gazelle smell a lion, they’ll dramatically change configuration to more effectively propagate information across the collective,” Couzin says. “The network of interactions does the computation for you.” The change in the network’s spatial configuration literally allows it to become more defensive, to keep all the members safer.