Learn LLM app development by designing and developing a text-based AI game, creating immersive game worlds, characters, and storylines through hierarchical content generation.
Building an AI-Powered Game
Instructors: Niki Birkner, Nick Walton
Earn an accomplishment with PRO · Updated Oct 7, 2025

- Beginner
- 1h6m
- 6 Video Lessons
- 4 Code Examples
- 1 Graded Assignment PRO
- Earn an accomplishment with PRO
- Updated Oct 7, 2025
- Instructors: Niki Birkner, Nick Walton
Together AI, AI Dungeon- Learn more aboutMembership PRO Plan
What you'll learn
Learn to implement game mechanics using AI to convert text data into structured JSON outputs, enabling features like an inventory detection system.
Learn to enforce safety and compliance for AI content creation, and create custom policies using Llama Guard.
Course recap
PROThis course, built in partnership with Together AI and AI Dungeon, teaches how to build an AI-powered text-based adventure game from scratch. It covers hierarchical content generation for world-building, interactive gameplay loops using LLMs, structured game mechanics via JSON parsing, and content safety using Llama Guard.
Concept map
Key concepts
- Hierarchical content generationCreating large amounts of consistent content by generating high-level descriptions first (world), then progressively more specific elements (kingdoms, towns, characters)
- Prompt EngineeringCrafting system prompts that define AI game master behavior, writing style, and constraints
- Structured output (JSON)Using LLMs to parse narrative text into structured game state like inventory changes
- Content moderationUsing Llama Guard to enforce safety policies (safe, moderate, mature) on AI-generated game content
Lesson highlights
- 1.Introduction — Overview of AI game development approach
- 2.Hierarchical Content Generation — Creating worlds, kingdoms, towns, and NPCs with consistent lore
- 3.Interactive AI Applications — Building the core gameplay loop with Gradio UI
- 4.Implementing Game Mechanics — Inventory tracking system using JSON output parsing
- 5.Moderation and Safety — Using Llama Guard for content policy enforcement
- 6.Conclusion — Live gameplay demo and next steps
About this course
Join our new short course, Building an AI-Powered Game, with Together AI and AI Dungeon! Learn from Niki Birkner, Senior Product Manager at Together AI, and Nick Walton, CEO and Co-Founder of Latitude.
This course teaches you how to build a LLM-based application by creating your own AI-powered text-based game. You’ll create a world with hierarchical content generation based on a prompt, setting up its core mechanics, and giving it a simple Gradio user interface.
By the end of this course, you’ll have a playable text-based game to share with your friends, built from scratch using LLMs. You will be guided through the building blocks of app development using LLMs, including incorporating safeguards using Llama Guard.
What you’ll do:
- Use prompt engineering to create a world with hierarchical content generation so your narrative is consistent and the AI can flesh out your game.
- Build the first version of your game with a user interface, load the world, and define the core action loop of the game, so you can have a game to play and interact with.
- Implement safe user-dependent and context-dependent guardrails into your game application with Llama Guard and custom content policy.
- Learn LLM tool calling by adding story and state components that improve your game’s memory, track inventory, and show progress.
With these techniques, you’ll hone your AI skills by building your own sharable game!
Who should join?
Anyone who has basic Python knowledge and wants to learn how to build with LLMs in a hands-on, fun way!
Course Outline
6 Lessons・4 Code Examples

Elevate your learning experience with Pro
Upgrade to Pro and gain unlimited accomplishments on your resume
Instructors
Course access is free for a limited time during the DeepLearning.AI learning platform beta!
Want to learn more about Generative AI?
Keep learning with updates on curated AI news, courses, and events, as well as Andrew’s thoughts from DeepLearning.AI!


