Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Controlling Character Animations - Character Controller?

Author
Message
anwserman
15
Years of Service
User Offline
Joined: 20th May 2011
Location: Wisconsin
Posted: 6th Jul 2011 12:32
Hello everyone!
I have a question for you all - about how to program and implement a character's animations. I just counted, and right now I have approximately 30+ animations that my character could be doing, such as walking, running, jumping, etc ("Animation Type")

What is the best way to determine which animation should be playing at a given moment? I have nothing programmed so far.

However, I do have all of my animation data stored into a flat-file.

An animation is assigned to one "Actor", or a character in the game
An animation has a start frame and an end frame
An animation has its own definable FPS
An animation can be set to loop or be played once
An animation can be set to a certain priority level
An animation has an "Animation Type", which is one of 30 values

So, a walking animation would have lowest priority and could be looped; any animation of higher or equal priority could interrupt it. However, an animation of lower priority would NOT play.

Or lets say, the character falls off a cliff. When they hit the ground, I'd like to make sure that they complete the full 'splatting against the ground and getting up' animation before they can start walking again, and thus that animation would have a higher priority than the walking one.

Overall, in order to set and apply animations, it needs to be incorporated into my overall character controller. But I'm not sure how, exactly. I think I have this thought through well, but I'm kinda hazy on implementation.

Any thoughts? Sorry if this has just been a huge ramble :3
Greenster
21
Years of Service
User Offline
Joined: 3rd Feb 2005
Location: US ©
Posted: 6th Jul 2011 12:44
You use them based on input or AI actions.

DBP animations are simple, there are no physics bodies used for blending animations like with more modern engines.
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 6th Jul 2011 15:11
Quote: "So, a walking animation would have lowest priority and could be looped"


All animation can be looped...walk, run , shoot , jump etc. You can use them depending on the situation as Greenster say. I prefer to have all animation in the same object, but you can have the differents animation in different objects and just append object animation to your object...it means that you just use the new animation in your object (I guess you know that ).

Cheers.

I'm not a grumpy grandpa
TuPP3
19
Years of Service
User Offline
Joined: 26th Jan 2007
Location: [+--]FINLAND
Posted: 7th Jul 2011 00:28 Edited at: 7th Jul 2011 00:32
I just do this just by normal coding.
So if key is pressed then check if you have correct keyframe(s) to execute the action.
Enhanced Animations are really a must buy for this, you can actually blend animations and do a lot more with the with it.

I store important keyframes in arrays, so I can use them in code:
Like:

These are just the keyframes of the piled animation in 3ds max.

Another thing for example:


For checking keyframes specific keyframes I also use function

Looks messy, but it just checks if current hand frame is a specific keyframe and the funtion will return 1 or 0, whether hands are free to perform that action or not.

You can also check if animation is playing when you need to perform specific action, like the walking. Character can't walk unless the frame is 0 or something another specific keyframe. If it's not, then you can't do the action.

Login to post a reply

Server time is: 2026-07-10 21:41:58
Your offset time is: 2026-07-10 21:41:58