CSC
471 Final Project
Carl Taylor
Download executable:
Windows 32-bit
Overview:
This program is a simple driving game. The user drives a
vehicle around a small world with obstacles and scenery. There is currently no
objective; this is meant to be an exploration of graphics techniques rather
than an engaging video game. This could, however, be used as a codebase for a
driving game.
Features:
·
Hierarchical models – All models are
hierarchically drawn
·
Scenery generation – Grass blades,
bricks and stars are randomly generated and displayed via hierarchical models
·
User input – The user controls the
acceleration and steering wheel angle of the vehicle
·
Camera control – The camera follows
behind and above the car as it drives around the world. The camera may also be
pitched up and down
·
Lighting – The sun lights the scene
when it is up; when the sun is down, the light changed to reflect this
·
Rigid body animation – The wheels of
the vehicle turn smoothly to reflect the amount that the vehicle is turning.
Additionally, the sun and the stars move as time passes
·
Color interpolation – As the sun rises
and sets, the sky’s color is interpolated over three phases to reflect the daytime,
sunset, and sunrise
·
Physics simulations – The vehicle has acceleration
and a momentum that propels it along the path determined by the rotation of its
front wheels
·
Plane-based collision detection – The vehicle
observes collision detection with both the trees and the walls. Tree collision
is detected by the plane of the vehicle’s sides crossing a tree’s origin, and wall
collision is detected by the plane of the walls being crossed by one of the
four corners of the vehicle
Controls:
click and drag – pitch camera up and down
w – accelerate forwards
s – accelerate backwards
a – turn left
d – turn right
e – apply brake
r – toggle star rotation (will not be smooth)
Other notes:
This
code is awful and should be broken up into many, many different files. This
project’s purpose was exploration, and if I were to do this again I would
organize it much differently.
Collision
detection has some occasional problems as well. Sometimes when “pushing” into a
tree for a bit, the front end of the car will actually pass through the tree.
Screenshots:
The opening view.
Night.
Sunrise.
Collision! Oh no!
Bricks colors and depth variations are randomly generated at the beginning of
runtime.
References:
http://gamedeveloperjourney.blogspot.com/2009/04/point-plane-collision-detection.html
VERY HELPFUL plane-based collision detection tutorial
http://en.wikipedia.org/wiki/Momentum
Momentum refresher
http://www.batesville.k12.in.us/Physics/PhyNet/Mechanics/Circular%20Motion/turning_a_car.htm
Physics of turning cars