Game Development Community

Walking And Running Ai Help Needed

by Donnie Hutson Jr · in Torque Game Engine · 05/18/2010 (10:54 am) · 4 replies

I have a walk animation I uploaded at torque.abigholeintheweb.com/public_system/useruploads/walk.zip, if anyone would like to use it for the soldier pack. I have my ai follow a path and it works great, the only draw back is they run every where they go. I would like to have them just walk during patrol and then run when needed. Thanks in advance for any help anyone might give in this matter and dont forget to get the walk.dsq. I also have the torque motion pack installed in my tge152 and currently my player can walk great with a key press, so the engine is almost there for the added walk animation already, my only drawback is the lack of programming knowledge. You would think by now this problem would have been resourced already, surely there is more, who would like to see their AI walking and running, and hopefully this great community can help come up with a solution. Anyways, I hope you can get some type of use out of the walk.dsq file I made, it might not be the greatest walk there is, but its a start and has the triggers setup for foot dust and sound. Thanks to all who help me in this matter and thanks for reading this at least........

About the author

Army at 17, proud papa and husband of the most amazing woman I have ever met!! Electrical Engineer by trade, Computer geek by night. Still learning and loving every minute.


#1
05/19/2010 (1:00 am)
First thing is that you can use the setMoveSpeed (I think that's the name) in AIPlayers to make them slow down (try 0.2 for walking speed). Then it's just a matter of adding your animation to player.cs, and making sure its ground transform is correct. Torque chooses animations based on a few factors - most relevant are the direction it's supposed to travel in, and how fast it goes that way. The direction is defined for you in player.cc, and it's determined by the type of animation you list your walk.dsq as ('run' for forwards movement, I think). The speed is defined by the animation's ground transform, and Torque chooses the animation whose speed most closely matches the player's current speed (I'm pretty sure).
#2
05/19/2010 (4:36 am)
Hey Daniel, ya I do have it set to about .17 actually and replaced my run.dsq with walk.dsq, to simulate a baddie walking on patrol. However, I'm looking for a better way of making him walk, without removing the run animation. I would like to have both and hopefully I can dig into the code today. I know player and Aiplayer movements are controlled in the player.cc, player.h, gameconnectionmoves.cc files, if I'm missing where I need to look, please let me know. Thanks for the reply....
#3
05/20/2010 (7:04 am)
I was under the impression you could add multiple named animations such as 'run' in your TSShapeConstructor. I may be wrong, but that's what I thought I remembered ;P. If not, then you'll need to go about adding new 'walk' animation definitions. See pickActionAnimation for better info ;P. (In my current codebase I've ripped all that out and replaced it with scripted action animation definitions.)
#4
05/20/2010 (8:18 am)
Hey Daniel, ya I have a walk animation already setup for the player, its the AIPlayer that I'm trying to make walk without losing the ability to run also. Im going through the code now and if I get anywhere I'll post my results.