Assignment 3: A Dungeon Crawl

Due: Monday, June 7

Implement a simple "dungeon crawl"--a program emulating what a viewer would see walking through a labyrinth.

Specifications:

Here is a sample dungeon.dat input file.

Additional Specifications for 561 Students:

Hints:

You can use any lighting model, so long as the viewer can appreciate his/her position in the labyrinth.

There is an on-line tutorial explaining a simple way to effect apparent "camera movement" over fixed terrain, by Antonio Ramires Fernandes (you may have to click on the "Moving the Camera" link in the navigation bar there). The technique relies on maintaining variables representing the camera's postition and orientation. The variables are altered via the keyboard. They are then applied via the gluLookAt function to obtain the desired view. Here is a link to a slightly modified version of the code Ramires provides on his page. There is another excellent discussion at the on-line RedBook, http://glprogramming.com/red/chapter05.html#name3. See the section labelled "Moving the Light".

One way to work on this is to generate a rectangular prism for each "space" of the dungeon. Some spaces are walls ('*' in the input file), and some are corridors/rooms (space characters in the input file). For the former, generate "tall prisms". For the latter, generate "short prisms". The "floor" that the user walks upon is actually the tops of the short prisms. To that end, you probably want a function/method something like:

generatePrism(int mazeX, int mazeY, boolean isFloor)

This function could make the necessary glPolygon calls to generate the appropriate prism. The mazeX and mazeY are coordinates into the character array comprised by the input file.

Submission:

Submit your source code to the dropbox.