Campers be gone!

By Tim Acorda

pic0.jpg

You play as a ghost awakened by disturbing campers! In order to rest once again in peace, you must eat the children. But don’t get caught by their flashlights or else you’ll lose and will never be able to return to your grave!

For my project I set out to create a game that enabled the user to view our ghost in third person view. Getting the overhead perspective took a little changing from our typical first person view. The look at position was always placed on the character and the eye location orbited our ghost.

Collisions

collisionWall.jpg

Another feature implemented is axis aligned bounding box (AABB) object collision. I calculated the max and min values for each axis and saved their vertices in a new class. Each model transform on an object also affected their AABB, so the AABB class needed to be constantly updated to be accurate in the world. A problem I stumbled upon was the bounding boxes for the trees. Their branches spread too far out over their trunks, which made their bounding boxes huge. This made the ghost unable to go relatively near the tree as the bounding boxes were set to the branches, and not to the trunk.

Collision detection for the campers was created in a different way. I took the distance from the ghost to the camper and checked if it was less than a certain threshold value. I also checked the angle for which the cone of the campers’ flashlights bloomed out and checked if the ghost was inside of that angle. If both conditions were met, the Ghost was caught. If the Ghost was outside of the angle, then we could go on with our usual AABB collision detection.

beforeCollision.jpg

Before Camper Collision

afterCollision.jpg

After collision

pic2.jpg

Getting caught by a flash light brightens the entire field. The campers jump up and down celebrating their victory.

Lighting

Lighting was done with Phong shading. I had a very weak directional light from above to emulate the moon, but the highlight (heh, highlight) were the flashlights help by the campers. A tutorial I found online enabled me to create directional point lights, using attenuation for brightness vs distance. A huge obstacle that I had to overcome was creating and passing in updated Light structs from the main program to the shaders. The syntax for this was a little wonky, but doable using some string mutability methods.

Final Thoughts

Overall, I’m very happy with how my project turned out, but am far from satisfied. I wanted to incorporate

I learned a lot and have a much deeper understanding and appreciation for the CG world. There are so many things that are accomplishable that the only limit is your imagination. If I could pick anything in the computer science world to do for the rest of my life, it would be graphics!

Resources and Thanks:

Flashlights: http://www.mbsoftworks.sk/index.php?page=tutorials&series=1&tutorial=20

Collison Detection:

http://www.learnopengl.com/#!In-Practice/2D-Game/Collisions/Collision-Detection

Best CG professor Zoe Wood

Brandon Dimaya for helping me conceptually with camera movement