Sprocket Invaders
Volume Number: 13
Issue Number: 2
Column Tag: Game Development
Shift into High Gear with Apple Game Sprockets
By Jamie Osborne, Apple Computer, Inc.
Turning your game idea into a reality, step by step
In the Beginning, There was a Cool Idea...
So, you want to write a cool game for the Macintosh. Well, you're in luck. This article
will take you step-by-step through the whole process, beginning with an idea for a
game, all the way to playing with your friends over a network. It will deal with loading
and blitting sprites to the screen, getting input from any input device, no matter how
snazzy, generating sounds that are correctly attenuated for distance and location, and
doing all the work necessary to play your game over a network.
If that sounds like way too much to cover in a single MacTech article, you're right. At
least, you would have been right if this article were written a year ago. Since the
advent of Apple Game Sprockets, it is now possible to discuss everything you need to
know (with a small amount of strategic glossing-over) in the space of a single article.
I won't be able to delve deeply into each of the Sprockets, but that's OK because there's
an on-line reference manual for that. I'll also gloss over some of the details about how
to do things, such as how to load or store resources, or what goes into the application
shell. However, the entire source for the game I will develop here is available with
this issue's code disk, as well as on the Internet.
Now, what game am I going to do? A snazzy 3D blood bath like Marathon? No. A
multi-player flight simulator that can have hundreds of people playing together over
the Internet, a la Warbirds? No.
I am going to start off with something that has proven game play, yet is
straightforward enough that I can actually get it done. I am going to do a game called
"SprocketInvaders." Why? For two very good reasons. First, it's doable. For every
game that you've seen on the store shelves or in the shareware section of INFO-MAC,
there are a dozen other games that were started with the best intentions but never
completed. Many of us have had good ideas for games. Some of us have even started
games ourselves. However, very few of us have ever finished writing a computer game.
Therefore, I am going to write something that I know I can do in a reasonably small
period of time. The second reason is that despite (or perhaps because of) the fact that
it is a very simple game, it lends itself very well to showing off the different areas I
am concentrating on - rendering, sound, input, and networking.
Step One - Design
Designing SprocketInvaders was greatly aided by the fact that the "Invaders" game
archetype is firmly established. Of course, you must make your game sufficiently
unique so that you don't violate anyone's copyright. My design was pretty easy. I knew
that I wanted aliens that moved in the invader style. I wanted a ship that would be able
to move left, move right, and fire. I wanted the waves to get progressively harder by
speeding up the rate at which the aliens moved and fired.
When you're starting a new game, it's easy to get bogged down in over-design. With
SprocketInvaders that was not a problem, but with something more complex, perhaps