138
Video Game Design Foundations
Loading
the tile-based game
map involves having the computer
arrange each bitmap image of a
tile from the back buffer into the
correct order in the front buffer.
The graphics processing unit reads
the front buffer and displays the
game map on the output device.
As the player moves, the map may
scroll to keep the player avatar on
the
stage,
which is the visible portion of the game map. When that occurs, the
game map in the front buffer is replaced with a new map that is drawn using
new tiles from the back buffer.
The idea of breaking a game into tiles is that the back buffer does not need
to store large bitmaps. Since many tiles are the same bitmap image laid side by
side, only one instance of that tile needs to be stored in the back buffer. This
way the front buffer can store the tiles in current use on the stage and the back
buffer can store tiles surrounding the stage.
An infinitely large tile-based
game can be constructed using
only a few tiles. Imagine a grass
tile, a road tile, and a river tile.
Using just these three tiles, a large
game map with several roads
and rivers could be constructed.
To
draw
the tile-based map, the
computer need only place the
correct tile in the correct location
to keep building the map in any
direction. Instead of having a massively large single bitmap for the game map,
only a few small bitmap tiles need to be stored. This makes tile-based games
ideal for low-memory devices.
Rendering
a tile map is very
similar to rendering a single
bitmap image. Since the stage is a
coordinate grid, each tile acts like
one large pixel to fill in each cell in
the coordinate grid. Imagine a tile
map that uses a standard-size tile of
32 pixels high and 32 pixels wide. If
the stage dimensions are 480 pixels
tall and 640 pixels wide, the map
is 15 tiles tall and 20 tiles wide, as
illustrated in Figure 4-17.
The coordinate location of each tile and the name of the tile are used
to render the map. The computer aligns each tile to make, or blit, a single
composite image. When that composite enters the front buffer, the pixels are all
aligned to make one large bitmap display that the player sees.
CHEAT CODE: LOADING
Loading means to transfer the
required data or files from one
location, such as a file on the hard
drive, to computer memory where it
can be quickly accessed.
CHEAT CODE: DRAW
When images are displayed on a
computer screen, it is referred to as
drawing. Just as a person draws on
a blank piece of paper or canvas,
the computer draws images, one pixel at a time, onto the
“canvas” of the computer screen.
CHEAT CODE: RENDER
Rendering is adding color and
shading to represent a solid object.
In terms of 3D design, the computer
renders 3D objects to make them
appear solid and then projects the image onto a 2D
surface (the computer screen).
Previous Page Next Page