Building PACMAN with AI
Project Overview
I created a fully-playable PACMAN game for Windows 11, built with Go + Wails and a vanilla JavaScript frontend, using AI assistance throughout the process.

My Inputs
I selected the AI tool (OpenCode) to guide development, chose the tech stack, and outlined goals grouped into phases for incremental delivery.
OpenCode
OpenCode is an AI-powered coding assistant that helps developers build software. It works through a chat interface where users describe what they want to build, and OpenCode generates appropriate code, explains implementation details, and helps iterate through problems.
aliases:
- “/blog/2026-01-21-building-pacman-with-ai/”
Alternatives to OpenCode include:
- Cursor Built to help you ship, right from your terminal.
- Claude-code Build, debug, and ship from your terminal, IDE, Slack, or the web.
- Codex CLI is OpenAI’s coding agent that you can run locally from your terminal.
- GitHub Copilot CLI reads, writes, and runs code where you work.
Tech Stack
- Backend: Go 1.20+ with Wails v2 (Windows desktop framework)
- Frontend: Vanilla JavaScript + Canvas API
- Resolution: 640x760 pixels (21x21 grid + UI margins)
Phases Implemented (6 of 8)
I decided to implement the project in iterative phases:
- Phase 0: Project Setup & Structure
- Phase 1: Core Game (PACMAN movement, collision, rendering)
- Phase 2: Ghosts (random movement, collision detection)
- Phase 3: Maze Design (symmetric layout, power pellets, ghost house)
- Phase 5: Enhanced Graphics (animations, glow effects, visual polish)
- Phase 6: Enhanced Sounds (7 effects, siren loop, overlays)
Skipped: Phase 4 - Level Progression (single-level game) Remaining: Phase 7: High Scores, Phase 8: Ghost AI (optional)
Result
A fully functional pacman.exe file.
Core Gameplay
- 21x21 symmetric maze with ghost house
- 4 ghosts with random movement
- 3 ghost states (Normal, Frightened, Eaten)
- Power pellet system (4 corners, 5s frightened mode, 3x slower ghosts)
- Ghost eating mechanics (200 points, 3s respawn)
- Scoring: 10/dot, 50/power pellet, 200/ghost
- 3 lives system with respawn
Audio & UI
- 7 sound effects (move, siren, power pellet, ghost eaten, death, level start, fruit)
- Web Audio API with WAV file support and synthesized fallbacks
- Background siren loop with proper lifecycle
- Mute toggle button with volume control
- Retro-styled overlays (start screen, game over/win)
- Keyboard focus handling (click to start ensures arrow keys work)
Visual Polish
- Animated PACMAN with mouth animation and glow effect
- Pulsing dots animation for visual interest
- 3D-styled walls with lighter inner color and border
- Frightened ghosts flashing blue/white
- Eaten ghosts in gray
Development Process
AI Assistance
For this project, OpenCode handled:
- Project setup and Wails configuration
- Go backend development (game logic, state management)
- Ghost movement and collision algorithms
- Maze generation algorithms
- Progressive disclosure documentation
- Git workflow management and conventional commits
- Debugging and troubleshooting (ghost speeds, collision issues)
- Code refactoring and optimization
Project Statistics
Code Metrics
- Go code: 649 lines
- JavaScript: 619 lines
- HTML + CSS: 160 lines
- Total code: ~1,428 lines
Git Statistics
- 61 total commits
- ~3 hours development First commit: 20:37, latest: 23:41
- 16 files changed with 956 insertions, 765 deletions

AI Testing Context (Jan 2026)
As of January 2026, there is an unofficial hierarchy of AI tools based on what people build to rank their capabilities:
- Level 1: Snake (Basic arrays and input handling) — 15,000+ daily
- Level 2: Tetris (Collision and rotation logic) — ~8,000 daily
- Level 3: Pac-Man (State-based AI and pathfinding) — ~4,000 daily
- Level 4: Flappy Bird Clone (Physics and gravity constants) — ~3,500 daily
- Level 5: 3D “Doom” style raycaster (The ultimate 2026 AI stress test) — <500 daily
This PACMAN project falls into Level 3 (Pac-Man), demonstrating state-based AI, pathfinding, and complete game mechanics. Check my Snake AI project created with these promts.