math & physics
Recently I've been exploring one of the most popular TPS (from my point of view of corse) - MaxPayne2 and trying to find and understand how it works. Well, I've found lots of interesting things, but now I'd like to discuss character's movement mechanism.
As I understand, guys from Remedy used special character animations, which contain information of movement in addition to ordinary bone tracks. Then this movement information is taken from animation system and used by physics engine (Havok). As the result we have character's moving synchronous to character's animation, which is quite good, no doubt.
Anyway, it's a nice idea to move information of movement from code to content (and animators can rather easier control it).
Although, I'm not quite sure about how to use (how to interpret) such information in game. Wheither it better to directly convert it to calls of physics engine (like physics_engine::RigidBody::setPosition(), setVelocity(), addImpulse(), addForce() etc.) or handle it in a different way?
What's better to do if, for example, during a complex somersault animation a character get a side kick?
And how to handle if during the jump the player keep pressed left-right keys and wish to move his character a bit?
It's interesting to know you opinion about this.
Physically, it is impossible to "move" the charakter while in the middle of a jump. This is however not very fun, so most games allow you to adjust the velocity in the Name of Gameplay.
Implementation wise, how about specifying mass for the bones, and numerically "derivating" the animation's frame-by-frame positions to forces/impulses of the muscles. Then, during animation playback, the forces/impulses would be applied to the bones and the following simulation will result in the desired animation, easily integrated to other physics.
If the character is kicked in the middle of an animation, or if itis carrying a hevay object, forces/impulses could be adjusted dynamically based on the difference of the artist's animation and the resulting simulation. Forces should of course be clipped by a set value, (the strength of the charakter) defined by the game designer. This strenght-value could of course be decreased if the player gets exhauseted or injured.
Just my thoughts on this.
mixed up integration and derivation[/edit]
There's current research to push character animation to the next level. One of them is a mixed of pre-animated model and ragdoll physics. I know they already mixed them now in some games, but these guys are truly taking it to the next level. They have a library of pre-animation, and if something happens to a character (he gets kicked in the chest), the rag doll physics kicks in for the initial behavior but then the movement of the rag doll is match to the closest movement in the library. The rag doll controller gives control over to the pre-animated controller once a close match is found. So if you kick the character in the chest, his arm will initially shove forward, the chest moves backward, head tilt forward etc, but then the "intelligent" behavior kicks in and the character model will brace for the fall or recover while looking somewhat graceful. Of course there's interpolation between the switch from ragdoll to pre-animated so it looks more believable.
I don't have the link to this research on this PC, if I see this thread again tonight, I'll post it.
Thanks a lot for interesting ideas, but it would be nice if someone tells me how they converted sequence of movement delta to something physical (I mean guys in Remedy). I just was wondering about MaxPayne2 mechanism, where - I'am sure - raqdoll is only activated after death.
In other words, MaxPayne2 animation system has a delta-vector of character movement every gameframe. Then this data have to be used in any way, for example characterRigidBody->setVelocity(deltaVector / deltaTime); and it seems to be ok, but it doesn't work in jumps and stairs. So, my main question is what to do with this movement information? How to handle it? Does anyone know how this works in MaxPayne2?