2 Reference

2.2 Flocking

2.2.1 The three rules

Each rule is a Reynolds steering force (desired velocity minus current velocity, limited to the maximum force), multiplied by its weight. The screen is a torus: boids leaving one edge return at the opposite edge, and all distances are measured the short way across edges. All boids steer from the same snapshot before any moves.

2.2.2 Parameters

# Parameter Default Range Meaning
1 separation 0 0 – 200 px* radius of separation
2 alignment 0 0 – 200 px* radius of alignment
3 cohesion 0 0 – 200 px* radius of cohesion
4 separation weight 2.0 0 – 5 strength of separation
5 alignment weight 1.5 0 – 5 strength of alignment
6 cohesion weight 0.5 0 – 5 strength of cohesion
7 max speed 3.0 1 – 10* top speed (from 1: 0 would only freeze the swarm, which SPACE does; below 1 the beat falls under ~15 BPM)
8 max force 0.3 0 – 2* how sharply boids can turn (IV: 1.0)

* Full HD reference values. Defaults come from Swarm Synth IV: the radii start at 0, so the swarm starts scattered and silent. A free-play session starts with 120 boids. All eight are played (arrow keys, HUD, the MIDI controller, 2.7.1): the radii in steps of 1 px, the weights, speed and force in steps of 0.1.

2.2.3 Tuning the flight

Two choices make the flocks flow instead of tremble:

IV's weights (2.0 / 1.5 / 0.5) stay. What still trembles are settings with a very large separation, where 120 boids have no room on the stage — and there the trembling is heard as a crackle (2.4.3).

2.2.4 Resolution independence

Everything is drawn into a stage image: the screen size in free play, the score's size (default 1920×1080) for scores and renders, shown letterboxed in the window. Radii, speed and force are stored in Full HD pixels and multiplied by scale = min(width/1920, height/1080) just before the flock moves, so the same slider numbers give the same composition on every screen. pixelDensity(1) keeps IV's line quality on every display.