3D Animation Workshop: Lesson 108: Scan The Skies! Interfaces | WebReference

3D Animation Workshop: Lesson 108: Scan The Skies! Interfaces

Lesson 108 - Scan The Skies! - Part 3

CLICK HERE to load the resizable version into a separate browser window.

Make sure that you display your frame rate by pressing the "f" key after you've clicked in the window to start the game. Adjust the size of your browser window and watch the frame rate change. Once again, Netscape will not perform as well as Microsoft Internet Explorer. With Netscape, you will probably have to press the Reload button to get the game to fill the adjusted screen correctly (something IE will do automatically). But once it's resized, the game should work perfectly.

Every aspect of how this game was designed and constructed is discussed completely in the Shout book, but I'll give you the basics here.

The user is simply a camera, located at the center of world space. The user is given controls, via the mouse, to rotate the camera in the pitch and heading directions. The natural complications that result from all "order of rotations" operations make perfect sense in this context because that's the way an artillery piece actually works. You have to combine an underlying heading rotation of the turret with a vertical rotation of the pitch of the gun. However, because we are in space, and not on the ground, the vertical rotation can be a full 360 degrees. That means that the left-hand direction can become right, and vice versa. This adds a bit of challenge.

The camera is also the gun. When the user releases the mouse button, a ray is "fired" from the camera into the scene. If this ray intersects an object (which can only be a missile in this game), a hit is scored. The display increments, the shot clock is reset, and the missile is replaced with an animated explosion that is moved to the spot of the intersection. The humorous "explosion" audio clip is triggered.

After every hit, a new missile is spawned with randomly generated pitch and heading values. These values are used to locate the missile at new location on an imaginary sphere surrounding the camera. The missile immediately begins moving toward the world center at a constant speed based on the amount of time set on the shot clock. If the user does not find and destroy this missile before it reaches the world origin, the same ends and the 2D display is written to invite the user to play again.

This project was a lot of fun, even for a non-gamer like myself. Those of you who are seriously into gaming can take these concepts a lot further, and can probably come up with much better ideas than I did.

To Return to Parts 1 and 2, Use Arrow Buttons

Previous Lesson / Table of Contents / Next Lesson

Created: December 18, 2000
Revised: December 18, 2000

URL: http://webreference.com/3d/lesson108/3.html