Flocking is an example of emergent behaviour - when simple rules executed by agents give rise to complex behaviour.
I got interested in this many years ago with the original paper on Boids by Craig Reynolds from 1987 and wrote my own version then (and a couple of times since.) The original ideas have been used and extended - a short CGI movie called Stanley and Stella in: Breaking the Ice showed up a computer graphics film festival in 1987, and Tim Burton created flocks of bats and penguins for his Batman Returns in 1992.
It’s surfaced again for me in the work of Robert Hodgin who has done incredible visualisations with half a million boids flying in murmurations in three dimensions.