Interactive Media & Game Development
Worcester Polytechnic Institute

IMGD


IMGD-3000: Technical Game Development I
Project 1
Due: January 19, 2007 at 11:59pm

Objective: THIS IS AN INDIVIDUAL PROJECT, NOT TO BE DONE IN TEAMS!

In this project, you will learn how to generate a labyrinth structure for use in the game "Jäger: The Hunt for Crazy Gert's Gold!" You will also implement code to store and load mazes you have generated using files. In addition, you will implement simple collision detection code to make sure Hedi stays within the confinds of the labyrinth.

There are two parts to this project: a "Preparation" part, and a "New Stuff" part.


Preparation: The aim of this preparation part is for you to get your feet wet in the Jaeger development framework. You will download the codebase, compile it on your system, and then execute it to see how it works. The code should compile and run on Mac OS X or Unix on the CCC machines, as well as most flavors of Windows using MinGW.

Download the ZIP file for this project. Copy it to the directory where you will be doing your work, and unzip it. You will see several .cpp and .h files, as well as some Makefiles.

If you are programming on a Mac, you can use the command-line to compile the code by typing:

make -f Makefile.macosx

and execute using:

./hunter

Unix is similar to this, except to compile you should type:

make -f Makefile.unix

Finally, under Windows, you should install MinGW, and then compile in a command window with:

make -f Makefile.windows

Use the cursor keys to move around the default labyrinth, and press 'q' or 'ESC' to exit.


New Stuff:
  1. You will need to write the code to generate a random labyrinth layout, based on the following rules:
    1. Each cell in the m x n maze should be assigned a cell type.
      (see JaegerConstants.h for the list of legal types. CELL_NONE is a valid filled cell type).
    2. Two cells may adjoin only if the adjoining sides are both openings or both walls.
    3. A cell side that abutts the edge of the maze must be a wall.
    4. A fully filled maze is only valid if there is a path from every filled cell to every other filled cell.
    5. At least 50% of all cells must have a type other than CELL_NONE.
    6. Cyles in the maze are okay.

    A method stub Maze::GenerateRandomMaze( float seed ) has been defined for you in the file JaegerMaze.cpp. You are to place your code within this function stub. The paramater 'seed' is the random number seed you should use before generating your random numbers.

  2. You will need to implement the code to save and load maze files. These files should have the form:

    4 3
    5 2 2 6
    10 2 2 8
    3 2 2 4

    where the first line contains two integters, denoting the width and height of the labyrinth, respectively, followed by 'height' lines containing 'width' integers each, separated by a single space.

    To do this, you will add your code to the two stub methods Maze::Load( char *file ) and Maze::Save( char *file ) in the file JaegerMaze.cpp. See the command-line arguements (e.g., ./hunter -?) for more info on saving and loading.

  3. We have implemented simple movement control using the cursor keys. However, we are not checking to see if the movement is valid. So, for example, Hedi will happily walk through walls.

    You will implement code to check whether the movement the player is attempting is valid, and if not, then disallow the movement (e.g., do nothing). Take a look at the function void JaegerKeyboardSpecial( int k, int x, int y ) in the file JaegerMain.cpp to see where this should go.


Documentation: You must create adequate documentation, both internal and external, along with your project. The best way to produce internal documentation is by including inline comments. The preferred way to do this is to write the comments as you code. Get in the habit of writing comments as you type in your code. A good rule of thumb is that all code that does something non-trivial should have comments describing what you are doing. This is as much for others who might have to maintain your code, as for you (imagine you have to go back and maintain code you have not looked at for six months -- this WILL happen to you in the future!).

I use these file and function (method) headers, in my code. Please adopt these (or the official CS ones) for all your projects. The file header should be used for both ".h" and ".cpp" (or ".c") files.

Create external documentation for your program and submit it along with the project. The documentation does not have to be unnecessarily long, but should explain briefly what each part of your program does, and how your filenames tie in. Most importantly, tell the TA how to compile your program.


What to
Turn in:
Submit everything you need to compile and run your program (source files, data files, etc.)

BEFORE YOU SUBMIT YOUR PROJECT, put everything in one directory on ccc.wpi.edu and make sure it compiles. Then tar (or zip) everything up into a single archive file.

The command to archive everything, assuming your code is in a directory "proj1", is:

tar cvf LastName_FirstName_proj1.tar proj1

or

zip -r LastName_FirstName_proj1.zip proj1


Academic
Honesty:
Remember the policy on Academic Honesty: You may discuss the project with others, but you are to do your own work. The official WPI statement for Academic Honesty can be accessed HERE.


Back to course page.