Let me take you back to the start of this project, where the enemies were just brains.
We have come a long way since then. Enemies have grown more detailed and scary-looking since then. Our graphics artist has done his best to make sure dangerous enemies actually look dangerous. Let's take a look at one of the epic bosses that will soon be part of Roche Fusion:
If we would just draw this picture in-game, the enemy would come across very static, and we would not have to freedom of moving some parts around. That is why enemies - but also player ships and many other game elements - in Roche Fusion are implemented using an animation system. In this dev log, I am going to give you a detailed overview how the above pictured boss comes to be.
First of all, our artist creates a full design of the enemy. After we are happy with how the boss looks, our artist takes apart the enemy in all its elements, which we then put in a single image. Using a bin packing algorithm we are able to optimise the size of these image files. The image file for the boss we are going to animate could look like this:
The next step in the process is to tell the software where the parts can be found. Using a configuration file (written in json) we define the rectangle in which a part can be found, and we name it as well, so we can access it easy in the actual animation.
With this configuration file in place, we can start building the skeleton. To do that, we make use of an in-house developed animation editor. The editor looks like this when we load a set of sprites and skeleton together:
The name "animation editor" is a little bit deceitful, because at this point the editor only allows us to view the animations without putting them in the game. The actual animations are written using a json document, just like the sprites. Because the editor gives us direct feedback, this can be done really efficiently.
The first thing we do is build a skeleton. Skeletons in Roche Fusion are not exactly the same as skeletons in real life, as we simplified them a lot. Our skeletons consist of bones only. These bones have an offset, rotation and scale relative to their parent. All these bones together form a skeleton.
Of course, these skeletons need sprites attached to make them actually look like enemies. In practice, we add these sprites immediately, to make sure the skeleton lines up with the sprites properly. Below you can see the same skeleton as above, but with the sprites attached.
If we have the skeleton and the sprites, we can put the enemy in the game. We have come all the way, and we have exactly the same result as a static image, so what exactly can we do now that we couldn't do before? Well, do you remember how the skeleton is defined by bones which in turn have a set of parameters? We can change those parameters to create different poses. If we then put those poses together and transition between them, we can create animations. The following animation is made from three different poses:
This is another example, also made with three different poses:
We can even do silly stuff like this:
All in all, using the animation system we can make the enemies a lot more interesting. Currently, the animation system is almost exclusively used by the bosses and player ships, but they are used to communicate important gameplay mechanics. Hopefully we will also be able to implement idle animations, but as you can imagine that would be quite a huge task.
I hope that using this dev log, I have been able to give you more insight in how the animation system works, and why we chose to use it. If you are interested how the sprite and animation configuration files look, you can always look into the Roche Fusion files. In the data/mods folder, you will find a file that contains all the sprite and animation configuration files of the game. Just unzip the default.rf-mod file, and take a look in the gfx folder inside. If you have any questions, feel free to drop them here and we'll do our best to answer them.