<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mian Muhammad Musharraf</title>
    <description>The latest articles on DEV Community by Mian Muhammad Musharraf (@mian_muhammadmusharraf).</description>
    <link>https://dev.to/mian_muhammadmusharraf</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3268370%2Fe227a681-81e6-49bd-bb43-933d22f45a68.jpg</url>
      <title>DEV Community: Mian Muhammad Musharraf</title>
      <link>https://dev.to/mian_muhammadmusharraf</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mian_muhammadmusharraf"/>
    <language>en</language>
    <item>
      <title>Building a Chrome-Style Dinosaur Game Using Amazon Q CLI – #AmazonQCLI</title>
      <dc:creator>Mian Muhammad Musharraf</dc:creator>
      <pubDate>Mon, 16 Jun 2025 10:55:39 +0000</pubDate>
      <link>https://dev.to/mian_muhammadmusharraf/building-a-chrome-style-dinosaur-game-using-amazon-q-cli-amazonqcli-f6</link>
      <guid>https://dev.to/mian_muhammadmusharraf/building-a-chrome-style-dinosaur-game-using-amazon-q-cli-amazonqcli-f6</guid>
      <description>&lt;p&gt;Ever found yourself without internet and playing that addictive Chrome dinosaur game? I decided to recreate this classic&lt;br&gt;
using Python and Pygame, but with a twist - I built it entirely with the help of Amazon Q CLI, Amazon's AI assistant.&lt;/p&gt;
&lt;h2&gt;
  
  
  What I Built and Why
&lt;/h2&gt;

&lt;p&gt;I recreated the Chrome dinosaur game that appears when you're offline, but with several enhancements:&lt;/p&gt;

&lt;p&gt;• A dinosaur character that can jump over obstacles and duck under flying birds&lt;br&gt;
• Multiple types of obstacles (cacti and pterodactyls)&lt;br&gt;
• Day/night cycle that changes the background&lt;br&gt;
• Lives system with heart icons&lt;br&gt;
• Power-ups that give extra lives&lt;br&gt;
• Score tracking and high score memory&lt;br&gt;
• Sound effects for jumping, scoring, and game over&lt;br&gt;
• Pause functionality&lt;/p&gt;

&lt;p&gt;I chose this project because it's a recognizable game with straightforward mechanics, making it perfect for testing&lt;br&gt;
Amazon Q's capabilities in game development. Plus, who doesn't love the Chrome dino?&lt;/p&gt;
&lt;h2&gt;
  
  
  How Amazon Q CLI Helped Me
&lt;/h2&gt;

&lt;p&gt;Amazon Q CLI was instrumental throughout the development process:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Initial Code Structure: With a simple prompt, Amazon Q generated the basic game structure using Pygame, setting up the&lt;br&gt;
window, game loop, and core mechanics.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Graphics Creation: Instead of requiring external assets, Amazon Q created all game graphics programmatically using&lt;br&gt;
Pygame's drawing functions, generating dinosaur animations, obstacles, and UI elements.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Game Logic: Amazon Q implemented collision detection, scoring systems, and the increasing difficulty curve that makes&lt;br&gt;
the game challenging.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Advanced Features: When I asked for enhancements, Amazon Q added features like the lives system, power-ups, and day/&lt;br&gt;
night cycle without requiring extensive explanations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Debugging: When we encountered issues with file structure, Amazon Q quickly identified and fixed the problems.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  My Prompts and How I Improved Them
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Initial Prompt
&lt;/h3&gt;

&lt;p&gt;My journey started with a simple request:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;I want you to make a good dino game as in chrome using pygame library&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This gave me a basic working game, but I wanted more.&lt;/p&gt;
&lt;h3&gt;
  
  
  Refining the Prompts
&lt;/h3&gt;

&lt;p&gt;I improved my results by being more specific about what I wanted:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;yes please get better graphics&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This led to more detailed sprite designs and animations.&lt;/p&gt;

&lt;p&gt;For additional features, I simply said:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;yes please&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And Amazon Q understood I wanted more game elements, adding power-ups, lives system, and sound effects.&lt;/p&gt;
&lt;h2&gt;
  
  
  AI Struggles and Solutions
&lt;/h2&gt;

&lt;p&gt;We did face some challenges:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;File Structure Issues: When enhancing the game, we encountered problems with the file organization. Amazon Q&lt;br&gt;
recognized this and created a completely new, properly structured file.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Sound Implementation: Creating sound effects programmatically was tricky, but Amazon Q implemented a clever solution&lt;br&gt;
using Pygame's sound array functionality to generate audio without external files.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Complex Graphics: While Amazon Q couldn't create photorealistic graphics, it cleverly used simple shapes and&lt;br&gt;
animations to create recognizable and functional game elements.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  The Final Result
&lt;/h2&gt;

&lt;p&gt;The final game includes:&lt;/p&gt;

&lt;p&gt;• Smooth dinosaur animations for running, jumping, and ducking&lt;br&gt;
• Multiple obstacle types with varying difficulty&lt;br&gt;
• Visual effects like day/night cycle and blinking invincibility&lt;br&gt;
• Sound effects for game actions&lt;br&gt;
• Score tracking and high score memory&lt;br&gt;
• Lives system with heart icons and power-ups&lt;br&gt;
• Pause functionality&lt;/p&gt;

&lt;p&gt;Here's what the gameplay looks like:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhlar5rsxftzuclx7knv2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhlar5rsxftzuclx7knv2.png" alt="Dino Game" width="800" height="332"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb53xryf7ts3vyya1ntd5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb53xryf7ts3vyya1ntd5.png" alt="Image description" width="800" height="324"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Code Highlights
&lt;/h2&gt;

&lt;p&gt;One of the most impressive aspects was how Amazon Q implemented the dinosaur's movement system:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python
def update(self, user_input):
    if self.dead:
        self.image = self.dead_img
        return`

    if self.running:
        self.run()
    if self.ducking:
        self.duck()
    if self.jumping:
        self.jump()

    if self.step_index &amp;gt;= 10:
        self.step_index = 0

    if (user_input[pygame.K_UP] or user_input[pygame.K_SPACE]) and not self.jumping:
        self.jumping = True
        self.running = False
        self.ducking = False
        if jump_sound:
            jump_sound.play()
    elif user_input[pygame.K_DOWN] and not self.jumping:
        self.ducking = True
        self.running = False
        self.jumping = False
    elif not (user_input[pygame.K_DOWN] or self.jumping):
        self.running = True
        self.ducking = False
        self.jumping = False

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Building this game with Amazon Q CLI demonstrated how AI can accelerate game development, even for someone without&lt;br&gt;
extensive Pygame experience. The assistant not only wrote functional code but also implemented creative solutions and&lt;br&gt;
game design elements.&lt;/p&gt;

&lt;p&gt;What impressed me most was how Amazon Q understood the context of the Chrome dinosaur game and recreated its essence&lt;br&gt;
while adding new features that enhanced the gameplay. The entire development process was conversational and iterative,&lt;br&gt;
allowing me to refine the game step by step.&lt;/p&gt;

&lt;p&gt;If you're interested in game development or exploring what AI assistants can do, I highly recommend giving Amazon Q CLI&lt;br&gt;
a try. It's not just about writing code—it's about collaborative creation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Next Steps
&lt;/h2&gt;

&lt;p&gt;If you'd like to try the game yourself, the complete code is available &lt;a href="https://github.com/MianMusharraf/chrome-dino-amazonqcli.git" rel="noopener noreferrer"&gt;https://github.com/MianMusharraf/chrome-dino-amazonqcli.git&lt;/a&gt;. Feel free to&lt;br&gt;
modify it and add your own features!&lt;/p&gt;

</description>
      <category>amazonqcli</category>
      <category>pygame</category>
      <category>gamedev</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
