OpenAI: Dungeon Quest — Build an AI-Powered RPG
Build a playable web RPG step by step using the OpenAI API. Add a game master, NPC dialogue, combat narration, structured output, streaming, and voiced speech narration — one exercise at a time.
View badge details
About This Course
Course Curriculum
3 Lessons
Dungeon Quest Lab 1 — Game Master and NPC Voices
Wire up the OpenAI client to a working Flask + vanilla JS dungeon shell. In this first lab you'll build a game master with full conversation memory and the ROOM_CHANGE signal that moves the player between rooms, then give every NPC their own private system prompt and conversation history so the same model becomes Marta the innkeeper, Grimtooth the goblin merchant, and Aldric the wizard.
Dungeon Quest Lab 2 — Combat and Structured Output
Pick up where Lab 1 left off — the GM and NPC dialogue are already wired in. In this lab you'll build a real combat loop with stat-based damage + AI-narrated rounds + in-character enemy taunts, then upgrade the GM to JSON-mode structured output so room changes, item finds, and gold drops arrive as reliable structured data instead of regex-parsed prose.
Dungeon Quest Lab 3 — Streaming and Voice
Pick up the dungeon from Lab 2 with the GM, NPC dialogue, combat, and structured JSON output already in place. In this final lab you'll stream the GM's narration token-by-token over Server-Sent Events with JSON-aware token forwarding and bounded memory compression, then add voiced narration with the OpenAI Speech (TTS) API mapped per character.