FlockingSimulation
This is a simple Android app, completely written in Kotlin to simulate flocking behavior based on Craig Reynolds's Boids algorithm.
Install / Use
/learn @jayasuryat/FlockingSimulationREADME
Flocking Simulation / Boids
This is a simple Android app, completely written in Kotlin to simulate flocking behavior based on Craig Reynolds's Boids algorithm.
[Wikipedia] Boids (which refers to a bird-like object) is an example of emergent behavior; that is, the complexity of Boids arises from the interaction of individual agents (the boids, in this case) adhering to a set of simple rules. The rules applied in the simplest Boids world are as follows:
- Separation: steer to avoid crowding local flockmates
- Alignment: steer towards the average heading of local flockmates
- Cohesion: steer to move towards the average position (center of mass) of local flockmates
Demo
<img src="https://github.com/JayaSuryaT/FlockingSimulation/blob/dev/demo/demo.gif" alt="Demo gif" data-canonical-src="https://github.com/JayaSuryaT/FlockingSimulation/blob/dev/demo/demo.gif" width="270" height="585" />
Adjust the coefficients for the three rules for different behaviors.
<img src="https://github.com/JayaSuryaT/FlockingSimulation/blob/dev/demo/all.gif" alt="All controlls gif" data-canonical-src="https://github.com/JayaSuryaT/FlockingSimulation/blob/dev/demo/all.gif" width="270" height="585" />
| Only separation | Only alignment | Only cohesion | | -- | -- |--| | <img src="https://github.com/JayaSuryaT/FlockingSimulation/blob/dev/demo/seperation.gif" alt="All controlls gif" data-canonical-src="https://github.com/JayaSuryaT/FlockingSimulation/blob/dev/demo/seperation.gif" width="270" height="585" />| <img src="https://github.com/JayaSuryaT/FlockingSimulation/blob/dev/demo/alignment.gif" alt="All controlls gif" data-canonical-src="https://github.com/JayaSuryaT/FlockingSimulation/blob/dev/demo/alignment.gif" width="270" height="585" />| <img src="https://github.com/JayaSuryaT/FlockingSimulation/blob/dev/demo/cohesion.gif" alt="All controlls gif" data-canonical-src="https://github.com/JayaSuryaT/FlockingSimulation/blob/dev/demo/cohesion.gif" width="270" height="585" /> |
Logic
- All the behaviors are abstracted behind FlockBehavior interface.
- All the applied behaviors are determined from FlockBehaviorProcessor class, you may add / modify / remove any behavior easily from here as desired.
Thanks
Thanks to Daniel Shiffman for his awesome video about boids / flocking simulation.
Related Skills
node-connect
345.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
104.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
345.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
345.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
