The story of a drawing robot
Posted in Uncategorized on February 27th, 2009 by ricardo – 6 CommentsA fitting start to the Tinkerhouse blog seems to be the history of the project that started it all, Shoebot.
Less coffee, more snakes
During my studies at the Piet Zwart Institute, i fell in love with the Python programming language; i had worked with Processing for a couple of years during my graphic design BA, but eventually reached a kind of dead-end since there’s only so much you can do with Processing’s limited scope of Java (which, nevertheless, is still a huge lot!), and just by looking at Eclipse’s interface i realised this step towards ‘serious’ Java programming was not for this little designer.
And Java is a pain in the neck for people, like me, who weren’t brought up as coders. As such, i remember spending most of my time looking for which closing bracket was responsible for the sketch’s weird behaviour, and i won’t even get started ranting about traditional ‘for’ loops, or the madness of ‘public static void’. I’m sure it makes a lot of sense to seasoned P5/Java hackers, but i never managed to cross the familiarity line.
Python just made it all beautiful: no more for (int i=0; i < range; i++)now i could just say for circle in list_of_circles and it would do the trick! No more Java for me, no sir. Michael Murtaugh at the PZI wonderfully guided us through the small intricacies of Python, and before we knew it we were already hacking on video, text, RSS scraping, databases and oh, so much more. Python never got in the way of our intentions, since the documentation is just a click away and its syntax is transparent enough so that, unlike Java, you can actually turn your thoughts into code almost effortlessly — one doesn’t even need to write pseudocode, as Python almost is pseudocode, with the difference that it actually runs it!
Drawing with code
My past experience with Processing eventually led me to consider looking into making small drawing tools with Python. During Michael’s classes i began hacking with PyCairo (the Python bindings to the marvelous Cairo graphics library), though i left them as they were — small hacks. Eventually it was time to consider what would be my final project, and after deciding for an application to work with digital typography (which would later become Lettersoup), i got more serious about the possibility of using code to create graphics.
The Lettersoup project would require some sort of back-end to handle vector graphics parametrically, preferably Python based. I took a look at Nodebox, which seemed to be exactly what i needed — with the small detail that it was Mac-only, and i was already a happy GNU/Linux user by then. Not even considering the possibility of getting a Mac, i went looking into the Nodebox code; and eventually found that it was very strongly linked to Cocoa, Mac OSX’s interface API. Even its console-runner had the Cocoa libs as a dependency, meaning that even when running a Nodebox script from the command line, it would have to load Cocoa. Not good for server applications, which were also something i was looking into.
So i set out to port Nodebox to GNU/Linux systems, but my inexperience in Python at the time made me give up scouring the Nodebox code and go back to my old PZI hacks to build up something similar — it didn’t help that the innards of the Nodebox code were sparsely documented, and me being an impatient coder certainly didn’t help either! Over time, and with crucial guidance and criticism from my tutors — Florian Cramer, Michael Murtaugh, Cal Selkirk and Aymeric Mansoux –, as well as my partners in crime at the PZI — Timo Klok and Alex Leray –, i came up with a little commandline application that could run Nodebox scripts; back then, it could only draw primitives and apply transformations. But through the power of Cairo, it could generate a 3000-path SVG file in half a second; being used to the waiting times of designer GUI apps, that was a pretty revelation. The first release was done around December 2007, if i remember correctly.
I eventually built up Shoebot (back then it was called ‘Shoebox’, but was later renamed because of the-shoebox.org) to support a couple more features i needed, more often than not referring to the Nodebox code to get enlightenment — particularly colour support and path handling, which needed a total rewrite of the path data classes since Nodebox used Cocoa’s bezier API and there wasn’t any equivalent i knew of; i remember feeling quite proud after seeing the beziers on the screen, based on ‘agnostic’ BezierPath classes (= not depending on any lib).
Eventually my little app was stable enough to serve as the back-end for my typography toy; Lettersoup was presented as my MA graduation project, got great feedback, and the story was apparently over back then.
Making friends
After finishing my MA studies and returning to Porto in mid-2008, i got contacted by Dave Crossland, whom i had met at the LGM2008 after a few excited e-mail exchanges concerning type design and code. Dave was very interested in both Shoebot and Lettersoup, giving me lots of great feedback on development possibilities for both projects; that marked the beginning of a wonderful partnership (the value of which i cannot yet put into words). Dave kept sending me pointers on how to make Shoebot a ‘proper’ free software community project, which was something i never realised the importance of. After putting up a little home page, bug tracker, Mercurial repositories and mailing lists (with the invaluable help of Aymeric and the magic GOTO10 servers), the results didn’t take long to happen.
A few people contacted me sending me patches and suggesting directions for Shoebot, and before i noticed there were already half a dozen hackers doing beautiful things with the Shoebot code and putting those up for inclusion in the project. This was totally exciting, as i was used to loner-style work (a leftover from graphic design education), and having extremely talented people doing great work for a common purpose was something i didn’t thought possible. It wouldn’t be fair to try and sum up all achievements and those responsible in this text (i’ll save that for a later post), but very quickly a lot of bugs were squashed, wonderful new features were implemented and a nice packaged 0.1 release was eventually done in Fall 2008.
Where do we go from here
Since then, the hackings haven’t relented and more beautiful stuff happened:
- Shoebot now supports all of Nodebox’s vocabulary and most of its features (including the Drawbot-inspired interface generation),
- it’s translated to 4 languages (Chinese, Japanese, Italian and Portuguese),
- it has a spiffy nice IDE much in the style of Processing’s sketchbook,
- a good part of Nodebox’s libraries were ported, welcoming Spiro curves, SVG and lots of other beautiful stuff to the Shoebot world,
- it sports a lot of great new features like video import (no export yet) and external control of scripts (via Pure Data or any other socket-enabled application)
- it runs fine on GNU/Linux (.debs are up!), almost fine on Windows; Mac support is being worked on (PowerPC users, we won’t forget you!)
And as you would expect, the TODO list runs long:
- make a proper manual and documentation, as well as introductory screencasts (ongoing)
- revamp the website and make it user-friendlier
- pimp it to the designer crowd and showcase some eye-opening examples and possibilities of usage
- support more vocabularies and languages — ContextFree, DrawBot, Processing are some of the possibilities –, if possible entwining them with Python
- offer back-end alternatives to Cairo for specific purposes — OpenGL, Mirra, and maybe 3D?
- make even weirder stuff, such as live-coding support and whatever we come up with in our collective nerdy hallucinations
As any FLOSS project, there’s always work to do — but we’re stubborn people who want to see their itches scratched in the best possible way! The shoebot-devel mailing list is a great spot to read about what’s going on and ask about whatever one might need; v0.2 is almost out, and spirits are high to aim for 1.0.
Looking back to what was a little application to draw SVG squares, i’m always getting surprised, overwhelmed and happy as to what this little tool became and the awesome people who found it useful and took some of their time to make it better, be it by submitting patches or e-mailing suggestions. It’s most of all a humbling sensation, and feeling part of a group effort to make our computers do pretty things gets me even more enthusiastic about what the future might bring.