JatinChopra/Boids-Flocking

A simulation that replicates the flocking behavior seen in nature, similar to how birds and fish move cohesively in groups.

★ 5Forks 3TypeScriptGitHub ↗Compare

Project website ↗

boids-simulationflockingthreejstypescript

README

Boids Flocking Simulation

A simulation that replicates the flocking behavior seen in nature, similar to how birds and fish move cohesively in groups.

Run : https://boids-flocking.vercel.app/
View related post on Twitter , LinkedIn

How it works

This core of this simulation is based on Steering Forces.

Basic Flocking Rules Include

  1. Separation: Boids steer away to avoid bumping into each other
  2. Alignment: Boids steer in the same direction as nearby boids.
  3. Cohesion: Boids steer towards the center of the group.

Predator-Prey Dynamics: A predator chases one group of boids while the others avoid it if it gets too close. I also gave predator ability to shoot projectiles and show explosion with some simple particle effect.

I wanted it to look more cool so I made the camera follow predator in a cinematic way and added unreal bloom effect.

Screenshots

boid image

Resources

Original Boids Model by Craig Reynolds
SubOptimal Engineer Three.js Playlist
Nature of Code - Autonomous Agents

Contributors

JatinChopra

Issues