Tag Archives: game theory

,

Game Theory: Understanding the mechanics of Pacman

Well. I’ll never look at a game of Pacman in quite the same way again.

Its mysteries have been revealed by these two links – firstly the Pacman Dossier – basically a textbook on Pacman, and secondly, this study of the mechanics, and individual personalities, of the Pacman ghosts – which draws on material from the first.

The ghosts have three movement patterns, each individually calibrated. These patterns are determined by what mode they’re in – chase, scatter, or frightened. And these modes switch based on time cycles in each level. The modes determine what a ghost will do as it approaches an intersection.

“The diagram above shows a simplified representation of the maze layout. Decisions are only necessary at all when approaching “intersection” tiles, which are indicated in green on the diagram.

When a decision about which direction to turn is necessary, the choice is made based on which tile adjoining the intersection will put the ghost nearest to its target tile, measured in a straight line. The distance from every possibility to the target tile is measured, and whichever tile is closest to the target will be selected.”

Here’s what happens in Scatter mode:


Each ghost has a pre-defined, fixed target tile while in this mode, located just outside the corners of the maze. When Scatter mode begins, each ghost will head towards their “home” corner using their regular path-finding methods. However, since the actual target tiles are inaccessible and the ghosts cannot stop moving or reverse direction, they are forced to continue past the target, but will turn back towards it as soon as possible. This results in each ghost’s path eventually becoming a fixed loop in their corner. If left in Scatter mode, each ghost would remain in its loop indefinitely. In practice, the duration of Scatter mode is always quite short, so the ghosts often do not have time to even reach their corner or complete a circuit of their loop before reverting back to Chase mode.