Sign in to follow this  
  • entries
    53
  • comments
    225
  • views
    69183

Cows with Guns

Sign in to follow this  
Milkshake

216 views

A few weeks back I was sitting down at my compiler after a healthy Gears of War session wondering which of the many hundred of ToDo items I should pick off next ... when all of a sudden it hit me: my trusty little cow needs a large gun to run around blowing things up with. Given my plans for 'gameplay' are ill-defined at the best of times, I figured I had nothing to lose by trying it out - and if nothing else, I'd get some new weapon and animation code I could use on another project down the road.

Unfortunately, things are rarely as they seem and while knocking up a simple inventory was smooth sailing, things quickly went pear-shaped when I tried to work out how my character animation could handle carrying different kinds of weapons around. Given there's only one of me, I didn't fancy the idea of having to build different animations for every different type of weapon (e.g. here's RunWithRifle, here's RunWithPistols, here's RunEmptyHands ... now rinse and repeat for every action the character has), and I also wanted something that would allow me to mix-and-match animations together, so my cow can run and reload at the same time.

After a few hours studying Gears and Tomb Raider I dove into my old Game and AI Programming Gems books and settled on adding Priority, Channels, Modifiers and Defaults to my animation system. Priority tells the system which animations are more important than other (e.g. being dead is more important than being told to reload your gun). Channels tell the system which 'layers' a given animation uses (e.g. LowerBody, UpperBody, Face, etc) - which also implicitly tells it which animations can play together vs which animations replace each other. Modifiers allow the state of the character (including which items he has in his hands) to govern which animations are available to the character at the current time. And Default animations play on any idle animation channels (or even overriding other animations if they're high enough priority). For anyone thinking about doing something like this - a lot of systems seem to tie the animation channel of an animation to the bones that animation animates. I actually didn't do this, any animation can use any set of channels it wants independent of the bones it animates, and I think the result is a lot more flexible and robust as a result.

Next came a lot of swearing as I pulled my run cycle apart into a top and bottom so I could re-use the leg animation while the top half of the body does lots of different things. I also bit the bullet and re-rigged my character with proper IK handles which I'd been putting off for a while.

The result turned out to be surprisingly satisfying, particularly when it's in motion. Plus, I now have a pretty flexible multi-layer animation system that I can use for facial expressions, overlaying damage animations, gesturing, etc. Time well spent.

Disabled

Now, I just need to make the gun fire =)

Sign in to follow this  


2 Comments


Recommended Comments

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now