A ship in a field of rocks, and a queen with drones that hunt it and shoot at it. Each thing is one Erlang process that senses, decides and acts.
Its module has the behavior gen_boid. Its force is a rule of its own: a function that reads your keys. The autopilot is a list of rules of the library.
A shot senses the rock that it touches, and sends hit to that process. The rock starts two smaller rocks, and stops. The world removes a boid that stops.
Each drone has the relation guards to its queen, and follows it. A drone that sees the ship changes its rules: it hunts the ship, and shoots bolts at it. The lines show the relations.
The number of swarms comes from boids:graph/2 and graph:components/1, one time each second.