Building “Alien RPG”: How I Used Amazon Q AI to Create an Alien RPG Game
Ravi kumar

Ravi kumar @ravikumar21

About: I am a BCA student in 1st year, I love tech....

Location:
patna, Bihar
Joined:
May 27, 2025

Building “Alien RPG”: How I Used Amazon Q AI to Create an Alien RPG Game

Publish Date: May 28
0 0

Image description

As a student with limited resources and only a Chromebook, I want to create a game. However, many people suggest I need higher processing power and more advanced technology. One day, I watched a YouTube video about B.Tecky. I learned that Amazon's Q technology is incredibly powerful. With just one prompt, I was able to generate a game, and it was both efficient and impressive.

**

Intro:

**
Video games are getting AI at the heart of this evolution. I set out to create a game called "ALIEN RPG".I used Amazon Q, an advanced AI assistant by AWS, to speed up development and power the brains behind the game. In this game, we control this game by giving commands like type 1 enter, type 2 enter, and type 3 enter . We control this game with this command. It's like a Q and A gam e. Wee give you 3 options like Attack, Use Item and Run.
**
What is Amazon Q?**
Amazon Q is a powerful AI tool designed by AWS to help developers build applications faster. Whether you’re writing code, generating assets, or managing logic, Amazon Q can assist with smart suggestions, code generation, and even integrations with your tools. For game developers, this opens up new ways to build dynamic and intelligent game systems.

Alien RPG gameplay
Image description
This is the first screen of the game, When we start a game, it shows like that.
First, we give a command 1 for New Game and 2 for Quit.
When we type 1 and enter, they give the 2nd screen.

Image description

Here, enter your name.

Image description
After entering the name, they give us 3rd screen.

Image description

So, they give you three options when you go with 1st option and type 1 and enter they give fourth screen.

Image description
Welcome to the game! You will attack and defend by choosing 1, 2, or 3.

Key Prompting Strategy:

  • build a game like a stone story they rpg fight eith aliens

Conversation,code and chat of Amazon Q

build a game like a stone story they rpg fight eith aliens
I'll help you build a text-based RPG game with alien combat, inspired by Stone Story RPG's ASCII art style. Let's

create a simple game in Python that features:

  1. ASCII art for visuals
  2. Turn-based combat with aliens
  3. Basic RPG elements like health, attack, and items Let's start by creating the main game file: 🛠️ Using tool: fs_write ⋮ ● Path: /home/arayachaudhar1309202/alien_rpg.py
  4. 1: #!/usr/bin/env python3
  5. 2: import random
  6. 3: import time
  7. 4: import os
  8. 5:
  9. 6: class Player:
  10. 7: def init(self, name):
  11. 8: self.name = name
  12. 9: self.health = 100
  13. 10: self.max_health = 100
  14. 11: self.attack = 15
  15. 12: self.defense = 5
  16. 13: self.inventory = ["Health Potion", "Energy Crystal"]
  17. 14: self.level = 1
  18. 15: self.exp = 0
  19. 16: self.exp_to_level = 100
  20. 17:
  21. 18: def take_damage(self, damage):
  22. 19: actual_damage = max(1, damage - self.defense)
  23. 20: self.health = max(0, self.health - actual_damage)
  24. 21: return actual_damage
  25. 22:
  26. 23: def heal(self, amount):
  27. 24: self.health = min(self.max_health, self.health + amount)
  28. 25:
  29. 26: def level_up(self):
  30. 27: self.level += 1
  31. 28: self.max_health += 20
  32. 29: self.health = self.max_health
  33. 30: self.attack += 5
  34. 31: self.defense += 2
  35. 32: self.exp_to_level = int(self.exp_to_level * 1.5)
  36. 33: print(f"\n╔═════════════════════════════════╗")
  37. 34: print(f"║ LEVEL UP! You are now level {self.level}! ║")
  38. 35: print(f"╚═════════════════════════════════╝")
  39. 36: print(f"Health: {self.max_health} | Attack: {self.attack} | Defense: {self.defense}")
  40. 37: time.sleep(2)
  41. 38:
  42. 39: def gain_exp(self, amount):
  43. 40: self.exp += amount
  44. 41: print(f"Gained {amount} experience points!")
  45. 42: if self.exp >= self.exp_to_level:
  46. 43: self.level_up()
  47. 44:
  48. 45: class Alien:
  49. 46: def init(self, level):
  50. 47: alien_types = [
  51. 48: {"name": "Crawler", "health": 30, "attack": 10, "defense": 2, "exp": 20,
  52. 49: "ascii": [" ... ", " / \ ", " | O O | ", " | V | ", " \---/ ", " ||||| "]},
  53. 50: {"name": "Blaster", "health": 40, "attack": 15, "defense": 3, "exp": 35,
  54. 51: "ascii": [" .---. ", " / \ ", "| - - |", "| ^ |", " \--_/ ", " ||||| "]},
  55. 52: {"name": "Sentinel", "health": 60, "attack": 12, "defense": 8, "exp": 50,
  56. 53: "ascii": [" /|\ ", " / | \ ", " /--|--\ ", "/ | \", " | ", " / \ "]}
  57. 54: ]
  58. 55:
  59. 56: alien_type = random.choice(alien_types)
  60. 57: self.name = alien_type["name"]
  61. 58: self.health = alien_type["health"] + (level * 5)
  62. 59: self.max_health = self.health
  63. 60: self.attack = alien_type["attack"] + (level * 2)
  64. 61: self.defense = alien_type["defense"] + level
  65. 62: self.exp_reward = alien_type["exp"] + (level * 10)
  66. 63: self.ascii = alien_type["ascii"]
  67. 64:
  68. 65: def take_damage(self, damage):
  69. 66: actual_damage = max(1, damage - self.defense)
  70. 67: self.health = max(0, self.health - actual_damage)
  71. 68: return actual_damage
  72. 69:
  73. 70: def clear_screen():
  74. 71: os.system('cls' if os.name == 'nt' else 'clear')
  75. 72:
  76. 73: def display_health_bar(current, maximum, length=20):
  77. 74: filled_length = int(length * current / maximum)
  78. 75: bar = '█' * filled_length + '░' * (length - filled_length)
  79. 76: percentage = int(100 * current / maximum)
  80. 77: return f"{bar} {current}/{maximum} ({percentage}%)"
  81. 78:
  82. 79: def display_battle(player, alien):
  83. 80: clear_screen()
  84. 81: print("\n" + "═" * 60)
  85. 82: print(f" {player.name} vs {alien.name}")
  86. 83: print("═" * 60)
  87. 84:
  88. 85: # Display alien ASCII art
  89. 86: for line in alien.ascii:
  90. 87: print(f"{' ' * 25}{line}")
  91. 88:
  92. 89: print("\n" + "─" * 60)
  93. 90: print(f"Player: {player.name} (Level {player.level})")
  94. 91: print(f"HP: {display_health_bar(player.health, player.max_health)}")
  95. 92: print(f"Attack: {player.attack} | Defense: {player.defense}")
  96. 93: print("─" * 60)
  97. 94: print(f"Alien: {alien.name}")
  98. 95: print(f"HP: {display_health_bar(alien.health, alien.max_health)}")
  99. 96: print(f"Attack: {alien.attack} | Defense: {alien.defense}")
  100. 97: print("═" * 60)
  101. 98:
  102. 99: def player_turn(player, alien):
  103. 100: print("\nYour turn! What would you like to do?")
  104. 101: print("1. Attack")
  105. 102: print("2. Use Item")
  106. 103: print("3. Run Away")
  107. 104:
  108. 105: while True:
  109. 106: choice = input("> ")
  110. 107: if choice == "1":
  111. 108: damage_dealt = alien.take_damage(player.attack)
  112. 109: print(f"You attack the {alien.name} for {damage_dealt} damage!")
  113. 110: time.sleep(1)
  114. 111: return True
  115. 112: elif choice == "2":
  116. 113: if not player.inventory:
  117. 114: print("Your inventory is empty!")
  118. 115: time.sleep(1)
  119. 116: continue
  120. 117:
  121. 118: print("\nInventory:")
  122. 119: for i, item in enumerate(player.inventory, 1):
  123. 120: print(f"{i}. {item}")
  124. 121: print("0. Back")
  125. 122:
  126. 123: item_choice = input("Select an item to use (or 0 to go back): ")
  127. 124: if item_choice == "0":
  128. 125: continue
  129. 126:
  130. 127: try:
  131. 128: item_index = int(item_choice) - 1
  132. 129: if 0 <= item_index < len(player.inventory):
  133. 130: item = player.inventory.pop(item_index)
  134. 131: if item == "Health Potion":
  135. 132: heal_amount = 30
  136. 133: player.heal(heal_amount)
  137. 134: print(f"You used a Health Potion and recovered {heal_amount} health!")
  138. 135: elif item == "Energy Crystal":
  139. 136: damage_dealt = alien.take_damage(25)
  140. 137: print(f"You used an Energy Crystal! It blasts the {alien.name} for {damage_dealt} damage!")
  141. 138: time.sleep(1)
  142. 139: return True
  143. 140: else:
  144. 141: print("Invalid item number!")
  145. 142: except ValueError:
  146. 143: print("Please enter a number!")
  147. 144: elif choice == "3":
  148. 145: if random.random() < 0.5:
  149. 146: print("You managed to escape!")
  150. 147: time.sleep(1)
  151. 148: return False
  152. 149: else:
  153. 150: print("You couldn't escape!")
  154. 151: time.sleep(1)
  155. 152: return True
  156. 153: else:
  157. 154: print("Invalid choice! Try again.")
  158. 155:
  159. 156: def alien_turn(player, alien):
  160. 157: print(f"\nThe {alien.name}'s turn!")
  161. 158: time.sleep(0.5)
  162. 159:
  163. 160: # Aliens have a chance to perform special moves
  164. 161: move_type = random.choices(
  165. 162: ["attack", "special"],
  166. 163: weights=[0.7, 0.3],
  167. 164: k=1
  168. 165: )[0]
  169. 166:
  170. 167: if move_type == "attack":
  171. 168: damage_dealt = player.take_damage(alien.attack)
  172. 169: print(f"The {alien.name} attacks you for {damage_dealt} damage!")
  173. 170: else:
  174. 171: if alien.name == "Crawler":
  175. 172: damage_dealt = player.take_damage(int(alien.attack * 1.5))
  176. 173: print(f"The {alien.name} uses Acid Spray for {damage_dealt} damage!")
  177. 174: elif alien.name == "Blaster":
  178. 175: damage_dealt = player.take_damage(alien.attack * 2)
  179. 176: print(f"The {alien.name} uses Energy Blast for {damage_dealt} damage!")
  180. 177: elif alien.name == "Sentinel":
  181. 178: alien.health = min(alien.max_health, alien.health + 10)
  182. 179: print(f"The {alien.name} uses Regeneration and recovers 10 health!")
  183. 180:
  184. 181: time.sleep(1)
  185. 182: return True
  186. 183:
  187. 184: def battle(player, alien):
  188. 185: battle_active = True
  189. 186:
  190. 187: while battle_active:
  191. 188: display_battle(player, alien)
  192. 189:
  193. 190: # Player's turn
  194. 191: battle_active = player_turn(player, alien)
  195. 192: if not battle_active:
  196. 193: return "escaped"
  197. 194:
  198. 195: # Check if alien is defeated
  199. 196: if alien.health <= 0:
  200. 197: display_battle(player, alien)
  201. 198: print(f"\nYou defeated the {alien.name}!")
  202. 199: player.gain_exp(alien.exp_reward)
  203. 200:
  204. 201: # Random loot
  205. 202: if random.random() < 0.3:
  206. 203: loot = random.choice(["Health Potion", "Energy Crystal"])
  207. 204: player.inventory.append(loot)
  208. 205: print(f"You found a {loot}!")
  209. 206:
  210. 207: time.sleep(2)
  211. 208: return "victory"
  212. 209:
  213. 210: # Alien's turn
  214. 211: display_battle(player, alien)
  215. 212: battle_active = alien_turn(player, alien)
  216. 213:
  217. 214: # Check if player is defeated
  218. 215: if player.health <= 0:
  219. 216: display_battle(player, alien)
  220. 217: print("\nYou have been defeated!")
  221. 218: time.sleep(2)
  222. 219: return "defeat"
  223. 220:
  224. 221: time.sleep(1)
  225. 222:
  226. 223: def explore(player):
  227. 224: clear_screen()
  228. 225: print("\n" + "═" * 60)
  229. 226: print("You venture deeper into the alien territory...")
  230. 227: print("═" * 60)
  231. 228:
  232. 229: events = [
  233. 230: {"type": "battle", "weight": 0.7},
  234. 231: {"type": "item", "weight": 0.2},
  235. 232: {"type": "rest", "weight": 0.1}
  236. 233: ]
  237. 234:
  238. 235: event_types = [e["type"] for e in events]
  239. 236: weights = [e["weight"] for e in events]
  240. 237:
  241. 238: event = random.choices(event_types, weights=weights, k=1)[0]
  242. 239:
  243. 240: if event == "battle":
  244. 241: print("You encounter an alien!")
  245. 242: time.sleep(1)
  246. 243: alien = Alien(max(1, player.level - 1 + random.randint(0, 2)))
  247. 244: result = battle(player, alien)
  248. 245:
  249. 246: if result == "defeat":
  250. 247: return False
  251. 248:
  252. 249: elif event == "item":
  253. 250: items = ["Health Potion", "Energy Crystal"]
  254. 251: item = random.choice(items)
  255. 252: player.inventory.append(item)
  256. 253: print(f"You found a {item}!")
  257. 254: time.sleep(2)
  258. 255:
  259. 256: elif event == "rest":
  260. 257: heal_amount = player.max_health // 4
  261. 258: player.heal(heal_amount)
  262. 259: print(f"You found a safe spot to rest and recovered {heal_amount} health.")
  263. 260: time.sleep(2)
  264. 261:
  265. 262: return True
  266. 263:
  267. 264: def main_menu():
  268. 265: clear_screen()
  269. 266: print("\n" + "═" * 60)
  270. 267: print("""
  271. 268: █████╗ ██╗ ██╗███████╗███╗ ██╗ ██████╗ ██████╗ ██████╗
  272. 269: ██╔══██╗██║ ██║██╔════╝████╗ ██║ ██╔══██╗██╔══██╗██╔════╝
  273. 270: ███████║██║ ██║█████╗ ██╔██╗ ██║ ██████╔╝██████╔╝██║ ███╗
  274. 271: ██╔══██║██║ ██║██╔══╝ ██║╚██╗██║ ██╔══██╗██╔═══╝ ██║ ██║
  275. 272: ██║ ██║███████╗██║███████╗██║ ╚████║ ██║ ██║██║ ╚██████╔╝
  276. 273: ╚═╝ ╚═╝╚══════╝╚═╝╚══════╝╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═════╝
  277. 274: """)
  278. 275: print("═" * 60)
  279. 276: print("\n1. New Game")
  280. 277: print("2. Quit")
  281. 278:
  282. 279: choice = input("\n> ")
  283. 280: if choice == "1":
  284. 281: return True
  285. 282: else:
  286. 283: return False
  287. 284:
  288. 285: def game_over(player):
  289. 286: clear_screen()
  290. 287: print("\n" + "═" * 60)
  291. 288: print("""
  292. 289: ██████╗ █████╗ ███╗ ███╗███████╗ ██████╗ ██╗ ██╗███████╗██████╗
  293. 290: ██╔════╝ ██╔══██╗████╗ ████║██╔════╝ ██╔═══██╗██║ ██║██╔════╝██╔══██╗
  294. 291: ██║ ███╗███████║██╔████╔██║█████╗ ██║ ██║██║ ██║█████╗ ██████╔╝
  295. 292: ██║ ██║██╔══██║██║╚██╔╝██║██╔══╝ ██║ ██║╚██╗ ██╔╝██╔══╝ ██╔══██╗
  296. 293: ╚██████╔╝██║ ██║██║ ╚═╝ ██║███████╗ ╚██████╔╝ ╚████╔╝ ███████╗██║ ██║
  297. 294: ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═══╝ ╚══════╝╚═╝ ╚═╝
  298. 295: """)
  299. 296: print("═" * 60)
  300. 297: print(f"\nYou were defeated at level {player.level}!")
  301. 298: print(f"Experience points: {player.exp}")
  302. 299: print(f"Items collected: {len(player.inventory)}")
  303. 300:
  304. 301: input("\nPress Enter to return to the main menu...")
  305. 302:
  306. 303: def game_loop():
  307. 304: if not main_menu():
  308. 305: return
  309. 306:
  310. 307: clear_screen()
  311. 308: print("\nWelcome, brave warrior! Earth is under attack by alien forces.")
  312. 309: print("You are humanity's last hope. Fight the aliens and save our planet!")
  313. 310:
  314. 311: player_name = input("\nEnter your name: ")
  315. 312: player = Player(player_name)
  316. 313:
  317. 314: game_active = True
  318. 315: while game_active:
  319. 316: clear_screen()
  320. 317: print("\n" + "═" * 60)
  321. 318: print(f"Name: {player.name} | Level: {player.level} | EXP: {player.exp}/{player.exp_to_level}")
  322. 319: print(f"Health: {display_health_bar(player.health, player.max_health)}")
  323. 320: print(f"Attack: {player.attack} | Defense: {player.defense}")
  324. 321: print(f"Inventory: {', '.join(player.inventory) if player.inventory else 'Empty'}")
  325. 322: print("═" * 60)
  326. 323: print("\n1. Explore")
  327. 324: print("2. Rest (Recover 30% HP)")
  328. 325: print("3. Quit")
  329. 326:
  330. 327: choice = input("\n> ")
  331. 328: if choice == "1":
  332. 329: game_active = explore(player)
  333. 330: elif choice == "2":
  334. 331: heal_amount = int(player.max_health * 0.3)
  335. 332: player.heal(heal_amount)
  336. 333: print(f"You rest and recover {heal_amount} health.")
  337. 334: time.sleep(2)
  338. 335: elif choice == "3":
  339. 336: break
  340. 337: else:
  341. 338: print("Invalid choice!")
  342. 339: time.sleep(1)
  343. 340:
  344. 341: if not game_active:
  345. 342: game_over(player)
  346. 343:
  347. 344: if name == "main":
  348. 345: while True:
  349. 346: game_loop()
  350. 347: if input("\nPlay again? (y/n): ").lower() != 'y':
  351. 348: break Allow this action? Use 't' to trust (always allow) this tool for the session. [y/n/t]: > y Creating: /home/arayachaudhar1309202/alien_rpg.py ⋮ ● Completed in 0.9s I've created a text-based RPG game called "Alien RPG" in Python. The game is now saved to /home/arayachaudhar1309202/alien_rpg.py. Here's what it includes: ## Game Features • ASCII art representation of aliens • Turn-based combat system • Character progression with levels and experience • Different types of aliens (Crawler, Blaster, Sentinel) • Inventory system with usable items • Health bars and stat displays • Special alien abilities • Random events while exploring ## How to Play
  352. Run the game with: python3 alien_rpg.py
  353. Enter your character name when prompted
  354. Choose actions from the menu: • Explore: Find aliens to fight or items to collect • Rest: Recover some health • Quit: Exit the game During combat, you can: • Attack aliens • Use items from your inventory • Try to run away ## Game Elements • Player stats: Health, attack, defense, level, and experience • Alien types: Each with unique stats and special abilities • Items: Health potions and energy crystals • Random events: Battles, item discoveries, and rest spots The game features ASCII art visuals and health bars to give it a Stone Story RPG feel while maintaining the alien combat theme you requested. Would you like me to explain any specific part of the code or make any adjustments to the game?

Comments 0 total

    Add comment