I recently participated in the "Build Games with Amazon Q CLI" campaign, which encouraged building games in local languages. This sparked an idea: why not create a Chinese Idiom (成语 chéngyǔ) Game? These idioms are concise expressions that often convey a deep meaning, similar to proverbs.
This project became an exciting journey, pushing the boundaries of what I thought was possible with AI-assisted development.
👉 If you want to go straight to the code, check out myGitHub repository!
What is Amazon Q CLI?
Amazon Q CLI is an AI assistant that enhances coding and development tasks through interactive conversations. What sets it apart from typical AI chatbots and IDEs is its ability to use external tools. It operates on a principle called the ReAct approach, where the AI agent plans tasks, executes actions using tools, and then observes the results to decide its next steps.
This means I didn't need to manually navigate directories in the terminal or create and edit files. Amazon Q CLI handled these operations autonomously, executing bash commands and writing files directly.
Amazon Q CLI using tools to execute bash command to write file
How I Built The Game
My development process unfolded in distinct phases, each revealing more about the power of AI-driven development.
Phase 0: Initial Experimentation with Mistral Chat
Before diving into Amazon Q CLI, I tested my core idea with Mistral Chat. My goal was a simple Command Line Interface (CLI) game. While the initial output had some bugs, it gave me a clear understanding of potential challenges and future enhancements.
I anticipated needing to:
v0: Prompt experimentation
Phase 1: The Amazon Q CLI Breakthrough
Armed with insights from my initial experiment, I used the same prompts with Amazon Q CLI. The results were astonishing. Within just 2 minutes (it could have been faster if I hadn't paused to observe and allowed "trust mode" from the start), Amazon Q CLI delivered a fully functional game. It perfectly addressed all my anticipated bug fixes and enhancements, even though I hadn't explicitly mentioned them in my prompts.
The generated code included color-coded feedback, and even an auto-generated README file. It was truly mind-blowing! 🤩
The core prompts I used were:
📜 Curious about the whole prompts? Check out theprompts archive!
Powered by the robust Claude 3.7 Sonnet model, Amazon Q CLI exceeded all my expectations. I could have left it at that, but I wanted to explore further. Inspired by Haowen Huang's approach, I chose to level up the game using Pygame.
Phase 2: Adding Pygame GUI and Multilingual Support
My next step was to enhance the game with a graphical user interface (GUI) and expand its language support. In addition to English, I incorporated Japanese and Korean translations, increasing the game's accessibility to a wider audience.
First, I used Amazon Q CLI to manage versioning, creating a new folder for the updated code. Then, I prompted it to integrate Pygame for a retro 8-bit style UI, add language-switching buttons, and implement sound effects.
The simplified prompts for this phase included:
🥲 Read theprompts archiveto see how I struggled with the UI design.
I also observed the agent running time. Each conversation, consisting of an average of 5 tasks, took 3 to 5 minutes depending on task difficulty. This efficiency is powerful and highlights the transformative potential of agentic coding. It was also fascinating to observe the clear folder structure Amazon Q CLI created.
The final product, while having minor text alignment issues, was far beyond what I could have achieved alone in a single day, given my limited knowledge of Pygame and UI/UX design. It was a significant success worth celebrating! 🥳
This project provided invaluable lessons, not just about AI tools, but about the evolving nature of software development itself.
The Power of Clear Communication
The most significant takeaway is that as long as you clearly define your desired outcome, AI can handle the heavy lifting. With advanced AI, humans can now delegate technical tasks and focus on strategic thinking. Instead of getting bogged down by how to implement a feature, I focused on what I wanted the game to do and how players would interact with it.
In my initial prompt for Phase 1, I meticulously described the game's mechanics, components (e.g., buttons, counters, lives), and how translations should be displayed. This detailed, structured approach is key to guiding AI effectively. Working with AI is, in essence, a masterclass in communication and leadership. It's not about knowing every technical detail, but about understanding the available tools and articulating our vision to leverage AI's capabilities.
The Indispensable Role of Domain Knowledge
Even with powerful AI, domain knowledge remains essential. My biggest challenge was styling the game's UI. Despite multiple attempts with prompts, I couldn't achieve the exact layout I envisioned. This was largely due to my unfamiliarity with Pygame's capabilities and my limited UI/UX vocabulary. I simply lacked the precise technical terms to describe my desired layout effectively.
While we can't master every field, AI can bridge knowledge gaps by providing quick summaries or introductions to unfamiliar topics. Before diving into a new tool, asking AI for a brief overview of its functionalities can save significant time and frustration.
Navigating the Error Loop
During development, I encountered an error loop of "Warning: received an unexpected error from the model". I gave it time to see if Amazon Q CLI could get out of the loop by itself, but it couldn't. I was stuck for about 20 minutes, realizing that without my intervention, it might never have resolved itself. I then interrupted the process and tried shortening my prompts to only one task. Amazon Q CLI successfully completed the task this time. It also remembered the previous prompts and continued to work on the tasks that had caused the error loop, even if they weren't explicitly mentioned in the recent turn. This shows that the memory persists even if tasks are not finished.
I checked the conversation state afterward and found error messages like "WARNING: the actual tool use arguments were too complicated to be generated" and "The generated tool was too large, try again but this time split up the work between multiple tool uses". I hope there will be a mechanism for the AI agent to break out of such error loops for solving this issue.
This experience underscored a crucial point: while AI has impressive memory, it can get trapped in repetitive cycles if not guided. It highlighted the need for human oversight and intervention, especially when debugging. This reinforced the idea that while the AI handles execution, the human's role is to maintain the overarching strategy and workflow.
Amazon Q CLI Additional Features
Beyond its core chat capabilities, Amazon Q CLI offers several other useful features:
Agent Flexibility
When a task extends beyond the agent's direct capabilities, it intelligently provides solutions. For instance, when font and sound files were needed for multilingual support and audio effects, Amazon Q CLI didn't download them directly. Instead, it generated clear instructions within the README file, guiding me to obtain the necessary assets.
AI auto-generated README instructions for assets
Image Input
During my UI design struggles, I wished I could simply show the assistant an image of my ideal layout. I later discovered that Amazon Q CLI supports image inputs! I provided a screenshot of my desired UI, and the agent accurately interpreted the visual information.
The screenshot I provided:
Screenshot provided to AI for UI change instructions
The agent's response:
AI response screenshot
The Optical Character Recognition (OCR) worked perfectly, and the agent understood the task. While the final UI wasn't an exact replica of my envision (it changed from one language button to three), the aesthetic result was pleasing and functional.
Intelligent Command Completions
Amazon Q CLI also provides intelligent inline command auto-completions. You can simply press the right arrow key → to accept a suggestion, streamlining your workflow.
Command line auto-complete
Check All Commands with /help
For a comprehensive list of available commands, you can type /help in the Amazon Q CLI. Some particularly useful commands include:
/usage: Shows the current session's context window usage.
/compact: Summarizes the conversation to free up context space.
/save,/load: Saves or loads the conversation state to a JSON file.
/mcp: Displays the mcp server loaded.
Conversation history has been replaced with compact summary
Telemetry Data Collection
AWS collects telemetry data about how you use the product, such as which commands you run and how often you use different features, to help improve the product. While you have the option to opt-out, contributing this data helps support open-source development. You can adjust your preference for telemetry data collection at any time. Refer to the documentation for more details.
👀 There are many more features to explore! Install Amazon Q CLI and start your own journey.
Conclusion
Building a game from scratch in a day, using tools I was new to, was an incredible experience. The agentic coding experience provided by Amazon Q CLI far exceeded my expectations and stands distinctly apart from simple AI chats or IDEs.
I've also learned how to work with AI. Instead of getting buried in work, it's time to step back and think about the big picture. Set up a clear initial plan and provide structured instructions to delegate the work to AI.
With AI, everything moves at rocket speed, transforming what once seemed like impossible dreams into tangible realities. This is truly the time to build. Try Amazon Q CLI to bring your most imaginative ideas to life in minutes!