πŸ”

πŸ€“ PacNerd

A prototype. A love letter to the yellow circle and her four colorful stalkers β€” rebuilt from scratch as a web component, with hand-rigged procedural sprites and way too much ghost AI research.

Arrow keys or WASD to move. That's it. You know what to do.

The Sprite Rig

No static sprite sheets here. Every frame is procedurally generated from parametric SVG geometry β€” Bezier curves whose control points shift based on animation state.

The player's mouth is a gape parameter from 0 to 1. As gape increases, the jaw arc widens, teeth reposition along the curve, and the glasses wobble on their hinges like they're about to fall off. The whole rig is stateless: feed it a time value and a direction, and it draws itself from scratch.

At build time, a Playwright pipeline renders every combination of direction and animation frame through the rig, captures pixel-perfect screenshots, and packs them into a spritesheet atlas. At runtime, the game just slides a clip window around the atlas. Zero rendering overhead β€” all the procedural work is pre-baked.

The ghosts get the same treatment: body scallops that undulate, eyelids that blink on random timers, pupils that track their AI target via lookahead pathfinding.

Ghost AI

Four personalities, faithful to the original arcade behavior:

  • Chase (red) β€” beelines straight for you
  • Ambush (pink) β€” targets four nodes ahead of your current direction
  • Vector (cyan) β€” uses the red ghost's position as a reference point, then doubles the vector. Creates pincer movements
  • Coward (orange) β€” chases when far away, retreats to the corner when close

They cycle between scatter and chase modes on authentic Ms. Pac-Man timers. When you eat a power pellet, they flee β€” but only briefly, and for less time at higher levels.

What Works, What Doesn't

This is a prototype. The maze works, the dots get eaten, the ghosts chase and flee, the jail system releases them in single-file order, and Psycho Chase kicks in when you've eaten 80% of the dots. Fruit spawns and can be collected for bonus points. Multiple mazes rotate as you advance through levels.

What's missing: cutscenes, sound, and probably a hundred edge cases that the original ROM handles with a decade of arcade-tested precision.

Good enough to play. Not good enough to put a quarter in.

components published