A real-time boids / flocking simulation running on an 800x480 8048S070 RGB panel with a touch UI, rendered using LovyanGFX.
The simulation is interactive: you can add boids by touching the screen and tune the flocking parameters live via sliders.
This project is inspired by and conceptually based on the Processing Flocking example:
https://github.com/processing/processing-examples/tree/main/Topics/Simulate/Flocking
Flocking is an emergent behavior model introduced by Craig Reynolds in 1987.
It simulates how birds, fish, or other agents move collectively without central control.
Each agent (“boid”) follows three simple local rules:
- Separation – avoid crowding nearby neighbors
- Alignment – steer toward the average heading of neighbors
- Cohesion – steer toward the average position of neighbors
Despite the simplicity of these rules, the group exhibits complex, lifelike motion.
- Real-time flocking simulation
- Touch-based interaction
- Tap simulation area to add boids
- Sliders to tune separation, alignment, and cohesion weights
- Buttons to clear or reset the simulation
Tested on:
- ESP32-S3 on a 800×480 8048S070 RGB panel
- Capacitive touch
- PlatformIO
- Arduino framework (ESP32)
- LovyanGFX
| Action | Description |
|---|---|
| Touch simulation area | Add a boid |
| Separation slider | Adjust personal space force |
| Alignment slider | Adjust heading matching |
| Cohesion slider | Adjust group attraction |
| Clear Boids | Remove all boids |
| Reset Simulation | Reset to initial state |
This project is inspired by the Processing example:
Flocking
https://github.com/processing/processing-examples/tree/main/Topics/Simulate/Flocking
The original idea and behavior model come from:
- Craig Reynolds — “Flocks, Herds, and Schools: A Distributed Behavioral Model”
