SC Marine
Nathanael Johnson
CSC-471-01 Spring 2006
Final Project Disclaimer: I know the pictures are not that great, and that they take up a lot of space. I have learned a lesson about how much quality you lose when converting from a BMP to a JPG. When I get a chance to get better screenshots, the page will look a lot nicer (the pics will be more detailed but less overall pixels).
|
Introduction | | | User Guide | | | Modeling/Layout | | | Animations | | | Other Concepts | | | Resources |
For those of you who aren't familiar with Blizzard Entertainment's Starcraft franchise (God have mercy on your souls), Starcraft is an RTS game for the PC (and Playstation, I beleive, but how would you play an RTS without a mouse and keyboard?). Starcraft was, and still is, one of the greatest RTS's out there. The Marine is the bread-and-butter of the Human troops (one of three playable races/species in the SC universe), and always has something uncouth to say to whoever's in command. Marines are really just bio-rehabilitated ex-cons, given a gauss rifle and strapped into a combat suit with a couple chemical stimulant dispensers (stim-packs) strapped onto their back. This program is a manipulatable model of a Marine, inspired by screenshots from Starcraft in-game cinematics, and by a more detailed model that exists as an "easter egg" in Blizzard's other RTS game, Warcraft 3. The Marine is a fully hierarchical model built from gluQuadrics and a few custom-made components (sphere-wedges, capped cylinders). A texture map taken from said easter-egg model file is used for the face, whereas the rest of the body is shaded by using various OpenGL material properties. |
To facilitate your viewing of the model from all different angles, the camera is fully mobile. The camera movement follows the standard "WASD + mouse" layout common to many first-person shooters (see table to right, if unfamiliar). The left mouse button must be held down in order for the movement to actually affect the camera rotation. Also, the mouse response only occurs when the "mouse mode" is set to "camera" (see description of menus below). |
| ||||||||||||||||
The main functionality is found in the program's Menu, which is accessible by right-clicking anywhere in the display window. The first important item is the mouse-mode selection: if set to "camera", click-and-drag motion affects camera rotation; if set to "joints", click-and-drag motion rotates the current selected handle (up to increase, down to decrease; simple enough). The other portions of the menu allow the user to select a "current handle" to manipulate or animate, or to select from a list of built-in animations to view. You can also select whether to rotate/animate left and right joints together, or separately (this of course doesn't apply to the neck and waist handles). |
| ||||||||||||||||
Some built-in animations are periodic, meaning they will continue to play until the user selects a different animation or clicks the "Stop all" option in the animation menu. Others are one-shot animations, meaning the Marine will retain the final position until told to do something else. Animations must be stopped with the "Stop all" option before the user can do manual joint manipulation, because otherwise the joints will continue to try to animate back to their desired positions and conflict with the user's interaction. Finally, the entire Marine can be rotated to face in a given direction (this is useful if you walk him into a wall and want to turn around). This is done simply by selecting the 3rd mouse-mode item, "rotate entire model", which in fact rotates the pelvis component about the Y axis, based on the mouse's change in X, and because the rest of the components/groups are children of the pelvis, the entire model rotates. There are some keyboard commands that can substitute for some of the menu operations, such as "C" to cycle through all joints in order. |
|
Marine is fully hierarchical, with the base reference being his pelvis (the small hexagonal cylinder to which the legs are attached). He is composed of gluQuadrics (lots of cylinders, some shperes, a few toruses) and some non-primitive objects that were either built from Quadrics (solid cylinders with different textures on endcaps) or partially from scratch (sphere-wedges, using polar sphere equations and partial-disks for the ends). Because Quadrics generate normals automatically, the bulk of the lighting work was done for me. Also, unfortunately, I had to use GL_NORMALIZE because I was deforming the Quadrics so often that manually adding matrix-transforms before every Quadric draw call would be a nightmare. However, for my manually-created objects, I did calculate my own normals. Now, since those objects were generally cylindrical or spherical in nature, this was not all that difficult. But I was pretty happy with the way all the components appear with their materials under different lighting conditions. The list on the right shows the model's layout, with a (G) indicating a "group" (it contains a set of components but is not a component itself). Also, each manipulation/animation handle is indicated by [H#], where # is the degree of motion it is capable of (1 to 3). Due to other deadlines and the fact that any more detail in the hand-area wouldn't add much to the overall project, the hands are more like a pair of opposing grabbers than anything resembling a human appendage. But remember, this is a battle-suit. |
|
after rotating the camera and turning on another light | after some manual joint manipulation, and more camera movement |
The Marine can perform a variety of animations. Animations are implemented using the GLUT idle-callback function; no fancy timers or machine-dependent framerates, so if you're getting choppy or sluggish animation, you can open up marine.h and change the global constant called "PRESCAL". All animations are performed in place EXCEPT the walking and running. These cause the Marine to move forward in the direction he is currently facing, until he is stopped or he hits the boundary of his world. This is the part of the project where I felt like I needed more time, because there are a lot of things that could be done better in this area, especially when it comes to realistic walking movements. However, it is what it is, and maybe someday I or somebody else will play around with it some more. Throughout this page, grayed-out text indicates something that I didn't get to implement, most of which is directly related to the lack of in-World translation (walking/running). |
a still of "at-ease" | final firing stance |
Lighting and materials constitute a fundamental part of making models look good. Four light sources, one at each top-corner of Marine's world-box, can be toggled on and off to see the different affects on the model's body. Many custom materials were used to finish the Marine model and give it more "personality": a silver metal, a much darker metal, a very dark matte, a golden-brass, a copper-like metal, and a blood-red plastic. There were also touches of blue plastic and bright white for the lamps. A texture map for Marine's face, as mentioned before, was obtained from a model file in the Warcraft 3 World Editor. I cropped and resampled it to create a 256x256 24-bit bitmap. The program uses a bitmap file-read utility written by Prof. Wood and distributed to all her students. The texture is then mapped manually onto a quad-strip that is actually shaped like a partial-cylinder; this gives it a somewhat rounded appearance while preventing too much warping of the image features. Finally, collision-detection was implemented in a very basic way. The Marine's position is tracked and checked against the edges of his world, plus a buffer distance that is relatively proportional to the Marine's overall size. More work could have been done in this area, but it was really not that important to me. |
I basically did all of this work on my own, drawing on the knowledge from CSC-471 and the OpenGL Primer that we had as a textbook. But just so this section isn't empty, here are some potentially useful/cool links:
|