Pac-Man ghost A.I. puzzle

Posted by (twitter: @shaunlebron)
August 30th, 2015 3:53 pm

GH4ST is a turn-based puzzle that uses the actual ghost A.I. from Pac-Man. Coordinate the ghosts to catch Pac-Man before he reaches the fruit.

Post Compo version includes more levels, character animations, the A.I. visualizations seen below, and smarter Pac-Man A.I.



The Concept

The original ghost A.I. is surprisingly simple and rich, which you can read about in the popular Pac-Man Dossier. But it’s just not easy to use this information in-game while everything is moving so fast. I’ve long wanted to build a turn-based version where you can think about every move, like Chess maybe.

Brainstorming the Theme

The “You are the Monster” theme made me think of this concept from the ghost perspective. The challenge was to keep the interesting Ghost A.I. while allowing the player to control them. These goals seemed opposing at first.

I initially wanted to let the player place the ghosts on the board to strategize, then to click “Play” to see how it plays out. (I was imagining something like ChuChuRocket here):


Obviously, there has to be some restrictions on ghost positions to give poor Pac-Man a chance. I eventually ditched this problem for something that struck me as elegant– the player should just choose which ghost to move on each turn by pressing a number:


(Pac-Man is walled-off for the purpose of the gif above so we can just illustrate ghost movement)

This seemed to work okay, especially with allowing the player to Undo their steps if they had made a mistake (a la PuzzleScript)

At the 48 hour mark, I had the core mechanics working and some levels illustrating the A.I. behaviors of the ghosts and a new A.I. for Pac-Man since something has to control him. I went back for the Post-Compo version to really bring out the hidden beauty of these behaviors through visualizations, and fixed some A.I. problems, and added more levels.


Though I think I failed to create a rich, balanced mechanic from the ghost perspective (it seemed to break down pretty fast), I think there’s more potential in letting the player control Pac-Man, the way God intended of course! It excites me to think about integrating the ghost-reversing timers and power pellets in this turn-based mode. I won’t be pursuing this for a while, but I’d really like to see Namco or someone else do it.

Oh, and I may write another post about technical implementation details. ClojureScript (amazing language!), React (simple UI model), SVG for visualizations, and CSS for sprite animations frames and movement. cool stuff

Thanks for reading!
-Shaun (@shaunlebron)
GH4ST entry page

Leave a Reply

You must be logged in to post a comment.

[cache: storing page]