Skip to main content
Dev Portfolio
All projects

Java Text Adventure Game (CLI/GUI)

Temple of the Last Shards — an MVC-structured exploration and puzzle game separating game logic from a JavaFX interface, built solo for CS4431.

Type
Coursework

Problem

Coursework requirement to demonstrate MVC separation and advanced OOP in a non-trivial Java application.

Role

Built solo for CS4431 coursework.

How it works

Temple of the Last Shards is a 2D text-and-graphics exploration and puzzle game: the player explores a temple, collects six shards, finds the vault key, and takes the crown to win, picking up hidden unlockable items and inventory along the way. The code is split by responsibility into four packages. misc holds the world model — Room, Player, Character and a Parser, in the classic Zork-style shape where each Room links to its neighbours and the Parser turns typed input into commands. Commands holds the command layer itself — Command, CommandType, CommandWords and Direction — which is what keeps "go north" or "take shard" as data the game logic can act on rather than string-matching scattered through the codebase. Items models everything the player can carry as a shared Item type with an ItemType enum, with Book, Crown, Hint, Key and Shard as concrete subclasses — the inheritance and polymorphism the assignment asked for, applied to something the game actually needed. GUI (MainGUI, Linker, plus the map art and stylesheet) is the JavaFX front end, kept separate from all of the above so the interface is a view onto the game state rather than part of it. The Room graph is what needs the Collections work: exits from a room map to the rooms they lead to, and the Parser holds the set of words it recognises to turn free text into a Command. Progress can be saved and reloaded through Java's own object serialisation, and the game ships as a Maven build with a bundled JRE, so playing it is a matter of unzipping and double-clicking the jar rather than having Java installed separately.
game logicJavaFXModelControllerViewcommands parsed → world state → rendered
Fig. — MVC: game logic on one side of the boundary, JavaFX on the other.

Stack

  • Java
  • JavaFX
  • Java Collections

Result

A complete text/graphics adventure — six shards to collect, a vault key, and a crown to win — with save/load via Java serialisation, packaged with its own bundled JRE so it runs by double-clicking the jar.