Predator Escape
A simple model that depicts how boids perceive and escape predators
Details
Meaning of boid colors:
- Light Blue: The boid hasn't detected any predator. The predator may lie in its blind spot, or it may be far away.
- Green: The boid has detected the predator, but the predator is not that close
- Red: The boid has detected the predator, and the predator is close enough to be a threat
- \( d < r_1 \): Predator avoidance will dominate the boid's behaviour
- \( d > r_2 \): The boid will continue to follow the rules of collective behaviour
- \( r_1 < d < r_2 \): The boid will follow a weighted average of predator escape and collective behaviour. The weight of predator escape 'w' is given by: \[ w_p = \frac{d - r_2}{r_1 - r_2} \] The weight of collective behaviour is therefore \(w_c = 1 - w_p\). The boid will seek to move in the direction given by the weightage average of these two instincts.
Note:
- This simulation is preferably viewed on a desktop/laptop.
- The method of combining both behaviours is inspired by a similar method in molecular dynamics: in order to reduce the time complexity of molecular simulations from \(O(N^2)\) to \( \approx O(N) \), one can cutoff the operating potential at some distance \( r_c \). However, this causes the force to be discontinuous at \( r_c \). This problem presents itself in the form of anomalous acceleration of individual molecules. In order to remedy this, one defines two radii \( r_1 \) and \( r_2 \), and brings the potential down to zero between these two radii in a smooth manner using switching functions of various degrees.
Developed by ChanRT | Fork me at GitHub