
๐งโโ๏ธ Build a Dark Fantasy RPG in Python with Amazon Q CLI
Built a 2D RPG in Python with Amazon Q CLI! See how AI-assisted development turned a fun project into a powerful game dev learning experience.
Published May 31, 2025
Dark Fantasy Game is a single-player, 2D, offline RPG mini-game set in a grim, medieval fantasy world. You play as a lone warrior battling waves of enemies โ mostly goblins โ in a side-scrolling environment. Despite its simplicity, the game includes all the basic elements of an RPG:
- Player Control: Move the character using arrow keys.
- Combat System: Press spacebar to attack nearby enemies.
- Enemy AI: Goblins chase the player and attack on sight.
- Stats Tracking: Health points (HP), score, and game-over logic.
- Sprite-Based Animation: Characters and enemies have walking, attacking, and death animations.
- Basic Game Loop: Start screen, active gameplay, and game-over states.
dark-fantasy-game/
โโโ assets/
โ โโโ sprites/
โ โโโ player/
โ โโโ goblin/
โโโ dark_fantasy_game.py
โโโ game_stats.py
โโโ enemy.py
โโโ player.py
โโโ utils/
โโโ animation.py
Amazon Q CLI is an AI-powered assistant that can generate code directly from the terminal using natural language prompts. I used it extensively to bootstrap the game's foundation.
aws q generate python \
--prompt "A player class in pygame that supports movement and attack animation" \
--output player.py
aws q generate python \
--prompt "Create an Enemy class that chases the player and animates attacks in pygame" \
--output enemy.py
aws q generate python \
--prompt "Create a StatsManager that tracks player health, score, and game over logic" \
--output game_stats.py
aws q generate python \
--prompt "A function that loads and plays sprite animations from a folder in pygame" \
--output animation.py
From there, I edited the generated code to fine-tune game mechanics, fix bugs, and add sound effects, collision logic, and enemy behavior.
I was able to scaffold most of the gameโs core structure in minutes using natural language prompts.
Q CLI encouraged me to split logic into separate files and classes โ cleaner code, easier debugging, and better organization.
Instead of reading documentation line by line, I learned by editing and testing code generated by Q CLI.
I still had to think through design, fix logic errors, and polish the game. Q CLI just helped me move faster.
๐บ YouTube Demo:
https://youtu.be/hO-bxtUiYOQ
https://youtu.be/hO-bxtUiYOQ
๐ป GitHub Source Code:
https://github.com/TrQuHuy/dark-fantasy-game
https://github.com/TrQuHuy/dark-fantasy-game
Dark Fantasy Game is not a commercial-grade product โ but itโs a complete, functional, and enjoyable mini-game built almost entirely through an AI-assisted workflow.
If you're a Python learner, hobbyist game developer, or just curious about the power of Amazon Q CLI, I highly recommend trying this approach. All you need is an idea, a few terminal commands, and youโre off creating your own game.
ย
ย