Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

What aspects should I take into consideration for creating character animation and rendering classes if I want to be able to have detachable limbs? I've developed a detailed body system that can have everything down to the nervous system defined. I'm aiming for something similar to the level of damage detail found in Dwarf Fortress. For example, when a character takes damage to their upper arm, there is a chance of nerve damage that can disable the entire arm. Or they could lose the arm entirely.

I have a system written up for handling the data part of this. Each character has a trunk, which has appendages and internal parts. Each appendage can also have child appendages and internal parts. Child appendages are disabled/removed if a parent appendage is disabled/removed. If any of the disabled/removed appendages or internal parts are required for life, the character will soon die.

What I'm working on now is the drawing/animation portion of this. How do I define animations to know which ones are allowed given the current state of the body (missing arms/legs and so on)? How do I set up the drawing system to not draw missing limbs? Does each limb/appendage have to be its own model (I'd like to draw cut off appendages on the ground)?

The simple system I'm transitioning from (I just wrote it for testing) imports all the key frames of an animation as full models into a VBO (along with vertex counts for where key frames start/stop). It doesn't import or utilize the bones defined in Blender, and it doesn't interpolate between frames.

This is likely a pretty big question, so I'm also looking for resources that can get me where I need to go.

EDIT

I ask about the animation knowing which limbs it's animating because I would like to have it set up to perform an alternate animation if a required limb is missing. After thinking about that, I imagine I would perform that check before activating an animation, and activate the appropriate animation at that time.

share|improve this question
add comment

2 Answers 2

up vote 6 down vote accepted

I'm currently working on a similar system. Procedural animation + dismemberment etc.

How do I define animations to know which ones are allowed give the current state of the body (missing arms/legs and so on)?

I don't quite follow this bit, if the limbs aren't there, then who cares if it's being animated or not, because it can't be seen.

Does each limb/appendage have to be its own model (I'd like to draw cut off appendages on the ground)?

I dynamically build these from using vertex bone weights. The quality is probably slightly lower than doing every limb by hand, but it's less effort once I've done it once, because I can then apply it to every model.

With the sane approach from the following section, yes, each limb would have it's own model.

I'd likely have a complete model on hand of the entire entity, and each of the limbs cut up.

How do I set up the drawing system to not draw missing limbs?

2 major choices, the simplest way is to simply draw the limbs separately, and where the limbs join have additional faces that are normally hidden with "raw flesh" textures that will be seen when the limbs are removed.

The second choice is to do it dynamically on the fly, this will only work with relatively simple models. The approach is to take the base model, and find the vertices that are weighted to the limb you wanted to dismember. Remove those vertices, noting what they connect to such that you know the open section. You then dynamically close over the open section with triangles with a "raw flesh" texture. From the perspective of a sane software developer, this approach isn't a good one (run time model deformation), and less "flat" performance characteristics, but I kinda like it.

While the first method will generate many more draw calls, it's also a bit more approachable.

I'm personally going with the second, with relative success, but all my models are very low poly, so dynamically cutting up a model and re uploading the VBO within the frame is doable for now.

It doesn't import or utilize the bones defined in Blender, and it doesn't interpolate between frames.

This makes it really hard to do dismemberment in a procedural way, because how do you know what vertices belong to what joint? Vertex bone weights and dismemberment go hand in hand so nicely I suggest you to rethink this bit.

I also suggest you invest in interpolation. Without it you can't speed up/slow down your animations, and you're coupled with the framerate. This means you'll be able to get less out of your animations. e.g. you can't slow the walk animation when someone is coming to a stop etc.

share|improve this answer
    
Thanks @Michael. I brought up interpolation and importing bones because I know I'll need them eventually, but I don't have them yet. From what you've said, it seems like I'll know what to do once I get to that point. Likely I would just associate an appendage or group of appendages with a bone. I'll ask a separate question about importing bones. –  Byte56 Dec 11 '11 at 21:47
    
since you're working on something similar, perhaps you have more information on this related question? gamedev.stackexchange.com/q/20931/7191 –  Byte56 Dec 12 '11 at 15:48
add comment

Your best option is to cut off the limbs and use multiple submodels depending of the current state of the wounds. Your approach of using a VBO per keyframe is just overkill; use a skeletal animation system and play different animations depending of the damage received (limping with one leg, crawling without the two legs, etc).

Valve published a good set of slides about the wounds and dismembering in L4D2. I really like the approach of using a model for the organs and bones, and clipping the "skin" model based on texture projections of cuts, gunshots, etc.

share|improve this answer
    
Interesting. Those slides look good. This seems like it would work for damage that didn't affect an entire appendage. –  Byte56 Dec 11 '11 at 21:59
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.