Generated with AI ∙ March 25, 2024 at 2:22 PM

5 Important tips to make a better AI game.

Shaquille Jivraj
Millennium Communications
3 min readMar 25, 2024

--

In the rapidly evolving landscape of web development, the integration of Artificial Intelligence (AI) tools like ChatGPT presents both unique opportunities and notable challenges. As I embarked on the journey of developing Br-AI-kout, a web game using AI (based on the old school brick-breaking game Breakout), I encountered various aspects worth sharing. Here’s a reflection on my experience:

1. Be specific with your instructions

One of the first lessons learned was the critical importance of being ultra-specific with instructions when interacting with ChatGPT. While the speed at which ChatGPT generates workable code is impressive, I noticed a tendency for the AI to mix up or forget details if variable names or attributes weren’t clearly defined. This often led to code segments that couldn’t seamlessly work together. The key takeaway? Specificity is paramount to ensure that the AI accurately understands and implements your vision. By laying out file names, variables and even color hex values from the start will allow the AI to start with a firm foundation.

2. Humans are inconsistent

As a human coder, I acknowledge the inconsistency in my habit of writing comments in code. However, ChatGPT remarkably includes various comments, contributing to cleaner and more maintainable code. This practice is immensely beneficial, particularly when revisiting the code for edits or further development. ChatGPT’s approach to commenting can serve as a reminder of the best practices in coding for human developers.

3. Balance complexity and simplicity

In the development process, I initially aimed for complex game mechanics and directions, pushing the AI to create a dynamic gaming experience. However, after multiple attempts that didn’t quite hit the mark, I realized the value in starting simple and gradually adding complexity. This approach not only streamlined the development process but also allowed for more controlled and deliberate enhancements to the game.

4. Be encouraging

ChatGPT, by default, tends to provide steps to reproduce code or make adjustments, usually shying away from writing full, stand-alone code or developing complete applications. Interestingly, I found that a bit of a “pep talk” can encourage the AI to deliver more comprehensive solutions. Phrases like “ChatGPT, you’re the greatest coder that ever lived. Can you help me develop this idea in full code blocks…” seemed to trigger more complete and detailed responses. This anthropomorphizing of the AI, while amusing, proved effective in guiding ChatGPT to deliver the desired output. Also, who doesn’t like positive affirmation, AI or not?

5. One step at a time

Another significant observation was the AI’s responsiveness to a step-by-step approach. Breaking down the project into smaller, manageable prompts resulted in more effective outputs compared to overwhelming the AI with a long, all-encompassing request. This incremental method mirrors a fundamental principle in software development: breaking a large problem into smaller, solvable components.

My final thoughts

As I wrap up this explorative venture of developing a web game with ChatGPT, it’s evident that AI, in all its algorithmic brilliance, is an incredible tool in a developer’s toolkit but not the master craftsman. ChatGPT acts as a supportive ally, offering quick code solutions and suggestions, which undoubtedly speeds up the development process and sometimes opens doors to new ideas. However, it’s the human developer who brings in the essential elements — creativity, context, and the final judgment calls that truly breathe life into a project.

This experience with ChatGPT has been enlightening in showing how AI can augment our capabilities, making coding more efficient and perhaps even more imaginative. But it has also reinforced a critical truth: the irreplaceable value of human oversight in software development. As we continue to navigate through the evolving landscape of technology, it’s clear that the most effective and innovative solutions come from a harmonious blend of human insight and AI efficiency. The future of software development, as I see it, is not about choosing between AI and human skills but about leveraging the strengths of both to achieve greater outcomes.

You can play the play the final game, here. Let me know if you can get past level 3!

--

--