CPSC 1070
Programming Methodology
Fall 2019
Amazing Game
Homework Assignment 6
Due by midnight: Sunday Dec. 1
For this final assignment, you are to complete the maze game that you began in the last homework
assigment. You should already have a program that will read
a maze from a maze description file, and display it. And, you should be able to
move the player character around along corridors using the w-a-s-d keys. If you do not have a
working maze building program, I will post a sample solution on Nov. 18,
after the closeout date on the previous assignment.
Your new program should be called amaze, and it
should be written in C++ using EZ Draw to display the graphics.
Just like the last assignment, you program should use a filename parameter from the
command line, to get the name of a maze description file.
For example, if the maze description is
stored in a text file named smallmaze.txt,
then the command to run the program would be
amaze smallmaze.txt
As before, the maze should be loaded from the file, and the maze built according
to the instructions for the last assignment.
New Program Requirements
To turn your maze builder into a game, here are the requirements.
-
Instead of displaying the entire maze, only the room that the player is currently in should
be displayed, and it should fill the entire window.
Rooms should be displayed with their assigned texture, and with icons indicating in which of
each of the 4 directions there is a door.
-
Keyboard key 'u' should be the "undo key". Each time it is pressed, the player should move back
one room along the path that it originally took.
-
Keyboard key 'h' should be the "hyperspace key". Each time it is pressed, the player should move back
to the last room along its path where it had to make a decision about which door to take. These rooms
will the ones with either 3 or 4 doors. You should be able to hit 'h' multiple times to jump back
through multiple decision rooms. If there are no decision rooms behind the player's current position,
hitting 'h' should take it back to the starting room.
-
The player should start with 3 health points. Whenever it enters a boss room, it loses 1 health
point. Whenever it enters a health room it gains 1 health point. If the player's health points
go to 0, the game is over with failure.
-
Entering a boss room implies a battle, leaving the boss dead, so there should be no further
health loss upon reentering this room. Likewise, entering a health room uses up the
medicine there, so there should be no further health gain upon reentering this room.
-
A player health box should be displayed in the lower-lefthand corner of the window, with
a number of hearts (or any other symbol you want to use) indicating the player's health points.
-
If the player enters the goal room, the game is over with success.
-
A non-required, but useful, extra feature would be letting the 'c' key be a "cheat key". If the
'c' key is hit, it toggles on or off a small version of the entire maze with the player,
displayed in the lower right-hand corner of the window. This can be very helpful in debugging.
Adding this extra feature correctly will be worth a bonus 1 point out of 10.
Recommended Program Structure
In the last assignment, I recommended that your create three classes for your maze builder program,
one to handle the maze, one to handle the individual rooms of the maze, and one to handle the player.
In my sample solution, I called these Maze, Room, and Player.
In this assignment, the game mechanics are more complicated, so it will be very useful to
create a new Game class that will handle these mechanics.
Previously, I suggested that Maze be responsible for loading the file and building the
maze structure. Now, I would suggest making the Maze and Player objects members of the Game class,
and moving the loading of the maze into the Game class. This class could also handle player
movement in response to keyboard input, and detect when the game has ended due to either
lack of player health, or the player reaching the goal room.
From our study of stacks, it should be apparent that implementing the 'u' and 'h' key features
will require that you maintain a stack of the rooms that the player has gone through. Popping the
stack once should tell you the previous room that the player was in. To implement the 'h' feature,
the stack will need to be popped multiple times until a decision room is reached, or the stack is
empty.
Image and Maze Files
Click here for a set of image files, and two example
maze description files. You are free to use these, but it might
be more interesting to choose your own images and design your own maze.
Grading Rubric
Click here for the grading rubric that will be used.
Turn-in Procedure
You are to turn in this assignment via the web interface at:
http://handin.cs.clemson.edu.
On this page you will be able to log in, and go to the help pages
for all information on how to submit an assignment. Our course is
CPSC 1070-001 or CPSC 1070-002. This homework project is called "amazing game"
on the course page.
Before turning in your work, please
follow these instructions. This is very important,
since we process your assignments via an automated script.
- Make a directory named with your Clemson username in lower case. Do not
add any additional text, and do not include any spaces in the filename!
- If you have done anything in your program that deviates from the problem
statement, please include a plain text README document (not .pdf or .docx)
that gives any instructions needed to run the program, or understand what
it is doing.
- Place all of your work in a flat-structured directory. There should be no
subdirectories containing code. However, it is ok if your images are in a subdirectory.
Delete all .o and executable files, and any IDE
project files. All that should be there are the images you used, one or more maze
description files, your Makefile,
any .cpp or .h files you used to build your program, and a README file (if you needed one).
Note, that you should not include the ezdraw.h and libezdraw.a files.
These should be in a directory named ezdraw at the top of your directory heirarchy,
and your Makefile should look for these files there. If your Makefile looks for
these files anywhere else, it will not compile when the TA's attempt to grade
your program.
- tar and gzip your directory, or zip your directory. If your
username were monty, then your zipped file would be named either
monty.tar.gz, or monty.tgz, or monty.zip
- Turn in only this
zipped directory.