Game Development Reference
In-Depth Information
in replay mode, one of the inputs is the saved replay information. In certain types
of mobile games, another input might be what's visible by the camera, or perhaps
GPS information. So there are quite a few potential input options, depending on
the particular game and hardware it's running on.
Updating the game world involves going through everything that is active in the
game and updating it as appropriate. This could be hundreds or even thousands of
objects. Later in this chapter, we will cover exactly how we might represent said
game objects.
As for generating outputs, the most computationally expensive output is typically
the graphics, which may be 2D or 3D. But there are other outputs as well—for
example, audio, including sound effects, music, and dialogue, is just as important
as visual outputs. Furthermore, most console games have “rumble” effects, where
the controller begins to shake when something exciting happens in the game. The
technical term for this is force feedback , and it, too, is another output that must
be generated. And, of course, for an online multiplayer game, an additional output
would be data sent to the other players over the Internet.
We'll fill in these main parts of the game loop further as this chapter continues.
But first, let's look at how this style of game loop applies to the classic Namco
arcade game Pac-Man .
The primary input device in the arcade version of Pac-Man is a quad-directional
joystick, which enables the player to control Pac-Man's movement. However,
there are other inputs to consider: the coin slot that accepts quarters and the Start
button. When a Pac-Man arcade cabinet is not being played, it simply loops in a
demo mode that tries to attract potential players. Once a quarter is inserted into the
machine, it then asks the user to press Start to commence the actual game.
When in a maze level, there are only a handful of objects to update in Pac-
Man —the main character and the four ghosts. Pac-Man's position gets updated
based on the processed joystick input. The game then needs to check if Pac-Man
has run into any ghosts, which could either kill him or the ghosts, depending on
whether or not Pac-Man has eaten a power pellet. The other thing Pac-Man can do
is eat any pellets or fruits he moves over, so the update portion of the loop also
needs to check for this. Because the ghosts are fully AI controlled, they also must
update their logic.
Finally, in classic Pac-Man the only outputs are the audio and video. There isn't
any force feedback, networking, or anything else necessary to output. A high-
Search WWH ::




Custom Search