tehnic 3d game

Introduction to
3D Game Development


Before we get into the nitty-gritty details of creating a game, we need to cover some
background so that we can all work from the same page, so to speak. In the first
part of this chapter, we will establish some common ground regarding the 3D
game industry in the areas that matter—the types of games that are made and the different
roles of the developers that make them. In the second part of the chapter, we'll establish
what the essential elements of a 3D game are and how we will address them.

Throughout the book you will encounter references to different genres, or types, of games,
usually mentioned as examples of where a particular feature is best suited or where a certain
idea may have originally appeared. In this chapter we will discuss the most common
of the 3D game genres. We will also discuss game development roles; I will lay out "job
descriptions" for the roles of producer, designer, programmer, artist, and quality assurance
specialist (or game tester). There are various views regarding the lines that divide the
responsibilities so my descriptions are fairly generic.

Finally, we will discuss the concept of the 3D game engine. If ever there is going to be an
area of dispute between a writer and his readers in a book like this, a discussion of what
constitutes a 3D game engine will be it. I do have a trump card, though. In this book we
will be using the Torque Game Engine as our model of what constitutes a fully featured
3D game engine. We will use its architecture as the framework for defining the internal
divisions of labor of 3D game engines.

The Computer Game Industry
The computer game industry is somewhat different than other high-tech fields. The business
operates more like Hollywood than traditional commercial or industrial software
development; there are properties, producers, artists, and distributors. This industry has
its own celebrities. It is quite a bit more informal and relaxed than other high-tech fields
in many ways but is quicker paced with a higher burnout rate. There are independent
game developers, or indies, and big-name studios, but the computer game industry tends
to be more entrepreneurial in spirit.

Just as in the motion picture industry, an indie developer is one that is not beholden to
other businesses in their industry that can direct their efforts. Indies fund their own
efforts, although they sometimes can get funding from outside sources, like a venture capitalist
(good luck finding one). The key factor that makes them independent is that the
funding does not come from downstream industry sources that would receive the developer's
product, like a major game development house, publisher, or distributor.
Indies sell their product to distributors and publishers after the product is complete, or
nearly so. If a developer creates a product under the direction of another company, they
are no longer independent.
A good measure of the "indie-ness" of a developer is the answer to the following two
questions:

■ Can the developer make any game he wants, in whatever fashion he wants?
■ Can the developer sell the game to whomever he wants?

If the answer is "yes" in both cases, then the developer is an indie.
Of course, another strong similarity with movies is that, as I pointed out earlier, games are
typically classified as belonging to different genres.
3D Game Genres and Styles

Game development is a creative enterprise. There are ways to categorize the game genres,
but I want you to keep in mind that while some games fit each genre like a glove, many
others do not. That's the nature of creativity. Developers keep coming up with new ideas;
sometimes they are jockeying for an advantage over the competition and sometimes they
are just scratching an itch. At other times, calculating marketing departments decide that
mixing two popular genres is a surefire path to a secure financial future.

The first rule of creative design is that there are no rules. If you are just scratching an itch,
then more power to you. If you are looking to make a difference in the gaming world, you
should at least understand the arena. Let's take a look at the most common 3D genres
around today and a few that are interesting from a historical perspective. When you are
trying to decide what sort of game you want to create, you should try understanding the
genres and use them as guides to help focus your ideas.

It's important to note that all of the screen shots in this chapter are of games by indie
game developers. Some of the games are currently being shipped as retail games, and
some are still in development. Almost all of them use the same Torque Game Engine we
will use in this book to develop our own game.
By no means is this a definitive list; there are many genres that don't exist in the 3D gaming
realm, and the number of ways of combining elements of genres is just too large to
bother trying to enumerate. If you take pride in your creativity, you might resist attempts
to pigeonhole your game idea into one of these genres, and I wouldn't blame you.When
trying to communicate your ideas to others, however, you will find it useful to use the genres
as shorthand for various collections of features, style, and game play.
Action Games

Action games come in several forms. The most popular are the First-Person Point-of-View
(1st PPOV) games, where your player-character is armed, as are your opponents. The
game play is executed through the eyes of your character. These sorts of games are usually
called First-Person Shooter (FPS) games. Game play variations include Death Match,
Capture the Flag, Attack & Defend, and King-of-the-Hill. Action games often have multiplayer
online play, where your opponents are enemies controlled by real people instead of
by a computer. Success in FPS games requires quick reflexes, good eye-hand coordination,
and an intimate knowledge of the capabilities of your in-game weapons. Online FPS
games are so popular that some games have no single-player game modes.
Some action games are strictly 3rd PPOV, where you view your player-character, or avatar,
while also viewing the rest of the virtual world your avatar inhabits (see Figure 1.1).
Half-Life 2, Rainbow Six, and Delta Force: Blackhawk Down are popular examples of FPSstyle
action games.

adventure games play like interactive books or stories, where you as the player decide what
happens next, to a certain degree.
Text adventures evolved into text-based games with static images giving the player a better
idea of his surroundings. Eventually these merged with 3D modeling technology. The
player was then presented with either a first- or third-person point of view of the scene
his character was experiencing.

Adventure games are heavily story based and typically very linear. You have to find your
way from one major accomplishment to the next. As the story develops, you soon become
more capable of predicting where the game is going. Your success derives from your ability
to anticipate and make the best choices.
Some well-known examples of adventure games are The King's Quest series, The Longest
Journey, and Syberia.

Online adventure games have not really come into their own yet, although some games are
emerging that might fit the genre. They tend to include elements of FPS action games and
Role-Playing Games (RPGs) to fill out the game play, because the story aspect of the game
is more difficult to accomplish in an online environment. Players advance at different
speeds, so a monolithic linear story line would become pretty dreary to a more advanced
player. An example of an online action-adventure-FPS hybrid game is Tubettiworld (see
Figure 1.2), being developed by my all-volunteer team at Tubetti Enterprises.
Windows XP target system, because that is the version that Microsoft is now selling to the
home computer market.

Within Windows XP, we will be using OpenGL and Direct3D as our low-level graphics
Application Programming Interfaces (APIs). These APIs provide a means for our engine to
access the features of the video adapters in our computers. Both OpenGL and Direct3D
provide basically the same services, but each has its own strengths and weaknesses.With
Torque you will have the choice of letting your end users use either API.
OpenGL's greatest strength lies in its availability with different computer systems. An
obvious benefit is that the developer can create a game that will work on most computers.
OpenGL is an open-source product. In a nutshell, this means that if there is a particular
capability you want that OpenGL lacks, you can get access to the OpenGL source
code and rebuild it the way you want. This assumes you have the skills, time, and tools
necessary to get the job done, but you can do it.
DirectX is proprietary—it is the creation and intellectual property of Microsoft
Corporation. Its biggest advantage is that it tends to support more features than OpenGL,
and the 3D video adapter manufacturers tend to design their hardware to work with
DirectX as much as they can.With DirectX you get a much more complete and the most
advanced feature set. Unfortunately, you are limited to Windows-based systems if you put
all your eggs in the DirectX basket.
The Torque Game Engine uses both APIs and gives you a rather straightforward set of
techniques to set up your game with either. This means that in a Windows version of your
game, you can offer your users the option of using the API that best suits their video
adapter.
Linux
For most people, the single most important reason to use Linux is the price—it's free. You
may have to pay to get a distribution of Linux on CD with manuals at a store, but you are
paying for the cost of burning the CD, writing and printing the manuals, and distribution.
You don't have to pay for the operating system itself. In fact, you can download Linux
from many different locations on the Internet.

As a game developer, you will have a threefold interest in targeting Linux:

■ Linux is a growing marketplace, and any market that is growing is a good target.
Although the market is growing, it is still smaller than the Windows market. The
place where Linux is growing is in universities, colleges, and other postsecondary
institutions—and this is probably where your best computer gaming audience is.
■ There are few computer games available for Linux desktops; most developers focus
on Windows because it is the biggest market. If you ship a game for Linux, you will
be a bigger fish in a smaller ocean. That gets you exposure and a reputation that
you can build on. And that's nothing to sneeze at.
■ Linux offers a more configurable and secure environment for unattended Internet
game servers. Linux servers can be run in a console mode that requires no fancy
graphics, buttons, or mice. This allows you to utilize slower computers with less memory
for servers and still get the computing power you need for your game server.
Unlike other operating systems, Linux comes in a variety of flavors known as distributions.
There are many ongoing arguments about the merits of one distribution or another. Some
of the more popular distributions are Red Hat, SuSE,Mandrake, Turbolinux, Debian, and
Slackware. Although they may be organized differently in some cases and each has its own
unique graphical look and feel, they are all based on the same kernel. It is the kernel that
defines it as Linux.
Macintosh
The Macintosh is used a great deal in art-related fields and in the art departments of many
businesses. Although the price point might not be as good as Linux (where the OS and
most software is free), the Macintosh operating system is typically more accessible to the
less tech-savvy users among us.

As with Linux, there has also traditionally been a dearth of computer games available for the
Mac. So the big fish–small ocean factor applies here as well. Go ahead and make a splash!
note
One minor disadvantage of working with cross-platform software like Torque is the issue of naming
conventions. In this book, wherever possible, I will head off the potential conflicts with a note
that will cast a particular naming approach in stone for the duration of this book.
An example that will probably become obvious pretty quickly is the concept of directories or folders.
The latter is shorter and easier to type, and the term will be used often. To save my editors the
hassle, I will use folders. If you are a directories person, please just play along, okay?
Game Developer Roles

In the context of the game we will develop during our journey together through this book,
you will wear all of the different game developer hats. The thing to remember is that
oftentimes the lines between the roles will blur, and it might be hard to tell which hat you
are wearing. So wear them all. Many indies wear multiple hats throughout the life of a
game project, so it's just as well to get used to it!
Producer

A game producer is essentially the game project's leader. The producer will draw up and
track the schedule, manage the people who do the hands-on development work, and manage
the budget and expenditures. The producer may not know how to make any part of a
game at all, but he is the one person on a game project who knows everything that is happening
and why.
It's the producer who needs to poke the other developers in the ribs when they seem to be
lagging. The producer needs to be aware when different members of the team are in need
of some tool, knowledge, or resource and arrange to provide the team members with what
they need.

Sometimes producers just need to spray a liberal dose of Ego-in-a-Can to refresh a
despondent developer who keeps smashing into the same brick wall over and over while
the clock ticks down.
The producer will also be the interface for the team to the rest of the world, handling
media queries, negotiating contracts and licenses, and generally keeping the big noisy
bothersome world off the backs of the development team.

Designer
If you are reading this, I have no doubt that you want to be a game designer.And why not?
Game designers are like fun engineers—they create fun out of their imaginations. As a
game designer, you will decide the theme and rules of the game, and you will guide the
evolution of the overall feel of the game. And be warned—it had better be fun!
There are several levels of designers: lead designer, level designer, designer-writer, character
designer, and so on. Large projects may have more than one person in each design role.
Smaller projects may have only one designer or even a designer who also wears a programmer's
or artist's hat! Or both!

Game designers need to be good communicators, and the best ones are great collaborators
and persuaders. They need to get the ideas and concepts out of their heads and into
the heads of the rest of the development team. Designers not only create the concept and
feel of the game as a whole, but also create levels and maps and help the programmers
stitch together different aspects of the game.

The lead designer will put together a design document that lays out all the aspects of the
game. The rest of the team will work from this document as a guide for their work. A
design document will include maps, sketches of game objects, plot devices, flow charts,
and tables of characteristics. The designer will usually write a narrative text that describes
how all of these parts fit together. A well-written and thorough game design completely
describes the game from the player's perspective.
Unlike the producer, a designer needs to understand the technical aspects of the game and
how the artists and programmers do what they do.
Programmer
Game programmers write program code that turns game ideas, artwork, sound, and
music into a fully functional game. Game programmers control the speed and placement
of the game artwork and sound. They control the cause-and-effect relationships of events,
translating user inputs through internal calculations into visual and audio experiences.
There can be many different specializations in programming. In this book you will be
doing a large amount of programming of game rules, character control, game event management,
and scoring. You will be using Torque Script to do all these things.

For online game programming, specialization may also be divided between client code
and server code. It is quite common to specify character and player behavior as a particular
programmer specialty. Other specialty areas might be vehicle dynamics, environmental
or weather control, and item management.

Other programmers on other projects might be creating parts of the 3D game engine, the
networking code, the audio code, or tools for use with the engine. In our specific case
these specializations aren't needed because Torque looks after all of these things for us.We
are going to focus on making the game itself.
Visual Artist
During the design stages of development, game artists draw sketches and create storyboards
to illustrate and flesh out the designers' concepts. Figure 1.9 demonstrates a conceptual
design sketch created by a visual artist, and used by the development team as a reference
for modeling and programming work. Later they will create all the models and texture
artwork called for by the design document, including characters, buildings, vehicles,
and icons.

The three principal types of 3D art are models, animations, and textures.

■ 3D modelers design and build player-characters, creatures, vehicles, and other
mobile 3D constructs. In order to ensure the game gets the best performance possible,
model artists usually try to make the least complex model that suits the job.
A 3D modeler is very much a sculptor working with digital clay.
■ Animators make those models move. The same artist quite often does both modeling
and animation.
■ Texture artists create images that are wrapped around the constructs created by 3D
modelers. Texture artists take photographs or paint pictures of various surfaces for
use in these texture images. The texture is then wrapped around the objects in
question in a process called texture mapping. Texture artists help the 3D modelers

Followers