Ghost AI
Pac-Man's four personalities
The iconic AI system from Pac-Man where each ghost has distinct targeting behaviour, creating emergent gameplay through simple individual rules.
Overview
Ghost AI refers to Pac-Man’s legendary artificial intelligence system where four ghosts with individual “personalities” create complex, emergent behaviour from simple rules. Each ghost targets differently, switching between chase, scatter, and frightened modes—a masterclass in designing engaging AI from minimal complexity.
Fast Facts
| Aspect | Detail |
|---|---|
| Game | Pac-Man (1980) |
| Designer | Toru Iwatani |
| Ghosts | Blinky, Pinky, Inky, Clyde |
| Insight | Personality through targeting |
The Four Ghosts
| Ghost | Name | Japanese | Personality |
|---|---|---|---|
| Red | Blinky | Oikake (Chaser) | Directly chases Pac-Man |
| Pink | Pinky | Machibuse (Ambusher) | Targets ahead of Pac-Man |
| Cyan | Inky | Kimagure (Fickle) | Complex, unpredictable |
| Orange | Clyde | Otoboke (Stupid) | Alternates chase/retreat |
Targeting Modes
| Mode | Behaviour | Trigger |
|---|---|---|
| Chase | Target based on personality | Default |
| Scatter | Target home corner | Timer-based alternation |
| Frightened | Random movement | Power pellet |
Individual Targeting Rules
Blinky (Red) - The Shadow
Target = Pac-Man's current tile
Simple, relentless pursuit. Gets faster as dots decrease (“Cruise Elroy” mode).
Pinky (Pink) - The Ambusher
Target = 4 tiles ahead of Pac-Man's facing direction
Tries to cut off Pac-Man. Bug: when Pac-Man faces up, targets 4 tiles up AND 4 tiles left.
Inky (Cyan) - The Fickle One
1. Draw vector from Blinky to 2 tiles ahead of Pac-Man
2. Double that vector
3. Target = endpoint
Uses Blinky’s position, creating unpredictable flanking.
Clyde (Orange) - The Feigner
If distance to Pac-Man > 8 tiles:
Target = Pac-Man's current tile
Else:
Target = Clyde's scatter corner
Approaches then retreats, creating a “shy” personality.
Scatter Corners
| Ghost | Corner |
|---|---|
| Blinky | Top-right |
| Pinky | Top-left |
| Inky | Bottom-right |
| Clyde | Bottom-left |
During scatter mode, ghosts retreat to their corners, giving players breathing room.
Mode Timing (Level 1)
| Phase | Mode | Duration |
|---|---|---|
| 1 | Scatter | 7 seconds |
| 2 | Chase | 20 seconds |
| 3 | Scatter | 7 seconds |
| 4 | Chase | 20 seconds |
| 5 | Scatter | 5 seconds |
| 6 | Chase | 20 seconds |
| 7 | Scatter | 5 seconds |
| 8 | Chase | Forever |
Why It Works
| Design Choice | Effect |
|---|---|
| Individual personalities | Distinct threat types |
| Mode alternation | Tension and release |
| Simple rules | Predictable when learned |
| Emergent complexity | Ghosts interact unpredictably |
Implementation Considerations
| Challenge | Solution |
|---|---|
| Pathfinding | Simple: pick direction closest to target |
| Reversals | Ghosts reverse on mode change |
| Tunnels | Ghosts slow down |
| No backtracking | Can’t reverse unless mode changes |
Legacy
Ghost AI demonstrates that compelling game AI doesn’t require complexity—it requires personality. The same principles appear in countless games: distinct enemy types, behaviour modes, and emergent interaction from simple rules.
Modern Applications
| Game | Ghost AI Influence |
|---|---|
| Spelunky | Distinct enemy behaviours |
| Pac-Man Championship Edition | Refined original system |
| Any stealth game | Patrol/alert/chase modes |