The dark art of creating gorgeous death animations

You know when a kill doesn't feel right in a shooter. It's a lack of connection, a detachment of cause and effect. The click of your mouse doesn't quite sync up with the death rattle of your enemy, and it nags at you as you turn the corner and, despite the slight fracture in your sense of involvement, press on regardless.

The moment Marty Stratton knew his team got the kills in the new Doom right was when he watched players reacting with a chuckle and an "Oh my God!" "Because when you're fighting and that happens they've recognised they've done a killing blow," he tells me.

Bad guys dying in a hail of pretend bullets is an art, a spectacle that tugs at the very nature of videogames. Non-believers might just see a burst of gore that serves to confirm the puerility of videogames. But we see beauty. Craft. A sudden bridge between us and the unfathomably quick electric pulses going on in the PC beside us. It's a splash of reward. You did something right! A wash of dopamine hits your brain and you want to do it again.

it's a cocktail of gameplay, things feeling real, and really satisfying feedback

From the gruesome cartoon trepanning of Turok's cerebral bore to the detachable limbs of Soldier of Fortune, deaths have always been used to set the tone of the game they appear in. "Fundamentally, in Doom the most important thing is the feeling of power that the player has," says Stratton.

give them a hand

For more on great animation in games, check out our picks for the best hand animations in first-person games, and PC gaming's best reload animations

"We're not really shooting a gun, so how do you do that? You do it with sound, animation, those are the things where you feel you're a badass," adds lead level designer Jerry Keehan. "The feedback is why we put so much into the animation and it's where people feel the most fun, because you're getting the reaction from what you're doing."

In the case of Killing Floor 2, it's about how you're shredding Zeds—enemies which can sometimes absorb a lot of damage. "Whenever you kill a Zed it's just a mountain of feedback for the player, almost at the level of Peggle, but with gore," says game director David Hensley. "Bill [Munk], our creative director, says that when you kill a monster it's kind of your treat, so you make it as big a spectacle as you can make it; it's candy for the player for succeeding. Graphics, animation, sound, effects, it's a cocktail of gameplay, things feeling real, and really satisfying feedback. What you put into the game is spit back out at you as blood."

So heads pop, limbs detach and blood spurts in a system Tripwire calls M.E.A.T. (Massive Evisceration And Trauma), which was developed by Hensley. When you shoot a Zed, the first thing that happens is that the game switches from the normal monster model to a gore one. The two versions are much the same to look at, but the gore one comprises 22 different sliced up body parts. But you won't notice the switch because the slices are animated on the monster's skeleton and visually connected to each other with a process called smooth skinning, which deforms the joints between them correctly. 

But if you should hit any of the slices with a powerful enough blow, several things immediately happen. The skinning for that part is switched from smooth to rigid so it's visually separated from the rest of the body, and then the physics constraints which attach it to the monster are broken, allowing it to fly off as an independent chunk of body.

"It's a really insane amount of work to set up because we have to make two full skins per character," says Hensley. Every slice needs gory textures for every side, and then there's several days of work in the Unreal Engine, setting up the slices so they can switch between the smooth and rigid skinning states. 

There's almost no death in Killing Floor that looks the same

Several blood systems come into play, too. Killing Floor 2 applies blood to the body around a destroyed slice, another challenge since each body has 22 different pieces which can be removed in any combination. Hensley solved it by packing bloody patterns for each slice into the different RGB channels of a single texture. Three types of blood particles then spray out of the wound, any chunk of body flying off leaves a trail of blood behind it, and another particle sprays out at the point of dismemberment.

The blood particles themselves change shape and size as they emerge and disappear to disguise their nature as flat images, while some blood is a static 3D mesh, made to look fluid by inflating and deflating it as it spawns and dies. "Designing a good blood particle is a whole other thing," says Hensley, with some glee.

The final part of the puzzle are animation systems which blend a large number of canned animations into physics-based ragdoll. If you hit a monster with a bullet and it doesn't die, it'll stagger depending on where you hit it. Kill it, and it'll fall back in a direction based on from where you hit it. "There's almost no death in Killing Floor that looks the same, and that's largely due to the insane variation in animation that we have," says Hensley.

Doom shares similar gore and animation systems, allowing an imp to dramatically fall back to a railing and then topple over it, giving a sense of dynamic grounded-ness to the action. Every demon has stagger animations dependent on the direction from which it's being shot, and also has death animations that purposefully call back to the classic melting demon, once presented as animated sprites and now created in 3D. 

And of course, Doom also has its 'glory kills', brief and entirely canned animated sequences where your character tears a jaw or a head or an arm or a heart from a staggered foe. Engineered so the sequence is dependent on what part of the body you're looking at when you trigger the attack, they underscore who the Doom Marine is and provide a moment of catharsis in which you also get to plan your next move. 

The glory kills are a big part of Doom's personality, and they came with a huge production cost. "It's not just animation, actually, but also making how you rip and tear the enemies, how you gore them up," says animation director Shinichiro Hara. "You can rip their arms off, you can tear them in half, you can blow them into pieces, and all that stuff is a lot of work. I'd say, per enemy you have 12 glory kill animations at least."

Another example of the glory kill approach to deaths is Sniper Elite 4's bulletcam. Rather than pre-canned, it's largely procedural, designed to show off as much as variety as possible. Every time you press the trigger on a killing shot, the game invokes various different systems, each checking each other to determine whether and how to play the sequence. Where should the camera be? Is there anything obscuring the view? Which visual effects and vignette to put on the screen? When was the bulletcam last shown?

And which part of the body is the bullet going to hit? If it's the head then there's a good chance you'll see an X-ray view of it penetrating the skull. In the balls? Well, that's almost certain. "It's a player reward so there's no point in getting a big, dramatic kill cam and you've shot someone in the big toe," says lead artist Tom Beesley. Long-distance shots are much more likely to be given bulletcam sequences, too.

The X-ray sequence itself is a slow-motion moment of heady gore in a game that can feel a little unsteady against its real-world setting and efforts to humanise enemies. But it's always striking, in part because it appears so dynamic as a jaw or eye socket explodes as your bullet passes through. But the actual shattering of bone is pre-defined. "If you're fully procedural you run into problems because you get unexpected results," says Beesley. Physics applied to objects inside other objects can often go very wrong, but when bone fragments and blood bursts outwards it's physics-based, with air turbulence applied to lend them variation that helps the bulletcam maintain a sense of reward. the player the cues as to whether a guy is dead or not was something we were always balancing against the level of blood spray and gore

While games today can throw all manner of blood and animation around, good death design depends on the information the player is being given at all times. "Doom is super-fast, split-second decisions, so giving the player the cues as to whether a guy is dead or not was something we were always balancing against the level of blood spray and gore," says Stratton. "Blood spray off the chest is good, but that killing blow has to communicate itself in some fashion. If you blow a limb off, you know they're not going to keep crawling after you."

Well, they don't in the final game. During early development, legless zombies and imps could sometimes still squeeze a few shots off, something id soon realised was extremely frustrating. Lessons like these are a sign that the future of the craft of death isn't purely a matter of technology and the ability to throw things around the screen. 

Mind you, Beesley would love to be able to have real fluid dynamics for blood. "Yeah, absolutely, that's what everyone would love," he says. "These are the spaces we're getting into now, people are starting to look into the fidelity of this stuff. We are throwing more at the processor and the hardware."

"I worked on all of our gore systems and I'm really hoping to do another one that's even more insane some day," says Hensley, who wants to be able to procedurally cut up bodies rather than have to rely on pre-defined sections. And he wants organs and bones inside them, too. "We would need a lot of graphics power, for a graphics engineer to do some research. There are probably some techniques from film 3D that we can borrow and figure out how to run realtime."

"Physics, animation and characters that feel really grounded in the world, all that stuff takes processing power," says Stratton. "As things expand it gives us more freedom. We can do more accurately what is in the artist, designer and animators' heads, and generally do it more easily. And we always want to put more demons on-screen."

There's also the consideration of studio economics. It takes time to build this stuff, whether it's graphics engineering or the grunt work of producing all the art that lashings of gore requires. "There are a lot of animations in Doom and it takes animators to do that work. That stuff doesn't get faster based on processing power," says Stratton. But if gore is crucial to your game, then it's worth the investment. The ever-rising power of GPUs and CPUs is only going to raise the fluidity, fidelity and the sheer reward of that moment when the game reaches out and says: good kill.