Thursday 9 January 2014

UOIT Game Dev - Development Blog 1

Welcome to my very first blog post about my second year university experience in the Game Dev program at UOIT. I will be posting a blog per week for the next 10 weeks regarding the things I've learned in our graphics class and the development (graphical side) of our game. I hope you enjoy :)

After a good long winter break, I feel refreshed and ready to start learning new things. This year is off to a good start, none of our group members have dropped out so our studio is still still intact.

We've been working on a game since September called "Project Horizon". This game features a guy running around with a sword in a futuristic floating city.


As you can see there are already some shading techniques used in this demo such as shadow mapping and bloom. However there are still a lot of things lacking such as multiple lights, normal mapping, bump mapping etc. So I was excited to start our second semester intermediate graphics course.

After a brief introduction to the course, we were taken through the syllabus and then after we were revealed the homework questions. Knowing that our year has only slightly touched on shaders I expected the questions to only contain the basic textbook fundamentals like phong, reflection, multi-lights etc. BUT much to my surprise some of the questions involves very interesting shading techniques that got me very excited like:

Ambient Occlusion

Motion Blur

and

Fluid Dynamics?! (Woah)

Needless to say I am very excited to learn and implement all of these techniques into our game and this class automatically became my favorite course of the semester.


Back on the development side, knowing that we only have 4 months remaining, we have decided to re-scope our game. Instead of traversing through a large linear level, the player would be fighting waves of enemies in a smaller arena like level. This re-scoped game has sprung up a new issue, and it is that the framework must be able to handle large volumes of enemies at the same time. The problem with this is that the skinning operations is quite expensive on CPUs.

While this was good for what we imagined before (few enemies along the linear path), sending thousands of vertex data every frame wasn't exactly efficient. 

As a simple stress test, I tried to run as many copies of our characters at one time. The results were very poor, the game was only able to support a maximum of 4 characters before the frame rate drops. This was bad.

So I finally decided to look into GPU skinning, and it turns out not to be all that difficult! It only requires you to send the mesh and weights data over once, and simply uniform over the bone matrix transformations each frame. Then within the vertex shader, multiply each vertex with the appropriate bone transformations along with the corresponding weight factors. 

Thats it! and boom now we can have 16 characters (each with over 3000 vertices and 37 bones) and still run at a good frame rate. Our enemies contain much less polygons and bones, and with a few adjustments we should be able to hopefully handle over 30 enemies at one time. 



For future implementations, I plan on adding motion blur when turning the camera, glow for our night level, normal mapping along with bump mapping for surface detail, ambient occlusion and hopefully various particle effects for our enemies. 

No comments:

Post a Comment