Swarms–like a flock of birds, or a school of fish–are mathematically complicated, but computer scientists are getting better at modeling, and learning from, them. Using code that simulates birds in coordinated flight, Cyrill Studer and Lazar Jeremic made the “visual instrument” you see in the video here: a knob- and button-controlled view of a swarm in motion. It’s mesmerizing.
This Computer-Generated Swarm Is Mind-Melting
Replace a flock of birds with fireflies on a dark night, and this is about what you'd get.