In computer physics engines
, ragdoll physics
are a type of procedural animation
that is often used as a replacement for traditional static death animations
Early video games
used manually-created animations for characters' death sequences. This had the advantage of low CPU
what the fuck that was needed to animate a "dying" character was chosen from a set number of pre-drawn animations.
As computers increased in power, it became possible to do limited real-time physical simulations. A ragdoll is therefore a collection of multiple rigid bodies (each of which is ordinarily tied to a bone in the graphics engine's skeletal animation system) tied together by a system of constraints that restrict how the bones may move relative to each other. When the character dies, his body begins to collapse to the ground, honouring these restrictions on each of the joints' motion, which often looks more realistic.
The term ragdoll comes from the problem that the articulated systems, due to the limits of the solvers used, tend to have little or zero joint/skeletal muscle stiffness, leading to a character collapsing much like a toy rag doll, often into comically improbable or compromising positions.
The first game to exhibit ragdoll physics was the Jurassic Park licensed game Jurassic Park: Trespasser, which received very polarised opinions; most were negative: the game had a large number of bugs. It was remembered, however, for being a pioneer in video-game physics engines.
Modern use of ragdoll physics goes beyond death sequences — there are fighting games where the player controls one part of the body of the fighter and the rest follows along, such as Rag Doll Kung Fu, and even racing games such as the FlatOut series.
Recent procedural animation technologies, such as those found in NaturalMotion's Euphoria middleware, have allowed the development of games that rely heavily on the suspension of disbelief facilitated by realistic whole-body muscle/nervous ragdoll physics as an integral part of the immersive gaming experience, as opposed to the antiquated use of canned-animation techniques. This is seen in Grand Theft Auto IV, as well as titles such as LucasArts' Star Wars: The Force Unleashed and yet-to-be-released Indiana Jones.
Ragdolls have been implemented using Featherstone's algorithm
and spring-damper contacts. An alternative approach uses constraint solvers and idealized contacts.
While the constrained-rigid-body approach to ragdolls is the most common, other "pseudo
-ragdoll" techniques have been used:
- Verlet integration: used by Hitman: Codename 47 and popularized by Thomas Jakobsen , this technique models each character bone as a point connected to an arbitrary number of other points via simple constraints. Verlet constraints are much simpler and faster to solve than most of those in a fully modelled rigid body system, resulting in much less CPU consumption for characters.
- Inverse kinematics post-processing: used in Halo: Combat Evolved, this technique relies on playing a pre-set death animation and then using inverse kinematics to force the character into a possible position after the animation has completed. This means that, during an animation, a character could wind up clipping through world geometry, but after he has come to rest, all of his bones will be in valid space.
- Blended ragdoll: this technique (used in Halo 2 and Call of Duty 4) works by playing a pre-made animation, but constraining the output of that animation to what a physical system would allow. This helps alleviate the ragdoll feeling of characters suddenly going limp, offering correct environmental interaction as well. This requires both animation processing and physics processing, thus making it even slower than traditional ragdoll alone, though the benefits of the extra realism seem to overshadow the reduction in processing speed.
- Procedural Animation: traditionally used in non-realtime media (film/TV/etc), this technique employs the use of multi-layered physical models in non-playing characters (bones / muscle / nervous systems), and deformable scenic elements from "simulated materials" in vehicles, etc. By removing the use of pre-made animation, each reaction seen by the player is unique, whilst still determinative. Rather than detract from gameplay through overstimulation, the "natural" qualities of movement provide for a more immersive experience, and extended replayability.
Due to the computationally expensive nature of performing simulations, most games using ragdolls use very simple approximations of characters:
- Extremity bones such as fingers often go unsimulated.
- Simple joints are used instead of actual constraints imposed by a true skeleton. (For example, human knee joints are often modelled as a rigid hinge even though an actual human knee allows some rotation.)
- Simplified collision hulls are used to detect contact with other rigid bodies rather than detecting collision with the mesh.
The chief advantage ragdolls offer over traditional animations is that they allow much more correct interaction with the surrounding environment. Where it would be intractably time-consuming to try to hand-craft custom animations for all conceivable circumstances, ragdolls fill in and generate a reasonably accurate interpretation of events on the fly.