James Hendershott

Case study

1980 Style Adventure Game

Python text adventure I wrote for CS 3620. Custom command parser, room/item system, inventory, Tkinter GUI, and save/load. This is my code.

1980 Style Adventure Game screenshot
PythonText AdventureGame Development

Overview

A terminal-based text adventure inspired by classics like Zork, built for CS 3620 Server-Side Web Architecture. I wrote this code myself — used AI for research and concept lookups, but the code is mine. This later served as the foundation for a Django web rebuild (see the Adventure Game project page).

Role & Stack

Course project using Python (standard library + Tkinter).

Problem

Wanted to build something from scratch that combined creative writing with programming fundamentals — data modeling, state machines, and input parsing — without relying on frameworks or game engines.

Solution

Designed a text adventure engine with:

  • Command parser: Handles verb-noun patterns (take key, go north, use lamp on door) with synonym support and error feedback
  • Room graph: Rooms as dictionary-based nodes with directional connections, descriptions, and item lists
  • Inventory system: Pick up, drop, use, and examine items with weight/capacity constraints
  • State machine: Tracks puzzle progress, locked doors, NPC interactions, and win conditions
  • Save/load: Serialize game state to JSON for session persistence
# Room definition example
rooms = {
    "entrance": {
        "description": "A dimly lit cave entrance. Passages lead north and east.",
        "exits": {"north": "hallway", "east": "storage"},
        "items": ["torch", "note"],
    }
}

Design Decisions

  • No dependencies: Keeps the project portable and focused on core Python
  • Data-driven rooms: Adding new rooms and items means editing dictionaries, not code logic
  • Forgiving parser: Accepts abbreviations (n for north), ignores articles (the, a), and suggests corrections for typos

Results

  • Playable adventure with multiple rooms, puzzles, and an ending
  • Clean enough codebase to serve as the foundation for a full Django rebuild (see Retro Adventure Game)
  • Good exercise in separation of concerns: parser, game logic, and world data are independent modules

What I Learned

  • Designing a text parser that feels natural without NLP libraries
  • Modeling game state as serializable data structures
  • Iterative game design through playtesting and feedback loops
  • The value of building a prototype before committing to a framework