A |
new trend is creeping into video games at an incredible rate.
This trend makes games more realistic, more believable, and in some cases, more fun. A large percentage of new games use this trend, and consumers are gobbling these games up as fast as they can be made. This new trend, of course, is the use of 3D. From the player models to the virtual game worlds, players are demanding some form of 3D interaction. This idea of 3D interaction encompasses many genres, even those that have traditionally been 2D. Games such as Blizzard’s Warcraft 3 have brought 3D interaction into the “Real Time Strategy” genre, a genre generally dominated by 2D games. Even puzzle and other “value games” are starting to hook into the idea of 3D.
At the same time, hardware manufacturers are creating better and faster hardware. Ultra-fast processors and graphics cards capable of handling millions of pieces of 3D geometry every second are becoming very commonplace in the average home computer. This allows you as a game developer to write more realistic and graphically intensive games without causing the average consumers’ computers to crawl under a rock at the sight of them. New generations of graphics cards are allowing more and more of the calculations to be done on the graphics card, freeing up the processor to concentrate on other aspects of the game, such as sound, enemy AI, and, well, even more graphical effects.
Many companies have realized that 3D is the future of video games and have worked to provide players with top-rate graphics and realism, including the following:
■ id Software (http://www. idsoftware. com) Starting in 1992, the creators of the revolutionary Wolfenstein, Doom, and Quake series were one of the first companies to realize the 3D dream. Their 3D engines have been licensed by other companies for use in countless games.
■ VALVe Software (http://www. valvesoftware. com) Even though VALVe came in a little later than id, it still rocked the world with the release of Half-Life in November of 1998. The graphical aspect of Half-Life was mind-boggling, not to mention the
advanced AI and the superb story line. For the first time, advanced technologies such as skeletal animation and colored lighting were available on the home computer.
■ Epic MegaGames (http://www. epicgames. com) With its beautiful Unreal Engine, Epic opened the world for games with large outside areas, putting an end to the claustrophobic corridors and tiny rooms of earlier games.
■ Parallax (http://www. pxsoftware. com/) Parallax showed gamers how wondrous a full six degrees of freedom could be. With its Descent series of games, Parallax opened the doors to a whole new dimension in the 3D game industry.
■ 3DFX I can’t overlook the contributions of the now deceased video chipset manufacturer. 3DFX introduced the general public to the miracle of 3D hardware 3D acceleration with the release of the Voodoo series of video cards. They were the fastest you could buy until nVidia released their TnT2 Ultra. The capability of the home PC to accelerate 3D graphics paved the way for new, graphically advanced games.
VALVe’s groundbreaking Half-Life |
The incredible Unreal Engine in Epic’s Unreal |
These companies and games are but a few of the many contributors to the 3D phenomenon. Many games have come and gone, unnoticed by the general public, and even to most gamers. Even so, a few of them have introduced new technologies and ideas that have changed the face of the gaming world forever.
Chances are if you are reading this, you either just got the book, or you are standing in a bookstore trying to decide whether you should get it. If you are interested in creating 3D games, this book shows you how to implement one to work with one of the most important parts, 3D models. Open up one of your favorite 3D game, preferably a first person shooter type. Look around you; see those enemies over there? Or how about that health pack and weapon sitting in the corner waiting for you to pick up? All of these features are created by 3D models created by the artists and loaded into the game by programmers like you.
So now you are probably wondering, “how will I benefit if I get this book and what will I learn?” You will learn all sorts of cool stuff here. After you read this you should be able to:
■ Understand how to load various 3D model formats.
■ Display and animate various types of models in your programs.
■ Understand how skeletal animation, the innovation that uses “bones” within models for animation purposes, works. Skeletal animation uses “bones” and “joints” attached to the model’s mesh to perform animation. Skeletal animation has many advantages over traditional keyframe animation, including reduced storage space, increased ease of animation for the artists, and more realistic motion. You will learn much more about this amazing technology later in the book.
■ Attach models to other models to form more complex objects.
The first two chapters are dedicated to a review of important math skills, with a quick review of vectors and matrices. Then, after you read the review of the elusive quaternion, you should be set for most of the math used in the remaining chapters.
After reviewing the necessary math skills, you move right into some of the less complicated formats such as OBJ (Chapter 4) and MD2 (Chapter 5). You will walk through the data structures and loading procedures needed for each type. Code is sprinkled through the text in the form of small functions or data structures, but there are never any large code dumps.
From these simple formats, you will go on to learn about two of the most important and useful technologies in 3D models: skeletal animation and tagging. You already learned what skeletal animation is in the previous bulleted list.
Tagging, as many call it, is the capability to attach models so that they move together. This technique is used to do things such as attach weapon models to the hands of characters, or even piece models together from parts, such as a head, torso, and leg models. Read on to Chapter 9 and you will learn more about this useful technology, and how it applies to Quake 3’s MD3 format.
After you learn about the needed math and play a bit with the simple formats, , you can take a look at loading some of the more complicated formats. Some of these will be skeletally animated using the techniques described in the previous chapters, and some contain tags to make up a full character model. Again, every detail of the formats will be outlined to allow easy implementation in your own game.