This is a simple boids (bird object oid) simulation that you can try out and read to figure out how boids work. They are a simple swarm intelligence, where each boid has knowlege of each other boid and there actions are affected by the whole population.
the rules are:
-
Coherence - For each boid in the boids view, we will take our center of mass which is the averge position of each boid and then move towards that point
-
Seperations - We dont want to clump up all together then we can see each boid and the boids would hit eachother and they all need some personal space, so we subtract the distance between the other boid in our personal space and save that so we have a vector that moves us away
-
alignment - this is the same as coherence, but instead of averaging the positions we average the velocities and move a small percentage of our velocity towards the average
SCREEN WIDTH = 2560 SCREEN HEIGHT = 1660 Max Speed = 6 Min Speed = 3 Max Distance (bird.java) = the distance we want to keep away from another boid Turn Factor = 0.2 Bird View Distance = 200 Boid Population = 50
cohesion factor = 0.0005 seperation factor = 0.5 alignment factor = 0.05