00:00:30.119
We are about to hear from Chris Dillon, the man who created the internet-famous 'cat faucet.' Has anyone heard of that? It blew up on the internet some time ago, and it was awesome. Chris invented an automatic faucet for his cat, so when the cat comes near, the faucet turns on, and when the cat goes away, it turns off. Cats only ever want to drink the coldest, freshest water, which is usually given to them by your hand while they look at you. Chris is into a lot of hardware hacking kinds of things. He is a member of PDX.rb and speaks regularly at our meetup in Portland. This talk is sure to please; I have actually seen a version of this, and it is fantastic. You have a treat coming up. I want to mention, real quick, that I think Chris is the only person to have ever written a Redis client inside of Minecraft, in Lua, inside of a modded Minecraft. He could track and monitor his Minecraft nuclear reactor and extract data from it, which he can then graph or export to New Relic, or whatever he wants. I think this is pretty awesome. Okay, I'm going to stop talking now and let you all hear from Chris. A round of applause, please, for Chris.
00:01:47.880
Okay, um, I'm going to be talking about this animation project I did called Dream. It's a gem in Ruby. So this all started in 1991. Now you might fall asleep because you've got all these years to listen to me talk about my biography, but I'm going to try to skip past all that setup. Although it's all true and it's all part of the context, which is always the hardest thing to warm up to and get the context set. But I really want to focus on the idea that all these things, which I think are really awesome right now, are about you guys and not me. So it's about peers and the inversion of control, or the inversion of content. What would YouTube be without all of you? So this is like a show-and-tell, and it should be entertaining, but I'm going to get to the gem part and the library stuff that you guys can work with if you want.
00:02:51.519
I’ve been doing music-related stuff. It all started with a funny story. MIDI has not changed since 1991, which is kind of awesome. It's like Legacy; you learn it once, and then you have that knowledge for the rest of your life. This is okay; maybe don’t learn all of it. But I was actually being serious. It all started with Cakewalk; that was my first program. It was a music arrangement tool, and then, I guess, nothing really changed until computers got better in the late '90s, and we got wave editors like Audacity and GoldWave.
00:03:32.000
So I guess my point is there's this history of programming languages and operating systems, and as you keep going through each one, you bring what you learned before. The generic stuff stays forever. Right now, I'm in love with Ableton Live and Ruby, but those things aren't the end of history. Whatever displaces Ableton Live or Ruby is, by definition, going to be awesome, at least to me. And that's good. The point is, experiences are not really repeated; I kind of hate that. You know how a guy is on a job for 10 years and essentially repeats that one year of experience over and over again? I’m sure that happens, but that's kind of depressing to me. I don't think experiences are repeated that often. Sure, tools change, but general patterns last forever.
00:05:12.199
Anyway, there are three threads in my skill set: audio production, graphics development, and Ruby. Audio production just happens by default; I’m earning zero American dollars doing this. It's just something you can’t stop doing. Even if someone tells you you're not making any money, you just do it. I'm terrible at graphics development. I did some pixel art for a project, which was a 2D array, but I don't identify myself as a designer. Then there's Ruby, which I want to talk about in the context of this project. Ruby allowed me to touch on a domain and then come back out. Many people think they can prototype something in Ruby and then rewrite it in something more serious. That's true, but you also get to experience more things because it's faster, and you don’t have to worry about memory management.
00:06:29.680
Rubies give you more access to universal concepts, especially in cases like pixel art and animation. I never get this question, but I know a lot of creative people do. Especially, I'm sure you’ve seen famous musicians asked about it, like Paul McCartney. It's around the idea of how you come up with ideas. I don't get this question, but I know it’s common, and it's a hard question to answer. For me, I usually get one idea for a project or a gem, and it sparks my interest, like an itch I have to scratch. You have this idea, and every programmer has this 'Untitled' text buffer, right? Like an empty document in Sublime. This leads to the question of how we know what to type.
00:07:59.159
I think outsiders think that this is where it starts: an empty canvas that could be anything, which can be both a good and bad thing. If you want something to exist, you are willing this idea into reality. You know there will be resistance, but if you really want it, you just keep working at it. This is the difference between me and many people who write really amazing gems. They just keep going; it takes discipline. This is the default screen for Ableton. When you boot it up, you’re greeted with a ton of options.
00:09:07.880
For this particular project, it started with this clavichord sound, which somewhat resembled a guitar. I hooked it up to an expression pedal for a bit more expressiveness, and that carried a lot of the emotion in the development of the animation. I began this project by naming it 'Dampy Patties.' I don't even know why I choose that name; maybe because I'm Irish and live in Portland, it's like damp. As you can see, I'm doing manual version control because I haven't found an in-between between Git and SoundCloud.
00:10:35.240
The important thing is the project came out to about one gigabyte of sound data, not even including video, just samples. When mixing it down, the file size reduced significantly from about a gig to about six megabytes as an audio file. This illustrates the work-to-content ratio of any creative project, where a considerable amount of work leads to a very short piece of finished audio or visual content. The animation took about a month to produce roughly four minutes of content.
00:11:37.760
Let’s talk about the music aspect. The very first track displayed, with all the bars, looks like Morse code; that’s a MIDI track. If I exported that, I’m pretty sure my DOS machine from 1991 could play it. MIDI has not changed; it’s just events and velocities represented as numbers in an array that tracks keys. Unlike MIDI, wave files were produced from various editing processes, and the extra visual details will be for show.
00:12:43.519
So regarding visuals, I knew I wanted animations that accompanied the song's lyrics, which tell a story. I experimented with various graphics development tools in the past, including Processing and Flash, but wanted to play with gamebox.io, which I had heard of. It turned out that gamebox.io was perfect for my needs. It organizes animations like an elementary school play: with a stage, a manager, actors, and scenes. Thus, creating a non-interactive animation for my music video was seamless.
00:13:38.920
To demonstrate how the gem works, it creates a window that will start maximized. It creates an application through Gosu, and I hope it goes full screen and that I have audio for this presentation. [Music plays] Now the animation plays, providing the visual backdrop to my music.
00:17:45.240
This is the part of the talk where we typically revert to slides—but I have a story that connects to what we've been doing. We once played a show in a field, where there was a DJ and a live band. The DJ played a record with an incredible bass that was so produced, and the rest of the band couldn't compete with it. That moment reminded me of additional aspects of production, including this presentation today, as we switch back to slides.
00:19:38.440
I want to share more details about the gamebox gem, which relies heavily on Gosu for rendering. The first command installs Gosu, and once you have it, you can install the gamebox gem. You basically set up a structure with a Gemfile and Rakefile, allowing you to include all of your assets effectively. I didn’t focus on testing per se, but the gem provides the scaffolding needed for any project.
00:20:56.399
The tricks used in this project can be broken down into sprites, tweening, and timers. Sprites are images that are part of the animation. A sprite sheet is an arrangement of sprites into a grid that is extracted as a film strip. Tweening smooths out animation, making it appear dynamic. The gem also offers a DSL to define actors by their naming conventions and allows for different properties through mixins, like graphical appearances and behaviors.
00:22:47.440
In addition to this, timers are incorporated for controlling sequences and actions in the animation synchronously. Using the appropriate mixins, you can add animated frames for each character or object, which can also include complex properties for their behaviors. For this project, I collaborated with a gem creator, Sean Anderson, who helped provide additional features for animating more fluidly.
00:24:45.120
As the project developed, I knew I had to use layers and properties correctly to create a parallax effect. This effect enhances the depth within 2D experiences, making static backgrounds move at different speeds from the primary action, creating the illusion of depth. I used this to create a more engaging scene that mimics what you’d see in classic arcade games.
00:26:44.200
We implemented a smooth motion system allowing all actors to contribute to this effect, and various textures were added to enhance visual dynamics. However, when working on this, I found that I had to avoid drawing to off-screen buffers prematurely. Although this technique is usually employed to improve performance, it backfires because it led to inappropriate random graphic artifacts.
00:29:00.000
With my work wrapping up, I realized that I had made notable mistakes during the development process, particularly with the aspect ratio of the graphics. Starting at 640x480 for assets created additional challenges when I decided I wanted a different wide-screen layout. This distorted the behavior of the parallax layer, breaking the composition. Fortunately, this was rectified before finalizing the project. I want to extend my thanks to Sean Anderson, who has been helpful throughout the development of this gem.
00:32:22.500
Thank you for your attention! I had a great time presenting this, and I hope you found some inspiration in my insights into using Ruby for creative projects!