As stated before, I was aiming to have BattleGrid playable on my iPad by PAX so I could get feedback from strangers. While the game is certainly playable on my iPad, it still suffers from framerate problems when things get hectic, so I’m probably not going to be showing it to strangers – it’s simply not ready for that.
I think I’ve figured out how to fix the framerate problem, I just don’t know exactly how to do it, and the only tools I’ve found to help either don’t work well or are a bit complex.
The problem is that iOS simply can’t handle drawing a lot at once. Unity uses “dynamic batching”, which means that each time it needs to redraw, it batches everything together that’s using the same material (textures + shader) and sends it as a single draw call. My game uses about 100 – 140 draw calls in busy scenes. Everything I’ve read says I should keep it below 30 draw calls for good performance. So I’m using over 3 times as many draw calls as I should.
I think I know what needs to be done to fix it – I need to use a texture atlas. This means taking all the individual textures and cramming them into a single big texture. This is the easy part.
The hard part is that the UV mapping on all the models also needs to change. The UV mapping defines what part of the texture is displayed on each face of the model. When all the textures are combined, I need to scale and offset the UV coordinates for each model, and I can’t find a tool to make this easy. In the end, I’ll likely just write a tool to do it myself, since working with meshes in code isn’t too difficult. Writing a tool to do the work for me will take some time, though, so there’s no time to do that before PAX.
I’ll install BattleGrid on my iPad 3 and see if it runs better, but I’m not getting my hopes up.