← Back to projects

Traffic Jams

A traffic coordinator game made for PlayStation VR where I focused on performance optimization for my thesis.

C# Unity PlayStation DevKit Optimization Debugging
Traffic Jams

Optimizing a VR game from 45 fps to 90 fps

When starting on this project, the main gameplay loop was already in place but was quite performance heavy. It was running at 45 fps while the target fps for VR games is above 90 fps. Combine this with the fact that it was running on a PlayStation console instead of a beefy VR ready computer made it quite a challenge to optimize to 90 fps, especially in 2019 when VR was relatively new.

As this project became my thesis, I did a deep dive into the performance of the project to learn as much as possible about optimization and to get the project to run on a smooth 90 fps.

I worked on this project at Little Chicken where I was an intern for about half a year. I did this optimization project alone with some supervision of the seniors there. The entire thesis is available in dutch containing all the specific optimizations done, if interested, please contact me.

What I optimized

A look at some of the systems and features I worked on while working on this project.

Profiler
01

Profiling

Extensive use of the Unity profiler and frame debugger was needed to remotely check what features were consuming the most CPU and GPU time.

Based on the results from this exploration, many features were individually optimized. A few of these are mentioned below.

Vertices
02

Vertices Reduction

The game had an over-abundance of vertices and triangles on many meshes. Most of these were solved by simply reducing the amount by making a lower quality model, making sure it still looks good from the distance that it's viewed from. Together with some LODs this drastically improved performance.

Next to this, I also did a thorough research into submeshes in Unity and found out by testing that submeshes will render extra unused vertices when there is an overlap in vertex usage.

Custom Outline
03

Custom Outline

I found out that the game was using an outliner from the Asset Store and that it was extremely inefficient. It was adding, initializing and removing components on runtime, used the depth texture and was overall not programmed to be performant.

As a solution, I wrote a custom outliner that looked near identical but used replacement shaders to only draw the outlined items to a low-res rendertexture that was then blurred and overlayed on the camera.

This solution was not only way more performant, but also completely eliminated the need for a depth texture which improved performance even more.

Car Crash
04

Object Pooling

The game was built around a lot of chaos, meaning cars crashing into another and parts flying around. This was done by just instantiating all the components when a crash happens. Doing this created stutters and frame drops when a crash happens, while those are the exact moments a smooth experience would be more fun.

I used a very common solution of object pooling all the components and particles needed to prevent instantiation during gameplay. I also used an object pool to optimize some other parts of the game like the cars and pedestrians spawning.

Problems I had to solve

PlayStation DevKit

Working with a PlayStation DevKit meant setting up remote debugging channels, build flows that easily put new versions on the PlayStation and setting up automated tests/flows to make sure I capture the right data while a VR headset is on my head.

Limited Hardware

PlayStations at the time weren't that powerful and VR was demanding a lot of performance by rendering for both eyes. This meant I had to squeeze every last drop of performance I could get.

Writing a thesis

It may not be obvious, but since I had to write a thesis about this, I had to take specific deep dives into researches and get to the bottom of every part instead of just trying to get as many optimizations done as possible. This meant some potential optimizations were still on the table but for the lack of time while writing a thesis, those may not have been implemented.

Interested in the game?

You can find the live game to try for yourself here.

To Traffic Jams