An authentic Pac-Man recreation with faithful ghost AI algorithms — Blinky chases, Pinky ambushes, Inky flanks, Clyde scatters.
This is a faithful recreation of the original Pac-Man, and the ghost AI is where I spent the most time. Each ghost has its own targeting algorithm matching the 1980 original:
Blinky directly chases Pac-Man's current position. Pinky targets 4 tiles ahead — the ambush predator. Inky uses a complex calculation based on both Pac-Man's and Blinky's positions to flank from the opposite side. Clyde switches to scatter mode when he gets too close.
The ghosts cycle through Scatter, Chase, Frightened, and Eaten modes. In scatter mode, each ghost has a designated corner. Frightened mode (after eating a power pellet) has the classic point cascade: 200, 400, 800, 1600.
Direction queuing lets you press the next direction before reaching an intersection, so it feels responsive. The original maze layout is faithfully reproduced. Web Audio API provides retro 8-bit sound effects. Mobile touch controls with a responsive D-pad work on phones.
Built with p5.js for rendering. Open the HTML and play the exact game that ate quarters in 1980.