This was a joint project for C++ Programming and Real Time Graphics, which I did in the first semester at Hull. This was the first time I'd ever programmed in C++, and what with my previous experience being mainly in Flash, I have to say I don't really mind C++. A lot of people seem to hate it, but if you throw
const's around like no tomorrow, a lot of the errors disappear. The rest are the really vague errors that Visual Studio helpfully makes vaguer, but everyone else knows them so it's cool.
No doubt I wrecked a few heads with constant noob questions, but then, nobody really remembers what it's like to be a noob. So a large thanks goes out to a lot of my class. A bigger one goes to Alexis, the french guy I'm currently living with, whose frequent conversations lead to a lot of things being easier. And for explaining the intricacies of bounding box collisions for me.
There is a back story to this project, roughly along the lines of developing an "asset retrieval simulation" to train grunts for a futuristic multi-national quantum processing technology developer. But, it kind of sucks a bit, so I won't really repeat it here. What we had to actually make was:
- An old factory with natural light coming from one direction, as well as hanging lights
- All objects to be editable through an external textfile
- Stairs and railings, and pipes carrying steam
- Player is tracked by security cameras, and the feed can be viewed on monitors in the level
- The asset - a briefcase - that opens under the combination of 2006 and ends the simulation
- Friend and foe pop-up billboards that come into sight when you're near enough and looking in their direction
- Billboards should be on a hinge and register a bullet hole (that you can see through) and a scorch mark
- Shooting a wall leaves a scorch mark
- Shooting the windows breaks the glass
- Shooting a pipe allows steam to escape - implemented using a particle system
- Your gun only has 100 bullets, should be aimed with a cross-hair, and running out of bullets ends the simulation
- A bullet-time effect should be included that shows the flight of the bullet in another window / area and shows the turbulence of the air
- Should have a day / night switcher, that includes lights on and off, as well as a night-vision mode
- The cone of light from the factory lights should be visible
- Player should be able to walk up stairs, and fall to the ground
- A GUI should display the player's progress
As you can see, a piece of cake! On to what I actually did.
The Finished Version
What I actually got done differed a bit from what was needed to do. In true gaming fashion I improved parts that would make a better game, and in true student fashion I dropped bits that I didn't have time to do.
Despite the fact that repeatedly through the semester our lecturers emphasized the fact that you didn't really need collision detection, I soon found this to be a rather blatant lie. I don't know of many games that don't involve collision detection, and for this there was: running around the level, shooting stuff, and something else to fill out this list and make my point. For collision detection around the level, I used bounding boxes, which turned out to be a very easy, fast way of collisioning. On the downside, I didn't have a whole pile of time to spend developing the system, so there was the restriction that all the objects were essentially cuboid in shape, and had to be axis-aligned. However, in a rare inspirational flash into the future, I had already designed the level like this. Which meant disco. You can see this in action in the picture and video sections.
For shooting stuff, there was the same bounding box algorithms, except this time it was line-plane. I used line-cylinder for the pipes, which works pretty well, except for the fact that it only works on infinite cylinders. Not a problem, just make all pipes span the length of the level, and as long as nobody thinks to shoot out the window where an infinite steam-carrying pipe would be if it had a physical representation in the world, nobody's the wiser.
I was also pretty pleased about the security camera systems that I had set up. It basically captures the scene, messes with it a bit depending on the level of interference on the camera, and saves it to a texture. Coupled with the
TextureManager class I developed, it meant that I could display a live level feed on the side of any object I wanted.
In the end I didn't add a lot of the cosmetic elements to the game, such as the GUI, briefcase, or indeed any game logic in itself. That doesn't mean that you can't play it as a game though. On the contrary, I challenge you to finish it without hitting the quit key. Or to stop having so much fun playing it. Anyway, I've uploaded some pictures and movies of the game in action, but you can also download the release version (3.15Mb). I've also uploaded the project report (1.48Mb) in super Word format, which includes amongst such delights as hand drawn sketches of the level. If there's enough interest I'll even put the originals up for auction. Probably in some sort of snazzy frame that automatically breaks any ice in any room.
Edit (01/Jun/07): I've decided to upload the source code of the warehouse project (3.26Mb). While I'm pretty pleased with it, it's not going to win any coding awards. Before judging harshly, please remember this was my first time doing anything in 3D, my first time doing anything in C++, and my first time using OpenGL. But hey, everyone has to start somewhere, right?