We have finally released our game over at Iridium Flare Games, it is a fun little endless runner with 100% original, hand crafted graphics and code. If you are an Android user you should check it out and let us know how you like it, you can find it on the Play Store as Ogre Simulator. It was a long and strange journey, we basically had no idea what we were doing, even though we had already worked on another title, that is still in progress, and every time we set a deadline we failed to meet it. To be perfectly honest I at some points was wondering if we were ever going to get it to the point where we could release it.
Along the way we ran into several bottlenecks, that I thought were going to end up dooming us. The biggest of which was getting it to run at 60fps on a Samsung Galaxy S3. I had profiled the game and came to the conclusion that we were spending a lot of time on collision detection, and tried to start narrowing down the objects that the Ogre could collide with. I first limited it to just what was on the screen, but it still seemed to take too long. So I moved on a QuadTree for making it so the ogre was only checking against a handful of objects at a time. And this did buy us some performance on the S3, but it was still hovering around 20-30 fps. I got pretty frustrated as I worked damn hard on that QT implementation and it really only bought us about 4fps. At some point I realized that my profiling didn’t take into account anything related to drawing and ran an OpenGL profiler on the game, and we were doing something like several thousand draw calls per frame. In those famous words “Well there’s your problem right there!”.
I had for some reason never occurred to me that we would need to implement viewport culling on a 2D game. So I came up with some rudimentary tests to make sure that things were indeed visible before issuing a draw call, and got us down to about 14 calls per frame. BAM! that gots us locked at 60fps on an S3. It was a very happy day for me, it was really a fairly minor achievement all in all, but it was probably the most memorable for me, cause I really wasn’t sure we were going to be able to release like we wanted to, and I just couldn’t figure out why our simple 2D game couldn’t pull the same fps as a big complicated 3D game on mobile.
So now we are going to take a breather, I have some pet projects I want to work on to add to my github portfolio, but then we are going to pick back up with Rabbots, and with the lessons learned from this there is a lot of refactoring I want to do to that codebase. Should be fun!