Quick Introduction To Skeletal Animation for Video Game Development

Skeletal animation, also known as bone-based animation or character rigging, is a technique used in video games and movies to create animations of characters, creatures, and objects. In this type of animation, the graphics are represented by a hierarchy of bones that act as the main controlling elements for the motion of the object.

In this article, I will explain the basic concepts of Skeletal (Bone) Animation, describe the basic process of creating an animation, and finally go over some considerations about how to choose the best software for your project.

Frame-based Animation vs. Skeletal Animation

The traditional way of creating animation is to use sprite sheets. Sprite sheet animation is a technique in which all animations of a character or an object are stored as frames in a single image. For each frame, a different area is taken from the image. The illusion of motion comes from changing the frames on the screen fast enough, so it looks like the object is animated.

Demonstrate the creation of frame-based animation
Frame-Based Animation

In skeletal animation, the character or object is broken down into its moving parts. Each part is then assigned a bone, which can move in different directions depending on the specific action. The animator then moves and rotates these bones in a manner that creates the desired motion. The position of each point in the graphical model is then calculated based on the position and orientation of the bones controlling it. This allows for smooth and realistic animation.

Why Should You Use Skeletal Animation?

Bone animation has several benefits over traditional sprite sheet (frame-based) animation. These benefits include easy modification and control of the animation, low resource requirements for animation storage and playback, animation reusability across different characters or objects, and graphical smoothness.

1. Easy Manipulation and Control

Controlling the animation created from a sprite sheet is impossible without changing the base art. With bone-based animation, the process of creating or changing the animation is much easier. After you have constructed the skeleton of your character or object, you can dynamically change different parts of the image to match the required bone movement.

2. Efficient Storage and Playback

Since we no longer have a huge sprite sheet to represent our animation, we reduce the storage and playback requirements for various animations by several times. The bone and movement information stored by the skeletal animation software is negligible compared to the high-resolution image files you would have used with traditional animation techniques.

3. Reusable animation

The use of a skeleton structure makes it possible to reuse animation data across multiple characters. Reusing the same animation for different characters will drastically reduce the amount of work required to create new animations.

4. Smooth Animation

The animation created with a skeletal system can be modified to run faster or slower without losing the smooth transitions between the frames. In contrast, sprite sheets will have issues when changing the frame rate. Playing it slower will cause the animation to lose its smoothness. Playing it faster can make the animation lose frames and look strange in the eyes of the viewer.

Basic Skeletal Animation Process

The skeletal (bone) animation process has several steps. You start by creating the art, splitting it to individual parts and building the bone structure (also known as “rigging”). Additionally, you can add meshes and deform them, create several different animations and export them in the format your project requires.

Creating the Base Art

The creation of a bone animation starts with a set of images. Your character or object should be split into several independent parts. For example, a character may have images for the torse, legs, arms, head, and other accessories on his body. The reason it’s parts are separated is because the skeletal structure will later transform each part individually, based on each bone’s position and rotation.

Building the Armature (Rigging)

The next step is the character rigging stage. In this stage, each image comprising your character should have at least one bone attached to it. Bones can be children of other bones, so that when the parent moves, the child will move accordingly. Once the skeleton is done, you are ready to create animations based on the skeletal structure you have created.

You may also use advanced techniques such as mesh deformations to create custom image changes based on several bone movements.

Animating the Character

After your character is rigged, you can create animations using a timeline. You create key frames on the timeline with the bone state you need, and the software will automatically calculate all skeletal states in between your keyframes. This automated process allows you to create animations without specifically defining each frame.

Exporting the Animations

Last but not least, you are ready to export your animation(s). You can export them in different formats. Some formats include single images, sequences (atlas), HTML files, GIF and most importantly – game engine runtime data.

The game engine runtime data allows you to import the animation files directly into the game engine you are using, such as Unity or Cocos2D. Once the animation is loaded, you can modify it in the game engine and use the available functions in your code. These functions may include commands for animation playback, mixing, switching, conditioning and sometimes even advanced features like runtime event handling and callbacks.

What Is Weight Painting?

Weight painting in skeletal animation refers to the ability to control the relative influence of a bone on the underlying connected image (mesh). When several bones are moved, they may have an effect on the same piece of the image. Therefore, the relative weight of each bone on the image determines how much the movement of the bone affects the distortion of the image.

What Is Inverse Kinematics?

Inverse Kinematics (IK) is an algorithm for calculating the position and orientation of all bones in a single frame, based on cetrain given constaints. When you define key frames, the software uses inverse kinematics to generate the frames between your key frames, depending on your constraints. For example, a moving leg of a character can have many joints and an end bone at the toes. The inverse kinematics algorithm can calculate the change in position and orientation needed for each of the joints, based on the start and end position of the toes (also known as the end effector), and other constraints applied on the skeletal structure.

Inverse Kinematics is the inverse function of Forward Kinematics. In forward kinematics, the start position and function are given to calculate the end position and orientation of each bone. For example, we can calculate the next several frames of a character leg by defining the starting state of all bones in the leg and providing a movement function, such as gravity. The next several frames can be generated by applying gravity to each of the joints and considering the effects they have on each other.

For an in-depth article, you can read the explanation about inverse kinematics at www.mathworks.com/discovery/inverse-kinematics.

What Are Animation Runtime Libraries?

Animation runtime libraries are code packages that can be integrated into the game engine you are using. These libraries allow you to inspect the animation from the game engine editor and control the animation from within your code. For example, Spine has runtime libraries for many popular game engines such as Unity, Unreal, Godot, Cocos2D, and more. It also integrates with other development frameworks like libGDX, SDL, and SFML.

With animation runtime libraries, it is possible to perform many operations on your animation during runtime. If we take the Spine example, the provided operations include runtime animation playback control, animation and bone transform manipulation, cross-animation mix, and animation transitioning and fading. In addition, Spine runtime libraries support multi-track animation control, event handling, callbacks, and many more.

Please keep in mind that Spine is a professional animation software and has many features that other tools don’t have. Free or open-source animation tools will usually have a limited set of features and functionality compared to professional, commercial software.

How Do You Choose the Best Skeletal Animation Software for Your Project?

The best animation tool for your project will depend on your specific needs and circumstances. There are several things you might consider before choosing.

Cost

Professional animation software can be expensive, especially if you are an indie game developer and just starting out. It can cost you tens, or even hundreds of dollars to purchase the software. I recommend starting with a free tool to gain some experience. Try using DragonBones since it is very beginner friendly. If you still feel you need advanced features which the free software can’t provide, consider spending some money on something like Spine

Features

Different skeletal animation tools offer different features. These features may include the ability to create complex bone hierarchies, add and manipulate keyframes, and create procedural animations. Consider what features are essential to your project and find a tool that supports them.

Compatibility

Make sure that the software you choose is compatible with your game engine. Some skeletal animation tools have specific plugins or integrations that make them easier to use within certain environments. As I mentioned before, these plugins are called Animation Runtime Libraries. You can usually download them from the website of your animation tool.

Expertise

Skeletal animation tools can have varying levels of complexity, and some may require more technical skill than others. Consider the level of your animation skills and the time you are willing to invest in learning, before choosing the right software for you.

Documentation, Tutorials and Community

documentation, tutorials and community support are important when comparing software. These types of software can sometimes be complex, even for experienced animators. And while you may be able to create basic animations on your own, advanced features will be much harder to figure out. So, make sure the tool you choose has a good chunk of tutorials and documentation available online. Look for user communities, tutorials, and technical support options that can help you troubleshoot issues or learn how to use the tool more effectively.

Final Thoughts

skeletal animation is an essential technique for video game development. And while the process of skeletal animation may seem daunting at first, the benefits of using this technique far outweigh the initial learning curve. By mastering the fundamentals of skeletal animation, you can bring your game characters to life, and do it in an efficient and easy manner.

To learn more about skeletal animation and 2D animation in general, I encourage you to watch this video:

I hope this article gave you a basic understanding of skeletal animation. If you want to learn more about game development, go to my blog at Night Quest Games Blog. I wish you success in your journey. Good luck!

If the information in this article was helpful to you, please consider supporting this blog through a donation. Your contributions are greatly appreciated and allow me to continue maintaining and developing this blog. Thank you!

Leave a Comment

Your email address will not be published. Required fields are marked *