DEV Community

Cover image for ๐Ÿฅท I Built a Procedural Ninja Stealth Game in Python โ€“ "Openstate" (with Amazon Q CLI)
Kshitij Gawankar
Kshitij Gawankar

Posted on

๐Ÿฅท I Built a Procedural Ninja Stealth Game in Python โ€“ "Openstate" (with Amazon Q CLI)

Ever wanted to sneak through a maze as a shadowy ninja, dodging guards, grabbing scrolls, and escaping undetected?
Thatโ€™s exactly what I built with Openstate โ€” a 2D stealth platformer game using Python, Pygame, and scaffolding powered by Amazon Q CLI.

Let me take you through how I made it, what makes it tick, and how you can play it or even build your own.

๐ŸŽฎ What is Openstate?
Openstate is a procedurally generated stealth game where you:

Sneak past patrolling guards with line-of-sight vision

Collect hidden scrolls across a maze

Use shadows and bushes to hide

Escape through the exit โ€” all without being caught

Each level gets harder, and every run is unique thanks to procedural generation.

๐ŸŽฅ Gameplay Demo
๐Ÿ‘‰ Watch the full gameplay of Openstate here: https://youtu.be/vvg_KIyrTkg

๐Ÿง  Key Features
๐ŸŽฏ Cone-of-vision AI: Guards detect you based on realistic field of vision

๐Ÿ” Procedurally generated levels: New maze every time

๐ŸŒŒ Dynamic guard speed: Increasing challenge each level

๐Ÿ“œ Scroll collection for stars

๐Ÿฅท Crouch, hide, and sneak to survive

๐ŸŒŸ 3-star rating system: Based on scrolls collected, exit reached, and stealth success

๐Ÿ” Game over + restart system if caught

๐Ÿ› ๏ธ How It Was Built
๐Ÿ“ Modular Architecture
player.py: Movement, jumping, crouching, hiding

guard.py: AI, patrol logic, detection

level.py: Handles maze, scrolls, exit, guards

maze_generator.py: DFS-based maze generation

ui.py: Timer, star count, detection alerts

๐Ÿ’ป Powered by Amazon Q CLI
Amazon Q CLI helped scaffold the basic architecture for this project โ€” making it easier to organize the code and scale features over time.
It was part of the "Build Games with Amazon Q CLI" challenge.

๐Ÿงช Challenges Faced
Tuning AI to be โ€œdumb but fairโ€ (nobody likes psychic guards)

Ensuring maze generation always leads to an exit

Getting animations and UI overlays working properly in Pygame

๐Ÿš€ Try the Game Yourself
๐Ÿ’ป Clone the Repo:
bash
Copy
Edit
git clone https://github.com/Kshitij-0007/openstate
cd openstate
pip install -r requirements.txt
python main.py
๐Ÿ”— GitHub Repo: https://github.com/Kshitij-0007/openstate

๐Ÿง  Lessons Learned
Procedural generation adds replayability โ€” but also debugging nightmares ๐Ÿ˜…

Simple AI systems can feel very smart with just a cone of vision and patrols

Amazon Q CLI can boost productivity and structure โ€” especially for solo devs

๐Ÿ›ฃ๏ธ Whatโ€™s Next for Openstate?
๐Ÿ”ฎ Smoke bombs to distract guards

๐Ÿง  Smarter guard AI variations

๐Ÿงฑ Level editor for custom mazes

๐Ÿ’พ Save/load progress

๐Ÿ›๏ธ In-game power-ups like invisibility or speed boost

๐Ÿ™Œ Final Thoughts
This was built as part of the Amazon Q CLI Game Jam, and Iโ€™m super proud of how it turned out. If you're from Amazon and reading this โ€” this ninja humbly accepts T-shirt tributes ๐Ÿ‘•โœจ

Thanks for reading, and go give it a try!
Got feedback? Fork it? Want to collab? Letโ€™s connect!

๐Ÿ”ง Built With:
Python 3.9

Pygame

Amazon Q CLI

Canva (video editing)

๐Ÿ•ถ๏ธ Peace, scrolls, and silent footsteps.

python #pygame #gamedev #amazonqcli #opensource #devchallenge #stealthgame #indiedev #proceduralgeneration

Let me know if you'd like a thumbnail image or a post for LinkedIn
Image description too. Let's get this ninja everywhere. ๐Ÿฅท๐Ÿ’ป๐Ÿ’ฅ

Top comments (0)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.