DEV Community

Cover image for I Built a Game in Under an Hour with Amazon Q CLI (and Here's What Happened)
Mj Gealogo
Mj Gealogo

Posted on • Edited on

I Built a Game in Under an Hour with Amazon Q CLI (and Here's What Happened)

The challenge was set:

Build a game using the Amazon Q CLI for a shot at scoring a coveted T-shirt. As a developer always up for a new challenge, I dove in headfirst. My goal? To create a functional shooting game in under an hour, relying solely on the command line and Amazon's new AI assistant. The result was a whirlwind of rapid development, unexpected hurdles, and a revealing glimpse into the future of coding.

Image description

Setting the Stage: From Docker to Local Dev

My initial thought was to keep my development environment clean and containerized using Docker. However, I quickly hit a roadblock. The game I envisioned, a dynamic shooter, would be built with Pygame, a popular Python library for game development. Pygame, by its nature, requires a graphical interface to render the game window, something my Docker setup wasn't configured for.

Pivoting quickly, I decided to set up Amazon Q and the necessary dependencies locally on my machine. A few commands later, I had the Amazon Q CLI installed and was ready to roll. The setup was surprisingly straightforward. A simple q login authenticated me, and q chat threw me right into an interactive session with the AI.

One of the most intriguing aspects of the Amazon Q CLI is its interactive nature. It doesn't just spit out code; it asks for permission to write files, make edits, and even run commands to install dependencies or test the application. This collaborative approach felt less like using a tool and more like pair programming with an incredibly fast partner.

From Vague Idea to Concrete Game

With the clock ticking, I started with a broad prompt:

"I want to create a shooting type game like gun mayhem"

Amazon Q responded with a foundational Pygame structure. It was a good start, but I needed to be more specific to get the game I had in mind. My next prompt drilled down into the core gameplay loop:

"I want to verse an enemy where each level it gets more difficult to beat"

This is where the AI started to shine. It began to scaffold out the game logic, introducing concepts of player and enemy characters, and a basic level structure. To add more flavour and strategic depth, I then requested:

"Include power ups such as health, speed, rapid fire, damage boost"

Amazon Q integrated these features, creating the code for power-up items that would randomly spawn on the screen. The game was starting to take shape, and all within the first half-hour.

The Inevitable Bugs and a Helping Hand

No development process is without its bumps, and working with an AI is no exception. A significant issue arose with the game's platforms; they were generated at a height that was impossible for the player to jump onto. I pointed this out to Amazon Q, and after a bit of back and forth, it adjusted the parameters to create accessible platforms.

I also encountered a few runtime errors. Instead of spending precious minutes debugging the code myself, I simply fed the error messages back to my AI partner. In most cases, Amazon Q was able to identify the issue and propose a fix, which it would then apply with my permission. This rapid, iterative cycle of prompting, testing, and AI-assisted debugging was the key to making progress so quickly.

Image description

The AI's Limits: A Glimpse of the Future's Challenges

As the codebase grew, a noticeable pattern emerged. Amazon Q, which had been lightning-fast with the initial scaffolding, began to slow down. Its responses took longer, and the accuracy of its code suggestions started to decline. It was as if the increasing complexity of the project was taxing its ability to maintain context and generate precise, error-free code.

Image description

Time's Up: The Final Product

When the hour was up, I had a functioning, if not perfectly polished, shooting game. There was a player character, levels that became more challenging, and a variety of power-ups to collect. It wasn't "Gun Mayhem," but it was a playable game, created from scratch in under 60 minutes.

My journey with the Amazon Q CLI was a fascinating one. It demonstrated the incredible potential of AI to accelerate the development process, especially in the initial stages of a project. The ability to rapidly prototype ideas and get a working foundation in minutes is a game-changer. However, it also underscored the current limitations of the technology. As projects grow in complexity, the reliance on a human developer's expertise to guide, correct, and optimize the AI's output becomes even more critical.

For now, I've got a cool little game and a great story to tell. And who knows, maybe I'll even get that T-shirt.

Top comments (0)