0AndyGadget 11 years ago The Boids website gives you most of the answer. There would be variables for each element in the flock for X,Y,Z position and speed and direction (as 3 dimensional vectors). For each 'tick', the program would process each element in turn with reference to the Separation, Alignment and Cohesion rules and work out the position and speed for the next 'tick'. This position would be constrained by maximum rate of turn and change of speed. The screen would be re-drawn and then on to calculate the next 'tick'. I believe the rules for pretty much all flocking / herding / shoaling / swarming creatures are very similar, just with different values for the S, A and C and rates of change.