Tricks of the Windows Game Programming Gurus:Putting It All Together: You God Game!

All ITKnowledge Source Code Search Tips Advanced Search |

| Tricks of the Windows Game Programming Gurus by Andre LaMothe Sams, Macmillan Computer Publishing ISBN: 0672313618 Pub Date: 09/27/99

Search this book:

Previous | Table of Contents | Next

## Chapter 14
Putting It All Together: You Got Game!

> “He slimed me!”

> —Bill Murray, Ghostbusters

This is the last chapter of Volume I, and it’s just in time; I’m starting to have a three-way conversation with myself. I admit I talk to myself, but when two different people talk back, it’s time to quit! Anyway, in this chapter I’m going to outline the design and implementation of a simple game, Outpost, which I wrote using the techniques that you have learned in the book.

The game took about five days to write, so don’t expect much. However, it sports 3D-modeled sprites, particles, some gameplay, sound effects, and a few different enemies, and I think it should be really easy for you to mess with if you want to. Here’s what I’m going to cover:

  • The initial design of Outpost
  • The tools used to write the game
  • The game universe: scrolling in space
  • The player’s ship: the Wraith
  • The asteroid field
  • The enemies
  • The power-ups
  • The HUDs
  • The particle system
  • Playing the game
  • Compiling Outpost

### The Initial Design of Outpost

I wanted to create a game that was easy to write, looked good, had some rudimentary gameplay, and used scrolling (if I had a dollar for every scrolling question I received, I would be a millionaire). Thus, I picked an Asteroids-type space game because the only background is black space. Plus, the artificial intelligence (AI) for Asteroids, along with search-and-destroy AI for the enemies, is pretty simple, so it all sounded like a good idea.

#### The Story

The story goes something like this: You are the pilot of the top-secret Wraith, a highly armored attack fighter sent to sector Alpha 11 to rid the area of an alien incursion. The aliens have infested the area with outposts that you must destroy. The only problem is that the sector is filled with heavy debris (the asteroids), alien warships, and homing mines protecting each outpost. That’s about all there is to the story. (Sounds like a great movie, huh?) Figures 14.1 and 14.2 show the game during startup and gameplay.

Figure 14.1 Outpost starting up.

Figure 14.2 Outpost during gameplay.

Although in most cases I think that creating the story of a game is one of the least important things about writing a program, it does give you a point of reference to build from and keeps the game semi-coherent.

#### Designing the Gameplay

Once I had the story down, I started designing the gameplay. This consisted of making up the rules. Which object/control performs which function? What’s the goal? And so forth. The game isn’t that advanced, so I basically thought up what the player can do, what the enemies can do, how the player wins (or loses), what kind of AI everything has, and so on. Because Outpost isn’t level-based and doesn’t have any kind of strategy, there’s not much else to the design.

### The Tools Used to Write the Game

I wanted to stick to 256 colors because I’ve used 256-color modes in the book to keep things simple, but I still wanted a really clean look for the objects. Hence, I decided to render almost everything. I used Caligari TrueSpace IV (TS4), which in my estimation is the best 3D modeler in the world for its price. However, price aside, TS4 can give 3D Studio Max a run for its money. There’s a demo copy of TS4 on the CD, so make sure to check it out.

The 2D artwork and touchup was done using JASC Paint Shop Pro 5.1, which is a killer paint package that supports plug-ins and has the easiest interface I have ever seen. Again, there is a demo copy on the CD.

Finally, the sound effects were taken from various sources and processed with Sonic Foundry’s Sound Forge XP, which is one of the best sound-editing packages for PCs. You can also find a demo copy of Sound Forge on the CD. That’s just about all the tools I used, in addition to VC++ 5.0, 6.0, and DirectX.

Table 14.1 lists all the game objects and how they were created.

Table 14.1 The Objects in Outpost

Object | Technique
--- | ---

Asteroids | Rendered with TS4
Player’s ship | Hand-drawn with PSP
Outposts | Rendered with TS4
Predator mines | Rendered with TS4
Gunships | Rendered with TS4
Power-ups | Rendered with TS4
Plasma pulses | Hand-drawn with PSP
Star field | Single pixels
Explosions | Digitized Pyrotechnics Stock Media

The meshes for all the 3D models were created by hand, and each took less than an hour with TS4. The hand-drawn images took about an hour each. I rotated the player’s ship using the software rotation algorithm in PSP rather than doing it manually. All sounds were sampled down to 11 KHz, 8-bit mono.

Previous | Table of Contents | Next

Copyright © Macmillan Computer Publishing, Inc.

Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction in whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.