Porting Coffin Rot Brewing Co.

Optimization

Lighting

Lighting optimizations easily brought 80% of the performance gains the game required to run on standalone VR headsets. Having been created for desktop, Coffin Rot was designed with realtime deferred lighting in mind. The Android based devices simply count not handle such an approach.

In my conversations with the developer, Jordan McGraw, he described his lighting technique as “painting with lights.” Deferred lighting affording him this ability, but for mobile VR the lights were going to have to be baked. This required a complete lighting rework as the baked color and intensities did not match the original vision as expressed by the realtime lights. For rapid iteration on light bakes I used my favorite lightmapper, Bakery from the Unity Asset Store. It is a high-quality, GPU-accelerated baker with AI denoising.

There was one complication with using lightmaps. As the player progresses through the game, they have the option to expand their bar and add some tools to their environment. This meant additional lightmaps and lightmap swapping. There were 16 possible combinations of bar expansions and two lighting conditions for a total of 32 different maps to bake. Lightmap swapping is not a feature of Unity, and for good reason. The indexing of static objects can be very touchy when switching things around like this. Nevertheless, I used Magic Lightmap Switcher from the Unity Asset Store to accomplish the technique.

Because there were no longer any realtime lights in the scene, light probes need to be set up so that dynamic objects did not look out of place. To expedite this process I used Magic Light Probes from the Unity Asset Store. This tool allowed me to set up zones for automatically populating light probes based on the lighting simulation preprocess.

Draw Calls

Very few of the assets were authored using an atlas or trim sheet so combining materials for batching manually was not an option. I ended up using mesh combine tools to bake out chunks of the environment to single meshes with one material each.

The environment was detailed enough that frustum culling provided more benefit than having the entire environment baked down to a single mesh and material. Because the player was always centered behind the bar, my chunking technique could be informed by the fixed vantage. Additionally, bar expansions had to be combined separately so that they could be swapped out.

Triangle Count

Triangle counts required the least amount of attention. The scene was already pretty lightweight in this regard. The skeletons required a decimation pass, but other than that there was not much to be done.

Controls

My job was to port the game to two lines of headsets: Oculus Quest 2 and IQiyi lineup. Making sure the input and tracking worked on both required coding of additional input layers. Luckily, the game’s input code was already generalized and all I had to do was implement the platform-specific layers. At this time Unity had also developed the unified XR Rig. I had to switch from the old Steam VR to this, but once that was done, it was set for cross-platform support.

Additional features like snap-turn were added for greater accessibility.

Localization

For release on the IQiyi lineup, the game had to be localized for China. This mainly involved translation to simplified Chinese.