MacMan – HTML5 Pac-Man-style Maze Arcade Game with Classic Ghost AI (Phaser 3 + TypeScript)

Free, complete browser maze-chase game: four ghost personalities with arcade-accurate targeting, three original mazes, 21+ levels of rising difficulty, keyboard, gamepad and touch (swipe, joystick, d-pad), and an optional online leaderboard. Full TypeScript source.

by DEV3 TechnologiesVerified Author(0) 0 downloads 2 viewsUpdated 24 Oct 2026
MacMan – HTML5 Pac-Man-style Maze Arcade Game with Classic Ghost AI (Phaser 3 + TypeScript) — preview 1
1 / 12

MacMan is a complete, free HTML5 maze-chase arcade game in the spirit of the 1980 classic, built by DEV3 Technologies with Phaser 3 and TypeScript. Eat every dot, dodge four ghosts that each hunt in their own way, and grab an energizer to turn the tables.

Play it now: the browser demo is the full game with local high scores. The online leaderboard needs the included Node.js server, which you host yourself (optional).

Free download: sign in to any DEV3 account and the full source code, documentation and deployment files are yours, including future updates.

Four ghosts, four personalities

Each ghost steers toward a target tile, and the targeting rules follow the arcade original:

  • Blaze (red) – Hunter: aims straight at your tile, and speeds up twice as the maze empties.
  • Pixie (pink) – Ambusher: aims four tiles ahead of you.
  • Frost (cyan) – Flanker: doubles the vector from Blaze to a point two tiles ahead of you, so it closes in from the side Blaze isn't covering.
  • Ember (orange) – Wanderer: chases you from afar but retreats to its corner when within eight tiles.

The ghosts alternate between Scatter and Chase on a per-level timer and reverse on every switch. They turn blue and wander randomly when Frightened, and race home as eyes when Eaten. The ghost house releases them by dot counters, with a no-eating timer so camping is never safe.

Arcade gameplay, done properly

  • Turn buffering and cornering: press a direction early and MacMan takes it at the next opening; turns up to 0.42 tiles before or after a junction are accepted, so corners feel smooth instead of grid-locked.
  • Three original 28 × 31 mazes (Neon, Circuit, Fortress) with side tunnels, rotating every three levels. Add your own as ASCII art: the loader validates connectivity, markers and tunnels.
  • Classic scoring: dots 10, energizers 50, ghost streaks 200 → 400 → 800 → 1600, eight fruit worth 100–5,000, and an extra life at 10,000.
  • Difficulty curve from the arcade tables: faster ghosts each level, and fright time falling from 6 seconds to none.

Plays everywhere

  • Keyboard (arrows/WASD), the Gamepad API (d-pad or stick, A to start, Start to pause), and touch with three styles: swipe anywhere, a virtual joystick or a 4-way d-pad. The game switches to whichever device you used last.
  • A fixed 60 Hz simulation with interpolated rendering stays smooth on 60, 120 and 144 Hz screens. We measured a steady 60 FPS at 720p and 1080p in headless Chromium, even with software rendering.
  • Neon vector walls, sprites, particles, sound effects and music are all generated in code. No image or audio files: the whole client is about 365 KB gzipped.
  • Synthesised Web Audio sound: a waka that never overlaps itself, a siren that rises in pitch as the maze empties, and fright and eyes loops with crossfades.

Leaderboard

  • Local top 10 in LocalStorage, always available.
  • An optional online board through a small LeaderboardProvider hook. The bundled Express server validates submissions with zod, rate-limits per IP, rejects implausible scores and stores the top 100 in a JSON file. Point the client at any compatible API with one environment variable.

What's in the package

  • Full TypeScript source as an npm-workspaces monorepo: packages/shared (the deterministic rules engine and ghost AI), apps/client (Phaser) and apps/server (leaderboard API), about 6,000 lines.
  • 46 Vitest tests (maze validation, movement, every targeting profile, the mode state machine, house release, scoring, progression, determinism and an autopilot soak run, plus the leaderboard API) and 6 Playwright browser tests (desktop, gamepad emulation, mobile swipe and joystick, game over through to the online board).
  • HTML documentation and an installation guide, a Dockerfile (game and leaderboard on one origin), Vercel and Netlify configs for static hosting, and a GitHub Actions CI workflow.

Requirements

  • Node.js 18 or newer (20 LTS recommended) and npm
  • Static hosting is enough to play. The online leaderboard needs any host that runs a Node.js process or a Docker container.
  • No database, API keys or paid services

More from this author

View all

Related in Web Scripts & Software

View all