Guard bees patrol in a ring around the hive entrance. When a predator crosses the detection radius, nearby idle guards break formation and converge on it, forming an attacking cluster. Each attacking bee contributes a fixed defense power per second; once accumulated damage exceeds the predator's strength, it is driven off and the guards return to patrol. If the predator reaches the entrance before enough guards have converged, it breaches the hive and a handful of bees are lost before it withdraws.
requiredGuards = ceil(threat.strength / power)
damage += attackers.length * power * dt
defended when damage >= threat.strength
breach when threat.dist(entrance) < arriveRadius
- Guard bees — total colony guard force; a bigger force can cover more simultaneous threats and wins fights faster.
- Threat frequency — how often hornets, birds and mammals spawn automatically from the tree line.
- Defense power / bee — damage each engaged guard deals per second; stronger stings shorten every fight.
- Hornets / wasps — fast, moderate strength, arrive in short solo sprints.
- Birds — very fast diving strikes from height, moderate-high strength, hard to intercept early.
- Mammals — slow ground approach but high strength, so they demand a large converging group before they reach the entrance.
Real-world relevance: this mirrors how a honey bee colony's collective defense scales with colony strength — small or weak hives with few guard bees lose disproportionately more encounters than large healthy ones, exactly as beekeepers observe with real wasp, woodpecker and mammal pressure.