One problem I can't solve though is I can't make every character myself from scratch. Fortunately, there are plenty of tools and character generators out there to help with this. My goal is to find a character generator that is fast and relatively cheap that generates characters that are already rigged / skinned.
Fuse from Mixamo and available on Steam.
Unfortunately, looking nice comes with a price as I find many of them are rather high poly or at least not optimized for mobile. Also, auto-rigging requires Mixamo. Fortunately, Mixamo does allow users to auto-rig two characters, Fuse or otherwise, for free during a period. Without an account though, which is about $50 a month -- a little hefty in my opinion, especially when prototyping -- you can't get any facial rigging.
MakeHuman is another option I looked into and was extremely excited about for awhile. It's free and the characters are highly customizable. One issue though is that the characters aren't the prettiest. Also, and every character generator I've used is guilty of this, the teeth are extremely high poly and not optimized. The characters do come auto-rigged, which is very nice; sadly, the skinning on said rigs isn't really the best, especially when it comes to certain areas such as the neck. Also, the rig I was using had additional bones that conflicted with Unity's Mecanim system, which I will go into later.
Autodesk Character Generator
Finally, Autodesk, the company behind 3D Studio Max, the 3D suite I use for my models currently. Autodesk Character Generator's level of customization is interesting. You don't use a slider to adjust features such as making the nose bigger or the ears smaller. You select from a set of body types and then interpolate between two of them. It's not as customizable as I'd like with things like Fuse or MakeHuman, but you definitely get a wide variety of characters.
Where it has advantages is how it can be exported. You can select from different mesh resolutions and different mesh sizes as well as facial rigging -- both morph targets and bones. Now, similar to Mixamo, this isn't for free, but it is much cheaper. Well it's technically free. If you want want the low resolution and don't mind having no facial rigging, it's free. If you want the additional features, however, it's $50 dollars a year, plus each character that uses extra features is $5 (or 5 cloud credits, which you can only buy in sets of 100, but you get 50 once you pay the initial $50 for the subscription).
Anyway, so far, ACG is my preferred choice. Maybe once I feel more confident in the project, I'll go with Fuse or a different character editor. The nice thing is that because rigs are already autorigged, I can use 3DS's Skin Wrap tool to transfer skin weights, and because of Mecanim and humanoid rigs in Unity, I should be able to retarget animations that I make.
Mecanim and Humanoid RigsSo with a recent version of Unity, 4.3 I believe, a major change to the animation system, a system that initially I was rather fond of, was introduced. I was initially bummed out, the seemingly overcomplicated web of states seemed like a huge hassle to learn.
As I started to experiment with and learn it though, I started to realize it's pretty cool. It's nice to be able to setup states and see how they will translate and connect. It's not a perfect system, and I still have some reservations, but one aspect of it that I feel like will be necessary to even get close to finishing the 3D fighter I have envisioned is humanoid rigs. Humanoid rigs are not as simple as "import your model and it works!" Well they are to a degree, but there is some finessing and careful considerations that have to be made when making one of these rigs. A developer at Unity wrote a very useful post about Unity's Mecanim tools here -- http://blogs.unity3d.com/2014/05/26/mecanim-humanoids/ . I'm basing a lot of my information based off of this and will refer to it.
Ideal RigThe ideal humanoid rig has two spine bones, one for the spine and one for the chest. This is a problem is that many character generators export rigs that have three or more spines bones. The closest is Autodesk's Character Generator which gives you a script to convert the export rig to a biped, but it moves the first spine near the pelvis so it's semi-accurate.
|This rig, generated by ACG specifically for Unity, has through bones. The gray bone above the spine is a through bone; it will not be animated.|
When assigning the hip, spine, and chest bone in Unity, the spine bones not used are referred to as through bones and even if you animate them in your 3D suite, their animation will not be reflected in game. This sounds rather irritating, but from what I've noticed is that you don't really notice too much. A good way to test this is when setting up the avatar rig, go to the muscle view and just play with the different distortions and assign the spines differently. I find, by default, Unity does a pretty good job assigning the skeleton by default, but rearranging it can help.
|This muscle test shows how the character moves without the gray bone in the previous image without movement.|
Again, the reason for doing all this is to save time through retargeting animations, so I don't have to animate the same animations for every character in the game, but use the same humanoid animation across all characters.
MirroringAnother important aspect is for mirroring animations. In some games such as Virtua Fighter and Dead or Alive, character animations "mirror" -- they switch between left and right bones as illustrated in the video below.
Interestingly, Tekken doesn't mirror. I think I know why though. Since the game is very left and right oriented -- left punch, right punch, etc. -- that if you mirror, things will become confusing for attacks. Since I want my game to be simple input-wise -- just punch and kick for attacks -- I think mirroring, which allows some attacks to end shorter and flow more fluidly.
My mirroring system is a little strange though and I'm not sure if it's the best way. Essentially, I have two float parameters in my Animator -- MainMirror and SubMirror. The idea is that idle, walking, etc., uses MainMirror and SubMirror is equal to this most of the time. Then, attack animations, which also use a blend tree for mirroring but based off SubMirror, use an AnimationEvent to change MainMirror so that when the attack animation ends, it will transition to the proper mirrored animation. There's some complex setup with this, but I think it solves what I'm trying to do.
|An example of character mirroring in Unity|
Root Motion IssuesAnother challenging part of animating humanoid rigs involves root motions. Root motion is the concept in which the animation of the root in the modeling suite will move the character as opposed to animating the character in place and moving them in code. For a fighting game, I think animating the movement in very important; however, when using humanoid rigs, Unity assumes a lot of the movement. Body orientation in the import settings can cause a lot of movement issues so if you want the character to run forward, it may not be in a perfectly straight line, which can be rather problematic. I may be messing something up with this; using the biped as an animation base could be causing issues so I just need to investigate this a bit more to figure out how I can make things more stable. Or, if worse comes to worse, just animate the character through script for certain movements.
|The character is supposed to be walking straight but they go off into the X a little bit after a few playthroughs.|