Tag Archives: opensource

Angry Birds & Box2D: An Open Source Holiday Wish

I have been spending far too much of my time over the last week or so playing Angry Birds. It’s a simple, clever, and addictive game which seems to have captivated large part of the human population (just yesterday, I heard a woman on the subway exclaim: “Take that, you %$!# pigs!”). Along with immense popularity, the game has also brought in millions upon millions of dollars for Rovio, the Finnish game company who created the concept and built the game. Though exact figures are unclear, the game has had upwards of 50M downloads, and brings in $1M per month in ad revenue alone. It’s likely that Angry Birds has made upwards of 100 million dollars.

For those that haven’t played, the gameplay is straight-forward: you launch birds out of a slingshot, in an attempt to collapse structures that are protecting egg-thieving pigs (it’s more fun that it sounds). A large part of the effectiveness of the game comes from the fact that these structures – built from blocks, triangles, and cylinders of various materials, react with realistic physics; the blocks knock each other over, the cylinders roll down hills, and the triangles act as convenient ramps.

I can’t say this for sure, but it’s very very likely that Angry Birds is built on top of Erin Catto’s excellent Box2D physics engine. Box2D is a set of libraries for C++ which makes it easy to build rigid body physics simulations – which is, essentially, what Angry Birds is. [EDIT: It has been confirmed that Angry Birds does in fact use Box2D]

Box2D is released with a very liberal open source license – it can basically be used by anyone, for anything. The only requirement is that, if and when source is released, the code has to be attributed to Erin, and can’t be claimed as original. There is absolutely no legal requirement for anyone using Box2D to pay for it in any way.

But is there an ethical requirement? The founders of Rovio are very, very, very rich men – thanks to Angry Birds. If, indeed, Angry Birds relies as heavily on Box2D as I suspect, they are also very, very, very rich men thanks to Erin and Box2D.

I’ve often thought of open source as a gratitude economy – people maintain and distribute projects largely because they are fueled by the thanks that they receive. By releasing Box2D with such a generous license, Erin Catto was clearly aware that he wouldn’t be profiting from its use. Likely, he’s been happy seeing his project used in so many interesting ways. I can’t imagine that he ever expected someone to make such a ridiculous fortune from his code, on the scale of Rovio and Angry Birds.

Of course, Rovio may have built their own physics engine for Angry Birds. And, even if they didn’t, they are perfectly within their rights to keep every penny, and not say a word about Erin or about Box2D.

With Christmas just around the corner, though, I can’t help but imagine an ideal world – in which Erin Catto receives some kind of an unexpected bonus. An open source holiday wish?

7 Days of Source Day #7: Variance – Better Design Through Genetics?

Project: Variance
Date: January, 2007
Language: ActionScript 2
Key Concepts: Genetic Algorithms


I’ll admit – this is some fairly dusty code. But I wanted to end this 7 (or 25) days of source release with this project for a reason: I think it’s a pretty good idea. I took it to a prototype stage but not much further – maybe someone will find the time to move it forward into something more functional.

Variance is a tool that lets you evolve graphics, from pre-built ‘sets’ of elements and typefaces. It combines some simple editing tools (you can manually change colour, position, rotation, etc.) with some evolutionary magic – you can select two different compositions and hybridize them to get a new set of graphics that share some of the properties of their parents. It works fairly well; usually within about 6 generations you can get a graphic that starts to look pretty good (starting from some jumbled random compositions).

When I was building this tool, I imagined how nice it would be if this kind of functionality was built into a ‘traditional’ tool like Illustrator. Working on a logotype, and are feeling a bit stuck? Have the application generate 9 mutations of your current design, then evolve those for a few generations until you get a result you like. Just getting started on a poster design? Pick some assets and have the Variance plug-in generate some possibilities. In both of these cases, the designer is still being a designer – picking the best results, tweaking layouts – but they are letting the genetic algorithms do the grunt work of coming up with possible variations. At the same time, they are allowing for mutations; often modifications that they may not have tried themselves. This is a very direct application of an Evolutionary Creative Process (ECP), which I’ve talked about before on this blog.

Utility aside, it’s fun to play with.

Getting Started:

You can see Variance in action here: http://www.blprnt.com/variance

To read more about the project and to get a walk-through, you can read this post (you may want to do this before you try the application)

You’ll need Flash to get into the source and to get working with it.

Download: VarianceSource(4.12 MB)


This software is licensed under the CC-GNU GPL version 2.0 or later.

7 Days of Source Day #6: NYTimes GraphMaker

NYTimes Drug Diptych

Project: NYTimes GraphMaker
Date: Fall, 2009
Language: Processing
Key Concepts: Data vizualization, graphing, NYTimes Article Search API


The New York Times Article Search API gives us access to a mountain of data: more than 2.6 million indexed articles. There must be countless discoveries waiting to be made in this vast pile of information – we just need more people with shovels! With that in mind, I wanted to release a really simple example of using Processing to access word trend information from the Article Search API. Since I made this project in February, the clever folks at the NYT research lab have released an online tool to explore word trends, but I think it’s useful to have the Processing code released for those of us who want to poke around the data in a slightly deeper way. Indeed, I hope this sketch can act as a starting point for people to take some more involved forays into the dataset – it is ripe to be customized and changed and improved.

This is the simplest project I’m sharing in this now multi-week source release. It should be a nice starting point for those of you who have some programming experience but haven’t done too much in the way of data visualization. As always, if you have questions, feel free to send me an e-mail or post in the comments section below.

You can see a whole pile of radial and standard bar graphs that I made with this sketch earlier in the year in this Flickr set.

Getting Started:

You’ll need the toxiclibs core, which you can download here. Put the unzipped library into the ‘libraries’ folder in your sketchbook (if there isn’t one already, create one).

Put the folder ‘NYT_GraphMaker’ into your Processing sketch folder. Open Processing and open the sketch from the File > Sketchbook menu. You’ll find detailed instructions in the header of the main tab (theNYT_GraphMaker.pde file).


It’s starting to get a bit repetitive, but once again this file depends on Karsten Schmidt’s toxiclibs. These libraries are so good they should ship with Processing.

Download: GraphMaker.zip(88k)


This software is licensed under the CC-GNU GPL version 2.0 or later.

7 Days of Source Day #4 – BC Budget Visualization Tool

BC Budget Visualization Tool

Project: BC Budget Visualization Tool
Date: September, 2009
Language: Processing
Key Concepts: Data visualization, data organization, sticking it to the man


More and more data is being released to the public every day. Big initiatives like the US data.gov and the UK’s upcoming data.hmg.gov.uk are resulting in a mountain of interesting data sets. These transparency initiatives are a step in the right direction, but we are quickly going to find ourself with a surfeit of data, and a very limited number of people with the skill set to do something with it.

One solution to this is to standardize the data so that generic tools can be built to dig into the data sets. This is a great idea – but it will take a lot of work, along with something that governments are not typically too good at: consensus.

Until that happens, tools like Processing offer another solution – make small, custom tools for individual data sets which can be built quickly and can be used specifically to work with the characteristics of a specific data set. Because Processing is fairly simple, journalists, researchers and activists can all be empowered to investigate data themselves, without having to rely on expensive or difficult to acquire resources.

This sketch is an example of how this might work. I wanted to investigate the recently announced staggering Arts & Culture cuts in my local government‘s budget, and built a simple tool to do that. All told, it took about 5 hours to gather the data, produce this tool and get the results out on the web – certainly a turnaround time that would be useful for media and for activists looking to be quick with their responses.

Getting Started:

Move the sketches into your Processing sketch folder. Open Processing and open the BCBudget sketch from the File > Sketchbook menu. You’ll find detailed instructions in the header of the main tab (the BCBudget.pde file).


Again, this project uses Karsten Schmidt’s amazing and incredibly useful toxiclibs.

Download: BCBudget.zip (12k)


This software is licensed under the CC-GNU GPL version 2.0 or later.

7 Days of Source Day #2: NYTimes 365/360

NYTimes: 365/360 - 2009 (in color)

Project: NYTimes 365/360
Date: February, 2009
Language: Processing
Key Concepts: Data Visualization, NYTimes Article Search API, HashMaps & ArrayLists


Many have you have already seen the series of visualizations that I created early in the year using the newly-released New York Times APIs. The most complex of these were in the 365/360 series in which I tried to distill an entire year of news stories into a single graphic. The resulting visualizations (2009 is picture above) capture the complex relationships – and somewhat tangled mess – that is a year in the news.

This release is a single sketch. I’ll be releasing the Article Search API Processing code as a library later in the week, but I wanted to show this project as it sits, with all of the code intact. The output from this sketch is a set of .PDFs which are suitable for print. Someday I’d like to show the entire series of these as a set of 6′ x 6′ prints – of course, someday I’d also like a solid-gold skateboard and a castle made of cheese.

That said, really nice, archival quality prints from this project (and the one I’ll be releasing tomorrow) are for sale in my Etsy shop. I realize that you’ll all be able to make your own prints now (and you are certainly welcome to do so) – but if you really enjoy the work and want to have a signed print to hang on your wall, you know who to talk to.

Getting Started:

Put the folder ‘NYT_365_360’ into your Processing sketch folder. Open Processing and open the sketch from the File > Sketchbook menu. You’ll find detailed instructions in the header of the main tab (the NYT_365_360.pde file).


Most of the credit for this sketch goes to the clever kids at the NYT who made the amazing Article Search API. This is the gold standard of APIs, and really is a dream to use. As you’ll see if you dig into the code, each of these complicated graphics is made with just 21 calls to the API. I can’t imagine the amount of blood, sweat, and tears that would go into making a graphic like this the old-fashioned way.

Speaking of gold standards, Robert Hodgin got me pointed to ArrayLists in the first place, and has been helpful many times over the last few years as I’ve tried to solve a series of ridiculously simple problems in Processing. Thanks, Robert!

Download: NYT365.zip (140k)


This software is licensed under the CC-GNU GPL version 2.0 or later.