How Ragdoll Physics Works


Sometimes the effects of ragdoll physics make for incredible realism. Other times, things get a little silly.
Sometimes the effects of ragdoll physics make for incredible realism. Other times, things get a little silly.
© John Nagle, used under Creative Commons license 3.0

Death is always a disappointment. That's true even in video games. It means the end of a combat round, the end of a level and perhaps the loss of minutes (or hours) of unsaved gameplay achievements. But in games from an earlier era, death wasn't just a bummer — it was a graphical disappointment, too.

Your kaput character's body would flip awkwardly from vertical to horizontal. Perhaps it would fragment or disappear. Death always looked exactly the same, thanks to older keyframe animation, where each action, such as jumping and falling, is repeated ad nauseum. These lame, scripted deaths were so unrealistic that they detracted from gameplay quality.

Since the early days, digital death has changed in amazing ways. Everyone knows that games have gotten gorier, with untold gallons of blood and splintering bones being animated everyday across the globe. But the realism of slumping, dead bodies has changed dramatically, too, thanks in large part to ragdoll physics.

Ragdoll physics is a category of procedural animation that displays human-like figures with more realistic motion. Sometimes the effect is eerily accurate. Other times the results are often overemphasized to the point of silliness, with arms and legs and torsos flopping and twisting like, well, a ragdoll that imbibed a few too many tequila shots.

When integrated into gameplay with care, ragdoll physics adds realism, particularly to screens with non-stop carnage. For example, if you're playing a first-person shooter in which you blast other characters with a variety of weapons, your victims will react differently each time you shoot them. Blasting an enemy in the shoulder causes the top side of the body to flail backwards as it absorbs the blow. Pop them in the gut, though, and the character might double over and then collapse forwards in the beginnings of virtual death throes.

These might sound like inane or simplistic video effects. But in reality, these animations rely on complex physics and math, and programmers are continually trying to find better ways to make onscreen objects more accurately resemble our analog world.

The Engines of Animation

Bodies go flying in “Max Payne.”
Bodies go flying in “Max Payne.”
Screen capture by HowStuffWorks staff

For decades now, video game makers have been trying to recreate real-world physics. They use simulated physics engines to build in principles of gravity, velocity, collision detection and momentum that affect your racecars, planes and even Mario as he jumps and scrambles through the underworld. Without these elements, there are no rules or boundaries to gameplay that make any real sense.

The same goes for character deaths. With primitive games, characters always died to exactly the same pre-scripted, static animation. That was fine and dandy in simpler times, but improved hardware made room for better all-around graphics performance. Dedicated graphics processing cards took some of the burden from the CPU, allowing for more sophisticated gameplay and, you guessed it, better death animations.

Games like the "Halo" series and "Max Payne" feature realistic movements as bodies are jolted by bullets. And Rockstar Games has made a name for itself with its "Grand Theft Auto" series, which is filled with natural-looking lighting effects and human motion that's almost startling in its accuracy. Thanks in part to ragdoll physics, instead of canned graphics, programmers make characters that respond in real time to other onscreen elements, from walls to bombs to bullets.

"Hitman: Codename 47" was one of the first games to employ ragdoll physics. After you incapacitated an opponent, you could drag the lifeless, rolling body and steal its clothes as a disguise. Bullets slammed into bodies with ridiculous force. The elements weren't altogether convincing, but they added a new layer of believability that had been missing from gameplay.

"Hitman" used Verlet integration, an algorithm used to incorporate Newton's equations of motion into applications such as computer animation. Each part of an animated skeleton is defined as points connected to other points with some basic rules as guidelines. The comparative simplicity of this algorithm means it uses less CPU processing time than other techniques.

Blended ragdoll physics combines real-time physics processing with premade animations, in games such as "Jurassic Park: Trespasser." The static animations interact more realistically with the environment; animated characters don't just flop down. They crash and bend more like actual human beings. But there are still visual flaws that don't make sense to the human brain. It doesn't look natural enough.

Procedural animation is the latest and most immersive type of game physics. There are no predetermined animations here. Instead, all of the characters and much of the environment is continually responsive to in-game physics. That applies to death animations, of course, but it also makes every other aspect of the game more convincing, too.

From 'Hitman' to 'GTA'

The “Grand Theft Auto” series offers plenty of opportunities to see ragdoll physics in action.
The “Grand Theft Auto” series offers plenty of opportunities to see ragdoll physics in action.
Screen capture by HowStuffWorks staff

If the physics engine is the stage, the animated characters are the puppets. Ragdoll physics look realistic because these characters are made up of rigid parts connected to one another in a system that's similar to real-world skeletal bodies. When damaged, the bodies flop, loll and bounce around onscreen.

The math and physics at play are exceedingly complex, and even now CPU power and processing algorithms haven't quite found a way to perfectly mimic a collapsing humanoid form. Thus, hilarity often ensues as the articulated limbs of the character twist and bounce in all sorts of unrealistic and absurd ways, like a ragdoll flung down a flight of stairs. Plenty of current online games, such as "Happy Wheels" capitalize on this effect, essentially providing crash-test dummies for you to torture and fling through all sorts of silly and bizarre scenarios.

Many simple contemporary games leverage ragdoll physics as a way to make onscreen action less violent and more cartoonish and fun. Yet the amusement and entertainment factors masks the complexity of the physics that go into contemporary games.

One of the most sophisticated animation engines is called Euphoria, made by NaturalMotion. Euphoria has been used in some exceedingly popular games, such as "Star Wars: The Force Unleashed," "Red Dead Redemption" and "Grand Theft Auto 4."

NaturalMotion boasts that Euphoria simulates bodily motion in real time for each and every part of every scene, right down a character's muscles and motor system. For instance, characters might be startled by the sound of a machine gun blast or try to break their fall when they topple from a moving vehicle. In the end, these kinds of games offer a more absorbing gaming experience.

Animated Physics

Whipping enemies around with the Force and watching them flip and flop is half of the fun of the game play in “The Force Unleashed.”
Whipping enemies around with the Force and watching them flip and flop is half of the fun of the game play in “The Force Unleashed.”
Screen capture by HowStuffWorks staff

Ragdoll physics is just one aspect of building realistic animation. Many games use skeletal animation to provide character realism. Skeletal animation involves two primary elements including the surface or mesh (the skin or armor you can see) and the rig or skeleton (the rigid underlying construction that supports the skin and makes it move). This is an articulated body — rigid parts connected with joints.

Programmers build in limits and constraints for the rig. A head, for example, can't swivel 360 degrees or flop into the chest area. Wrists can rotate and swing, but only to certain angles and then they stop, just like on a real person.

Once the skeletal system for a game is built, developers can use the same foundation for multiple characters, simply changing the surface appearance to flesh out the population of the virtual world.

As with a real skeleton, skeletal animation is based on kinematic chains or trees, so the pieces move as part of a hierarchy. In short, this just means that all of the "bones" are connected. For example, when the bone of an upper thigh moves, so too does the lower leg.

It's difficult to program this kind of action-reaction movement in a digital character. Developers use various techniques to accomplish the feat. One common way is based on Featherstone's algorithm, named after Roy Featherstone, an expert in articulated-body algorithms.

This dynamic modeling requires a lot of data to make a character look believable. Programmers need to account for geometry and the relative locations of all body parts. The have to create restrictions and rules for joints and connectivity, as well as spatial inertia.

All of those factors must be described with mathematical algorithms and physics. Animators then use CAD-like software to build geometrical characters, joint by joint, until they've literally constructed a digital being. Then that being can be inserted into a digital environment.

No matter who makes them, physics are what drive modern video games. Whether those physics are fantastically real or gut-achingly funny doesn't matter as much as simply making the games more enjoyable to play. And with ever bigger budgets and more powerful hardware on their hands, you can expect that the physics engines will get more sophisticated and elegant by leaps, bounds and bullet holes.

Author's Note: How Ragdoll Physics Works

I grew up playing games like "Ikari Warriors" and "King's Quest," both of which featured blocky animation that looks downright rudimentary by today's standards. There were no dynamic graphics in those days. The characters hovered their way through the polygon-ish landscape in search of victory or perhaps a way to escape their two-dimensional hell. Contemporary gamers are spoiled by graphics so convincing that the digital world becomes a secondary life. And now that I remember how addicted I was to even old-school video games, maybe it's best that I missed out on this era of gameplay.

Related Stories

Sources

  • Champandard, Alex J. "Procedural Characters and the Coming Animation Revolution." AIGameDev. Aug. 20, 2012. (Sept. 4, 2015) http://aigamedev.com/open/editorial/animation-revolution/
  • Clary, Grayson. "Fearsome Engines." Method. 2015. (Sept. 4, 2015) http://www.methodquarterly.com/2015/06/fearsome-engines/
  • DigitalRune. "Ragdolls." (Sep. 4, 2015) http://www.digitalrune.com/Documentation/html/0f8abfcc-b27e-4887-8017-9fda6e7fb0fc.htm
  • Florian, Razyan. "Featherstone's Algorithm for Simulating Articulated Bodies." Thyrix. July 27, 2005. (Sept. 4, 2015) http://www.thyrix.com/documentation/featherstone_method.php
  • Glimberg, Stefan and Morten Engel. "Comparison of Ragdoll Methods." Jan. 23, 2007. (Sept. 4, 2015) http://image.diku.dk/projects/media/glimberg.engel.07.pdf
  • Massoudi, Peyman. "Combing Ragdoll and Keyframe Animation to Achieve Dynamic Poses." AniMotion. May 25, 2015. (Sept. 4, 2015) http://peyman-mass.blogspot.com/2015/05/combining-physical-animation-with.html
  • Millington, Ian. "Game Physics Engine Development: How to Build a Robust Commercial-Grade Physics Engine for Your Game." CRC Press. July 23, 2010.
  • NaturalMotion. "Euphoria." (Sept. 4, 2015) http://www.naturalmotion.com/middleware/euphoria/
  • Pitzel, Steve. "Character Animation: Skeletons and Inverse Kinematics." Intel Developer Zone. Sept. 9, 2011. (Sept. 4, 2015) https://software.intel.com/en-us/articles/character-animation-skeletons-and-inverse-kinematics
  • Solberg, Dan. "Why Are Ragdoll Physics So Funny?" Kill Screen Daily. April 1, 2014. (Sept. 4, 2015)
  • http://killscreendaily.com/articles/why-are-ragdoll-physics-so-funny/