Evan's Dev Blog 4/4 - March Recap
Updated: Apr 4, 2020
Hello, everyone! Though I've been at home and staying healthy, for the past month, I've been focusing on a new old project: Spell Strike! MassDiGI has recently reached a publishing agreement with Waysun Games, and as a result, a number of their games must be optimized to run on a simple TV box. The first of these games is my old friend, Spell Strike, which will be released at the end of April. For the game to be ready for release, it must properly run on the device itself, support localization, and be optimized to run as well as possible. Throughout this process, I have run into a number of difficulties from audio, to the setup of the game itself.
My first big challenge was setting up the box itself. All the documentation for the device is quite limited, and matched a different model number. For example, I am supposed to press a series of buttons on the remote to open the Android console, but this is not available on my box. Instead, after an unintended factory reset, I was to download a dev key, plug a USB with the key on it into the box, and then I could connect to the box using the Android Debug Bridge. The key itself was intended for an older model (CM 201-1), but worked with my model just as well.
With the box set up, To start with, as ads and data tracking are unsupported on the box, the ad and data analytics packages needed to be pulled from the project. Once removed, I built an APK and installed it onto the box using ADB. While the game installed properly, it was impossible to play at this point. As a mobile game, Spell Strike made no considerations for controller use, and the game could not be started. Issues with crackling audio were also apparent at this stage.
Setting up controller support for menus in Unity is a breeze. The built in EventSystem is designed for this purpose. However, if a second menu was opened, the game would lock up. This was solved by a simple script that sets the proper menu selection when a menu screen is enabled. Minor adjustments were made to the shooting script as well. The original behavior would check to see if the player's finger was over any buttons before firing a projectile, which is great for mobile, but unnecessary for console. Instead, a button on the remote would be used to pause the game. Before the first real test of the game, I re-purposed some old promo art to make a nice border and letterboxed the game content to 16:9.
Once controller support was fully integrated, it came time to play Spell Strike! The biggest challenge working with this TV box is its working around its weak specs. While Spell Strike runs well on devices running Android 4 and up, the box would have trouble with certain aspects of the game despite being based on Android 4 itself. There would be noticeable delays when a level started up due to a high number of Instantiate calls, and the boss levels featured noticeable performance dips due to the fog effects. The long delays would not be present in scenes that did not Instantiate prefabs. While this makes the game more unfriendly to edit (until I rework my level tool :), all Instantiate calls save for the required manager instantiation needed to be removed from the game. The fog effects unfortunately had to go. Once the rest of the game is stable, I may try and re-integrate the effect. At this point, the game is perfectly stable when it runs, but will experience frame dips after long sessions of play. Capping the game to 30FPS solves this issue, but if frame dips occur at all, it means there is still more that can be optimized.
Finally, one of the most important considerations when working to lessen CPU load is audio. Spell Strike originally used Wwise for audio implementation, and while no problems occurred on the target platform in most cases, the music could occasionally become static, and including Wwise dramatically increases filesize and build times. To solve these issues, I made the decision to replace Wwise with Unity's basic audio source implementation. While this does remove some of the cool audio blending, it also solves the occasional audio distortion.
Outside of continuing to improve the game's performance, all that needs to be done is localization work. With a little under a month remaining before the build is due, I remain confident that I can get Spell Strike functioning properly on the TV box.
Last update, I said I would talk more Odin, but optimization has been my focus for almost a month now, so it's more fresh on my mind. Until next time!