Gaming is cool you guys.
I’d like to talk a little bit about my educational background for a second. Aside from receiving a BA in linguistics, critical theory, and symbolic systems at Colgate University, I have had very little—if any—“formal” training in the computer arts. Bah! Haha. Formal!? I took a computer science class once and the coolest shit we built all semester was a lame cash register program that could calculate change based on a given input. Wtf are they teaching kids these days? My UP bracelet has more computing power than that. And I’d hope my brain does as well…
Anyways, after my adventure deep into the fairyland forest of liberal arts (which I totally loved, mind you), I decided it would be super fun to jump straight into a Master’s degree in “Digital Media.” Wtf is that? Don’t ask, I still don’t know… All I know if that I started taking classes at NYU’s Game Center (it was a little more fun than making P&L spreadsheets at Stern) and ended up in quite a few game design and development classes. I mean, where else do you get graded in how well you play Halo 4, or in your analysis of Heavy Rain’s so-called “Immersive UI.” Interestingly enough, I managed to get a Master’s Degree in “Digital Media” without ever once having to program a game or application myself.
The other night I was perusing some of the incredibly witty and not so informative presentations on speakerdeck.com and stumbled upon a few presentations about Ruby video game development.
Who doesn’t want to play with Ruby?! First of all, most games are build on C++ and C# or worse yet, Java and C.
Super cool game companies have written their own proprietary languages like id Software’s QuakeC and Epic Games’ UnrealScript, which is awesome. For them.
That really doesn’t help me at all so whatever. Screw them. It’s 5 am and I want to build a game in Ruby!!!
This guy knows what’s up.
I really don’t like reading anything that is a vague abstraction of a fairly straightforward concept. I spent the past 6 years doing that, and trust me, I loved it. I had to have loved it if I put myself through thesis after thesis on Derrida, Kafka, Benjamin—the whole god damn Frankfurt School xoxox #frankfurtschool—but these days, I really value clarity. I don’t want to spend 8 hours musing over one line of code like I’d spend analyzing Heidegger’s Being and Time. Maybe I’m an asshole, I don’t know, but I feel like to design a good system is to design a clear system. So it only makes sense to me that instead of reading some dude’s convoluted and abstract instructions on how vaguely to build a game using Ruby, that I follow some clear as glass tutorial and then fill in that whole understanding part after the fact.
I decided to build a ruby version of the game Breakout based on this tutorial. Mark (the dude giving the tutorial) is pretty clear in explaining WHY he is doing things and I found the experience quite pleasant, aside from his incessant chewing and coughing.
First of all, please check out my SpeakerDeck Presentation: A Brief History of Action Games.
I got a little bored midway through so I stop at Breakout, but that’s cool cause that’s the only game you need to know about for now.
What is an “Action Game,” you ask?
Wikipedia says the following:
The action game is a (https://en.wikipedia.org/wiki/Video_game_genres “Video game genres”) that emphasizes physical challenges, including hand–eye coordination and reaction-time. The genre includes diverse subgenres such as (https://en.wikipedia.org/wiki/Fighting_game “Fighting game”), (https://en.wikipedia.org/wiki/Shooter_game “Shooter game”), and (https://en.wikipedia.org/wiki/Platform_game “Platform game”), which are widely considered the most important action games, though some (https://en.wikipedia.org/wiki/Real-time_strategy “Real-time strategy”) games are also considered to be action games.
…Wiki says it better than how I could describe it so we will go with that one. In terms of examples, action games started with Pinball, moved to Pong, Breakout, the nerd-idol Space Invaders, Pac Man, Donkey Kong, Zelda (more action adventure), and so on.
I did a lot of game design in my masters but pretty much paired up with a CS kid in order to prototype games when project time came around. From what I could gather, the general programming logic of a video game is as follows:
The central component of any game, from a programming standpoint, is the game loop. The game loop allows the game to run smoothly regardless of a user’s input or lack thereof. Most traditional software programs respond to user input and do nothing without it. For example, a (http://en.wikipedia.org/wiki/Word_processor “Word processor”) formats words and text as a user types. If the user doesn’t type anything, the word processor does nothing. Some functions may take a long time to complete, but all are initiated by a user telling the program to do something. Games, on the other hand, must continue to operate regardless of a user’s input. The game loop allows this.The game loop may be refined and modified as game development progresses, but most games are based on this basic idea
Look Ma, I Built a Game!
First of all, feel free to check out my version of Breakout on Github and follow along!
What I used:
Ruby has a few Game Development Libraries, two of which are pretty popular: (1)RubyGame and (2) Gosu. I chose to work with Gosu because word on the street is the RubyGame is not actively maintained and Gosu is a little easier to use.
Gosu, my new best friend.
Find it here: https://github.com/rubygame/rubygame
Ruby Wrapper uses SWIG to call C++ (if you don’t know what SWIG is read up on it here.)
Uses OpenGL for Rendering
The best part about Gosu?
gem install gosu
Then you just require ‘gosu’ at the top of your breakout.rb program like so:
You then create classes for the Ball, the Brick, the Paddle, and then GameWindow, which is a superclass of Gosu. See my code or watch Mark do a fairly informational walk through of the process in this tutorial.
This was really just an exercise in following instructions, and trying to figure out what the hell all of it meant after the fact. All the breakout game is, in essence, is a bunch of simple classes and instances of classes.
For those of you interested in more info, hit me up via any social media or check out my site: samantharadocchia.com
Other games built with Ruby:
More Resources for Building Games in Ruby: