First of all, I would like to dispel the notion that animation is not worth the time to optimize. This is wildly inaccurate. With certain settings, animation has made my game double in app size and take 10x longer to load. The main culprit? Animation key reducer.
- I am working with three scenes loaded additively. First is the scene loader. Second is the character scene. Third is the ui.
- The character has 21 animation clips so far, with more on the way
As I added animation clips, the game started receiving severe memory warnings on 3g and often crashed. Everyone kept insisting that animation can’t be the cause of the memory problems because they contain such small amounts of data comparitively. Believing that to be true, I moved on and scrutinized every other asset in the game, one file at a time and ultimately came up with nothing. There simply was no other explanation, so I started tinkering with the animation import settings. In this process, I found a major problem - the Keyframe Reducer. That option was switched off for reasons I will go into shortly, but here are the results:
–key reducer off, 21 animations–
app size (uncompressed) = 64.4MB
Scene load times:
Scene loader = 664
Character scene = 19080
UI scene = 6697
–key reducer on, same animations–
app size (uncompressed) = 34.4MB
Scene load times:
Scene loader = 677
Character scene =1312
UI scene = 2066
The lack of key reducer had doubled the app size and made the character scene take over 10x longer to load.
Now, you may be asking yourself, why would this guy turn off the key reducer in the first place? The answer is simple. The key reducer sucks. Here’s why.
Every animation I have completed for this project uses planted keys to anchor the feet (and sometimes hands) to the floor. This allows me to grab any part of the body and animate it, knowing that the feet will not move. When I export the FBX, the keys stay intact. I can bring the animation back into Max or into Maya using the keyframe reducer for either software, and the feet remain anchored. When I bring the same FBX into Unity the feet slide around. Often quite noticably. The only way to stop the feet from sliding is to turn off the key reducer.
So there’s my problem. If I keep the key reducer off I have a game that doesn’t work on anything lower than a 3gs. If I turn it on, my character floats around.
I will post some samples of the animation sliding in the morning.