Hardware Reference
In-Depth Information
ONE OF THE early great hits of computer gaming was Pac-Man, although I don't think many
people had any idea about why it had this name. In the Japanese language there is a tradition
of having words that sound like the spirit of what they convey. hese are often two identical
words said together. In the west the closest we have to that is the concept of onomatopoeia,
but it is not quite what giongo and gitaigo is all about, although it is close. Two examples of this
are pyonpyon, which is about hopping/skipping, and niyaniya, which is about a grin/smirk. As
you can see there is not much sound associated with these, but if there was, those terms are
what they would sound like. here is one such word, pakupaku, which is the sound of biting,
chomping or eating - in other words, “the munchies” - and it is this phrase that gave the name
to Pac-Man. How itting, then, that my version of this game also has an eating connotation;
only this time, the tables are turned, and it is the pie that does the eating.
here have been many variants of this basic game over the years, but some things are con-
stant over diferent versions, such as the chomping “man” consuming pills distributed in a
maze and being pursued by ghosts. Occasionally the tables can be turned on the ghosts by
the consumption of a “power pill”; then it is the man that is lethal to the ghosts. (How you
could actually kill a ghost, something already dead, is never quite explained.) his situation
when the man can kill the ghost is known as a power play. he graphics in the game can range
from simple to a stylistic complex 3D rendering, and the sound efects range from bleeps to
a horror show. here are optional add-on bonus score items to eat often in the form of fruit,
but mainly it is about eating the pills and avoiding the ghosts.
The Pie Man Game
In the preceding chapter, “Ping”, the Ping-Pong game was basically constructed with the tech-
nique of having a model of the action in the computer, and the graphics were generated from this
model. So variables held the position of the bats, balls and walls, and you set the game going by
changing some of these variables and making them interact, and then drawing the result. In this
chapter I will show you the other way of making a game, which is in efect the exact opposite. he
technique you will use for the Pie Man game involves not knowing in advance the location of
anything; things are discovered from frame to frame by examining the pixels in the surrounding
locality. his requires a whole bunch of new techniques that need to be learned. In many profes-
sional games a mixture of these two methods are used. So, to begin at the end, Figure 6-1 shows
a screen dump of the inal game, but there is a lot of work to do before you can get there.
Most chapters in this topic show you how to build up software by getting increasingly complex
and adding more features. However, if I were to take that approach in this chapter, it would prob-
ably double the size of the topic. his is because each step involves a large piece of code, most of it
very similar to the previous piece. So instead I will approach this program in chunks, with each
chunk consisting of a number of functions. I will explain what is going on in these functions and
talk about the techniques used and diiculties encountered. Each listing needs to be typed into
the same ile, and there is little that needs to be in any speciic order, so let's get to it.
Search WWH ::




Custom Search