Game Development Community

Action thread interrupts animation threads

by Patrick Webber · in Torque 3D Professional · 03/10/2014 (6:59 am) · 3 replies

Hi all,

So I've been working with this problem for the last two weeks, and just concluded that a solution I had been working on didn't work, so I thought I'd ask you guys to see if there are any better ideas out there.

The problem is that the action animation thread (where walking, jumping, etc. are held) overrides a sword swing animation. I'm trying to smooth out gameplay, so I've been trying to fix this.

What I've done is animate my model such that the action animation thread only ever animates the lower half of the body. This makes it so that I can run two threads at the same time for the upper and lower body and (ideally) have them animate perfectly independent of each other. So the walk animation is actually 2 animations blended (this works well).

I have also put together a (only top body) sword swing animation, which is suppose to be able to be used on the move. So a player can start a swing while standing, start moving and have this animation continue swinging as if nothing interrupted it. This works well with transitions off (which I'm fine with doing) but the problem stems from returning the upper body walking animation thread to where it should be. I need to match the arms up with the legs again.

I can do all of this stuff in a single player test with no issues (and I've gotten it working to!). However, I'm hoping to have this working in multiplayer. In multiplayer, the characters are twitchy, and animations will cancel/jump when the players transition between action animations (and sometimes whenever they feel like it).

Does anybody have a solution to this issue or an idea as to what is causing it? If not, do you have any idea where I could start looking to improve this?

I'm planning on starting my fixes again, but this time I'm going to try to get rid of the action animation thread, and move it to all the threads in a ShapeBase object (TSThread). So thread[0] will be the new action animation thread and thread[1] will be all upper body stuff.

Thanks,
Patrick

About the author

I'm a computer science major at Stony Brook University, and have been working with the Torque Game Engine for a number of years.


#1
03/10/2014 (12:48 pm)
This is going to be tricky - the client is trying to interpolate between notifications from the server. You could add some sort of flag that will simply schedule the animation change on the client so that the running animation completes before the new notification from the server takes effect. I'm just thinking on paper here - haven't really looked at this stuff at all.
#2
03/10/2014 (2:45 pm)
Thanks for the response,

I've tried sending some cleanup variables to the client's so that they will fix up their animations before. The problem is that other players won't see the fixes, so only your own character looks right. The other clients look like their running around with messed up animations.

I believe this will still occur with what your suggesting, if I'm reading it right.
#3
03/12/2014 (6:16 am)
Found something interesting, which I think is the cause for most of my fixes being messed up. I'm trying to turn off actionAnimation changing at all while the character is attacking.

void Player::setActionThread(U32 action,bool forward,bool hold,bool wait,bool fsp, bool forceSet)
{
	if (!mDataBlock || (mActionAnimation.action == action && mActionAnimation.forward == forward && !forceSet) || attacking)
		return;

This will stop the transition from occurring on the client who does the attack, however players who are watching, will still allow the action animation to update...

attacking is a networked boolean, which is setup originally by the server, when it sees an image's trigger update to firing.