An implementation of Craig Reynold's 1986 artificial life program for Unity.
For a live/WebGL demo, please see here.
Current behaviours:
- Flocking:
- Cohesion, Separation, Alignment.
- Cohesion: Steer towards local average position (group center).
- Separation: Steer away from individual boids nearby.
- Alignment: Steer towards local average velocity (group heading).
- Cohesion, Separation, Alignment.
- Type (visualized as colour):
- Flocking cohesion and alignment filtered to same-type boids.
- Separation still applies to all (to prevent inter-particle/boid collisions).
- Wander:
- Each boid has a tendency to stray randomly (with order over time).
- Bounds:
- There are no strict bounds, boids can simulate anywhere.
- A 'soft' bounding force contains them on the screen (which you can set to 0.0).
Boids.mp4
The simulator is independent from the renderer, where the latter uses Unity's actual particle system to render all agents efficiently in one go.
Do whatever you want with this.