← All stories
2013

Measure first: making Steam Defense run on an iPhone

When Steam Defense started to lag, the obvious suspect was the AI — dozens of units, each making decisions. Before touching any code I built a benchmark. The frame rate dropped hardest on iPhones, and the bottleneck wasn’t the AI at all: it was how many pixels the GPU had to draw, again and again, through semi-transparent objects.

Shaders. I went through them and found that for ordinary objects a simple Unlit shader was enough, and for see-through things a Cutout shader — a pixel is either fully transparent or fully opaque — instead of Unity’s standard diffuse shader with real transparency. I asked the game designer to limit even Cutout strictly: it’s still extra work for every pixel.

Build size. In parallel I looked at the list of the heaviest images in the build. At the top was a grenade: an inventory icon shown at 30–50 pixels, stored in Full HD. I recompressed everything and explained to the team how to prepare graphics. Then we added on-demand downloading: the build contained only what the first two levels needed, and the rest arrived in packs.

The lesson: profile before you optimize. The part of the system you’re worried about is rarely the part that’s slow — and the biggest wins are often boring: the right shader and the right image size.