Naomi Inouye, OMiCodes By submitting this file, I hereby declare that I worked individually on this assignment and that I am the only author of this code. I have listed all external resources (web pages, books) used below. I have listed all people with whom I have had signficant discussions about the project below. Inspiration and references: I referenced the following websites: http://www.opengl.org/resources/code/samples/mjktips/TexFont/TexFont.html for texture mapping text onto cubes http://www.lighthouse3d.com/opengl/glut/index.php?bmpfont for rendering bitmap strings http://www.gamedev.net/community/forums/topic.asp?topic_id=180189 i used code posted here to calculate the inverse of a 4x4 matrix http://www.spacesimulator.net/tut2_texturemapping.html and http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=06 I referenced these two websites for loading bmp texture files. Please note: the spacesimulator site no longer appears to be working. Most of the information I received was from the nehe site but I did look over the spacesimulator site early in the project http://www.swiftless.com/tutorials/opengl/circle.html referenced for drawing a circle with points http://mathworld.wolfram.com/Sphere-SphereIntersection.html for some math behind collisions http://www.3dcodingtutorial.com/Collision-Detection/Collision-Boxes.html I read this page for ideas on making a bounding box. They implemented a point/box collision detection whereas I implemented circle/circle and circle/box collisions High level Description: My game is a puzzle/maze game. You are given a homework assignment and must find the right puzzle peices to complete the assignment before the submission deadline. You pick up a piece by clicking on it. You move using the keyboard. Clicking on the piece removes it from the environment. If it is a useful peice it is stored in your inventory and your score goes up. If it is not a useful piece, your score decreases. There are also some special pieces with increase your size or speed. A villain is also moving in the world. Touching him reduces your size and speed and triggers an animationg The view switches in between follow cam and 1st person. It is normally follow cam but if movement would cause the camera to intersect with a wall, it switches to 1st person. You can also switch to a minimap mode and see an overview of the whole floor as well as your location on the floor. You can also switch to a view that shows your assignment and the pieces you have collected. There are three types of lighting: regular, alarm mode, flashlight. The flashlight is a spot light centered at the character. Using it allows you to cheat and see if a piece is valid but decreases your score. Alarm mode has two spinning red and blue lights. A heads up display shows score, time, fps and inventory. Messages are also displayed that are triggered by picking, time, or the key strokes. For the additional feature I have implented collision detection. The first form is character/wall interaction between bounded boxes and circles. An interaction will restrict movement and possibly trigger a change in camera position. The second form is two moving characters represented by circles. An interaction will cause a an animation and change in size/speed. Mid-level description: For the collision detection I used a formula to find th distance between two circles. Since my world does not involve a change in height, I decided to compare circles rather than spheres to increase performance. For the wall intersections I checked if the sphere was within the size of a given bounded box+the radius of the character sphere. Every wall was stored in an array of bounded boxes. The characters position is compared to each box in the array. If the character collides with any box, collision detection is reported. Once all the boxes have been tested, the interaction between the two characters is tested. If the distance between the centers of the spheres is less than the combined radius of the two spheres, collision detection is reported. To make the bounded boxes, I looked at each of the eight points of the cube. I converted them from object to world coordinates by obtaining the current matrix: pWorld = matrix*pObject. I then compared the coordinates to find two vertexes: min and max. I tracked my bounded boxes using those two vertexes. The character rotation caused the boxes to warp and expand so I tracked my rotation reversed it when recording the bounded boxes. The puzzle pieces are a data object consisting of a position, a string, and two booleans to indicate if they are valid and if they have been picked up/should be drawn. When the player picks an assignment, the strings are read from a file. The file also indicates which pieces are valid. The heads up display is done by rendering a bitmap string. Player position on the minimap is done in a similar manner as the project 2 spaceships. Animation is done in a similar manner to project 1: I track the real angle and the desired angle. If they are different I slowly increment them. FPS is calculated by tracking the number of frames I draw. I track the time and whenever one second passes, I record how many frames were drawn during that second. I also calculate the amount of time left for the level by keeping track of the start time of the level and comparing it to the time when I draw each frame. Text messages appear on the screen and are removed after about 10 seconds have passed. The time can trigger different messages. Texture mapping uses glTexCoords and the vertexes of one side of a wall. I pass the method the normal value (plus or minus 1) to properly orient the normals (so the normal is not pointing the opposite way. I loaded bmp's using the nehe tutorial. For picking I referenced the opengl redbook. I used a name stack and stored all the object capable of being picked. I then loaded the walls under the same name. I set up the gluPickMatrix and look at the hit buffer to determine which hit is closest. If that closest hit was a valid object, the object is picked and removed from the scene. If the closest hit is a wall nothing happens. How to play: keys action w forward a turn left d turn right s backwards f flashlight - shows which peices are valid but decreases score t view minimap y quit j trigger another character to patrol hallways h get time extension v view assignment cheat keys for demoing p toggle mini ' ' (spacebar) sets inventory to full and ends level o toggles alarm click on an object to pick it.