🐝 Modelling Bee Colony Behaviour — A New Interactive for Secondary Biology
Published by lookang | sg.iwant2study.org | March 2026
Why Model a Bee Colony?
A honeybee colony is one of nature's most extraordinary computing systems. No single bee holds a map of the hive, yet thousands of individuals — each following a handful of simple rules about its nearest neighbours — collectively thermoregulate, navigate, and even vote on new nest sites. This is emergence: complex, coordinated behaviour arising from local interactions alone.
For Secondary 3–4 Biology students meeting concepts like adaptation, response to stimuli, and the organisation of living things, a bee swarm offers an almost perfect case study. But it is notoriously hard to observe in a classroom. That is why I built the Bee Colony Behaviour Model — a free, browser-based interactive that puts a living colony in every student's hands.
What Is the Interactive?
The Bee Colony Behaviour Model is a self-contained HTML5 simulation — no installation, no plugins, no login — that runs on any device from a school Chromebook to a mobile phone. It lets students adjust real environmental parameters and watch the colony respond in real time.
At its heart is an agent-based model (ABM): each bee on screen is an autonomous software agent with its own position and velocity. Agents sense only their immediate neighbourhood; there is no central controller. Global patterns — the tight "beard", the coordinated drift in wind, the pulsing waggle dance — emerge spontaneously from their local interactions, exactly as they do in nature.
Key Concepts Covered
The interactive is explicitly designed around five biology key concepts, displayed as hoverable chips at the top of the page:
| Concept | What the interactive shows |
|---|---|
| Agent-Based Model | Each bee obeys three local rules; complex swarm patterns emerge without a "leader" |
| Collective Behaviour | The colony acts as a superorganism — individual bees respond to neighbours, producing coordinated group dynamics |
| Thermoregulation | As wind increases, bees cluster to maintain ~35 °C inside the hive; outer bees insulate inner bees and the brood |
| Waggle Dance | Toggle on to see forager bees break into a figure-8 motion, communicating food source direction |
| Beard Formation | At high wind speeds, the cluster elongates into a teardrop shape — minimising aerodynamic drag while holding the group together |
Feature Tour
🎛️ Simulation Controls
Four one-click weather presets — ☀️ Calm, 🌬️ Breezy, 💨 Windy, ⛈️ Storm — immediately demonstrate how colony structure changes across conditions. Students can then fine-tune:
- Wind Speed (0–10 m/s): the most dramatic slider. Even a small increase to ~3 m/s triggers visible clustering. At 8–10 m/s the colony compresses into a dense teardrop beard.
- Wind Direction: a 3×3 compass grid (N, NE, E, SE, S, SW, W, NW) lets students test whether the beard always forms on the downwind side of the hive.
- Number of Bees (20–200): larger colonies cluster more effectively — a real phenomenon, as thermal mass scales with group size.
- Cluster Strength (0–1): the cohesion parameter (\phi_s) in the model, letting students decouple clustering tendency from wind intensity.
- Waggle Dance toggle: activates a figure-8 velocity perturbation on ~8 % of agents to represent returning foragers.
📊 Real-Time Graphs
Two live strip charts update every animation frame:
- Cluster Compactness (%) — derived from mean agent–centroid distance; rises sharply as wind increases, showing the beard transition quantitatively.
- Average Bee Speed — peaks briefly during the reorganisation phase as bees rush inward, then settles lower once the tight cluster is stable.
Students can read off these graphs to support written answers or data analysis tasks.
🖱️ Click-to-Label Canvas
Clicking anywhere on the simulation canvas drops a persistent text label at that point.
Students can annotate the display — marking "high-activity core", "peripheral guard bees", or "wind direction" — turning the screen into a digital field-sketch, excellent for practicals and e-portfolios.
🎨 Colour-Coded Bees
The colour of each bee reflects its local density, serving as a visual proxy for the thermal gradient inside a real beard:
- 🟠 Orange — high-density core (nurse/worker bees, ~35–38 °C)
- 🟡 Yellow-green — intermediate zone
- 🔵 Teal hollow circle — peripheral guard bees (~20–25 °C)
- Small direction arrows show each bee's instantaneous heading
The Mathematics Inside
One of the design goals was to make the simulation's equations fully transparent — so that curious students and teachers can see exactly what is going on. Clicking 📐 Mathematical Model at the bottom of the page expands a journal-style derivation of all 11 equations, rendered in crisp LaTeX.
Here is a brief tour of the core physics:
Euler Integration advances each bee's position each timestep:
\[\vec{x}_i(t+1) = \vec{x}_i(t) + \vec{v}_i(t)\]
Five forces are superposed to update velocity:
\[\vec{v}_i(t+1) = \mathrm{clamp}!\left(\vec{v}_i(t) + \vec{f}^{,\mathrm{sep}}_i + \vec{f}^{,\mathrm{ali}}_i + \vec{f}^{,\mathrm{coh}}_i + \vec{f}^{,\mathrm{wind}} + \vec{f}^{,\mathrm{clust}}i,;;v{max}\right)\]
The three Boids rules — Separation (avoid crowding), Alignment (match neighbours' heading), Cohesion (steer toward local centre of mass) — were first formalised by Craig Reynolds in 1987 and remain the canonical model for collective animal motion.
The two bee-specific additions are what make this more than a generic flocking simulation:
- Wind force (\vec{f}^{,\mathrm{wind}} = \alpha_w \cdot v_w (\cos\theta_w, \sin\theta_w)^\top) applies a uniform environmental perturbation on every agent.
- Colony centroid pull (\vec{f}^{,\mathrm{clust}}_i \propto v_w \cdot \phi_s) grows with both wind speed and user-set cluster strength — capturing the empirically observed switch to tight beard formation under adverse conditions in Apis mellifera.
The compactness observable plotted in the live graph is:
\[C(t) = \max!\left(0,;100 - \frac{\bar{d}(t)}{1.8}\right)\]
where (\bar{d}(t)) is the mean agent–centroid distance. A full parameter table (12 parameters with symbols, defaults, and descriptions) is also provided.
Built-In Quiz
A six-question quiz tests conceptual understanding by tying each question directly to a numbered equation in the derivation section.
Students are asked, for example, which force drives beard formation as wind increases (the colony centroid pull, Eq. 8), or why speed clamping is necessary (metabolic / biological locomotion limits, Eq. 9). Correct answers are highlighted green; incorrect answers show a targeted hint pointing back to the relevant equation — encouraging students to reconcile the maths with the visual behaviour they just observed.
A score banner gives tiered feedback from "Keep exploring — re-read the equations!" (0/6) to "Perfect score! You have mastered the bee swarm behaviour model." (6/6).
Pedagogical Design Decisions
Several deliberate choices were made to maximise learning:
- Presets before sliders — Students click a weather preset first (immediate payoff), then explore sliders (hypothesis testing). This mirrors the scientific method without requiring explicit scaffolding.
- Observation hints — Each preset updates an observation box ("Notice how the colony compresses and slows — the cluster absorbs wind energy collectively!"), narrating what to look for so students know what constitutes a valid observation.
- Equations after exploration — The maths panel is collapsed by default. Students meet the behaviour first; the formal model rewards curiosity rather than front-loading abstraction.
- Mobile-first responsiveness — The two-column grid (canvas + controls) collapses to a single column on screens narrower than 700 px. All sliders and buttons pass touch-target size guidelines, and the canvas uses
https://sg.iwant2study.org/ospsg/index.php/interactive-resources/biology" target="_blank" rel="noopener noreferrer" class="underline text-text-300 hover:text-text-100" style="color: rgb(61, 61, 58); font-family: "Helvetica Neue Light", HelveticaNeue-Light, "Helvetica Neue", Helvetica, Arial, sans-serif; outline: rgba(27, 103, 178, 0) solid 1.5748px; text-decoration: none; transition: color 0.3s; display: inline; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: hsl(210 70.9% 51.6%/1); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-text-opacity: 1; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid rgb(31, 30, 29); box-sizing: border-box; outline-offset: 2px; scrollbar-color: rgba(31, 30, 29, 0.35) rgba(0, 0, 0, 0); scrollbar-width: thin; text-rendering: optimizelegibility;">Access the Bee Colony Behaviour Model and all other Biology interactivesThe interactive is free, requires no login, and works on any modern browser. If you find it useful in your class or would like to suggest improvements, do leave a comment or reach out through the iwant2study.org portal.
Made by lookang, using Claude 4.6. Part of the Open Source Physics @ Singapore (OSPSG) project.