Boids

Brian Kirkby
Zappos Engineering
Published in
4 min readNov 6, 2015

The Zappos engineering blog design started with a birdwatching video.

At a company all-hands, our CEO showed the video to help inspire the journey to self-organization that Zappos is currently engaged in. I had never been exposed to birds behaving like this before and I was mesmerized by the beauty and chaos of the scene unfolding on the screen.

It’s clear why Tony was showing us the video since it’s a prime example of a complex system where the actors in the system act on localized information which then creates emergent behavior that is greater than the sum of it’s parts. Each bird in the formation (known as a murmuration) is only acting on knowledge about what it’s neighbors are doing. There is no manager bird standing on the sidelines telling specific birds where they should go or how they should behave.

When each bird simply reacts to their immediate environment, a sort of chaotic order emerges; the mesmerizing beauty of which would be very difficult to orchestrate.

Similarly, our move to self-organization acknowledges that no one has an omniscient view of all the working parts of the organization. Self-organization requires that those who are closest to the work be the ones making decisions about the work. Using a system that will facilitate this kind of distributed decision making creates it’s own ballet; chaotic, stunning, and beautiful, similar to what we see happening with the starlings.

While I could certainly appreciate the metaphor of the starling murmuration, I was also simply mesmerized by the natural ballet on display in front of me. I had an urge to reach out and interact with the bird cloud. What would happen if I swiped a finger through the middle of the cloud? How would the birds respond to a predator?

I dreamed of being a godlike giant where I could reach out and play with the starlings like so many stress-relief office toys, but alas there was really no way for me to do that.

Sure, I could make a computer simulation of those birds flying, but then I’d have to get it to display. Which, I suppose is doable as well, but then I’d have to create some interactions with the mouse to see how they respond, and that would… well… actually, that would be possible! After all, I’m a software engineer!

So I decided to give it a shot. After some initial attempts that didn’t quite have the flocking affect that I wanted, I discovered the Boids algorithm created by Craig Reynolds in 1986 and decided to just go with that.

I forked an unlicensed javascript implementation and added predators, attractors, and explosions to create a metaphor for self-management at Zappos.

Check it out at the Zappos Engineering Blog. (click on the “self-organize” link in the upper right)

The bigger and brighter dot in the middle is supposed to represent you being inserted into the self-organizing environment. It’s much easier to follow your bright dot and see what it does in the midst of all that organizing chaos.

The phrase “herding cats” has long been used by project and engineering managers to describe what it’s like to “manage” the creative souls that create fantastic software. The best software engineers are very interested in making an impact with their work which means they often have an opinion about what’s important for them to work on. Hence, managing them is much like what you would expect to get from trying to herd cats.

In our self-organization simulation you can move the mouse around trying to herd those teal dots. It might get to be a bit frustrating, but you can make it easier by pressing and holding the mouse button. If you want to force the issue, the teal dots will obey.

It doesn’t take much time to see the disastrous consequences of forcing the dots to focus on what you think is important, no matter their natural tendency. While you can create some beauty and even accomplish some things by commanding and controlling the dots, you’ll quickly notice that a lot of space is not being traversed. Anything outside of the small radius of the mouse is not even being considered. The dots are tripping over themselves to focus on your control and, after a short while, it becomes very clear that the price you pay to exert that kind of control simply isn’t worth it.

In our move to self-organization, it’s becoming increasingly clear that the characteristic trait that stands out in our people, more than any other, is a willingness to self-organize and, just as important , a humility to allow others to self-organize.

I hope you enjoy playing with this simple simulation of that self-organization journey.

-bk

P.S. Something I thought was interesting, the Wikipedia page for Boids mentions that there is a Boids implementation in the original Half-Life game by Valve Software. Valve is a storied example of self-organization working well and provides a model for what we are doing here in Zappos tech. I wonder if the author of Valve’s Boids implementation thought about the parallels between their work environment and the algorithm while they coded it up.

P.P.S. Another interesting note is that Medium, the blogging platform we are using for the Zappos Engineering blog, is also self-organized even using the same system that we use at Zappos.

--

--

Brian Kirkby
Zappos Engineering

father of six, twiddler of bits, thinker of thoughts.