Dissection of the Pac-Man AI

Understanding Pac-Man Ghost Behavior

Inky actually uses both Pac-Man’s position/facing as well as Blinky’s (the red ghost’s) position in his calculation. To locate Inky’s target, we first start by selecting the position two tiles in front of Pac-Man in his current direction of travel, similar to Pinky’s targeting method. From there, imagine drawing a vector from Blinky’s position to this tile, and then doubling the length of the vector. The tile that this new, extended vector ends on will be Inky’s actual target.

As a result, Inky’s target can vary wildly when Blinky is not near Pac-Man, but if Blinky is in close pursuit, Inky generally will be as well. Note that Inky’s “two tiles in front of Pac-Man” calculation suffers from exactly the same overflow error as Pinky’s four-tile equivalent, so if Pac-Man is heading upwards, the endpoint of the initial vector from Blinky (before doubling) will actually be two tiles up and two tiles left of Pac-Man.

Tags: , ,

3 Responses:

  1. Mike Hoye says:

    Every level of Pac-Man uses the same maze layout, containing 240 regular "food" dots and 4 energizers.

    I can't tell you how many arcade machines I've seen in my life that, whatever game they're playing now, have the Pac-Man maze layout burned irrevocably into the phosphors of the screen. To this day if you can find an arcade at all you can find a machine like that in it.

  2. Ryan Finnie says:

    I find it interesting that they implemented an RNG for only one aspect of the game (Frightened ghost fork decisions), which could have been done in another similar way that would not have required an RNG. Say, distance from pac-man modulo number of choices. It appears that literally every other piece of logic in the game is based on environmental factors and not random.

  3. devon says:

    have you played the new pac man on ps3?