This project is a 2D simulation of the Boids Algorithm, rendered using Three.js and controlled interactively with Dat.GUI. The simulation illustrates the flocking behaviour of birds, an artificial life program known as "Boids."
The Boids Algorithm is a simulation of collective behavior, such as bird flocking or fish schooling. It consists of individual agents, called "Boids," following simple rules to achieve flocking behavior:
- Alignment: Boids align themselves with the average heading of their neighbors.
- Separation: Boids avoid getting too close to each other to prevent collisions.
- Cohesion: Boids steer towards the average position of their neighbors.
The term "Boids" represents a simulated flocking behaviour, which was originally developed by Craig Reynolds in 1986. You can read more about the Boids algorithm on its Wikipedia page. https://en.wikipedia.org/wiki/Boids
Visit the live demo at the link below:
The demo allows you to view a simulation of the Boids algorithm. Use the interactive controls to adjust various parameters and see how the Boids respond in real-time.
Before you begin, ensure you have the following:
-
Git: You'll need Git, a version control system, to clone this project. You can download and install Git from the official website: Git Downloads
-
Node.js and npm: This project relies on Node.js, a JavaScript runtime, and npm (Node Package Manager) for managing dependencies and running the development server. You can download and install Node.js, which includes npm, from the official website: Node.js Downloads
To run this project locally, follow these steps:
-
Clone the project repository to your local machine using the following command:
git clone https://github.com/RhysMarch/Boids_Algorithm
-
Navigate to the project directory:
cd <project_directory>
-
Install the required dependencies (three and dat.gui) using npm:
npm install three dat.gui
-
Start the development server using Vite:
npx vite
-
Open your web browser and go to the provided localhost link in your terminal. You can now interact with and explore the Boids Algorithm simulation.