Toontown: Event Horizon

Backstage: Cog Suit Development

Posted on January 3, 2024 by Measured Moth
Backstage: Cog Suit Development

Hello, Event Horizon fans, and welcome to the first post of our Backstage series! It’s been a while since we have talked, but you can rest assured that our staff is still hard at work. While our team develops the next set of features, we would like to expand on something we’ve previously shown off!

These Backstage posts are opportunities for members of the team to come out and talk about their process in designing new content for the game. In future posts, this could include the process of making brand art, models, textures, composed music, sounds, or even the game’s code! Today, we have Measured Moth, who helped us with designing the rigs we use for cogs in-game. Take it away!

Note: any content showcased in these posts is a work-in-progress and not necessarily representative of the final product.

Introduction

Howdy! I’m Measured Moth, one of the developers for Toontown: Event Horizon. I have quite a few roles within the team, but one of the most interesting ones is rigging! In fact, it’s that work that was needed to make animations like Pitchman’s curve ball attack seen in Horizon Talks 4!

Pitchman using his "curve ball" attack, winding up before hitting a toon with a baseball.
Pitchman using his "curve ball" attack, winding up before hitting a toon with a baseball.

When developing a 3D game like Toontown, it’s pretty important to have accessible rigs in order to make it easy for animators to add new animations. If a model has a bad rig, it’s mighty annoying to get any new cool animatons in! But if you know anything about Toontown development, you might know of the questionable state of rigs gained from publicly accessible resources.

Suit-C body type rig shown in Blender.
Suit-C body type rig shown in Blender.

If you’ve done any kind of rigging or animation in Blender… you can see how bad it is.

If you aren’t aware, this rig is a complete mess. But we can’t just remove or change it drastically, else we’ll lose access to a lot of the old animations!

This means there is a LOT of work to be done before we are able to properly add new animations in-game while keeping compatibility. Luckily, there is a way.


Background Knowledge

(There’s a wide variety of rigging, but I will only cover what’s needed here for the task at hand.)

If you are new to the rigging scene, Welcome! Here is a general summary of how things work:

Animations are played on objects called rigs, of which are made of a bunch of bones not unlike a skeleton.

Default rigify skeleton-rig comprised of multiple bones that form the shape of a human.
Default rigify skeleton-rig comprised of multiple bones that form the shape of a human.

Each of these bones is used to deform a mesh. Skinning is a process where we use weight painting to determine how much influence a particular bone affects parts of a model’s geometry.

Single bone's weight paint influence on a cylinder mesh.
Single bone's weight paint influence on a cylinder mesh.

When a bone is moved from its starting position, it deforms the mesh based on the weight the bone has on that particular bit of mesh. Whether you have a simple or a complex model to rig, these are the basic elements you need to know to make moving parts!

Most modern rigs we sometimes call meta-rigs which are rigs that contain helper objects to make the animation process easier. These usually carry a lot of exclusive bones and widgets that modify the main rig’s deforming bones, acting as a sort of middleman in-between so you don’t have to touch them yourself.

Meta-rig generated from previous rigify skeleton.
Meta-rig generated from previous rigify skeleton.

Creating The V1 Rigs

Well to start, we have to get the already existing game rigs into Blender to tinker. We want this rig so that we can preserve the animations for future use. We don’t exactly want to throw away at least 100 perfectly good animations, after all!

Below is a step-by-step guide on how to create our first iterations of Cog rigs. This does require at least a curiosity understanding of Blender, but it should be easy enough if you have any experience with rigs.

  1. First things first, we get our suit model into view. We should have our old rig in an empty scene. If you need to get sample resources, the best place to obtain them is from Open Toontown’s resource repo here and using Panda3D’s built-in bam2egg program to convert it to an egg file as stated above. Then, use an egg importer to get the models into Blender along with all the animations associated with the file. We are using a forked version from my good pal Wizzerinus as it works with future versions. You can dowload that here.
Imported rig of the Suit A body.
Imported rig of the Suit A body.
  1. Then, we get our meta-rig. For this, we utilized Blender’s free meta-rig creating tool Rigify. We remove the extra bits we don’t need (extra finger control bones, face control bones, extra spine controls) so that the rig is identical to the old one in structure. We add a couple of extra bones set to be Super Copy types with rigify’s system so we can attach shadows and nametags.
Rigify skeleton, overlapped on top of the old rig's skeleton.
Rigify skeleton, overlapped on top of the old rig's skeleton.
  1. Now that we have both our metarig and old rig, time to make some dummies! We will be using Blender’s empties (objects that simply store transform data) to use as a medium between our awesome new rig and the old one. For each bone on the old rig, we create an empty that needs to have the exact same transforms as the bone we are adding it for—in this case, using a Copy Transform modifier, then applying it will do. Repeat for every old rig bone we have!
Various empties placed at the points of the old rig's bones.
Various empties placed at the points of the old rig's bones.
  1. Then after that is done, we then go through every bone in the old rig within Pose Mode and add a Copy Transform modifier to its accompanying dummy bone. The bones shouldn’t look any different after if done right as the dummies should have the same transform values as their bones.

  2. With all our bones set to copy the dummy’s transforms, we then go to each of the empty dummies and give them a Child Of modifier that makes them act as if they are the child of our selected object. If you haven’t already, make sure you went ahead and generated the rig. We make its fake parent in this case to a bone on the meta-rig that is close to the bone on the old rig.

  3. Once we are finished with that, the rig should be fully set up! Any bone moved by the meta-rig should now move the old rig as we expect. To make animations, we just have to create it using the meta-rig, and then when exporting, make sure to export with only the old rig selected. Boom! We now are able to export any new animation as we please! I highly recommend YABEE, especially our special forked version that works for newer versions of Blender here.


Amazing… But.

We can now add animations! The thing we needed to really add that extra bit of flair to new attacks, or just spruce up any old ones.

But that doesn’t mean it was perfect. We still had to deal with the strange system the Toontown Online developers had set up their rig, which seems to be using an old meta-rig set up that is extremely outdated! In addition, it’s hard to do major edits without having to redo large chunks of the already existing rig. Imagine having to do all the steps from 3-6 all over again… Yikes!

It definitely wasn’t the best, but we were alright with it if that’s all we could really do… until someone came up to me with a question.


Creating the V2 Rigs

When our Creative Director, Buck, asked me if it was possible to bake animations from the old rig to the meta-rig, so we would be able to use old animations as a reference on the new rig, that got me thinking. Yes, that wouldn’t be too hard, and if were able to do that…

Why not just ditch the old rig and go with using ours?

Well… here is how we did that.

  1. So we have our current V1 set up. Now we simply take the principles of what we did before… and do the inverse. This time, our old rig is going to control the new rig. First, we take all of our meshes and parent them to the new rig, setting up weight paints accordingly.

  2. Then we take our existing dummy bones, and use Copy Transform modifiers to place them in the exact spots of our meta-rig bones. You can see where this is heading…

  3. After, we then use the already existing Child Of modifiers to then make it so the dummies are children of their respective old rig bones. Now when the old rig moves, the meta-rig moves!

*Note: Past this point I Highly recommend you save a copy of your set up in this current state. The next stuff will do irreversible things to your rig that you might not be able to ctrl-z your way out of. Fair warning!

  1. Next we go through and bake all of the animations onto the new rig. This can be a pretty tedious process, so we created an in-house baking script that goes through and bakes everything automatically. Something sadly I can’t show quite yet due to its cobbled together state, I would probably shed a couple tears if I did, but if you know even a decent bit of python it shouldn’t be too hard to set up. I recommend doing visual keying and bake selected, otherwise you will end up with a VERY large Blender file as all the fancy bones rigify uses will also get baked which you don’t want (Don’t end up with a 5GB Blender file like me).

  2. After we are done baking the new animations made for the meta-rig, we can delete any old animations if they weren’t overridden already, the old rig, and all the dummy bones as we just removed the need for them!

  3. (RECOMMENDED) Now there is one step that I highly, highly, highly recommend to do after baking the meta-rig animations. The meta-rig in its current state has a lot of unnecessary bones and isn’t considered “game ready” due to the extra bloat those extra bones will bring. To make the rig game ready you can do it manually, but I recommend an addon that creates a game ready rig for you from your meta-rig such as this one. You will have to rebake your animations onto the game-rig (I recommend you at this point save another version!) and then you can export!

New Suit C cog walking.
New Suit C cog walking.

Post Export

Now that we have our fancy new rig setups, there are a couple of important things you need to do in order to export your cool, sick, radical new animations. These are pretty useful to know expecially if you plan to make major adjustments to your Cog model.

  • Exporting with some of the Blender plugins, such as YABEE, also requires removing the names of the UV maps from the model. Otherwise, texture overrides will not work properly. This can be done directly through Blender, but we also have some neat tools to automatically fix issues like that before running egg2bam.
  • egg-optchar is a command in Panda3D that optimizes actors (egg/bam files that have rigs!) and allows for some post-export adjustments. Highly recommend using the -keepall command as it keeps joints from being removed. Loading the model in Panda3D auto-removes joints by default if Panda3D thinks joints aren’t being used. Example: egg-optchar cog.egg -keepall -inplace (Optimizes cog.egg, keeping all joints and overriding the file with the new one)
  • using the -flag parameter, you can mark meshes to be “visible” for options like texture swapping body parts (Toons use a lot of these). Example: egg-optchar -inplace cog.egg -flag arms (Optimizes cog.egg while making sure the mesh named “arms” remains accessible in game.)
  • using the -expose parameter, you can mark joints to be “exposed” in-game. This allows you to attach nodes onto those joints, where they will then be parented to the joint’s current transforms. Useful for things like characters holding objects! Example: egg-optchar -inplace cog.egg -expose hold.L (Optimizes cog.egg while preemptively exposing the “hold.L” joint for use in-game)

Egg-optchar is a versatile tool that can do a lot of other neat stuff, but for general use, the above parameters are what most people need to know. I highly recommend using it after exporting any actor, especially since Cogs and Toons both require some joints and meshes to be flagged and exposed to work in-game.


Conclusion…?

Wow! That was a lot of instructions. Getting to these rigs was probably one of the more complicated parts of our technical art work, but it was very much worth the effort.

Being able to build fully custom Cog bodies and animations was an important first step towards making a truly unique Toontown experience. There are plenty of new animations we have in mind to give our robotic foes some more character, which you might see in the near future.

I hope the development insights have been mighty useful! I wanted to be as thorough as possible so that if you ever wanted to do your own custom animations for Toontown, you’d have the chance. Toontown is a game built on its community, and we believe that the more resources the community has, the better off the community is! This isn’t the last time we will be doing our part to provide resources to the community.

You might see some further updates from yours truly in the future as well… after all, we didn’t leave the Toons hanging.

Until next time!
Until next time!