AI Instructor Live Labs Included

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.

Intermediate
6h 25m
3 Lessons
SMU-OPENAI-RPG
OpenAI: Dungeon Quest — Build an AI-Powered RPG Badge

View badge details

About This Course

Build a fully playable web-based RPG powered by OpenAI. You'll start with a complete game engine rooms, characters, combat, pixel art, the whole dungeon and progressively breathe life into it using the OpenAI API. Each exercise adds a new AI capability: a game master that remembers your adventure, NPCs with real personalities, dynamically narrated combat, structured output for reliable state changes, streaming responses, and finally voiced narration with the OpenAI Speech API. By the end you'll have a game you actually want to play, and a solid understanding of how to build multi-turn, multi-persona, multi-modal AI applications.

Course Curriculum

3 Lessons
01
Lab Exercise
Lab Exercise

Dungeon Quest Lab 1 — Game Master and NPC Voices

2h 5m 2 Exercises

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.

Summon the Game Master Connect the OpenAI API to power the game master. Build a system prompt that describes the dungeon world, hook up Chat Completions with full conversation history, and parse the GM's response to move the player between rooms. ~40 min
Give the Characters a Voice Bring Marta, Grimtooth, and Aldric to life. Each NPC gets their own system prompt and their own private conversation history — the same model becomes three completely different personalities. ~40 min
02
Lab Exercise
Lab Exercise

Dungeon Quest Lab 2 — Combat and Structured Output

2h 5m 2 Exercises

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.

Make Combat Actually Hurt Add narrated combat rounds with enemy taunts. Stats decide who wins — the AI only provides the drama. Make two OpenAI calls per round: one for the narrator, one for the enemy's in-character reaction using their own system prompt. ~40 min
The GM Levels Up — Structured Output Upgrade the game master to return structured JSON. Room changes, item discoveries, and gold finds become reliable data fields instead of text the code has to regex-parse. Discover why structured output is the right tool any time an AI needs to update application state. ~40 min
03
Lab Exercise
Lab Exercise

Dungeon Quest Lab 3 — Streaming and Voice

2h 15m 2 Exercises

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.

Streaming and the Long Memory Stream the GM's responses token-by-token so they feel alive instead of appearing all at once. Then add automatic history summarization so the dungeon never forgets — even after a long adventure pushes the conversation history well past what the model can hold. ~55 min
Voice the Dungeon — Speech Narration Add OpenAI Speech (TTS) narration so the GM, every NPC, and the enemies in combat each speak in a fitting voice. You'll map characters to voices, generate cached MP3s with `client.audio.speech.create`, and wire up a 🔊 Narrate toggle. ~35 min

This course includes:

  • 24/7 AI Instructor Support
  • Live Lab Environments
  • 3 Hands-on Lessons
  • 6 Months Access
  • Completion Badge
  • Certificate of Completion
OpenAI: Dungeon Quest — Build an AI-Powered RPG Badge

Earn Your Badge

Complete all lessons to unlock the OpenAI: Dungeon Quest — Build an AI-Powered RPG achievement badge.

Category
Skill Level Intermediate
Total Duration 6h 25m
OpenAI: Dungeon Quest — Build an AI-Powered RPG Badge
Achievement Badge

OpenAI: Dungeon Quest — Build an AI-Powered RPG

Awarded for completing the OpenAI Dungeon Quest course — building a fully playable web RPG powered by the OpenAI API, including a memory-keeping game master, NPCs with personalities, narrated combat, structured outputs, and streaming responses.

Course OpenAI: Dungeon Quest — Build an AI-Powered RPG
Criteria Complete all five exercises in OpenAI: Dungeon Quest — Summon the Game Master, Give the Characters a Voice, Make Combat Actually Hurt, The GM Levels Up (Structured Output), and Streaming and the Long Memory.

Skills You'll Earn

OpenAI Chat Completions API Multi-turn conversation history System prompt design Persona-based NPC dialogue JSON-mode structured output Streaming responses (SSE) Flask application development Game state management

Complete all lessons in this course to earn this badge