Look Ma, I built a Game!
LOOK MA, I BUILT A GAME!
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.
âŚ. yeah
fuck that.
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.
EW!
YUCK!!
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 video game genre that emphasizes physical challenges, including handâeye coordination and reaction-time. The genre includes diverse subgenres such as fighting games, shooter games, and platform games, which are widely considered the most important action games, though some 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 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
C++ Library
Ruby Wrapper uses SWIG to call C++ (if you donât know what SWIG is read up on it here.)
Uses OpenGL for Rendering
Actively Maintained
The best part about Gosu?
gem install gosu
done.
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.
https://github.com/SamanthaRadocchia/breakout-game
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:
http://www.youtube.com/watch?v=_VmOiZVc7pM
http://www.libgosu.org/cgi-bin/mwf/board_show.pl?bid=2
More Resources for Building Games in Ruby:
http://manwithcode.com/310/making-games-with-ruby-ep-2-setup/
https://speakerdeck.com/cadwallion/game-development-and-ruby
https://speakerdeck.com/sausheong/playing-with-ruby