« | Home | »

Robotron 2084

For personal reasons, I have not been particularly productive over the last couple of years. This has been deeply frustrating to me, and at the suggestion of my friend Matt Neuburg I have started a series of fun development projects. The idea being to build things that I never plan to sell. Along the way, break the “writers block” I have been experiencing and learn some new stuff.

One of these projects has been an implementation of the classic Robotron 2084 video game from the 1980s for the iPad. I spent a lot of time as a youth playing this game, along with another Williams classic: Stargate, in local arcades. We became so good that we could play for hours on a single quarter, despite the game being incredibly hard.

Game Controllers

One of the key elements of Robotron was its use of two joysticks. One joystick controlled movement while the other controlled firing. I needed an analog to this for the iPad. I wanted to get as close as I could to that experience with my version of the game. After a lot of hunting, I finally found JSController project through the wonderful Cocoa Controls web site.

Initially I had no intention of creating a Mac version of the game, but when SpriteKit appeared in iOS 7 and Mac OS X Mavericks I had the opportunity to create Mac and iPad versions of the game. For this to work, I needed to get physical joysticks. I had an old LogiTech “Dual Action” USB game controller, so I set about trying to get that working. Mavericks introduced GameController.framework, but sadly that framework does not work with legacy USB controllers so I ended up turning to Dave Dribin’s DDHidLib.

SpriteKit

When I began this project, we had iOS 6. I was hunting for a simple 2D graphics framework on which to build my game. Cocos2D for iPhone seemed like the most mature of the free offerings, but somehow its complexity kept me at bay. I did a few experiments with it, but in the end it didn’t take hold.

Time passed and with the release of iOS 7, Apple introduced SpriteKit. It took me a while to notice SpriteKit, but I finally began working with it, and was successful in bringing up a few quick proof-of-concept tests. SpriteKit had the advantage of supporting both iOS and Mac OS X (much as Cocos2D does), so the idea of creating a Mac version of my game began to work in my brain.

Its been many years since I’ve written a game, so I won’t pretend that I can judge game frameworks in any meaningful way. However, I must say that SpriteKit was perfect for what I was trying to do. Getting 2D sprites onto the screen, moving them around, and playing sounds is trivial. I was on my way.

Reconstructing an Old Game

It turns out that a lot of people have spent a lot of time trying to reconstruct the Robotron game logic. They have gone so far as decompiling the original ROM code hoping to figure out exactly why the various enemies move the way they do.

For my attempt, I downloaded a couple of videos of people playing the game from YouTube, and set about reconstructing the logic as best I could. This is tough because there is a lot going on in Robotron that appears to be fairly random, but there are patterns if you watch long enough. However, with the videos and my memories of playing the game, I was able to recreate the game logic for several of the enemies.

The web also provided a lot of resources for reconstructing the sprite images used in the game. I’m sure I’m breaking copyright rules by using this imagery, but since its a personal project I decided to go ahead anyway. For game sounds, I extracted audio from the YouTube videos I downloaded using iMovie and Audacity.

Robotron for iPad

Conclusion

While the project is still very much a work in progress, it is playable through to level 5 and incredibly hard. Its fun, and I’ve learned a lot along the way. It has been nice to be able to create new code with relative ease after such a long time of feeling blocked.

Along the way, Ive discovered some non-obvious things about SpriteKit which I hope to write about in future blog posts.

I have to thank Matt again for encouraging me to move forward with projects like this. It has been a real help to me as I persevere with a difficult period in my life.

Download

If you want to give the game a go and you are handy with Xcode, you can download the source code for the game from GitHub:

github.com/alldritt/Robotron


About this entry