This is my second attempt at boids in godot. I've implemented an acceleration structure which is a spatial partitioning scheme which optimizes the nearest neighbor lookups. All boid locations are stored in a 2D grid which represets the space. The boids query the structure to the cells in it's vacinity. The boids then filter that list based on their view range. This way the boid isn't looping over the entire list of neighbors. It's only concered with it's immedaite surroundings.
For more information on boids see Craig Reynolds Boids. A more detailed breakdown of Boids with pseudocode can be found here.
Click F5 to run the default scene
Controls:
- left click - place a target flag
- right click - clear flags
- space - toggle controls UI
- escape - exit
- G - toggle visible grid
- V - toggle glow effect
- R - respawn boids
- Q - reset simulation (factory reset the boids)
- GUI borrowed from RKelln's fork of this repo. They added a lot of amazing special effects! Check it out it's very cool!
- This project uses the FarmPuzzleAnimals pack created by CoMiGo