Building Super Mario Games with AI 🍄
Nostalgic game devs, if you grew up jumping through pixelated worlds as Mario, you’re going to love this!
This is a modern reinterpretation of the classic Super Mario experience—reimagined in two formats:
one for the web, one for desktop. Both versions were crafted to deliver smooth animations, vibrant graphics, and that familiar, addictive gameplay. 🎮
I created both versions in less than an hour using the Amazon Q Developer CLI, exploring the power of AI to scaffold the game logic, generate the folder structure, and even handle bug fixes automatically.
The Original Plan (That Failed)
I initially asked AI to build a "professional Super Mario game with advanced features." The result?
- 2000+ lines of complicated code
- Confusing file structure
- Features nobody wanted
- A game that wasn't fun to play
Lesson learned: More code ≠ Better game
The AI-Powered Breakthrough
Instead of fighting complexity, I worked with AI to build TWO focused versions:
🌐 HTML Version - The Universal Champion
Perfect for sharing and playing anywhere!
What I asked AI:
"Create a smooth Super Mario game for browsers. Make it mobile-friendly, under 300 lines, with spinning coins and responsive controls."
What AI delivered:
- Instant browser play
- Works on phones and tablets
- Smooth animations
- Easy to share with friends
🎮 Pygame Version - The Desktop Powerhouse
Enhanced with professional game development techniques!
What I asked AI:
"Take the HTML version and create a Pygame version with professional animations like squash & stretch effects and enhanced visual polish."
What AI delivered:
- Squash & stretch animations (like Pixar movies!)
- Glowing coin effects
- Smooth physics simulation
- Desktop gaming experience
Game Screenshots - HTML Version
Game Menu
The Game
Winning Scenario
Game Over
Pygame Version
[Desktop app with enhanced animations]
Pygame
AI Development Magic
The AI surprised me with smart suggestions I hadn't thought of:
Automatic mobile support for HTML version:
// AI added touch controls without me asking!
canvas.addEventListener('touchstart', handleTouch);
Professional animation techniques for Pygame:
# AI implemented industry-standard squash & stretch
if mario.jumping:
mario.scale_y = 0.8 # Squash when jumping
mario.scale_x = 1.2 # Stretch horizontally
Cross-platform optimization - AI automatically optimized each version for its platform.
Effective AI Prompts I Used
✅ Good Prompts (That Worked)
"Create a Mario game for HTML5 that works on mobile browsers"
"Add professional squash & stretch animations to the Pygame version"
"Make the coins spin in 3D with a golden glow effect"
❌ Bad Prompts (That Failed)
"Make a complex Mario game with advanced features"
"Add every possible animation and effect"
"Create the most professional game possible"
Key insight: Specific, focused requests work better than vague "make it awesome" prompts.
Time Saved with AI
- HTML Version: 2 hours (vs 8+ hours manually)
- Pygame Version: 3 hours (vs 12+ hours manually)
- Bug fixes: AI caught and fixed issues instantly
- Cross-platform adaptation: AI handled platform differences automatically
The Results
Feature | HTML Version | Pygame Version |
---|---|---|
Platform | Browser (Universal) | Desktop |
Installation | None | pip install pygame |
Best For | Sharing & Mobile | Gaming & Learning |
Animation Quality | Smooth | Professional |
File Size | 45KB | 15KB |
Running the Games
HTML Version (Recommended for sharing)
# Just open in any browser
open smooth-mario.html
Pygame Version (Recommended for desktop)
cd pygame-mario
python3 smooth_mario_pygame.py
Easy Launcher
python3 play.py # Choose your version!
What I Learned
🤖 AI Development Tips
- Be specific - "mobile-friendly Mario game" works better than "good Mario game"
- Iterate gradually - Build features one at a time
- Ask for explanations - Understanding AI's choices helps you learn
- Platform matters - Different platforms need different approaches
🎮 Game Development Insights
- Simple can be better - Two focused games beat one complicated mess
- Platform optimization - HTML for sharing, Pygame for desktop experience
- User experience first - Fun gameplay > technical complexity
- Clean code wins - 300 readable lines > 2000 confusing lines
Try It Yourself!
🔗 Play the games: GitHub Repository
🔗 HTML Version: Play in Browser
Want to build your own AI-powered game? Start with a simple, specific prompt and iterate from there!
Credits
- Built using AI assistance for rapid development
- HTML version: Pure JavaScript, no frameworks
- Pygame version: Python with professional animation techniques
- Total development time: 5 hours (would have been 20+ hours manually)
🍄 Some more days until the deadline. Join “Build Games with Amazon Q CLI” to get hands-on agentic coding experience, build games, complete the steps and redeem a cool T-shirt. Get started from here → https://s12d.com/BGWQCLI”
What game will you build with AI next?
Top comments (0)