See Mike Jungbluth’s excellent series over at Gamasutra here.

In this part, I’m going to cover the concept of squash and stretch and what it can mean for AI developers.

Squash and stretch is very well described in Mike’s post, so I wont go over the artistic principle (that and I don’t want to steal his bouncing ball picture). But the theory is pretty simple, because the original animators were working in a fixed time interval medium, they had to draw elements in a way that suggested deformation and momentum. These images used squash (to suggest momentum being converted to elastic energy) and stretch (to suggest that energy being converted back into kinetic energy). What they were doing was draing the various inbetween states as a rubber ball rebounds off a solid object. The deformations an impact produces gives a particular look as you can see if you study any high framerate photography of rubber balls.

 

high speed video of bouncing rubber ball on youtube

As you can see from the above video the deformation results in a squashing motion as the volume of the ball is preserved during an impact. This deformation is mimicked in hand animation by simply elongating or truncating the shape of the object in the direction of motion.

A relatively simple visual trick can add substantially to the feeling of stiffness and solidity of an object (or vice versa). Stiff objects tend to not deform as much as softer objects. So you get an inherent sense of the material of an object as it squashes and stretches.

 

squash and stretch video on youtube

 

You might find the concept of squash and stretch pretty alien as an AI programmer. Why would we want to deform something that way? But don’t think of it literally. Think about the principles that the animators were trying to apply. They wanted to show that different materials deform differently. They also wanted to show that there was weight and momentum to the motions they were animating. So how can we think of these same kind of principles in terms of AI? Well, one area that seems reasonable to apply this principle to is that of group movements. You could consider that moving a group of units would require a fair degree of deformation of the group structure, but overall maintaining coherence. The group of units could “stretch” out as it moves, then “squash” back together again before finally settling on the overall structure.

But I’m thinking at a more abstract level, we can consider squash and stretch to be demonstrating the constraint of force and momentum within a particular value. By tracking say the amount of help a squad gives to a player in a squad shooter, you might apply the principles of squash and stretch to allow the player to run ahead of the squad (not literally, but figuratively in terms of help) and stretch themselves against enemies, but squash back together to help them out if their forward progress is halted for some reason. You could apply this principle in an AI director to maintain a non-constant helper system, so what would actually change would be that your squad would maybe be less accurate with shots as you progressed quickly, but then became more accurate as your progress slowed.

The main question is to consider how much momentum we want to portray as part of the movement. Another example of a potential application of squash and stretch in AI is the “rubber banding” you might apply to racing games. Clearly this is a very obvious application of the squash and stretch principle applied to the progress of a players race. Good progress is rewarded with the player pulling away from the field and “stretching” them out, but if the player slows down, then the field “squashes” back into place. Its easy enough to see how that actually works in a real race and might be useful to apply in similar areas where one agent is racing against another to accomplish a task.

Squash and stretch perhaps isnt immediately obviously applicable, but hopefully these examples will start getting you thinking about the value of showing the player different types of squash and stretch beyond simply the visuals.

Next time, we’ll have a look at one of the more directly applicable animation techniques and how important it is that we start to consider it as part of building really compelling AI characters and scenes.