Introduction
For my final project, I created a first person shooter game. The object of the game is to shoot all of the balloons before they reach the clouds. Each balloon emits from a tree and makes its way towards the cloud right above it. Line up the crosshair with a balloon and fire away! If a balloon reaches a cloud, you lose. If you manage to shoot all of the balloons in time, you win and your final time will be displayed in the console.
Controls
- Use the mouse to look around
- Left click the mouse to shoot
- W to move forward
- S to move backwards
- A to strafe left
- D to strafe right
Features and Implementation
- Shoot a balloon: Implemented via picking. I encoded a unique id into the color of each balloon. When the user clicks to shoot, the pixel at the center of the window (which is the center of the crosshair) is read and if the color matches a balloon id, the balloon is not drawn anymore.
- Shooting animation: Done by translating the shapes that are drawn on the screen in a way that makes the gun appear as if it were shooting (blast, recoil, crosshair bloom)
- Trees and Clouds: Hierarchally modeled trees and clouds to make a scene. These models are also phong shaded.
- First Person Camera: Gun is drawn close to camera to appear as if the user is controlling a virtual person holding a rifle. User can look around and move about the scene.
- Fun and Challenging: People who have tried playing this game find it fun and challenging. It plays very smoothly and naturally for those who are familiar with first person shooters.
Demo
References
OpenGL Picking TutorialOpenGL Camera Tutorial
OpenGL Basic Lighting Tutorial