Building The Animation System of My Game Engine

For the second milestone of the Game Engine Programming II class that I took in the spring quarter 2013 at DePaul University, I added animation capability to both my game engine and my FBX converter. It was one of the most difficult tasks that I did for this class. It took a lot of iterations to write a good easy-to-use animation system. My intention was to make the system completely data-driven, having the FBX converter extracting all the needed animation data from the FBX file (an FBX file can contain multiple models, with each model having multiple animations in a so-called animation stacks) and placing these data as a table-indexed binary chunks into a .dpu file for the model data, and into a .bdpu file for the skeleton data. The extracted skeleton data are:

  • The skeleton bones hierarchy.
  • The skeleton’s animation stacks.
  • The keyframes associated with each bone in each animation stack.

I then made the game engine capable of loading these data, and using them to draw the bones and animate them.

The Math Engine Library that I wrote for the first part of this class had to be changed to support quaternion math operations and to fully integrate them with the existing vector and matrix operations. Linear & Spherical Linear Interpolation (LERP and SLERP) operations have been added as well. These operations are crucial to any animation engine.

The Animation Engine Features

  • Completely data-driven (loads all needed data from a flexible expandable binary file).
  • Ability to draw bones based on the data read from the binary file. Bones colors can be changed by the user of the system.
  • If the FBX model has multiple animations in multiple animation stacks, they will all be available for that model’s bones and any of them can be selected to be the current active animation in the engine.
  • Ability to play back the animations forward, backward, faster, and slower.

Next thing I will be working on is “Skinning”. The above features are demoed in the below video.

Building an FBX File to My Game Engine Binary File Converter

During the second class of Game Engine Programming, which I’m currently taking this quarter, we are learning how to write offline tools to help us feed data (models and animations) into our own game engines. The choice was to create a command-line tool that converts an FBX file to the binary format expected by my own game engine ( I call it the .dpu file ). It’s a command line tool so that it can be easily used in a script to handle multiple conversion. We also chose to work with FBX files since they are widely supported by most 3D graphics creation suites. Its SDK is very well documented, and the documentations contain a lot of examples.

For the first milestone of this class, each student was required to individually write his own converter, and modify his own game engine as needed. I modified my game engine so that it’s more dynamic when loading the .dpu files. It deals now with indexed binary chunks rather than a fixed set of data in the file. It can also deal with models that are built from multiple meshes placed in a certain hierarchy. The game engine can now load these hierarchies dynamically into the scene graph and transform them correctly according to the extracted matrices from the FBX file.

Each student was required to record a demo video of his converter and Model Viewer (modified game engine), and write a design document demonstrating his own game engine binary format and why he made his own design decisions.

Here is the video: