The last few weeks I’ve been working on a post-compo version of my tower defensish LD48 game “Def”. Apart from fixing the obvious balance and stalemate issues that pretty much everyone discovered in the ‘survival mode’ after the deadline (thanks for all the screenshots !), I’m adding a campaign mode with some story elements. It’s shaping up to be pretty awesome so far :)
Last week I went through a few rounds of optimising the rendering in Unity this week to get better performance on Android. Mostly this involved more intelligent handling of materials to reduce draw calls and combining some meshes – these rendering inefficiencies were there as a result of taking some short cuts for a 48 hour game, since they didn’t cause any performance issues on on small maps I think they were sensible shortcuts to take for a game jam. But, now I’ve cleaned up my mess :)
(My little noob-tip for the Unity folks – in most cases you should avoid setting renderer.material.color directly so you don’t end up with a pile of ‘material instances’ and associated draw calls. Also, mark anything that doesn’t move as ‘static’. This will allow the static and dynamic batching in Unity Pro to do it’s thing. Another good alternative if you have many unique colours and don’t want to generate piles of materials is to use Mesh.colors [or even better, it’s sister function Mesh.colors32] to set the colour of any mesh which uses a Vertex shader. Note – Vertex shader … not Diffuse or anything like that. It must be a Vertex shader or you’ll see no effect setting Mesh.colors).
As a result I ended up also tweaking the visuals – I prefer the version where the (purple) shooter range is transparent (no glow) and below the transparent grid squares, since it indicates the range of the shooters fairly clearly without getting in the way of the gameplay.
I’ve also temporarily removed some of the more nuanced indicators of the enemy pheromone trail. These will probably return when I figure out the most efficient way to render them (probably via a single-pixel gradient texture used as an texture atlas, or setting Mesh.colors32 with a simple Vertex Shader). But actually, it works just fine without that extra detail and I may decide it doesn’t benefit much to put it back.