main page | gallery | rationale | contact

modtanks
an exploration into 3-Dimensional game programming

Written:Fall 1999
Last Touched:Spring 2000



Introduction

This is my first real foray into 3D graphics programming, and really into making a fully-functional game from scratch. The project is much less than it was conceived to be, but the end result is still visually impressive. Here's a rundown of the features:

  • It's in 3D.
    I taught myself basic OpenGL from MSDN and online documentation. The graphics code in this app is by no means optimized or efficient, but it does draw pictures on the screen.

  • It has a system console.
    I really like the configuration console system in games like Quake, so I decided to try and add one to this project. As an exercise, I had written a simple C++ class to emulate the functionality of the Java StringTokenizer class, and I used it to construct a small, hardwired grammar parser to handle console input.

  • It can be considered a completed product.
    Personally, there are a ton of features I'd like to add to this, but in its current form it is a complete, playable, somewhat-entertaining game.

What Was Difficult?

Thinking in 3D. I hand-constructed the vertices for the tank models using only my head and a piece of paper. It took several tries to get it right while I was still grappling with 3-Dimensional space. Things like polygon culling and lighting were also difficult to get working correctly, but there were a prolific number of examples on the MSDN CD to aid my on my way.

There were a couple interesting bugs along the way as well. I had a really difficult time getting the textures to load and display properly, and I spent several hours wondering why my nice logos were displaying upside down, skewed and pink. Eventually, I tracked it down to my misuse of an OpenGL library function, after I was so sure it was a problem in the library or perhaps my in computer itself. When I first added the console, I had some trouble with it showing up on the playing field instead of at the top of the screen (!). This was kind of amusing, since I had to drive the tank over to the edge of the playing field to actually see what I was typing on the console.

I learned a lot from this project: not only how to write a 3D game, but a lot about how NOT to design a program. My object-oriented design skills were pretty fuzzy at this point, so the code is a mix of objects and procedural code. Looking back on it, the design isn't horrible, but it definitely could have used a much more experienced designer.

And In the End...

This project was enjoyable for me to write, and every late night spent in front of my monitor writing it was worthwhile. There is nothing quite as rewarding as the stage after the completion of an immense, complicated project in which one can look at the final product and say with pride: "I did that."

What you need to compile & run this

For Windows, I'd recommend Microsoft Visual C++ 6.0 or greater, since that's exactly the tool I used to develop this project. You'll also need the DirectX 6.1 or greater SDK, currently available from:

http://msdn.microsoft.com/library/default.asp?url=/downloads/list/directx.asp

For Linux, you're out of luck. Unless you feel like messing with WINE, but neither I or the WINE programmers will guarantee you any degree of success. But hey -- it never hurts to try. Let me know if you manage to get it working, and I'll give you something cool for your efforts.


Controls

AccelerateW
Decelerate/ReverseS
Turret LeftLeft Arrow
Turret RightRight Arrow
Slow Turret LeftShift + Left Arrow
Slow Turret RightShift + Right Arrow
FireInsert (Numpad)
Open Console` (next to main keyboard 1)
Quit:Escape, Alt+F4

Console Commands

setBodyColor(r,g,b)Changes your tank's body color to r,g,b. Each component is specified as a number between 0 and 1, with 1 being the brightest.
setTurretColor(r,g,b)Changes your tank's turret color to r,g,b. Each component is specified as a number between 0 and 1, with 1 being the brightest.
setTreadColor(r,g,b)Changes your tank's tread color to r,g,b. Each component is specified as a number between 0 and 1, with 1 being the brightest.
setName("name")Changes your name to "name".
closeConsole()Closes the console and returns to the game
cc()Synonym for closeConsole()
exit()Quit


ExecutableComing Soon.
SourceComing Soon.



Last updated: 2003.03.03 by falger@calpoly.edu