Flashlight Survival Game Ian Meeder CPE 471

Intro

Inspired by games like Amnesia, Slender, and Alan Wake, I created a game in which the player is only equipped wiht a flashlight. As the light begins to dim, so does the player's hope as they slowly slip into insanity. Programmed in C++ using GLEW, GLFW, and OpenGL with GLSL shaders. All assets were created by me in Blender.

Graphics Techniques

Spotlight

The flashlight was implemented using a spotlight placed slightly to the front right of the player and pointed straight out in the -Z direction.

Depth Mapping

So in order to crate cast shadows from one object onto another, I created a depth map out from the flashlight. Then when drawing the frame, if the depth of the fragment was greater than the depth indicated by the depth map, don't apply the lighting from the flashlight. Here you can see the depth buffer and the phong-shaded buffer side by side.

Fog

With GLSL shaders, fog must be implemented by hand. There are three main equations to calculate fog - linearliy, exponentially, and exponentially to the power of two. Although this EXP2 equation is the heaviest on processing, it is almost the best looking. Finding the distance of a fragment from the camera, I applied the fog accordingly.

Collision Detection

Although not strictly a graphics concept, I implemented collision detection between the player and other objects in the world. The player will not be able to move if there is anything in their way. However rocks that are low enough in the ground will be passed over.

Playing the Game

To win, the player must find the exit on the edge of the map before insanity sets in.

Controls

  • WASD Keys move the player forward, backward, or to the sides.
  • Mouse movement changes the player's (and the flashlight's) direction.
  • Left clicking with the mouse will toggle the flashlight on and off.

Battery Life

Over time, the flashlight's battery will start to dim. However, there are randomly placed betteries throughout the stage that give a bit more battery power to further delay the inevitable. Walking over the batteries will collect them for the player.

Insanity

If the flashlight is turned off or if the light is too dim, the player will begin to lose their sanity. This will begin to manifest itself with the fog growing darker over time. Additionally, the world will begin to tilt as the player turns around. If the player loses all their sanity, all hope is lost and the player loses.

Winning

If the player manages to find the exit to the map, then the player does not go insane and lives to die another day. Here is the exit to the map: And after walking out of the valley, you get this end screen:
Free Web Hosting