3rd Person Techniques

[Prison Escape!]
Genre: 3rd Person Shooter
Platform: PC
Language: C++
Made With: OpenGL


Spatial Partitioning / Level of Detail / 3rd Person Cam Implementation


Of all the 3D OpenGL projects I've worked on, this is the one I spent most of my brain juices on.

By the end of this project I was about to crumble at the face of the amount of sleepless nights + hair pulling hours, and to be very honest I am still surprised by the fact that I pulled through alive. Hooray for hardcore programming?

All that being said though... I can't deny the fact that at the end of the day, the final product was a feat worth being proud of.

The aim of this project is for us to come up with algorithms to cater for a 3rd person shooter game. I've to basically research online for formulas to the 3rd person camera (this is the one that took me a lifetime to figure out), on top of what had been given to me by my lecturer.

What I initially thought to be as simple as "positioning the camera behind the camera and following him" ended up being one of the hardest algorithm I had to figure out.

The rotation of the camera, how it reacts if the user scrolls infront of the player, what it does when it goes behind a wall, etc. have to all be taken into consideration to make the whole game feel "right".

After what seemed like an eternity, I finally got the 3rd person camera to function. The camera will even reside and "move up" when it hit against a wall, and pan downwards when the player jumps. This is something I thought I'd never achieve.

This algorithm was one valued across the entire class since I shared it with everyone, and it saved us from our imminent C's. I did get some help from online sources. Specifically this video from ThinMatrix on youtube: 3rd Person Camera Java OpenGL

It was written in Java and so I had to find the C++ way of doing it on my own. But nonetheless, it was a HUGE help. Thanks ThinMatrix.

By the way, there are 2 parts to this project. Aside from making the base to a 3rd Person Game, we've also got to make sure everything is lag-free using game development techniques (E.g. Spatial Partitioning, Level Of Detail)

The first technique we tackled is frustum culling, and I had to think of a game idea that utilises frustum culling techniques.

The implementation of the technique itself wasn't really that tough, since the formulas are all provided. The hard part was figuring what to do with it.

After some long consideration I finally decided on a game idea that utilises the frustum culling technique.

The idea goes like this: The player is a criminal escaping from prison, and there are yellow "head lights" above lighting down on the game environment. The yellow lights are of course, the frustums.

The player has to try and avoid being caught in these said lights, and kill off the "enemies", which are the patrolling police officers. The concept was unique and I actually like it alot.

So I moved on to my other techniques. I ended up implementing the spatial partitioning algorithm, level of detail, LUA scripting, and basically everything required, then moved on to do additional features.

Looking back, this one project taught me so much, mainly to just press on and not give up. I guess it was more of a blessing than a nightmare after all.

Thanks Mr Toh :]


Level of detail of objects (Near = Green)


Level of detail of objects (Far = Red)


Level of detail of objects (Very Far = White)


Character in the Light Frustum, under attack from enemy 


Character attacking while in mid air


Jumping, camera pans downwards

No comments:

Post a Comment