Game Development Reference
In-Depth Information
the designer to take control of what the player sees and from what perspective.
Camera scripts can be used tomake sure that the player can appreciate all the work
the art team has put into the game. Between the scripts and the artwork, there
should be no problem with evoking emotions in the player. Did the runway
survive the combat unscathed? A touch of camera AI at the right point in the game
brings relief or dismay to the player without saying a word or showing a face.
There are two kinds of camera AI to consider. The camera AI described earlier is
on behalf of the designer, who wants to achieve dramatic impact. Like many of
the items in this chapter, the AI is simple to provide, and the real emphasis is on
game design. There is also camera AI that is on behalf of the player. Such AI need
not exist in first-person games, but when we leave first person for another point
of view, we need camera AI. Third-person viewpoints, particularly the chase
camera view, present interesting problems to the camera AI. The first problem to
consider is when the camera hits a wall.
To fully appreciate the problem, a quick graphics refresher may be in order.
Think of the objects in a 3D world as if they were blow-up balloons. Their
geometry ''blows them up'' to their final shape, and we paint textures on the
outside surfaces. In order to save CPU time, we don't paint on the inside surfaces;
they might as well not exist. Real balloons are closed, so they hold air, and we
want our objects to be closed so that no one can see inside them and spoil the
illusion that they are solid objects.
Our objects can be as interesting as the real balloons seen in the Macy's New
Year's Day Parade or as mundane as a flat sheet of wallboard. We use a mesh of
flat triangles instead of curving air-tight fabric. It takes a large number of tri-
angles to build a detailed world, particularly when our objects appear curved. The
more triangles we consider and the longer we consider them, the slower our
system draws.
One very easy way to reject a triangle is to check which way the triangle is facing.
If the painted outside surface, known as the front face, is facing away from us,
we do not need to draw the triangle. The unpainted back face is facing us, and no
one is ever supposed to see it. As long as our object is closed—it ''holds air''—
and we are not inside it, we know that there is a front face somewhere on this
object that is closer to the camera than the back face we are considering. This
technique is called back-face culling and has been used to speed up rendering
since the dawn of time in computer graphics. Roughly speaking, back-face cul-
ling lets us reject half the triangles of every object in the scene.
Search Nedrilad ::

Custom Search