CS461 - Program Seven

Due: 2016-11-28 11:59p

Objectives

Get me out of here!

Program7 screenshot

Our final project is to build a dungeon crawler, or, as I've been calling it, a 'first person, non-shooter'. This will be very close to a working game. The idea is that you are exploring some maze-like locale equipped only with a simple headlamp for light (you can, of course, build on this to make it whatever you like).

Generating the map

You will need to automatically generate the map. As I mentioned in class, you have already done most of this back in assignment one. Of course, for that assignment, you generated a two-dimensional maze, and we would really like a three-dimensional oneā€¦

In truth, this isn't that big a step. My advice is to start with the walls, and then try your camera in a few positions outside of the maze to see if you have them set up correctly. You will need to make sure not to try and look straight down at the maze since your walls are infinitely thin.

Here is an example looking down at a simple maze.

Program7 maze

Once that works, the floor and ceiling can just be big rectangles that sandwich the walls. My advice is to leave off the ceiling initially to help you see what is going on.

Note that you don't need to go very big. It is easy to get lost in a maze when you are inside of it.

Placing the camera

Once you have the map, you need to put the camera inside. Just so that I would have something to see, I used my normals trick again and painted all of the walls based on the absolute values of the normal vectors (the ceiling is still not in place here).

Program7 Normals

Now you want to position the camera inside the maze at some known open cell. This camera can be pretty simple. You can probably reuse the one you created for assignment 5. At a minimum, you should be able to move forwards and backwards and spin in place (i.e., yaw). You should make use of the WASD standard for these controls. Strafing (movement along the u axis) is optional. If you don't implement strafing, rotation can go on the A and D keys, if you do, pick another reasonable set of keys for rotation.

Adding textures

Once you can run around the maze, it is time to start adding some textures. You can find a variety of textures out there with a little work, but you could start at opengameart.org, which has a good selection, and many of them have normal maps. The walls and the floor should have different textures.

You will probably want to turn on mip mapping, which I didn't do in the examples.

Program7 Texture

The blurriness is the mipmapping at work.

Lighting

Once you have textures working, it is time to switch on the head lamp. The head lamp rather obviously should be attached to the player's head. So, unlike the lights from the examples and the last assignment, this one should follow the player around. Place it a little above the origin so it is over the player's head.

You can start by making it a point light source, but I would like you to make this a spotlight. I suggest building up to this one step at a time.

  1. Define a vector that is the primary axis of the light. Have it tip down slightly so it shines on the floor as it would if you were wandering around in the dark with a head lamp (this won't make any difference until the next step).
  2. Restrict the beam to some angle (of your choosing) around the axis. You should now have a sharp circular beam.
  3. Add fall-off so the light gets dimmer towards the edge of the beam.
  4. You will notice that really distant walls shine brightly when the light is pointed in their direction. This would be due to the fact that we have been ignoring distance attenuation because it didn't really matter for what we were doing. Now it looks weird. Add the attenuation quadratic to your lighting calculations so that it stops.

Grading

This assignment is worth 80. If you look closely below, that means that you need to pick up 15 points of "cool things" to get full credit. Make sure to list what you did at the top of your JavaScript file in order to get credit.

Points Metric
5 Presentation - good commenting, name in the files, followed naming convention
5 Design - no spaghetti code, sensible allocation of responsibilities, extensibility
10 Maze - maze is correctly generated and shaped
15 Lighting - head lamp lighting works
15 Camera - camera moves around the scene well and has appropriate view
15 Textures - surfaces are textured correctly (and uniquely)
10 Objective - give the player an objective like an exit or other objective
10 Bump map - use a normal map to make the surfaces more realistic
10 Mouse look - go full scale FP(N)S and use the mouse for looking and turning
10 Collisions - make sure you can't walk through walls
10 Additional lighting - add some more lights around the maze
10-20 Heads up display - show a compass or a mini-map overview
15 Objects - scatter objects around as decoration or "treasures" to be picked up
? Something else

Turning in your work

For this submission, you will have your source files as well as all of your resources like the textures. Name the directory username_hw07. Internally, name your html index.html so that it is the default HTML file in the directory. Please zip the directory and submit it as username_hw07.zip.

I would also like to make all of the submission live off of the website. As we get more involved, this will be very interesting. In the meantime, I think you will benefit from being able to look at how your peers approached the assignments. If you would like to opt out from this, please tell me so in the text box on the assignment submission form.

All work will be turned in on Canvas.