Can I Build a Game in Five Hours with AI? Exploring Cookie Quest with Claude AI
Artificial intelligence has been making steady inroads into software development, but how effective is it in practice? This question lies at the heart of Cookie Quest, a 3D cookie-clicker game developed with the help of Claude AI and the PlayCanvas framework. Designed as an experiment to explore the boundaries of AI-assisted programming, the project sought to evaluate how AI can assist in creating a functional game in a compressed timeline.
Cookie Quest draws inspiration from the 2013 web game Cookie Clicker, developed by Julien "Orteil" Thiennot. The original game captivated audiences with its simple yet addictive mechanics: players clicked on a cookie to earn points, eventually unlocking upgrades to automate cookie production. Its charming premise and infinite progression loop made it a cultural phenomenon in casual gaming. Cookie Quest was chosen as a tribute to this classic, serving as a straightforward project to explore AI-assisted development without the complications of intricate mechanics or large-scale systems.
The process uncovered remarkable strengths and noticeable limitations, offering a glimpse into the current state of AI-powered development tools and their potential future.
Claude AI: A New Partner in Code Generation
Claude AI, developed by Anthropic, represents a leap in AI's ability to assist developers. Compared to other models, such as OpenAI's GPT-4o, Claude offers distinct strengths in generating precise, functional code. While GPT-4o excels in rapid prototyping and creative problem-solving, Claude demonstrates a stronger focus on producing clean, documented solutions that integrate seamlessly into projects. In many cases, during this experiment, the code generated by Claude was error-free and could be used without modification.
at GameState.notifyListeners (gameState.js:60:24)
at GameState.reset (gameState.js:82:14)
at new GameState (gameState.js:5:14)
at HTMLDocument.<anonymous> (main.js:6:23)
When errors did occur, the AI excelled at debugging, quickly resolving issues when error messages were provided. However, it struggled with certain tasks like user interface (UI) design, where inaccuracies often required manual intervention. Additionally, the AI’s ability to produce modular code was limited—it required explicit prompts to break down a project into maintainable components, making human oversight crucial.
PlayCanvas: A Versatile Tool for Web Game Development
PlayCanvas is an open-source, browser-based game engine built to create high-performance 2D and 3D web games. Designed for accessibility, the platform offers tools for rendering, animation, physics, and user interface development, all within a collaborative online environment. Its compatibility with both desktop and mobile browsers makes it an excellent choice for developing interactive applications.
This project leveraged PlayCanvas to create an engaging, easily accessible experience. The framework's modularity and cross-platform capabilities proved essential in achieving the game’s dual goals of desktop and mobile compatibility.
Developing Cookie Quest: A Case Study in AI Collaboration
The development of Cookie Quest highlighted both the power and limitations of AI-assisted coding. The goal was ambitious: to create a playable demo within five hours using Claude AI as a coding partner and PlayCanvas as the development framework. The results demonstrated how AI can accelerate game creation while emphasizing the continued importance of human expertise.
Setting the Foundation
Claude AI’s precision was immediately apparent in the early stages of development. It handled boilerplate code effortlessly, generating the foundational elements for Cookie Quest:
- A rotating 3D cookie rendered in the PlayCanvas engine.
- A basic UI to track clicks and display points.
- An upgrade system for purchasing automated cookie production.
It is important to note that at the start of the project, the author had no prior experience with PlayCanvas. This made Claude's ability to generate functional, accurate code all the more valuable, as it bridged the gap in familiarity with the framework and allowed for rapid progress.
The generated code was accurate and functional, requiring minimal debugging. When errors did arise, such as issues with event handling or logic, they were swiftly resolved by feeding error messages back into the AI for corrections. However, setting up the project’s architecture highlighted one of Claude’s weaknesses: modularity. Without explicit instructions, the AI defaulted to producing monolithic code, necessitating deliberate efforts to refactor the codebase.
Iteration and Refinement
Development quickly moved into an iterative cycle. Game features, such as the cookie’s animation, evolved through multiple refinements. For example, the rotation effect started as a basic spin but was enhanced to include a wobble effect, adding visual charm to the gameplay. Claude excelled in handling these iterations, generating clean code with each adjustment.
However, the iteration process revealed another limitation: daily usage limits. Although the project was completed in five hours, it spanned two days because Claude restricted the number of queries allowed in a single session. The AI’s interface suggested starting a new session to reduce conversation complexity, but this created significant overhead. Reloading all source files and reestablishing context in the new session proved time-consuming and disruptive. These limits raise concerns about the practicality of using AI tools for extended programming sessions, particularly in professional settings where efficiency is paramount.
The UI design process was also challenging. Claude often produced solutions that failed to account for edge cases or platform-specific behaviours, particularly on mobile devices. This was evident during mobile testing, where touch inputs failed to register consistently, and unwanted zooming disrupted gameplay. Solutions required extensive manual intervention, including:
- Adding meta tags to prevent zooming.
- Refining touch event handling for better responsiveness.
- Adjusting UI elements for smaller screen sizes.
These issues underscored the importance of human judgment in areas where AI struggled to account for user experience nuances.
Balancing Gameplay Mechanics
Game balance remained one of the most complex aspects of development. The initial implementation of Cookie Quest’s factory system relied on linear production scaling while costs increased exponentially, creating an imbalance that negated elements of the games. Although Claude provided a solid starting point for balancing formulas, fine-tuning progression curves required human intervention. AI struggled to grasp the mathematical subtleties of a satisfying progression system, highlighting the ongoing need for human creativity in game design.
Final Thoughts
While AI tools like Claude AI are not yet replacements for human developers, they are increasingly valuable collaborators. In the case of Cookie Quest, AI assistance allowed for the rapid creation of a functional game, even with limited familiarity with the tools and framework. However, the process revealed that human creativity, testing, and decision-making remain indispensable, particularly in areas like game design and user experience.