the most crucial parts of most games is the part that actually
does the hard work of drawing what you want to see. In this module
goes some of the most time critical code - the 3D matrix math.
All of todays 3D games, we have lots of 3Dgeometry going
on. In lots of ways, this particular module will set the frame
rate of your game, since both the quality of the code, and the
amount of triangles you try and pass through it will affect the
amount of time you spend in this part of your code. Optimization
usually starts in this module, and ends in this module too, since
changes here can make the most difference. When it comes to actually
drawing data on the screen, almost no one actually uses software
to render anymore (ie programming the CPU to draw individual pixels).
When you consider the resolutions that most of todays games
run at, and the amount of overdraw that goes on, its just not
feasible to expect the CPU to be able to do it fast enough. And
when you start adding semi transparency for individual pixels
into the mix, it gets very slow very fast. Most PC games today
are using 3d accelerator cards to do the rendering for us. We
hand it the triangles we want to render, hand it the textures
we want to use, turn on the features we want, like fogging, or
tri-linear interpolation, and it handles the actual drawing for
us. Now I'm going to get a little technical here for a second,
if youre not a techy, just tune out for a second J. Since
there are multitudes of different video cards out there, with
all different abilities, a universal method of drawing to them
is required. Now, we, as game developers, dont want to spend
the time writing drivers for each and every card, so we use an
off the shelf API (API stands for Application Programmer Interface).
This is just a standardized way we can talk to the
graphics cards. Almost all card manufacturers supply one of two
graphic API drivers. Direct3D, developed by Microsoft - which
is very complete, but incredibly hard to use, or OpenGL, developed
20 years ago and now maintained by Silicon Graphics. We use the
OpenGL standard, simply because thats what id uses, and
since we use their engines, well...
can see the relationship from the top-level code right down to
the pixel pipeline on the graphics card itself.
and Arcade machines, the rendering technology is somewhat different.
Firstly, you always know what kind of display systems you have
at your disposal; they dont change from machine to machine.
This means that once youve written a renderer, you dont
need to change it from game to game. Plus, you almost always get
much closer to the metal. For instance, in all the Mortal Kombat
games, the programmers talk to the graphics chip directly; setting
registers and so on without any kind of API layer. Its harder
to keep track of whats going on, but it does generally result
in a faster graphics pipeline, plus a much greater understanding
of exactly what the hardware is doing.
you are doing a purely one on one game - i.e. one person against
another, you are going to need some form of Artificial Intelligence
code in the game, in order for the player to have something to
play against. In Tetris, this would take the form of deciding
which block to send down next, something relatively easy with
a decent random number generator. In Solider of Fortune for instance,
this expands a little into pathway tracking, enemy tracking, decision
making, (deciding whether to run away, shoot at the player, follow
someone, or whatever). The system has to take into account the
local environment, so the bad guy doesnt fall down a hole,
or try and run through a wall. Convincing AI can make a huge difference
to a good game playing experience. One of the biggest problems
is making the AI not too smart. Since the world you are playing
in is generated within the game, it means that the bad guy AI
has access to all information regarding this world, and your actions
in it. This can mean that the bad guy is aware of everything,
and when he shoots at you, he will never miss. Bit of a boring
game that. So we have to tone it down a bit to make it more fun.
Another thing we have to do is include lots of different animations
for the bad guys, since he more they are visually capable of doing,
the less predictable they are. If all the guy can do is run, shoot
and die, then hes only got that range of operations. However,
if he can walk, crawl, duck, roll, and jump, then he has a far
greater range, and is less predictable. Another thing to take
into account is the visual and aural acuity of the bad guy. Let
me explain that with graphics.