Home▸Articles▸Animals & Their World

Nightjar Moth Hunt Lab: A Study in Flocking Behavior

Explore the fascinating dynamics of flocking behavior through a simulation that mimics nightjars hunting moths.

mysimulator teamUpdated June 2026≈ 3 min read▶ Open the simulation

What the Nightjar Moth Hunt Lab Is

The Nightjar Moth Hunt Lab is a top-down 2D simulation that models the complex behaviors of nightjars (a type of nocturnal bird) as they hunt moths in a meadow. Each nightjar acts according to simple rules, leading to emergent flocking behavior.

By adjusting various sliders, users can observe how changes in flock size, moth density, visibility conditions, and wind gustiness affect the birds' movements and hunting strategies.

Why It Happens

The behaviors observed in this simulation are governed by the Boids model introduced by Craig Reynolds. Each nightjar follows three simple rules: alignment (matching direction with nearby flock-mates), cohesion (staying close to nearby flock-mates), and separation (avoiding crowding nearby flock-mates).

These rules, combined with the pursuit of moths, lead to complex emergent behaviors that mimic real-world flocking dynamics.

live demo · related simulation● LIVE

Real-World Applications

Understanding flocking behavior is crucial in various fields. In biology, it helps explain how animals move together as a group for protection or efficiency. In robotics and artificial intelligence, similar models are used to design autonomous systems that can navigate and interact with their environment.

The Nightjar Moth Hunt Lab provides insights into these phenomena by allowing users to manipulate variables and observe the outcomes in real-time.

Key Concepts

In this simulation, nightjars exhibit behaviors that are a result of simple rules applied at an individual level. The collective behavior emerges from these interactions without any central control.

The pursuit of moths by the birds is driven by their innate hunting instincts and the need to find food in their environment.

Frequently asked questions

How do nightjars use Boids rules to hunt?

Nightjars follow three main Boids rules: alignment (matching direction with nearby flock-mates), cohesion (staying close to nearby flock-mates), and separation (avoiding crowding nearby flock-mates). These rules help them move as a cohesive group while also allowing for individual hunting.

Why is the moth density important in this simulation?

The moth density slider determines how many moths are present in the environment and influences the nightjars' hunting behavior. Higher moth densities can lead to more complex interactions as nightjars compete for prey.

What does the wind-gustiness slider control?

The wind-gustiness slider introduces turbulence into the simulation, affecting how nightjars move and interact with each other. Stronger gusts can disrupt flocking behavior and alter hunting strategies.

How do nightjars separate from their flock-mates when hunting?

Nightjars use the separation rule to avoid crowding nearby flock-mates while still maintaining a cohesive group. This allows them to efficiently hunt moths without interfering with each other's movements.

Try it live

Everything above runs in your browser — open Nightjar Moth Hunt Lab (2D) and change the parameters while it is running. Nothing is installed, nothing is uploaded, the whole model lives in one tab.

▶ Open Nightjar Moth Hunt Lab (2D) simulation

What did you find?

Add reproduction steps (optional)