Optimising the mayhem February 10, 2009 cliffski The last few days have been spent on optimising the space battle code. Basically I mad a dcision that the battles were not vaguely big enough, and needed to support a bunch more ships, especially now given that you can zoom in and out. That meant there would probably be some bottlenecks as I scaled up the number of ships, and it’s been a few days of identifying them and sorting them out. Everything now runs way faster than it used to. I had a lot of really inefficient texture-setting code that was setting textures for objects and trying to render them offscreen. Now I’ve bunched lots of the particle stuff into a single texture atlas and optimised away all the offscreen stuff, it works much better. What I haven’t got done yet is any LOD stuff, which is ironic seeing as though my first AAA industry job was on the ‘infinite polygon engine’ of lore. I really need to get some higher detail particle effects for close-ups, and I think I might massively ramp up the number of damage textures and similar stuff for when you zoom in. As always, the problem will be fading it all in nicely so you don’t get ‘popup’ whilst retaining the performance benefit when you are zoomed out. Plus I’ve started the very early work on the screen where you deploy your ships pre-battle.