Simulating herds, flocks and swarms