Kanishk Sachdev

Software Engineer and Student

Boids Flocking Simulation

A flocking simulation based on Craig Reynolds' boids algorithm. Each boid follows three simple rules: separation (avoid crowding), alignment (steer towards average heading), and cohesion (steer towards average position).

Technical Implementation:

Flocking Algorithm: Each boid applies three steering behaviors based on nearby neighbors within its visual range to create emergent flocking patterns.

Separation: Boids steer away from neighbors that are too close, preventing collisions and maintaining personal space.

Alignment: Boids adjust their velocity to match the average heading of nearby boids, creating cohesive movement.

Cohesion: Boids are attracted toward the center of mass of nearby neighbors, keeping the flock together.

Trail visualization is currently disabled. Watch how different parameter combinations create unique flocking behaviors.

100
75
0.005
0.05
0.05
20
15
1
200

Parameter Guide:

Visual Range: How far each boid can see other boids. Larger values create more global awareness.

Centering Factor: How strongly boids are attracted to their neighbors' center of mass. Higher values create tighter flocks.

Avoid Factor: How strongly boids repel each other when too close. Higher values prevent overcrowding.

Matching Factor: How strongly boids try to match their neighbors' velocities. Higher values create more uniform movement.

Feel free to contact me at kanishksachdev@gmail.com