About Download
Birds Flocking
Jorgen Kristpas

Visualising Game Theory with Boid Flocks

Jörgen Weibull, Kristaps Dzonsons

Start with a flock of birds. Each bird is coloured according to its flock and each flock represents a strategy — like a market strategy, or more simply, like whether to choose heads or tails in a coin-toss contest. Periodically, a random bird is chosen to pit its strategy against its closest neighbour, and the payoff of this contest is a probability of reproduction. In our example, this is like calling heads or tails in a coin-flip contest, where matching coins with the other player gives a high chance of reproduction and not matching gives a low chance. If the bird reproduces, its offspring replaces a random existing bird.

The prisoner's dilemma, the yellow flock being cooperators and the red flock, defectors. The game uses uniform random matching: birds tend toward the perceived centre of all birds. Since defectors score well against cooperators (100% vs. 0% birthrate) and boids are matched with a mixture of other boids, eventually the defectors take over.

In terms of assortativity, how do the dynamics of the bird flocks change if the flocks fly separately or together? This will change the proportion of matches between own-types, that is, boids are matched more often within the flock.

The prisoner's dilemma again. This time, the game uses assortative matching: birds tend toward their own flocks more than the whole. Thus, they're matched more often within their own flock. Since cooperators get better payoffs when matched with other cooperators, they take control!

What governs flock motion? In general, each bird moves independently with a fixed set of swarm movement rules, specifically boids. For more information, consult the libflocks library, which implements our swarm movement and game-play.

For questions, comments, and so on, please contact , k-Consulting, who originally wrote the flocks application for , Stockholm School of Economics with financial support from the Knut and Alice Wallenberg Research Foundation. If you'd like to use our work, please use the included citation! And if you're interested in running the system yourself, consult the download section below.

flocks is open source software. We're distributing it as an application for Mac OS X or source code for other UNIX systems. At this time, a Microsoft Windows version of this software is not available. (Please contact us if you can do this!)

If you're using Mac OS X, the gtkflocks application includes a pre-built flocks component so you can deploy flocks painlessly. We recommend you use this: managing dependencies and downloading all components for Mac OS X is a pain.

If you're using another UNIX machine and wish to compile from scratch, the flocks source code is in ISO C, and requires OpenGL (visualisation), GLUT (windowing), SDL (audio), SDL mixer (audio mixing), libgd (graphics input and output), GSL (randomisation), libzip (unpacking ZIP files), and libflocks (flocking machinery). It uses gmake to build and needs ffmpeg to record movies. I include Manual L.'s bird wireframe, originally part of a Blender project. Once you've installed all dependencies, installing flocks is as easy as running make in the source directory, then make install to install. (This follows the usual UNIX conventions.) This will also install the flocks(1) manual, which describes how to operate the system. Since the command-line can be awkward, we suggest using gtkflocks to command simulations.

The beautiful sky-box bitmaps on this site may be downloaded from Emil Persson's site. An all-white default is bundled with the system.

Recent Releases