Contents
The Pac-Man Dossier
 
 
Printer-Friendly VersionPrinter-Friendly Version
 
Latest News
spacer View All spacer
 
November 22, 2009
 
Video Game Watchdog National Institute On Media And The Family Shutting Down [11]
 
Modern Warfare 2 Infinity Ward's 'Most Successful PC Version' Yet [12]
 
New Tech, Design Details Of Project Natal To Emerge At Gamefest In February
spacer
Latest Jobs
spacer View All     Post a Job     RSS spacer
 
November 22, 2009
 
Trion Redwood City
Sr. Environment Artist
 
Trion Redwood City
Sr. Evnironment Modeler
 
Sucker Punch Productions
3D Environment Artist
 
Sucker Punch Productions
Network Programmer
 
Sucker Punch Productions
Texture Artist
 
Sucker Punch Productions
Character Artist
 
Crystal Dynamics
Sr. Level Designer
 
Monolith Productions
Sr. Software Engineer, Engine - Monolith Productions - #113767
spacer
Latest Features
spacer View All spacer
 
November 22, 2009
 
arrow Upping The Craft: Susan O'Connor On Games Writing [6]
 
arrow Small Developers: Minimizing Risks in Large Productions - Part II [7]
 
arrow iPhone Piracy: The Inside Story [49]
 
arrow And Yet It Grows: Analyzing the Size and Growth of the European Game Market [5]
 
arrow NPD: Behind the Numbers, October 2009 [13]
 
arrow Reflecting On Uncharted 2: How They Did It [5]
 
arrow Sponsored Feature: Rasterization on Larrabee -- Adaptive Rasterization Helps Boost Efficiency
 
arrow Postmortem: Wadjet Eye's The Blackwell Convergence [2]
spacer
Latest Blogs
spacer View All     Post     RSS spacer
 
November 22, 2009
 
Time Fcuk [1]
 
Accepting the Inherent Value of Games
 
Planckogenesis, Part II: Song Structure & Gravy Train [1]
spacer
About
spacer News Director:
Leigh Alexander
Features Director:
Christian Nutt
Editor At Large:
Chris Remo
Advertising:
John 'Malik' Watson
Recruitment/Education:
Gina Gross
 
Features
  The Pac-Man Dossier
by Jamey Pittman
10 comments
Share RSS
 
 
February 23, 2009 Article Start Previous Page 6 of 10 Next
 

Target Tiles

Whenever a ghost is in chase or scatter mode, it is trying to reach a target tile somewhere on (or off) the screen. A target tile is merely a way to describe the tile a ghost would like to occupy at any given moment.

Advertisement

This tile can be fixed in place or change location frequently. Whenever the ghosts scatter to the corners of the maze, for example, each ghost is striving to reach a fixed target tile located somewhere near its home corner.

In chase mode, the target tile is usually (but not always) related to Pac-Man's current tile which changes often. Although it may not be obvious at first, the only difference between chase and scatter mode to a ghost is where its target tile is located. The same pathfinding logic applies in either case.

Looking Ahead

Ghosts are always thinking one step into the future as they move through the maze. Whenever a ghost enters a new tile, it looks ahead to the next tile along its current direction of travel and decides which way it will go when it gets there.

When it eventually reaches that tile, it will change its direction of travel to whatever it had decided on a tile beforehand. The process is then repeated, looking ahead into the next tile along its new direction of travel and making its next decision on which way to go.

When a ghost looks ahead into the upcoming tile, it must examine the possible exits from that tile to determine a way to proceed. In the picture below, the red ghost has just arrived at tile A and is moving right-to-left. It immediately looks ahead to tile B (the next tile along its direction of travel).

Each tile has four potential exits to be considered: right, left, up, and down. In the case of tile B, the up and down exits are blocked by walls and must be discarded as potential candidates. The right exit is also discounted because it would only take the ghost back to tile A again, and ghosts never voluntarily reverse direction. With three of the four possible exits eliminated from tile B, moving left is the only remaining choice.

This example is the most simple to explain as the ghost has but one way it can legally move. As such, we did not have to worry about where its target tile was located. The majority of game tiles in legal space are similar to this one, but things get more interesting when a ghost approaches a tile with more potential exits to choose from.

Intersections

When a ghost arrives one tile away from an upcoming intersection, it must choose between several possible directions in which to proceed. Consider the following example:


(click image for full size)

In the first picture, the red ghost has just reached tile A and is seeking its target (shown as the green tile). It immediately looks ahead to the subsequent tile along its present direction of travel (up). In this case, that tile is a four-way intersection. As this intersection tile has no walls blocking off any of the exits, the ghost can only discard his reverse direction (down), leaving three exits open for travel.

It looks one tile beyond the intersection in each of the three remaining directions, collecting "test tiles" (shown as the tiles with dashed, white lines). In the middle picture, the ghost triangulates the distance from each of these test tiles to its target tile.

Whichever direction's test tile has the shortest distance to the target becomes the direction the ghost will take upon reaching the intersection tile. In this case, the right test tile has the shortest distance to the target, and the ghost updates its chosen direction for the intersection tile accordingly.

Sometimes a ghost is presented with two or more test tiles that have the same distance to the target tile. In the example below, the red ghost must choose between moving down or left at the upcoming intersection tile. Unfortunately, both test tiles have the same distance to the target (bottom left).

To break the tie, the ghost prefers directions in this order: up, left, down, right. Up is the most preferred direction; right is the least. Therefore, the ghost chooses to go left at the intersection because left precedes down in the preference list. Although it may seem obvious to a person that going down was the better choice to reach the target, ghosts are not that smart. They cannot see more than a few tiles ahead and, as a consequence, cannot recognize the disparity between these two options.

Scatter Targets

As mentioned before, each ghost has a fixed target tile it is trying to reach in scatter mode. The picture below shows the actual tile used by each ghost. Notice each target tile is in dead space on either the top or bottom edge of the screen. As such, the ghosts will never be able to reach them.

Luckily, a ghost does not care if its goal is attainable or not-the A.I. routines are very short-sighted. All a ghost cares about is following the pathfinding logic described above to make the best choice it can on which way to turn at the next tile.

As a result, it will simply make circles in the area of the maze nearest its target tile until the target is set to some other location. That's all scatter mode really is. The only reason a ghost has a "favorite corner" of the maze at all is due to the location of a target tile it will never reach.


 
Article Start Previous Page 6 of 10 Next
 
Comments

Jake Romigh
profile image
This was a most informative and entertaining read. I'm not sure everyone will agree with me here, but I think these articles have promise. They show the development history, design principals, execution, cultural reaction, and legacy of a game. If the rest of your "Dossiers" are as indepth and quality as this one, I'll be sure to read them.

Mike Saunders
profile image
This was an amazing article! I really enjoyed reading it due to the clear descriptions and the great diagrams visually depicting the algorithms/etc. Of course, I'm an arcade junkie from the 80's so the fact that the article focused on one of those games was just icing on the cake.

Please, please do more of these types of in-depth technical analysis articles! I'll read every one.

Roberto Alfonso
profile image
Indeed, this is one of the most insightful articles I have ever read. I knew about the chase/scatter modes from an early interview, but didn't know the gameplay was so deep!

Joshua Dallman
profile image
This is a simply fantastic article and I would love to see more well researched, in-depth game design and theory articles such as these here. There's a lot to sink your teeth into in this article, it isn't just armchair speculation about theory and market trends. Very well done, well researched, and an appreciated read and reference. I hope this type of article can also show newer game developers how much subtle coding behind the curtain occurs to create a well polished and deep gameplay, even if seemingly on the surface it is a "simple game" especially by graphical standards alone. I would also be remiss to not point out the recent "Pac Man Zero G" outlined on your sister site: http://www.indiegames.com/blog/2009/02/freeware_game_pick_pacman_phys.html

Tom Newman
profile image
The best article on Pac-Man I have ever read. Answered many questions I've had since the 80's.

This proves that you can deliver a deep gameplay experience without lots of CPU, without high end graphics, and with minimal player control (up, down, left, right, no buttons). Peolple will still be playing Pac-Man 50 years from now.

Christopher Enderle
profile image
The game's depth is astounding, I'll never look at Pac-Man the same way again. Such in depth analysis as this makes me wish we could see the game's actual GDD, if such official documents exist. I'd imagine they do with the continual remakes that come out, but perhaps that's the same reason they still hold on to those.

John Leffingwell
profile image
Absolutely great article. The superlatives do not exist for how I feel about the author's coverage of this subject matter. I didn't know of the author until now, but I've been a follower of Don Hodges work for a while, and I do this sort of thing myself from time to time. I hope we can see similarly gritty technical articles about classic games in the future. The only thing that could possibly improve this article is if Gamasutra could use some of its clout to get in contact with the original designers for additional insight and background information. I'd love to see something about the work of Vid Kidz. Robotron: 2084 has some nifty bugs, and some of the later technology Jarvis et al. developed was radically ahead of its time. See Halcyon Days.

Tom Newman
profile image
I would love to see a dossier on Joust. Left, right, and a flap button - the rest of the gameplay built in to the physics of the game itself.

Matthew Oztalay
profile image
Very well written, very informative. An excellent window into the level of depth and detail required to design a game.

Shawn Yates
profile image
Excellent article. I'm such a sucker for the algorithm diagrams I cannot express how grateful I am. This really helps peel back the layers of complexity of a game that at first glance might seem "simple".


none
 
Comment:
 


Submit Comment