Boing!Publication date: 3 February 2013
Originally published 2012 in Atomic: Maximum Power Computing
Last modified 04-Feb-2013.
Around the tenth time something like this happens in a 3D game...
...you might find yourself wondering why it happens.
By "this", I only partly mean this specific situation of backing into a swing-set in Grand Theft Auto IV and then flying the friendly skies, or being smashed down into the ground by a Skyrim giant and then...
...entering low Nirn orbit. (Sound effects not entirely original.)
I mean the general case, in which an object in a 3D game suddenly shoots off at outrageous speed. Bethesda games are particularly prone to this, but they're far from the only games in which opening a door can result in a chair or dinner plate spanging off the wall at Mach 4.
Stuff like this even happens in some non-game physics simulations. It always looks ridiculous, but the alternative can look even more ridiculous.
Few games, you see, have what can fairly be called a realistic physics model. Simulating true Newtonian physics that takes into account the characteristics of many objects simultaneously can use an awful lot of processor time, even if you aren't bouncing any objects off each other. So game physics is simplified, first by not making most things subject to physics at all...
...which is why stuff like this can happen. When someone sits on a chair in a 3D game, they're meant to just rendezvous with the furniture and execute their sitting animation; if they miss the target grossly or...
...subtly, the game does not yet have a way of rectifying, or even detecting, the problem.
When objects actually are acted on by the physics engine, it's normal to economise by, for instance, ignoring the concept of elasticity, and making objects indestructible, whether they're a sapphire or a sweetroll.
This leaves object-overlap as the only way the game has to handle things bouncing off other things.
The most obvious symptom of game-physics shortcuts is interpenetrating objects. Whether slight (big shoulder plates on dude's armour clip through his breastplate when he moves his arms...) or...
...blatant (dude standing in the middle of a desk with just his torso sticking out, looking like John Malkovich in the 2005 Hitchhiker's Guide movie), it's a clear and shameless violation of the basic physical concept of impenetrability.
Some objects are meant to penetrate other objects, like the arrows to the head that so famously can only mildly bother Skyrim NPCs. But NPCs themselves are not meant to penetrate floors or doors, carrots are not meant to penetrate cooking pots, and...
...cars are not meant to penetrate roads.
Yet they sometimes do.
A simple way for this to happen is if an object is moving fast enough that in only one physics-engine clock-tick it goes from being in empty air to being halfway through a wall.
Now the physics engine has a problem. Should the object stay there stuck in the wall? Should it sort of slowly ooze out of the wall, one way or another? (Pick the wrong direction, and a car stuck in the ground will slowly sink out of sight.) Should it just be silently moved back to the last location it had that wasn't halfway through a wall? Or should the problem be left to the tender ministrations of the standard collision code?
That last option is what's responsible for the Skyrim Giant-Assisted Space Program.
Basic 3D-engine collision code uses simple vector arithmetic to determine what objects do when they hit each other. The location of the object is defined by some point within it, and its shape is a simplified invisible geometric region which with any luck roughly corresponds to the apparent shape of the object. After any clock-tick in which two or more objects end up with their invisible shapes overlapping, the location and magnitude of the overlap and the location-points within the objects are used to create new movement vectors for the objects, bouncing them apart. The further objects overlap, the faster they are assumed to have been going when they collided, and the faster they bounce off.
This works well enough until two objects overlap by a lot for some reason other than that one or both of them just hit the other at great speed. There are a variety of other possible reasons for big overlaps in 3D-game environments.
Perhaps a pile of objects is collapsing, and limits on the amount of movement calculation that can be done mean some objects are neglected for a tick or three, just passing through other objects, until the engine notices them again. Perhaps the player just reached into their preposterously huge inventory bag and dropped a rocket-launcher or greatsword or something - which, in engine terms, means that object just spawned from nowhere - into a space too small to hold it. Or perhaps a garage door is closing on a car, and there's no way to make the door stop moving, so the car has to end up overlapping the door, or the ground, or both.
If resolution of this sort of problem is left to collision code, one or more objects are about to blast off like a watermelon seed squeezed between the fingertips of Jehovah.
When a Skyrim giant shoots you into the sky with a killing blow, it's because your dead body was smashed down below ground level. Ancient 3D-game tradition states that what happens then is that you fall into an infinite single-coloured void below the universe...
(it looks as if I'm not going to be calming that tiger this time...)
...but if the collision code does its thing, quite the opposite happens. Your body gets a massive bounce velocity, straight up.
When objects try to de-interpenetrate but fail - because they don't move far enough to avoid bouncing "back" again next clock tick, or just because some other object blocks them - they may make the standard noise they would make when bouncing around the environment, only repeatedly and rapidly. This creates a sort of flapping sound, as if a panicked bird is stuck in a drawer somewhere. This happens fairly often in Oblivion-engine games when a door sweeps open and traps some hapless object between it and a wall.
There are plenty of other games with interpenetrating object problems, including outrageous flight velocities and flappity noises. Quite a few feature in this compilation of Skate 3... occurrences:
And there's a bit of flappity-jiggle in the middle of these Red Orchestra 2 excerpts:
And here, in the same game, is a corpse disentangling itself from the floor in a sub-optimal way, and someone who achieved a Skyrim-like altitude in death:
I think Skyrim tries to fix some of these problems in a sneaky way, by making certain interpenetrating objects pop apart only when the player isn't looking at them. In more than one game, though, I've had objects next to the central fire in every single tavern in Skyrim interpenetrate the second I walk in there, and attempt, but fail, to de-penetrate when I'm looking at the tavern-keeper.
So it's [clank clank clank clank] behind me as I try to talk to the innkeeper, and I turn away from the sales counter to see what the deal is - silence. I turn back... [clank clank clank clank] again. I once had a house with that same poltergeist problem, and it wasn't even the one you'd expect. (I bet other games have the same problem, but are able to detect flapping and, if not stop it, at least mute it.)
Perhaps one day physics engines will simulate everything from elasticity to relativity, and randomly shooting into the air will be about as common a problem as finding new cactus thorns for your phonograph.
In the meantime, at least you can know why putting too many cheese wheels in that basket caused one of them to break the sound barrier.