Game Development Community

AI Animation Jerky On FollowPath()

by Scott Doerrfeld · in Torque Game Engine · 07/17/2006 (8:58 pm) · 4 replies

I am having this problem with my AI Players where their forward animation does not play smoothly when they are set to followPath(). I am using a 'forward' and a 'root' animation that I created, and what appears to happen is the root animation keeps trying to interrupt the forward animation as the player moves along the path. It's like the AI Player keeps starting/stopping. Has anyone else seen this behavior with followPath()? Any suggestions on what I can do to resolve this? Thank you.

#1
07/17/2006 (10:57 pm)
I've seen similar behaviour with AIPlayer setMoveDestination() (i think that's it),
but i figured it was something i broke.

i'd love to hear more.
#2
07/18/2006 (6:13 am)
Yep, I've run into it before. One thing I can suggest is try, if possible, to not have your nodes too close together. I don't remember exactly what I changed to fix it, but I do remember it involved adjusting some tolerance values in the follow path code. Sorry I don't remember what they were, but as I remember if you look at the code it wasn't too difficult to find. I also ended up commenting out the code that slowed the AIPlayer down as it neared its destination. Its caused unrealistic movements like walking in place.
#3
07/18/2006 (6:39 am)
What's causing this?

It's a precision issue that is specific to AIPlayers. Basically the engine believes you're travelling at a vector of (0,0,0) due to the rounding math that happens during network updates.

It also happens when your framerate is low or when your network connection has high latency and the updates are starting to lag behind. When this happens, the AIPlayer's velocity is zero before Torque can receive it's update from the server. pickActionAnimation() will thus use the root animation. When the update does arrive though, pickActionAnimation() will briefly use the forward animation until it is (again) updated with a zero vector.

What can you do to remedy this?

* Increase the speed at which the AIPlayer travels.
* Or better yet, increase the packet rate/size of your network simulation.

So why does this only apply to AIPlayers?

Control objects (ex: player) get higher priority than non-control objects (ex: AIPlayer) and are scoped at a higher rate. Also, the rounding math doesn't seem to happen with Players so one could assume it has a higher precision when writing that packet out.

Edit:

More info.
Player animation bug at slow speeds
#4
07/28/2006 (8:42 am)
I followed the link Stefan provided and so far it has helped me eliminate the problem with slow-moving AI players. Thougth I still have several AI players to add. Will report if I experience any problems. Thanks a lot, Stefan!!!