Roche Fusion Technical Recollection 2

Today we will continue our exploration of Roche Fusion’s development process that we started last week.

We will do so from a technical point of view, exploring some of the various systems I developed for the game. With my role as team-lead and graphics programmer, this mostly means that we will mostly be looking at graphical effects.

Real-time performance debugging (May 2014)

As the game became more complex after more than half a year of development we realised that we needed to start measuring the performance of the game’s different systems to analyse bottlenecks and make sure the game would run well under all circumstances and on different platform.

I implemented a system that allowed us to take very detailed measurements of all our different systems for each frame and display them in real-time. If you are interested, check out my post on the matter.

See below for a later screenshot showing much more details in the graph.

Animation based collisions (August 2014)

With our flexible key-frame animation system in place and all of Roche Fusion’s enemies split up into multiple sprites (see last week’s post), another game-play relevant system I developed was a more detailed collision system which allowed for the animation files to define much more precise collision areas by assigning each bone in the animation a collision radius.

While not all enemies make use of this, many do, and it comes in especially handy for bosses – some of which are rather large and less than perfect spheres.

The system allows for collisions – with both players and projectiles to be very accurate, even if the enemy was heavily animated.

Note that we decided to stick to circles as collision areas, since this simplifies physics and ray-casting calculations greatly.

Automated sprite sheet baking (August 2014)

Being busy adding more and more content to the game, we were in need of more and more automation of the boring and repetitive tasks. One of these was organizing sprites into sprite-sheets (or texture atlases).

Our tool uses a bin packing algorithm to allow us to save as many pixels – and therefore as much memory – as possible and would output both the compacted image file as well as the a JSON file defining the various sprites and their UV coordinates and sizes for rendering.

GPU accelerated particles (October 2014)

With the game becoming more and more complex, and us realising that a lot of the game’s fun was centered around slaughtering large numbers of small enemies in a short timespan, we started to be more and more concerned about the performance of our particle systems.

With each enemy exploding into dozens, if not hundreds of particles, it was not uncommon to have tens of thousands of particles visible at the same time.

To make sure to prevent frame drops and allow for good performance on slower machines we had to either cut down on particles dramatically – at least during more intense moments (note that this describes most of Roche Fusion’s late-game) – or find a way to increase performance by about an order of magnitude.

Given that our esthetic vision did not really allow for the former, the choice was obvious.

Looking back at it, there were a lot of things we could have done to get significant improvements using a variety of macro and micro optimisations to our existing particle systems.

However, we decided to change the things up completely and instead rewrite our particle system – and this time have them run virtually entirely on the GPU.

Suffice it to say, the results spoke for themselves.

Apart from the time needed to create and upload particles to the GPU when they are created, the new system left all of the CPU idle to simulate the game’s physics and AI instead.

Roche Fusion has a lot of particles

At the same time we were able to increase the number of particles even further without any measurable effect on overall performance. With its heavy post processing Roche Fusion’s graphics are entirely fillrate bound. The little amount of calculations in vertex and geometry shaders is insignificant in comparison.

For the technical details on how exactly we simulate particles on the GPU, feel free to check out my post on the matter, including an example project.

There also is a more Roche Fusion centered write-up including the specific shader code and some more images.

Fancy shields (November 2014)

After over a year of development, hardly any parts of the game where still the same as they had been in the beginning. One of them was how we rendered shields: As static circular sprites – and not even particularly interesting ones.

When it was time to fit this detail into the much more mature visual style Roche Fusion had changed into I decided to go all out and create shields that were both 3D, and would light up in the direction they were being hit from, instead of all-over like the original sprite version.

The solution – a dome shaped grid that propagates alpha value – is fairly straight forward, but the result was so flexible and convincing, that it has not changed since then and was even reused for a much much larger version in a boss-fight, more than half a year later.

Feel free to take a look at my write-up with a few more details as well as a before-after comparison.

Volumetric sprite projection (November 2014)

Created during a moment of inspiration, a much less important detail, but certainly one of Roche Fusion’s most technically (or mathematically) sophisticated effect are volumetric sprite projections.

The effect allows us to render any sprite as if it was projected from a given point through a scattering medium. It does so by taking multiple samples per pixel on a ray through the projected volume and blending the result.

The effect is used sparingly in game, but makes for some great highlights and enhances Roche Fusion’s visual style where it is.

Localised crepuscular rays (November 2014)

Yet another small effect we developed during this period are localised crepuscular rays. In essence we took the most common screen-space implementation of the effect commonly known as ‘god-rays’, and applied them on a small scale – and to every explosion in the game.

This makes it look as if light of the explosion was shining out from between the particles that were part of a ship’s hull.

Comparison of explosions with and without localised crepuscular rays in Roche Fusion

The effect does a lot to make Roche Fusion’s explosions look more powerful and energetic and is also used in a few other effects we added later.

For more information, see my write-up here.


I hope this continuation of my technical Roche Fusion write-up has been interesting to you.

Next week we will continue and talk about the things we got done in the final stages of Roche Fusion’s development.

Until then,

Enjoy the pixels!

Leave a Reply