Boids algorithm to simulate birds or fishes flocks
Community Forums/Showcase/Boids algorithm to simulate birds or fishes flocks
| ||
Hello, here is an implementation of Craig Reynolds boids algorithm, written in Blitzmax. I intended to use this to manipulate small "armies" for a game but I'm not sure it is suitable for my needs. Maybe someone will find it useful.![]() Video with 1000 boids : https://youtu.be/WUXq7GYH62Y Source code : http://www.blitzmax.com/codearcs/codearcs.php?code=3297 This helped me to learn types synthax in Blitzmax and especially types that differs from Blitz3D, I hope the code is not a mess :D Anyway it's quite fast I think (or Blitzmax is fast, really fast when you come from Blitz3D !), depending of the number of boids of course and the number of neighbours each boids has to process. If you're interested, check the code archive link, you can tweak some parameters to make different patterns. |
| ||
I do remember there's already a boid demo somewhere but not sure but this is just awesome Flanker! thanks for sharing. :D |
| ||
Thanks RustyKristi. I found a video on youtube about boids saying it's written in Blitzmax too but nothing in the code archives : https://youtu.be/QKfDqnc41SQ |
| ||
Hey Flanker, Here it is which is lost in the forums unless you do a proper search: http://www.blitzbasic.com/Community/posts.php?topic=99409 I just posted it in code archives for posterity and proper link. full credits to Drak. http://www.blitzbasic.com/codearcs/codearcs.php?code=3298 |
| ||
Hello Flanker. Nice video. And a lot of boids agents there. The algorithm is very effective. The video you link is my demo. I wrote it a few years ago for use in a game i was writing at the time as extra eye candy. Keeping each boids schoal down to under 20 or so, it was quite usable in game with very little performance hit. My fish demo here uses about 50 boids i think. And here's the game i was writing with the boids swimming about in the water. At about 38 seconds in. Both written in Blitzmax. |
| ||
Nice one Trinosis, the fishes look natural, it's interesting to see an actual use for this algorithm in a video game. I've been looking for your code in the code archive but nothing so I had to write my own :p |
| ||
I did my Uni dissertation on Alife, very interesting stuff! * Boids * Cellular Automaton * Langton's ant |