ColorBoid Engine

Hi all Unity Developers!

I’m making a game based on flocking behavior. I am using Craig Reynold’s Boid model for the flocking AI. In addition, I have implemented a color transmission mechanic between neighboring flock members, which yielded some quite interesting visual results. So far, much of the development have been focused on optimizing the algorithms to support a large number of flock members, aka boids. The flocking uses the OpenSteer library, but it has been optimized for my use. This allows me to have 10k boids running at 100+ FPS at my desktop and 2500 boids running at about 40 FPS on my Galaxy S3. Next, I will focus on gameplay development.

Feel free to try the tech demo of the game engine I have dubbed ColorBoid, I’d love to hear your reactions. You can find a Windows build here:
http://dl.dropbox.com/u/3010788/ColorBoidEngine_Tech_Demo_v0.1.zip

In game screenshot showing 10k boids.

A video from the tech demo:

I think its amazing how birds, fish and insects, ect. can do this in real life.

This looks pretty cool.

That’s awesome. If you could somehow make that into a live wallpaper that would be awesome. I’m excited to see what the game to come out of this looks like.

Nice work, keep it up.

That’s one pretty looking demo.

Shameless self promotion… boids was the inspiration for this game (although it diverged pretty rapidly): http://itunes.apple.com/au/app/swimbles/id442912820?mt=8

It really is. This is part of my inspiration: http://www.youtube.com/watch?v=eakKfY5aHmY

Thanks!

Cute little game! Games having flocking incorporated to the gameplay seem to be few and far between. I’m looking forward to this one: http://glenncorpes.blogspot.se/2012/02/quick-video-of-some-big-herds.html

As you can see from my user name, I am brand new to Unity. My primary interest in the product is in attempting to rapidly prototype various swarming behaviours. What does your zip contain? Does your zip contain things that I can import into the free version of Unity 4 and attempt to modify/expand/enhance for my purposes? Your screenshot is very nice. Following Craig’s work, and the OpenSteer code was wise. Have you looked for an old copy (circa DirectX 8) of the DMBoids example? I am curious about your approach to partitioning the space, or are you sequentially calculating nearest boids, etc. Thanks in advance for any reply. Regards and good luck. (boids, again … on youtube … Ap)

Hi BrandSpankingNew, sorry for my late reply. Unfortunately, the zip only contains an executable for running the tech demo. Any publishing of code/assets/plugins will not come before the release of the game, but possibly after. In the meantime I can only point you in the right direction. For neighbor localization I basically use what is in OpenSteer (bin-lattice space partitioning). I search for only k-nearest neighbors (k = 14 looks good), up to some maximum distance. Check the paper “Spherical Indexing for Neighborhood Queries” by Nicolas Brodu for the currently best known algorithm to do this (I use a simplified version). You can find C# (.NET) ports of OpenSteer published but they had worse performance than the C++ version, due to garbage collection issues from excessive dynamic memory allocations. This is apparent for larger number boids and causes frame rate drops.
Not sure what you mean about DMBoids, but if you mean the Boids.cpp sample plugin to OpenSteer, then yes, my basic implementation is quite similar.

Overall I like to do rapid prototyping in Unity (I am used to Matlab!), specifically because of the possibility to adjust parameters live, and the quite powerful profiling. Sometimes I think there is too much happening under the hood that I can’t see or access though. Also, you may have to write some debugging visualization on your own. Good luck!

New cool video coming soon!

Sorry if I missed it. Is this in Unity or no?

Way cool.

Magnetic attractors and repulsor fields are when boid simulations get really interesting. Back in the mid-90’s I built “Boids in a Box” for SGI and then Win95, that used the same techniques borrowed from Reynolds original papers on the subject. I shall follow your work with interest.

Nice visuals, interesting to see how you can add gameplay.

Here is the new video (do watch in HD!):

It shows target homing using leaders (show in white) and hierarchical following (detailed in http://www.youtube.com/watch?v=XxhB54bEYsg), that I plan to incorporate in the gameplay.

Yes this is done in Unity! Code written in C#.

With OpenSteer C++? Or is that C# too?

Lots of potential here :slight_smile:

I started with a C# port of OpenSteer, but modified it quite heavily to make it faster. Still, it is C# only. I tried to stay closer to the original C++ version which was faster. There is UnitySteer too, but after much consideration I decided not to use that.

Yes, should be possible to make a lot of cool games from this tech! On many platforms too.