Our third assignment and considered the most difficult of all the assignments for first year was Tiny Tanks. Looking back I can certainly agree it was bigger with the addition of OpenGL on top of the usual framework and I did struggle for the first few weeks trying to grasp Matrices and Vectors in the context of code. The theory made sense and I found it as a refresher to the knowledge I had already gained in my first year of engineering. It was when that theory was applied as code where the confusion arised. Learning something fundamental as Matrices and Vectors can only be understood by simply creating functions and classes and coupling them with unit testing. Once the tests were made and working as expected then adding OpenGL eliminated the fault of the class and directed the attention to OpenGL and how I was using it, which is complicated enough for newcomers and doing it this way eliminated having to chase multiple possible areas of faults in code. Having done most of the work in Pacman did lessen the burden of learning too many new things. SDL, multiple projects and files, inheritance and gamestates were all transferred from Pacman and all that was left was to concentrate on the OpenGL addiitons. So in a way, I found the previous Pacman assignment much more difficult that this one.
This did give me a chance to experiment with changes to the collision detection. In pacman I was using an array and checking to see if the ghost and pacman borders occupied the same area. In Tiny Tanks I used AABB collision detection. Each sprite was marked differently and it was then a matter of nested iterators to traverse the list of sprites to see which one was colliding as well as identifying which item it was. During testing I was surprised how important spatial hashing is even with such limited collision checks. So choosing to not applying any spatial index hashing I found the game required cotinous speed variable changes to OpenGL to compensate when more walls were added. This was annoying as I wanted to add an editor to the game and with deadlines looming I decided to not include this into the game. As such the game is not as complete as Pacman. Another factor was it is not the type of game I would consider it a game I would enjoy making. I believe if you’re not enjoying your’re game programming you’re doing it wrong and this was one instance where I was probably doing it wrong. In hindsight, I would now have changed the collision code and implemented spatial hashing for improved performance. I strive for performance in my code and this factor alone annoyed me to no end.