Amazon Q in Action ! Pacman Inspired game deployed

Building a Pac-Man Inspired Game with Amazon Q CLI

By Yashvi Kothari
Published: June 27, 2024

Introduction

amazon q

It turns out a simple, 200-line Pac-Man demo into a full-fledged, 2000+ line game using Amazon Q CLI. Along t…


This content originally appeared on DEV Community and was authored by Yashvi Kothari

Building a Pac-Man Inspired Game with Amazon Q CLI

By Yashvi Kothari

Published: June 27, 2024

Introduction

amazon q

Image description

It turns out a simple, 200-line Pac-Man demo into a full-fledged, 2000+ line game using Amazon Q CLI. Along the way, I learned how AI can speed up development, sharpen prompting skills, and shape the future of coding.

Image description

Why Pac-Man?

Inspiration: https://community.aws/content/2y6egGcPAGQs8EwtQUM9KAONojz/build-games-challenge-build-classics-with-amazon-q-developer-cli?trk=b3ed9c83-eb20-4f68-b5b4-ffdc878e85c6&sc_channel=em&bb=237784

https://community.aws/content/2vlITBGRfv8slpeU1UlTrpT4bBI/vibe-coding-in-practice-building-a-super-mario-game-with-amazon-q-developer-cli

  1. Complexity in layers—from basic movement to ghost AI.
  2. Real-time needs: 60 FPS, collision checks, responsive controls.
  3. Familiar rules make it easy to judge quality.
  4. Clear specs help shape prompts.

Image description

Core Challenges

  • Rendering with HTML5 Canvas
  • Collision detection (walls, ghosts, dots)
  • Ghost pathfinding and behaviors
  • State management (levels, lives, scores)
  • Audio via Web Audio API
  • Performance tuning

Image description

Mastering AI Prompting

https://youtube.com/shorts/ALgU6YR8Kkc

From Broad to Precise

  1. Too vague:

    "Create a Pac-Man game"

    → Minimal output

  2. More detail:

   "Make an 800×440 Canvas game with:
   - Grid movement
   - Wall collisions
   - Dot collection
   - Score tracking"

→ Working prototype

  1. Contextual ask:
   "Add four ghost AIs:
   - Blinky (chases Pac-Man)
   - Pinky (ambushes ahead)
   - Inky (patrols)
   - Clyde (random)
   Ensure proper pathfinding."

→ Distinct ghost behaviors

Prompting Tips

  • Iterate: Build feature by feature.
  • Keep context: Refer to earlier code.
  • Break problems down: Solve movement → input buffering → corner turns.
  • Be specific: Provide dimensions, rates, algorithms.

Tackling Key Problems

Youtube Video | Hindi-ENglish (Hinglish)

https://www.youtube.com/watch?v=iMuAm4wQ2vE

Working as per AI but not even ready for local/test setup

  • try to first verify what commands fall under root permissions
  • verify port is up & running

Image description

Collision Detection

AI generated both:

function checkCollision(a, b) {  }    // Circle vs. circle
function checkWallCollision(e, dir) {  }  // Grid-based

Ghost AI Behaviors

State machine per personality:

switch (ghost.type) {
  case 'aggressive': target = pacman.pos; break;
  case 'ambush':    target = ambushPos(); break;
  
}
ghost.pathfind();

Performance

  • Object pooling for particles
  • Dirty-rectangle rendering
  • Frame-limited loop with requestAnimationFrame

Automating Development

Tests

AI wrote unit and integration tests:

test('collect dot', () => {  });
test('ghost collision', () => {  });

Docs & Assets

Generated API docs and CSS animations:

@keyframes pacman-chomp {  }

When AI Surprises

Audio System

Full Web Audio API class without prompt:

class AudioSystem {
  generateTone(freq, dur) {  }
  play('dot');
}

Input Buffering

Handles rapid inputs and old entries:

inputBuffer.push({dir, time});
processBuffer();

Testing & Bug Fixes

  1. Manual: Unit → integration → UX tests.
  2. Automated: AI-generated test suites.
  3. Bug fixes:
    • Hidden loading screen
    • Pause button state issues

Image description

Final Product

Image description

  • Code: 2000+ lines, 15+ files
  • Features: Ghost AI, particle effects, achievements, mobile support
  • Performance: Steady 60 FPS on major browsers
  • Deployment: Live on GitHub Pages

Live URLs (After Deployment):**
Main Game: https://yashvikothari.github.io/pacman
Original Version: https://yashvikothari.github.io/pacman/versions/v0.1/
Working Version: https://yashvikothari.github.io/pacman/versions/v2.0.1-working/
Flexible Version: https://yashvikothari.github.io/pacman/versions/v2.0.1-flexible/

Audio & other version is not deployed here !

Lessons Learned

  1. AI multiplies, not replaces, your skills.
  2. Prompting is an art—detail and context matter.
  3. AI handles boilerplate, tests, docs well.
  4. Human oversight is key for architecture, UX, and performance.

What I’d Do Differently next time

  • Better upfront architecture planning
  • Test-driven prompts
  • Smaller, frequent commits with feature branches
  • Living documentation alongside code
  • integrate with git first

Image description

Recommendation

Yes, for prototyping, learning, and solo projects—if you:

  • Practice prompting
  • Understand generated code
  • Review performance
  • Pair AI with your own creativity

Conclusion

This Pac-Man project shows how AI can help you go from a rough demo to a polished game in hours. Treat AI as a coding partner, iterate often, and combine your creativity with AI efficiency to build amazing things faster than ever.


This content originally appeared on DEV Community and was authored by Yashvi Kothari


Print Share Comment Cite Upload Translate Updates
APA

Yashvi Kothari | Sciencx (2025-06-27T18:19:02+00:00) Amazon Q in Action ! Pacman Inspired game deployed. Retrieved from https://www.scien.cx/2025/06/27/amazon-q-in-action-pacman-inspired-game-deployed/

MLA
" » Amazon Q in Action ! Pacman Inspired game deployed." Yashvi Kothari | Sciencx - Friday June 27, 2025, https://www.scien.cx/2025/06/27/amazon-q-in-action-pacman-inspired-game-deployed/
HARVARD
Yashvi Kothari | Sciencx Friday June 27, 2025 » Amazon Q in Action ! Pacman Inspired game deployed., viewed ,<https://www.scien.cx/2025/06/27/amazon-q-in-action-pacman-inspired-game-deployed/>
VANCOUVER
Yashvi Kothari | Sciencx - » Amazon Q in Action ! Pacman Inspired game deployed. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/06/27/amazon-q-in-action-pacman-inspired-game-deployed/
CHICAGO
" » Amazon Q in Action ! Pacman Inspired game deployed." Yashvi Kothari | Sciencx - Accessed . https://www.scien.cx/2025/06/27/amazon-q-in-action-pacman-inspired-game-deployed/
IEEE
" » Amazon Q in Action ! Pacman Inspired game deployed." Yashvi Kothari | Sciencx [Online]. Available: https://www.scien.cx/2025/06/27/amazon-q-in-action-pacman-inspired-game-deployed/. [Accessed: ]
rf:citation
» Amazon Q in Action ! Pacman Inspired game deployed | Yashvi Kothari | Sciencx | https://www.scien.cx/2025/06/27/amazon-q-in-action-pacman-inspired-game-deployed/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.