How nickwalton/ai-dungeonmaster works
Project Type and Purpose
• This is a standalone, full-stack (monolithic) Python application that runs entirely on the command line.
• Purpose: Provide an interactive, AI-driven text adventure (“Dungeon Master”) using a locally-hosted GPT-2 model (117M parameters).
File Structure Analysis
• Top-level entry points:
• dungeon_master.py – the CLI/game loop.
• generator.py – orchestrates calls to the GPT-2 sampling code.
• download_model.py – helper to fetch the GPT-2 checkpoint.
• story_tracker.py – maintains game state and history.
• utils.py – shared utilities (e.g., text cleaning, I/O).
• story_prompts.yaml – seed data for the adventure.
• gpt2/ package:
• download_model.py – duplicates model fetch logic under the package.
• models/117M – stores the downloaded model files (encoder.json, vocab.bpe, checkpoints).
• src/ – GPT-2 implementation modules (encoder.py, model.py, sample.py).
• Configuration: requirements.txt lists external dependencies (tensorflow, numpy, tqdm, regex).
README Insights
• Installation steps show pip-based dependencies and GPU alternative.
• Usage: first download the GPT-2 model, then run dungeon_master.py to start the game.
• No network calls at runtime—everything is local.