Games●●●●●Difficulty 4 of 5

How do Pac-Man's ghosts hunt you without being very smart?

Four ghosts seem to stalk you with cunning. Each one just heads for a single target square, and their Japanese nicknames include 'fickle' and 'playing dumb'.

▶ Start the story

Pac-Man's ghosts seem to hunt you with cunning, but each one runs on a rule short enough to fit in a sentence. A ghost always has a target tile, the square of the maze it would like to occupy. It may not turn back on its own, and it looks only one tile ahead. At each junction it takes the exit whose next tile is closest to its target. That is the whole chase.

Four ghosts, four targets

Blinky and Pinky

  • Blinky targets Pac-Man's own tile
  • Pinky targets four tiles ahead of Pac-Man

Inky and Clyde

  • Inky doubles a line from Blinky to two tiles ahead of Pac-Man
  • Clyde chases from afar but heads for his corner within eight tiles

What makes the four different is how each picks its target. Blinky, the red ghost, aims at Pac-Man's own tile, so he follows doggedly. Pinky aims four tiles ahead of where Pac-Man is heading, which is why it seems to cut you off, and Pinky and Blinky often seem to box you in together without any plan to do so. Inky draws a line from Blinky to a point two tiles ahead of Pac-Man and doubles it. Clyde chases like Blinky from afar, but within eight tiles he turns for his home corner. Their Japanese names describe the effect: chase, ambush, fickle and playing dumb.

Those personalities were a design decision, made to keep the game from becoming too boring or impossibly difficult. A timer adds rhythm: the ghosts alternate between chasing and scattering to their corners at set intervals.

The man behind them, Toru Iwatani, wanted a game that would attract women and younger players, particularly couples, at a time when most games were war games or Space Invaders clones. Namco's president wanted the ghosts all red, but when Iwatani surveyed his colleagues the result was 40 to 0 for multicoloured ghosts, and the president agreed.

This is how game AI often works: a few rules of thumb that create the illusion of intelligence. You feel hunted because the rules are well chosen, not because the ghosts understand anything.

Typical building blocks of game AI
  1. Step 1: Pathfinding

    Gets a character from point A to point B

  2. Step 2: State machine

    Switches between behaviours, such as chase and flee

  3. Step 3: Behaviour tree

    Organises choices; popular since Halo 2

Quiz me

0/3

  1. 1.Why does Pinky seem to cut you off rather than follow you?
  2. 2.What does the lesson mean by calling game AI 'the illusion of intelligence'?
  3. 3.At a junction, how does a ghost choose which way to go?

Recap

Game AI is a handful of readable rules tuned for fun: a target for each ghost and a one-step choice at each junction, so the player feels hunted without the ghosts understanding anything.

💡 A trick to remember it · Four ghosts, four moods: the chaser, the ambusher, the fickle one and the one playing dumb.

Surprising fact · Namco's president wanted all ghosts red until a 40-to-0 staff survey changed his mind.

Sources (4)

No source, no claim. Every fact in this lesson (28 claims) cites at least one of these.

  1. [1]Pac-Man · Wikipedia
  2. [2]Ghosts (Pac-Man) · Wikipedia
  3. [3]Game AI · Wikipedia
  4. [4]The Pac-Man Dossier · Game Developer (Jamey Pittman)
More lessons in 🎲 Games (3) See all games lessons →

One more light on your map.

Get one lesson like this every day, about the things you love. Free, in two or five minutes.

Get the share card for this lesson ↗