What Are Boids?
Boids are a model for simulating the flocking behavior of birds, fish, and other animals. Developed by Craig Reynolds in 1986, boids follow three simple rules: cohesion (moving towards the center of mass), separation (avoiding collisions with neighbors), and alignment (matching velocity with nearby boids).
In a coral reef school simulation, these rules help mimic how fish move together as a cohesive group while avoiding predators or seeking food.
How Boid Rules Apply to Coral Reef Fish
By adjusting the cohesion rule, you can control how strongly fish are attracted to their neighbors. A higher cohesion value means tighter schooling behavior.
The neighbor radius determines how far a boid considers its surroundings for alignment and separation rules. Adjusting this parameter reveals how fish space themselves out or cluster together based on their environment.
Impact of Directional Currents
Introducing a directional current into the simulation adds an environmental factor that influences boid behavior. Fish must adapt to swim against or with the current, which can affect their schooling efficiency and speed.
The alert level reflects how sensitive fish are to changes in their environment, such as the presence of predators or food. Higher alert levels lead to more cautious movement patterns.
Schooling Percentage and Average Speed
The schooling percentage measures how well boids maintain a cohesive group under various conditions. It provides insights into how effective the boid rules are in mimicking natural fish behavior.
Average speed is another metric that shows how fast the school of boids moves collectively, which can be influenced by both environmental factors and internal boid rules.
Frequently asked questions
What does a high cohesion value mean for coral reef fish?
A high cohesion value means that the fish are more likely to stay close together as a group, which can be beneficial for protection against predators.
How does adjusting the neighbor radius affect boid behavior in the simulation?
Adjusting the neighbor radius changes how far boids consider their surroundings. A smaller radius means fish will focus more on nearby neighbors, while a larger radius allows them to consider a wider area.
Why is it important to simulate directional currents in coral reef schools?
Simulating directional currents helps understand how environmental factors influence the behavior of real fish, such as their ability to navigate and find food or avoid predators.
What does a low schooling percentage indicate about boid behavior?
A low schooling percentage suggests that the boids are not maintaining a cohesive group well, which could be due to high alert levels, predator presence, or other environmental factors.
Try it live
Everything above runs in your browser — open Coral Reef School — 2D Boids & Current Lab and change the parameters while it is running. Nothing is installed, nothing is uploaded, the whole model lives in one tab.
▶ Open Coral Reef School — 2D Boids & Current Lab simulation