Home Technical Talk

Animation Help for Games

Hey guys, I'm starting to work on animations for my friend and I's game, but I keep running into blocks. (I'm using XSI 5.11 and the programmer's using OGRE.)

First, how can I get animations to blend together. I know that's all done in code, but how I do make it easier for the programmers to work with? For instance, in my walk cycle, I animate all the bones. They all have a translation, and even if they don't I save the translation of 0 for that cycle. So when I play the animation everything is fine. I create another animation, one where the character shoulders his rifle. I use the start pose of the walk cycle as the start pose of him shouldering the rifle and everything is fine. But when I make a third animation, one of him standing upright (his walk is pretty crouched and sneaky-like), the last frame of that animation is not the same as the last/first frame of his walk cycle. So when I make the character walk, then stop and stand, then shoulder his rifle, the character spazzes out and he ends up aiming at the sky. I know the reason he does it is because the key frames for the beginning of the aim animation don't line up with the last frame of the standing animation. So what do I do? Do I make animations for every conceivable combination? That could get extensive, not to mention meticulous to make sure they all started and ended in exactly the right spot so his movements don't jump.

Second, what do I do about realtime decisions in mid-animation? For instance, our character is going to have grenades on his leg and be carrying a rifle. When the player presses a certain key (call it 'G' for now), the character will reach to his thigh, grab a grenade and throw it. But the player culd push that at any point in an animation, so how do I know where to make the character's hand go to grab said grenade? It could be in any point of the forward/back motion.

I know there are more but I can't think of them right now. These are the two big ones that are stopping me from doing anything productive frown.gif

Replies

  • e_x
    Options
    Offline / Send Message
    e_x polycounter lvl 18
    You guys need to break things out into upper body and lower body. Usually, the run cycle for the legs will always loop, and then you can blend the upper body to play what every animation you want. So if you are running, the lower body always plays the running animation, and then if you shoulder your rifle, only the upper body plays that animation.

    You might be able to just export the legs once for the run, and then animate and export just the upper body for the all the different weapons you might need.

    Hopefully that makes sense.
  • Archvilell
    Options
    Offline / Send Message
    Okay, that's one way we thought we could do it. I didn't know if that was an accepted way or not. I haven't tried that yet, I didn't know if we'd run into problems with that.

    Any thoughts yet on how to make the upper body and lower body synch up on something like a grenade grab and throw? One idea i had was to simply ignore it and make the hand to go to the average spot of the grenade and make the grenade appear in hand, since it will only be there for a few frames. I didn't want to do this right away because I figure somewhere down the line I'll run into a similar situation that I can't cheat myself out of.
  • Hito
    Options
    Offline / Send Message
    Hito interpolator
    [ QUOTE ]
    Any thoughts yet on how to make the upper body and lower body synch up on something like a grenade grab and throw? One idea i had was to simply ignore it and make the hand to go to the average spot of the grenade and make the grenade appear in hand, since it will only be there for a few frames. I didn't want to do this right away because I figure somewhere down the line I'll run into a similar situation that I can't cheat myself out of.

    [/ QUOTE ]

    That's how every game has done it from what I've seen. They reach behind around the belt, and out comes a grenade in their hand. You might do a pulling pin part or an idle bit holding the grenade about the throw if you decide to incorporate "cooking off" a grenade.
  • Mark Dygert
    Options
    Offline / Send Message
    [ QUOTE ]
    I didn't know if that was an accepted way or not

    [/ QUOTE ]That's pretty much the rule for games. You can even designate a spine bone's rotation to be driven by the mouse input. So when the player stops and looks around so does the torso. Most engines even control where the head is looking. Some engines have you create extreme frames for those bones controlled by code. Which end up being where the engine will stop rotating, so your player won't break its back or have its head go through its crotch. I don't know how it all works on the code end, I just know from an animation stand point thats what I've had to do in the past with engines like Quake, Doom, Half Life, Unreal tournement.
  • Archvilell
    Options
    Offline / Send Message
    Huh, that's good to know. Thanks a lot. Now I can get to work! Thanks guys!
  • animatr
    Options
    Offline / Send Message
    animatr polycounter lvl 18
    yup. as for your spine bones, we have torso_base(bone controlled by player input), then torso, and upper torso.
    so heriarchy is:

    Null
    __Pelvis
    ___Torso Base
    ____Torso
    _____Upper Torso

    etc
  • Archvilell
    Options
    Offline / Send Message
    Wait, why would the Torso Base be controlled by the player? Wouldn't you want Null to be controlled by the player so he would move the whole character around onscreen? The code would just play the looping animations of the character walking while the player moved the character around, wouldn't it?
  • Mark Dygert
    Options
    Offline / Send Message
    Mouse input drives the Torso Base for "mouse look". W,A,S,D drives the players actual movement.

    In most cases the player is going to be using the mouse to look around not move. Looking can act as steering but you don't want to waste mouse input on something that is on or off, a key can do that well enough.
Sign In or Register to comment.