3D Animation Workshop: Lesson 118: WildTangent for Online Games | 3 | WebReference

3D Animation Workshop: Lesson 118: WildTangent for Online Games | 3

Lesson 118 - WildTangent for Online Games - Part 3

I was highly impressed with the JavaScript Game Tutorial provided in the SDK. This is an outstanding opportunity to learn not only the basics of the WildTangent API, but also principles of interactive 3D games programming generally. Anyone with the slightest interest in this subject should soak up everything there is to learn here.

The game is a simple first-person shooter scenario in which the camera is attached to a gun. The player surveys a flat grassy field with walls of mountains on all sides. Rotating alien ships descend from the sky and the player must shoot them all before any touch down.

The initialization process involves creating and texturing the simplest geometry and putting it to the scene. The more sophisticated geometry of the gun and alien ship (which is instanced multiple times) is imported. The gun and the camera are made children of the same group (transform) so that they move and rotate as a single unit.

Once setup is complete, the application responds to mouse and keyboard input. Dragging the mouse rotates the camera-gun group in both the pitch and heading, and uses a clever mechanism to assure that the cursor never passes off the edge of the screen. Three keys are used to move the camera-gun unit forward and backwards, and to fire spheres as bullets. In each of these cases, the keystrokes serve only as triggers because the actual object movement is handled between render cycles. This allows the proper determination of the distance moved, based on the amount of time that has passed since the previous frame was rendered.

The bullets move in the direction in which the camera-gun is pointed. A collision test is performed for each bullet on each render cycle to determine whether it has encountered an alien ship. If it has, the ship is made invisible and an explosion is triggered in the form of a textured ball with animated scale and opacity.

Here's a screen shot from the middle of the action. Note the grey bullet fired from the gun.

I can well imagine the excitement of someone who has never created an interactive 3D application finishing this tutorial and feeling transformed by the awareness of what it means to create a true game with a well-designed, professional API. At 16 MB, the WildTangent SDK is a big download for those without a broadband connection, but it's worth it. Those who are already familiar with powerful high-level 3D API's will definitely want to assess the WildTangent approach. (Indeed, a specific comparison between this tutorial and the game tutorial in my Shout3D book is very instructive.) Those who are new to the art of interactive 3D design may find themselves with a whole new passion.

To Return to Parts 1 and 2, Use Arrow Buttons

Previous Lesson / Table of Contents

Comments are welcome
and brought to you by webreference.com

Created: May 8, 2001
Revised: May 8, 2001

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