Chadon Woods' Final Project

CSC 471, Introduction to Graphics

Winter 2007, Dr. Zoё Wood

Introduction

My final project is designed around a simple first-person shooter game. The “world” consists of a outdoor environement in which the player can walk around. Collision detection takes place between the player and the walls such that the player cannot walk straight through them. The view takes place through the eyes of the player’s character, with a on-screen display that shows the player's current number of kills, accuracy, time played, and health. In the center of the screen is the player’s crosshair, which is controlled by mouse movements. Also in the room is one Hierarchically-modeled AI bot that walkes around the world. Hopping around the room, are an assortment of bunnies that chase the player around the room with an intent to kill. Collision detection for both the bot and the bunnies takes place such that they stay within the walls. The player's health begins to go down is the bunnies get too close. This program was writen in C and uses OpenGL and GLUT.

Feel free to download Bunny Hunter v1.0 here

Program Usage

A main menu may be displayed during gameplay by pressing the ESC key on the keyboard. During gameplay, the following commands are accessible via the mouse and keyboard:
 

Mouse controls:

Actions:

  • Mouse Movement: Look around
  • Click Left-Mouse Button: Fire weapon

Keyboard controls:

Movement Controls:

  • A: Translate camera left
  • D: Translate camera right
  • W: Translate camera forward (zoom in)
  • S: Translate camera backward (zoom out)
  • Space: Jump

Miscellaneous controls:

  • T: Change time of day (day/night)
  • L: Enable/disable flashlight
  • H: Help
  • Q: Quit

Bot's Hierarchical Modeling

The bot is hierarchically modeled such that the arms and legs both have 2 pivot points each. The bot walking around the room, moving his arms and legs it a somewhat realistic manner. The bot is comprised of circles and cylinders that make up the different parts of its body.

Animation

The bunnies and bot are animated using OpenGL timers. These timers move the objects and also provide collision detection. Both the bunnies and bots detect collision with the walls and trees. When a collision occurs, their path of travel, or direction angle, is adjusted until they are free to roam again. The bunny timer recalculates each bunny's direction angle based on the angle of the vector from the player to the current bunny. The bunny is then repositioned to be facing the player at all times, allowing the bunny to chase the player with an intent to kill.

  • When the game first starts up, a main menu screen will be displayed. From here, the user may select a menu item, which performs as follows:
    • Start New Game: Begin playing Bunny Hunter
    • Options: Allows setting sound volume, crosshair color, gravity
    • Help: Displays information about game control
    • Quit: Quits Bunny Hunter

Main Menu Screen

Options Menu Screen

Texture Mapping

I used texture mapping to map images to the wall, ground, main menu items, and moon. The ground and wall planes were both divided up into many polygons in order to support the "flashlight" feature during night mode. The stone image used for the wall was too big to map directly to one of the wall's polygons. Instead, parts of the image had to be mapped accross multiple polygons multiple times across the wall's entire surface.

Object Picking and Selection

Object picking occurs when the user clicks the left mouse button. The bot, bunnies, and trees all have picking enabled. During picking, the depth of the objects are also tested such that a bunny cannot be shot through a tree trunk, but can be shot thought the green part of a tree. Also, up to four bunnies may be shot at once time, if they happen to all line up in such a manner. Only one part of the bot may be shot at one time, such that each invividually-selectable bot part must be shot directly.

Lighting and Materials

I have a single point light source in my world during daylight mode, which is supposed to act as the sun. During nighttime mode, the player may choose to enable a spotlight light source, which acts as if the player is holding a flashlight. Depending whether the player is in day or night mode, certain object's material ambient property changes such that they emitt very little light at night, but emitt more during the day because of the sun.

 

 

Screen Shots:

Playing Bunny Hunter during the day
Playing Bunny Hunter at night, with the flashlight on

Future Additions

The following is a list of items, had time permitted, that I would have liked to implement. Perhaps I may still add them one of these days.

  • Add additional elements/objects to the world, for example: add clouds to the sky
  • Add more texture mapping to make world more visually appealing
  • Give the bot and bunnies more advanced AI
  • Enable ability to actually "kill" the bot
  • Improve game animations, for example: flying guts and body parts when a bunny is shot
  • Enable automatic changing of daylight mode to night mode, by progressively making it darker

References

  • Talkingwaves.com - Free WAV sound files
  • OpenGL Example - Random OpenGL source code, including FMOD (provides sound playback)
  • Flipcode.com - OpenGL crosshair information & other stuff
  • Angel, Edward. "OpenGL: A Primer." Pearson Education, Inc., Boston, 2005. - OpenGL reference book