Unity Logo

Fitting the Universe in your palm

The outer space is massive, and the emptiness of deep space is always contrasted by the massive wonders it contains.

When designing a game set in outer space, we’re often confronted with the problem of integrating super-massive objects within the limited resources allocated to us from the hardware running the game. Even an asteroid mining base can be complicated to integrate without suffering frame rate drops.


Mining Base


An object as big as this can be seen from huge distances which forces us to have it loaded inside the level from the very beginning. This however adds stress to our graphics card, as it has to render a very complex object always, even when we’re not even remotely close to it.

To combat this issue, it is standard procedure to load a lower polygon version of the model that can be seen from afar, and then load the higher polygon model to replace it once the player moves closer to interact with the structure.

This however leads to another issue. Loading a complex model such as this while the player is fighting can drastically reduce the frame rate during loading time. In order to address the issue, we created a sophisticated asset streaming system which gave us the option to load an object over a long period of time, in order to spread the load over multiple seconds. This allows us to set how long we want the loading time to take; the slower the load, the smoother the operation becomes. By loading the higher polygon version over a time of 10 seconds for example, long before the player reaches it, we make sure the change is not noticeable at all.


Procedural Loading


However, our problems are not done just yet. The example mining base is an interior space; the player flies inside its corridors, from entrance to exit. This means that the interior spaces need complex collision systems, since dodging obstacles now becomes part of the game-play. And as with all physics related issues, colliders are heavy on the CPU.

First optimization in order is to replace the game engine’s mesh colliders which are extremely heavy, with simpler clusters of primitive sub-colliders (cubes, planes and spheres). This can take an extremely long time to set up, since all the work is manual, but in regards to performance, the payout is worth it.

Even with primitive colliders however, loading hundreds of colliders even when the player is far away from them still impacts performance; the physics system still checks them all, regardless of distance. And this results in constant frame rate drops. To combat this issue, we created a collision optimization system, in which colliders far from the player are turned off, while colliders close to the player turn on.

This drastically increases performance, as physics are only calculated around the player now, where it is most relevant.



Colliders are shown in green outlines


Having the above technologies already developed, we can introduce to the game a seemingly infinite amount of super-massive structures; as infinite as the universe ought to be, but still fitting inside our palms.