HireSnatch: "Pick Your Own Adventure" Game

Java, Swing, File I/O
cover

HireSnatch was one of my earliest substantial programming projects, built as part of my university coursework for object-oriented programming. Inspired by interactive narratives like Netflix’s Bandersnatch, it was a text-driven, branching adventure game where player decisions carried them down diverging paths, sometimes converging again in unexpected ways. What began as a coursework requirement quickly grew into an experiment in how object-oriented design could capture the logic of narrative choice.

Building the World

  • The game world was structured around classes for characters, items, and scenes, each with attributes and behaviours that interacted through object methods.
  • The branching narrative was represented as a tree of scene objects. Each scene contained decision nodes that mapped directly to other scene instances, creating diverging and converging storylines.
  • Player interactions—picking up weapons, consuming food, choosing dialogue—triggered methods that modified the state of the main character object and determined which scene was loaded next.
  • Inventory management was handled through a list of item objects, with specific interactions tied to conditions in later scenes.

Persistence and State

  • Save/load functionality was implemented through Java I/O, with serialized scene and state objects written to binary files.
  • On reload, buffered streams reconstructed the game world exactly as it had been left, including character stats, inventory, and story position.
  • This created persistence across sessions and allowed replayability without restarting from the beginning.

Interface Layer

  • A Java Swing GUI was built on top of the engine to move beyond the command line.
  • The GUI provided buttons for decisions, text panes for narrative output, and simple images for scene context.
  • Swing’s event-handling system was central: button listeners triggered transitions between scene objects and redrew the interface accordingly.

Architecture at a Glance

  • Model: Classes for items, characters, and scenes with encapsulated logic.
  • Controller: Decision handlers that processed player input and mapped it to scene transitions.
  • View: Swing-based panels and frames rendering the story state.
  • This separation made the project modular, enabling the addition of new scenes and items without rewriting the engine.