"Target Practice"
Final Project for CPE 471-01/02
Mike Murray
Spring 2009
Project Description:
My project focuses on creating a simple physical simulation in which
the user can control a camera (similar to that of a first-person
shooter) and wander about a scene containing a target. Equipped with
arrows, the user shoots at the target in attempt to hit the bull's eye.
Since precision is an important part of every game, I spent a
significant portion of my time perfecting/adjusting the controls to
maximize user happiness.
Collisions are checked every frame for every arrow. Each arrow checks
for contact with the ground (a plane) and the target (a cube). If the
ground is hit, the arrow's y-velocity experiences a small amount energy
dissipation, then bounces upward. If an arrow strikes the target, the
magnitude of its velocity instantly becomes zero. Each arrow keeps
track of it's mass in addition to its position and velocity; however,
its mass is not used in this version. In the future, mass will be used
to calculate applied forces from two colliding objects (e.g. arrow and
target).
Simulating gravity can make any game feel much more realistic. In my
project, objects, such as Arrows, are created as a subclass of the
Simulation class. The arrow inherets functions such as
"simulate(float)," "operate(float)," and "solve()." This structure
makes it easier to create new object types and add them to the scene.
Although I have not had time to fully capitalize on this setup, I
intend incorporate many more objects and features in the near future.
Features:
- First-Person Shooter style camera and controls
- Crosshair for targeting
- Realistic gravity simulation applied to all objects
- Collision detection
- Texture mapping
- Hierachical modeling
- Slow motion control
Controls:
Keyboard:
w - move forward
s - move backward
a - strafe left
d - strafe right
f - fire an arrow
spacebar - jump
c - toggle between normal and slow motion (Default: normal)
x - toggle between large and small arrows (Default: small)
Mouse:
left button (down) - charge bow (i.e. power of the arrow)
left button (up) - release/fire arrow straight ahead
left button (down), moving cursor - adjust pitch and yaw (i.e. rotate current view), fire arrow on release
right button (down), moving cursor - adjust pitch and yaw (i.e. rotate current view) without having to shoot an arrow
passive mouse movement - <nothing>
Screen Shots:
Collision Detection and Multiple Arrows
Slow Motion from a Shot Fired while Jumping
Future Work:
In the near future, I plan on implementing many new features. Firstly,
I would like to use the mass of the arrows, which is already stored in
the object, and calculate/apply forces such as torque and friction. I
also plan on adding a key to permit the user to randomize the target
location and size. Furthermore, I expect to add different scenery, such
as building, trees, and perhaps vehicles. The foundation has already
been implemented, (i.e. the Mass class and Simulation container class),
so the workload for adding these features has be significantly reduced.
References:
NeHe Productions
-Lesson 39
-Lesson 40
Hazel Whorley
-Skymap Texture
Apron Tutorials
PyOpenGL 2.0.1.04 Man Pages
Zoe Wood's CPE 471-01/02