CPSC 240 - OOA&D - Fall 2024

"Zork++" phase 3: supplemental features implementation

Due: Friday, Apr 26th Monday, April 29th, midnight

Zork++ phase 3

For Zork++ phase 3, your team will fully implement (code) and debug your game engine's supplementary features. You'll be code complete. Yay!

I will obviously not post a test .zork file that is compatible with your supplementary features, because this is the point where every team's project is going to diverge from the others — different features will often result in different syntactic elements in the dungeon file.


In addition to working code (duh), there are three files I require, all of which should be put in the "files" directory of your git repo:

  1. A plain-text file called "featureList.txt". This file should list of all your supplemental features, along with idiot-proof instructions for how I can see them in action in your phase 3 dungeon. (Note that you can and should use vim to edit this file, just like you do to edit .java, .zork, and .sav files.)

    Here's a sample excerpt from a fictional featureList.txt file, to show you what I'm looking for:

    Light -- Some rooms are completely dark to the adventurer unless he/she has a light source available and turned on. Light sources are items that are discoverable in the dungeon and which "defuel" over time; i.e. there is a finite number of turns to how long they last before burning out. You can test light in sampleDungeon.zork by grabbing the lavaLamp in the ChillaxinRoom (n,w,w from the entry), then going to the ManCave (e,s,e,e from ChillaxinRoom). The ManCave will be dark upon entry. Type "switch lavaLamp" to turn it on, at which point you will see the ManCave room description. Type "switch lavaLamp" again to go back to darkness. Type "switch lavaLamp" a third time to turn it back on, then waste time by going w,e,w,e,w,e,w,e,... a total of ten times (ten "w,e" pairs). At that point, the lavaLamp will be burned out, and the ManCave will once again be dark. ----------------------------------------------------------------------------- Rotate room -- To test this feature, ...

  2. A file called literally sampleDungeon.zork that contains a possibly boring, but complete, dungeon that exercises all your supplemental features.
  3. A plain-text file called sampleDungeonWalkthrough.txt, which will be a walk-through description of how to win your sample dungeon (see below).

"But what about actually cool, individual dungeons?"

Your very last assignment for the semester will be for each of you to write your own non-bare-bones, creative .zork file for use within your game engine. Coming soon, don't worry.

Making your game determinstic

Note that your dungeon will contain random components that make each play of the dungeon different. (At the very least, your teleport event(s) will put the adventurer in a random location each time. Also, NPCs may choose to move to different rooms, combat may resolve differently, etc.) You will want to make this deterministic for purposes of testing, so that your walk-through will always "work" in the same way. To accomplish this, your team should do the following in your game engine:

  1. Make sure you only instantiate one java.util.Random object over the entire run of the program. The easiest way to do this is to make an instance variable of type Random in your GameState class, initialize it in the GameState constructor, and in every place where you need to roll a random number, access that Random object and call .nextInt() or .nextBoolean() or whatever to do so.
  2. Immediately after instantiating the Random object, call ".setSeed(13)" on it. (If you don't like the number 13, substitute any other number you do like.)

After doing this, you should discover that your game runs the same way every time you play it.

Turning it in

To turn in this assignment, one team member send an email to cpsc240submissions@gmail.com with subject line "CPSC 240 Zork++ phase 3 turn-in", Cc:'ing the other team members. There should be no attachments, and the body of this email should simply say, "Have at it, Kenzie!" Kenzie and I will clone your github repo to read your featureList.txt and to test your latest committed-and-pushed code.

I need help!

Come to office hours, or send email with subject line "CPSC 240 Zork++ phase 3 HELP!!!"