Boids Simulation
Boids is an artificial life program that simulates the flocking behavior of birds. Developed by Craig Reynolds in 1986, the term "boids" is derived from "bird-oid objects." This simulation demonstrates how simple rules can create complex emergent behavior, such as flocking, schooling, or herding, observed in nature.
This repository contains a Typescript implementation of the Boids simulation using HTML cavnas. Boids are represented as simple agents that follow three basic rules:
- Separation: Boids avoid collisions by steering away from nearby flockmates.
- Alignment: Boids align their direction with nearby flockmates.
- Cohesion: Boids move towards the average position of nearby flockmates.
- Attraction: Boids are attracted to nearby flockmates within a certain radius.
- Adjustable simulation parameters such as cohesion radius, alignment radius, attraction radius, and separation radius.
- Interactive canvas rendering of boids' movements.
- Simple and intuitive code structure for easy understanding and modification.
To run the simulation locally, follow these steps:
-
Clone the repository:
git clone [email protected]:Clement-Muth/boids-simulation.git
-
Navigate to the project directory:
cd boids-simulation
-
Start with
yarn dev
and go tohttp://localhost:8008
- Simulation Controls:
- Adjust the simulation parameters by modifying the
FlockOptions
object in theindex.ts
file.
- Adjust the simulation parameters by modifying the
Contributions to this project are welcome! If you have any ideas for improvements or new features, feel free to submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.