Tales from the Profiler 2 - Graphics

By: sleipnir

There are lots of things we can add to make a game look prettier. The more, the better. Streamlining all of them so they don’t slow down the fluidity game is an art itself. Here’s how the dev and art team worked out solutions for the effects we wanted to put in Agent Aliens.

Unity has a tool called the Frame Debugger (Window > Frame Debugger) that allows us to pinpoint rendering problems easier. We can see how many times the GPU is called per frame of the game; more calls means slower rendering.

Viewing the Draw Calls

A basic form of optimization is batching or sprite atlasing. That means grouping multiple related sprites together so they can be drawn by batch in a single call to the GPU. As our levels are constructed procedurally using a tileset, these are atlased to be more efficient. All projectiles in the game are also atlased for the same reason.

Texture atlas used for the first sector

In Unity, even frame by frame Animations can be sourced from an atlas. Particle Systems can also be animated with a single texture. With the performance of our particle systems taken care of, we could compound them to create complex looking effects.

Boom!

The quickest we could implement our characters in Unity was just using PNG sequences. Moving forward, we saw a lot of downsides to this approach: large file sizes, high ram usage, low framerates, and costly rendering.

Fortunately, we found an existing open source extension that allowed us to transition into a better animation engine. This was Dragonbones and we used it with Flash to generate skeletal animations for all our characters. Their GitHub repository is located here.

It wasn't all smooth sailing. On the animators' side, they had to learn stricter guidelines that the exporter could read. The dev's side dealt with the importer and the runtime performance of the new engine. The code was a bit unmaintained and not up to production speeds yet so a lot of issues had to be fixed.

Combining these techniques, we made the game look more alive and detailed.
Stay tuned for more updates on Agent Aliens!


Nothing beats shiny stuff and explosions, except more explosions!




DISCUSSIONS