Programming Projects

OpenGL First Person Shooter - A Time to Kill

A Time to Kill screenshotI had a final project for a 3D programmnig class to enhance the game “A Time to Kill” (included with the text Beginning OpenGL Programming). My project was to rewrite the game so that it compiled and ran independent of Microsoft DirectX, as well as code some in-game enhancements to demonstrate my knowledge of OpenGL programming.

The game “A Time to Kill” is a simple OpenGL first-person shooter where you run around and kill enemies. The enemies don’t fire back and run away when approached. The object of the game is to kill all the enemies before the time runs out. You are able to fire flame rockets and heavy missiles. Flame rockets fly faster and straighter, but heavy missiles have a larger impact area. The arrow keys move you around. The mouse will allow you to look around and aim, and the mouse buttons will fire your weapons.

DirectX provided all the sound and inputs controls for the game using its DirectSound and DirectInput modules, respectively. I replaced these as follows:

  • For game input I used Windows’ built-in mouse and keyboard functionality. I rewrote much of the keyboard and mouse code in the parent window class file. It should be noted that I don’t think the controls are as robust as with DirectX, but this might have been different if I had tried using SDL’s input library.
  • For sound I used SDL’s sound library called SDL MIXER. It provides a multi-channel sound engine I used to replicate all of the DirectSound functionality in the game. I added new sounds for weapon launching and explosions. In addition to sound effects, I added a looping “arcade-style” music file for some videogame ambiance. I wrote a new class AudioSystem from scratch to provide all the SDL MIXER functionality the game needed, including an interface for in game objects to play their own sounds.

Languages: C++

Coding tools: Dev-C++

Executable and source files: ATimetoKill-final_project.zip 1.5 MB

Required supporting installs:
gcc compiler
OpenGL
SDL
SDL Mixer

Project overview letter: ATimetoKill_README.doc

NOTE: This game is very rough and simplistic, but it was designed to demonstrate the fundamentals of OpenGL programming and DirectX and SDL software architectures.