Head through the wall
July 29, 2011 8:24 PM   Subscribe

Video-game animators, compositors, you-who-make-the-magic-happen: Why do dead enemies sometimes come to rest with their heads through a wall?

I have seen this many times, in many PC games. Ten-year-old 2D games on low-graphic settings, new games on high graphic settings. Dead enemies sometimes come to rest with their heads through a wall. Never their arms or legs, only their heads. And only when they are dead, and have fallen down.

That screenshot is from Dragon Age Origins (PC).

I don't even know what this phenomenon is called, though it is so common it must have a name. I would really like to have as technical an explanation as you can give me... or as you can make understandable to someone who loves computer games but knows nothing at all about how they are made.
posted by pH Indicating Socks to Sports, Hobbies, & Recreation (10 answers total) 3 users marked this as a favorite
 
Both the wall and the enemy exist as a simplified model in the game. You could make a very detailed model and could tell with great certitude whether any part of the enemy intersected with the wall, but it would be very time consuming. Or, you could do as most games do, and use a simple model. Maybe you could pretend the player is sort of a stick figure, and try to see if any of the sticks intersect the wall. Or pretend he's a square box, etc. In any cases, any model fails at some extremes - it's easy to keep the middle of someone from intersecting a wall.

As to why it's always the head - I suspect this is confirmation bias on your part, since I've seen legs and arms for sure. It's possible heads are more likely, I suppose, since the stick figure model may do a better job of detecting foot collisions than head, but I don't think so.
posted by RustyBrooks at 8:36 PM on July 29, 2011


Also it occurs to me that when someone falls down, they are standing with their feet on the floor, and when they fall, their feet will stay close to where they are now. If they're standing near a wall and fall toward it, their feet will stay away from the wall and their head will go toward it. You might get different results if the person was blown off their feet or something.
posted by RustyBrooks at 8:37 PM on July 29, 2011


The effect is called clipping. It happens when the physics model doesn't account for what would be two hard surfaces to collide. Most games use a really simple physics model because drawing and lighting a scene are really computationally expensive as it is. Realistic physics is beyond most game engines and even ones that do well with it still make lots of shortcuts.

You meet this same issue in other games - for example in Civ5 the AI at harder levels isn't any better - the player has more handicaps - because writing a good AI is hard and, again, computationally expensive. In flight sims, you'll have wing performance estimated by certain fixed points using a predetermined lookup table instead of calculating the dynamic fluid forces at work - again, because it is very computationally expensive.
posted by Pogo_Fuzzybutt at 8:50 PM on July 29, 2011


Response by poster: Oh! So then clipping is also why, on low-graphic settings, a person's face, for example, when zoomed-in, looks like a bunch of planes, rather than a solid object? And the computational cost is why dead enemies disappear once you've taken their stuff, rather than being persistent objects like a wall or a chair?

I lose myself so completely when I am playing these games, that it is almost hard to get my head around that someone codes the rules of physics and makes computational-cost vs. "realism" decisions like these.
posted by pH Indicating Socks at 10:54 PM on July 29, 2011


The technique for making dead or unconscious characters fall down somewhat realistically is often called "ragdoll physics." There is also the term articulated bodies, but the term ragdoll physics is a better description of the way it usually looks when applied to human forms.

It models the human (or other) form as a set of rigid shapes connected with joints that approximate how the form might be able to move and bend its limbs. This approximation cannot be very accurate in most games, because that would be too computationally expensive, and the game would not run in real time. The errors and weird behavior you see result from this approximation occasionally breaking down.

TV Tropes lists a number of games with odd behavior resulting from their use of ragdoll physics. This somewhat old technical article from Gamasutra talks about how the physics were implemented in the game Hitman: Codename 47. There is also a Wikipedia page on the topic. (These are the results of a few quick web searches.)
posted by tykky at 11:07 PM on July 29, 2011


Yeah, they look like they're made of polygons because they are. Here's a page showing HL2's Alyx Vance with the wireframe highlighted.

Ragdolls have a much lower polygon count than 'living' NPCs, but they're still some of the more complex things on the map, so it makes sense to make them fade away. (Buildings and even terrain are also made of polygons but way. way fewer of them.)
posted by zompist at 12:53 AM on July 30, 2011


And the computational cost is why dead enemies disappear once you've taken their stuff, rather than being persistent objects like a wall or a chair?

Yup, it's a design decision made on the basis of gameplay and computational cost. If the game allows an unlimited number of fights in an area, then leaving the bodies arounds invites an unlimited amount of bodies accumulating, which in turn, invites a crawling framerate, as millions more polygons need to be rendered in the scene than it was designed for, or a game eventually crashing as memory is exceeded.

For some games (such as thief or hitman type games), making the bodies persistent is a decision that makes sense, so you'll see it done that way in some games (but never in areas with potentially infinite enemies), but for most games, they want to spend their computation budget on the action, rather than on rendering detritus from encounters that are no-longer relevant.
posted by anonymisc at 8:22 AM on July 30, 2011


We've also had problems in some games where the character is a person, but their simplified physics-shape is a person-proportioned egg-shape, and when they run, they lean forward, and their head is outside the egg-shape, so when they run into a wall, (they can only run towards the wall until their egg hits it) their head clips into the wall. Ok, so make the egg bigger - but now, when they're standing still, other characters can't get close to them, and doorways are harder to fit through. In cases like this, the animators might be asked to take some of the lean out of the run animation, and the coders might be asked to enable dynamic positioning of the egg, so it can be moved forward during run animations and moved back during other sequences.

Game making is, every day, a constant balancing act between making it awesome and making it computationally feasible on target :)
posted by anonymisc at 8:30 AM on July 30, 2011


Clipping is when 2 objects intersect each other when they shouldn't. It's a result of the fact that when you draw objects in a video card, you typically do it by drawing polygons, and the graphics card does not give a shit if they intersect, but shouldn't. It's up to you as the programmer to contrains objects so that they don't intersect, and it's *very* easy to do, at the cost of enormous computation.

You mention that you value immersion, so you don't understand why programmers wouldn't make a similar evaluation, but consider how immersive it would feel if you could only eke 1 frame per second out of a game because it's spending all it's time trying to prevent object collisions.

I've made some simple 3d games and even under pretty constrained circumstances, this kind of thing is very difficult to do efficiently and realistically.
posted by RustyBrooks at 10:41 AM on July 30, 2011


Response by poster: Anonymisc -- I've seen that! This is fascinating.

Rusty, what I meant is not that I want maximum realism in rendering all the time and frame-rate be damned -- no, that would be less fun for sure -- but that, in my favorite games, the illusion *is* so good, that trade-offs made *are* so invisible, that the idea that someone sat there and coded it all is counter-intuitive.

Dragon Age Origins, for example, despite the clipped heads, has absolutely blown my mind. I actually had a dream earlier this week that I woke up in Ferelden, and my real life had been a dream. I am thinking it cannot possibly have made enough money to pay all the writers and actors and artists and coders and ?ers as much money as I want them to have for making something so awesome.
posted by pH Indicating Socks at 1:41 PM on July 30, 2011


« Older This "health company" sells salt water in a bottle...   |   When people don't tell you who they are, what do... Newer »
This thread is closed to new comments.