Friday, November 7, 2014

INFR3110 Blog 3


Barely in the groove of using 2loc, after many attempts, hurdles, scrapping together pieces of information here and there, and even abandoning some projects, I’ve managed to complete a few medium homework questions. 2loc has been a challenging beast to say the least and it is the primary adversary when it comes to completing these assignments. Constantly scratching my head and questioning everything, I’ve bided for time in hopes of learning new details from either the lecture or the tutorials.

One of the more challenging of the completed - Shadow mapping is simple in theory, but the implementation in 2loc involves what I believe to be the combined use of many unknown 2loc features lurking in the depths. The main points to take away in the implementation is the use of ShaderOperators to update the passed in light viewprojection matrix. As I did not properly understand ECS, I had been scratching my head as to why the light camera’s passed back view projection matrix was wrong – I expected it to be computed and then returned but was forgetting that the system was the one to do that, and has yet to perform the task.The other important part is passing in specific uniforms not exposed or directly controlled by the programmer. Rather, these functions were hidden away and must be enabled. Even then, finding the exact name of the uniform was difficult. It would seem that this has been alleviated in the latest distribution, where these functions are exposed in full and would even warn you if they are enabled and not used in the shader; a bit late for me, as much time was lost in finding and learning these features. From then on it was smooth sailing - calculating the position to shadow coord by using the lights’ view projection and the model matrix, than deserializing it to sample from the shadowmap. Following the standard algorithm already taught to us and a bit of tweaking to get rid of shadow acne and voila, shadow mapping.

Shadowmapping in 2loc

The other bit I worked on was Pacman. The most challenging element of this was in figuring out what method to implement the collision. I was tempted to use box2D, but realistically it requires the arduous process of creating static bodies for all the walls. Looking towards the future, I decided on a supposedly easy approach of collision masks. The only problem encountered was the different coordinate systems between sampling the texture with the build in readpixels function. The simplest remedy being to rotate the png itself.

As for the rest of this term and the hard homework questions waiting, the roadmap I had in mind is to take Pacman all the way; a total of 35xp is tantalizing. The obligation of doing the AI centric homework question compels me as I am taking “Artificial intelligence for gaming” this semester. Salvaging my A* algorithm from the previous year, I will be able to implement the AI for the ghosts to a much more accurate degree. If you’ve read up on the AI of the ghosts, it would seem they are a lot more complicated than meets the eye…

No comments:

Post a Comment