Posts

Add Post

« Return to Posts

How We Made Shadow Fencer Theatre Run Great

When we launched Shadow Fencer Theatre, our multiplayer awkward physics sword fighting game set in the world of shadow puppets, we had some feedback regarding the game’s performance. There were occasions of slowdown and general lower frame rate issues, but more noticeably, there were some pretty long load times on certain devices. So, while we were flying high, having just released our premiere title, we knew we had to come back down and optimize a few things to bring about an improved experience for our players. We’ll break down some of the key aspects we targeted for optimization, as well as some nuggets of wisdom we wish we knew from the beginning.

Sprite Dicing

The art in Shadow Fencer Theatre is certainly unique to most games. All the characters and background assets are black cutouts with detailing done in the negative space. This meant that we really wanted higher resolution art assets to show the details around the edges of our sprites. Our art assets were not very optimized, and we were having a lot of draw calls happen with larger textures than what we really needed. So in comes sprite dicing. What sprite dicing does is it divides up your art assets into even squares (let’s say 32x32 pixels) and then compares them with each other. If there are diced sections that are the same, it throws away the duplicates, and creates a compact sprite atlas with the remaining. We were familiar with the concept as it was utilized in the game Night in the Woods in order to preserve crisp edges in the art, and we knew the art in Shadow Fencer would be a perfect candidate for the technique.

After investigating what tools were available in Unity that could help us with this, we discovered an Asset Store tool that we already owned called 2DToolkit had the capabilities to do sprite dicing. With this we were able to repackage all our sprites into smaller sizes, and reduce our draw calls in the scene. Minor issue, we had to replace every single sprite with the newer 2DToolkit sprite. I don’t know the exact count, but it was somewhere between 500-1000 sprites to change spread out through all the scenes, stages, characters and whatnots. Now, there is probably a way to automate this change, but we’re just not smart enough for that. In the end, it was a lot of rework, but did it help?...

It did! Roll credits. But really, we were expecting a big boost as far as reducing load times, with less and smaller assets being loaded. However, we only really saw a minor gain with that. Most importantly though, it really helped our frame rate performance. After the changes we made, we found some platforms were able to bump up from 30 fps during play to 60 fps during play. Faster play equals more fun.

Audio

One of the biggest improvements to our load times was when we finally figured out how to format our audio correctly, specifically the music. When we started working with profiling the game and setting up AssetBundles, we discovered that our game was basically loading in every single audio file into memory, including the music. This was a big issue that was causing long load times between scenes. We made a number of changes with how prefabs were referenced to not load in unnecessary items, and we also made sure our audio import settings were correct per clip. This is one of the areas that can be easily overlooked in Unity. Audio files need to have certain settings selected based on how often they will be used and on what platforms. The default Audio Clip Load Type is “Decompress on Load” which is good for small files used often, but is a memory hog when applied to larger files such as music and dialogue. We found that setting the Load Type to “Streaming” provided the best performance for our music clips, where only one would be playing at a time between scene changes. We also managed to reduce the quality of the compression down to 70% without losing much in sound quality for our music files, which helped decrease the memory footprint of our audio.

Textures

Much like audio files, the import settings for art assets is an important place to get some performance gains. Unity has options to change the compress and max resolution of individual textures on a platform by platform basis. This means that you can bring your art assets into the Unity project at a high resolution, and utilize the import settings to reduce the size in builds based on platform. This was mighty useful, while creating new sprite atlases during the sprite dicing process. We could then set the maximum resolution of these new textures, getting more performance gains. It definitely depends on how the texture is being used on which device, so I recommend doing some testing and playing around with these settings to see if improvements can be made without sacrificing visual quality.

Wrapup

Some of these are pretty simple, and even a little obvious, but can easily be ignored when you are just focused on making your game. Optimization can definitely be overlooked at the start of game development. In a lot of cases that’s fine, because there are easy improvements that can be made simply by tweaking options in asset imports, physics, and platform settings. Other times, much like our sprite dicing, the more proactive you are about optimization, the less time you have to spend fixing problems later.

It might have been rough to change out all our sprites to the new system, and then having to realign colliders and joints for every piece. However, as painful as it was, making these changes allowed us to bring the game to more platforms, created a better experience for current platforms, and ultimately gave us an education moving forward.

**About Shadow Fencer Theatre: **
Shadow Fencer Theatre is the competitive awkward physics sword fighting game set in the world of shadow puppets. Battle your friends on stage in a veritable variety show of game modes and skits to prove to the world you’re the best performer on the shadowy screen.
Available now on Xbox One & Steam.

**About ShuddaHaddaLottaFun: **
ShuddaHaddaLottaFun (SHLF) is a small Indie Game studio ran by folks who spent college making sketch comedy videos instead of going to class. We focus on making unique and enjoyable experiences for our audience that sometimes contain real jokes. Visit http://shuddahaddalottafun.com/ to learn all about Shadow Fencer Theatre and more.