The Python Text Adventure Game Engine

In February of 2021, I started a project that I got partially working to the point that I could finally display a background image, foreground image, and text that faded in (like Tom Riddle's Journal from Harry Potter), but it fell victim to squirrel chasing. It was a text adventure game, that I was designing it to be modular and customizable, so that it could be modified play all sorts of adventures, be they medeival fantasy, cyberpunk or space opera.

I recently revisited it and boy, what a mess! It worked, but I had no idea why. This is why you should ALWAYS comment your code! I decided to figure out what I did and how I did it and write proper comments so I don't forget again. Then I thought about where I wanted this project to go and decided it would be best to rewrite it from scratch since so many things would need to be fundamentally changed. As it was written, the prototype of PyTAGE was tightly integrated with multiple interdependencies. I would like to make it easier to modify and maintain by encapsulating and modularizing as much as I can this time around.

What have I got so far?

  • The original working prototype. I draw inspiration, and often times, code snippets from it.
  • Lots of notes all over the place - hand written, text files, code comments, website links...
  • Working prototypes of specific features I plan on including (ex: scrolling text)
  • A prioritized list of features I want to include later.

What features do I want to include?

  • User configurable game, defined in a YAML data file
  • Data file must be simple and intuitive to create and modify (YAML Satisfies this requirement)
  • Some graphical capability; mostly thematic backgrounds and minimal animations
    Could be a piece of parchment paper or old spell book for a medeival theme, or a computer screen or hologram for a sci-fi theme
  • Transition effects - fade, scroll, page turn, TV static...
  • Have a boolean flag for whether the text is locked to the image it overlays (paper) or scrolls independently (computer screen)
  • Default commands: Load, save, quit, map, inventory
  • Background music that changes appropriately depending on what is happening in-game (like Skyrim expoloration music changes with the biome or time of day/night)
  • Some kind of action and combat routine that has a randomizer but uses the player's abilities and inventory to influence the outcomes
  • A save game feature that tracks player stats, visited locations, defeated enemies, completed quests, accumulated inventory