Game Development Community

Walking Problem...Urgent

by Temasek Polytechnic · in Torque Game Engine · 08/22/2006 (1:20 am) · 13 replies

Please help.

My game allows me to add animals on the fly. When i add my first elephant, it walks normally(the walk animation is played). When i add my second elephant, the walk animation isn't played. It moves but the animation is still the root animation, so it slides around.

I really don't know how to solve it.

I have uploaded the elephantModel.zip file Here

This file contains:
1. server_elephant.cs(put this file in the server folder and rename it to elephant.cs)
2. client_elephant.cs(put this file in the data/shapes/elephant folder and rename it to elephant.cs)
3. DTS and DSQ files
4. Texture file

Please try it out and see if you can help me solve it. I've been stuck with this problem for a very long time.

Thank You.

#1
08/22/2006 (9:29 am)
I tried it and all animations worked for me just fine. No matter how many elephants I spawned in, they all played their walk animations.

So, maybe something is wrong with your aiPlayer.cs script?
#2
08/22/2006 (6:38 pm)
Can you pls send me your aiPlayer.cs script? I can use it to check against mine.

My e-mail is drmmr_420@yahoo.com.sg

And, did you make the elephant walk(setMoveDestination) or just played the walk animation?

Thank You.
#3
08/22/2006 (8:05 pm)
My aiPlayer script is stock. I spawned the elephants by using createElephant(%point) and they just walked on their own.

Upon further investigation I discovered that they didn't always play the walk animation correctly :(
It's very random for me, sometimes it works (for all elephants) and at other times it doesn't.
#4
08/22/2006 (8:26 pm)
Yes, the same thing happens to me.

Do you have any clue why this happens?
#5
08/22/2006 (10:08 pm)
Not as yet. I'm looking into it for you though. I will report anything I discover here.
#6
08/23/2006 (1:23 am)
Alright, many thanks!!
#7
08/23/2006 (6:39 am)
I took a look at the elephant.dts file in ShowToolPro and I noticed that the walk sequence doesn't contain any ground transform data...this may have something to do with it; but since it appears as though you are forcing the walk animation through scripting I don't rightly know if that[no grnd xforms] have anything to do with this.
#8
08/23/2006 (9:42 am)
I don't know what's going on exactly but I have some ideas.

A few things that may be contributing to the problem are:

- aiPlayers don't respond well to such low 'runForce' settings. It's a known bug within the source code. If you search you might find a fix. Also, this low 'runForce' setting would mean the elephants would only walk well on flat terrain, hills & slopes will cause them problems.

- If I disable the 'turn' function, the walk animation plays perfectly every time, regardless of how many elephants I spawn in. I think some of your schedule times are too low and that the 'turn' function is conflicting with the 'walk' function in some spots.

- The walk animation is very long in length.

- AI should be done in source code. Script is too slow.

- Bounding box is way too small for model (script setting).

That's about all I can come up with. Sorry I couldn't be of more help.

- Tim
#9
08/27/2006 (5:56 pm)
Thank you everyone for your help!

I will look into it and see what happens.
#10
08/27/2006 (6:48 pm)
I believe it may be with the scripting...I inserted the elephant shape as the playerAvatar and it seems to work fine. I popped into 3rd person and it runs the idle, run as well after I edited the TSShapeConstructor script to work with SDK code, ie run not walk. The sequence ran slow compared to the player velocity, but, afterall; it was a walk sequence running as run...even without ground transforms it seems to work[the sequence].

I tried putting the elephant on a path as the stock SDK AIrunner and that's where things went wacky. At some point along the path, it just spins and vibrates, as if it can't locate the next node in the path. It's got the eye node...?? I think I've read something in another Thread about AI shapes exhibiting this type of behavior; can't remember where or the why, sorry. I also didn't comment out the mounting of the weaponImage...that may have had some part of it. Good searching.

PS: It's been hit/miss with playThread and some things I've tried to do; you have to issue a stopThread on the Thread before you start running the same sequence. I do wonder what the animate function in AIPlayer.cs is for??? Also adding some code for onSequenceEnd, might help smoothe things out, over my head now...
#11
09/03/2006 (6:45 pm)
So does anyone have any progress on this problem?

@Tim

I removed the turn animation and that did help. However, after some time, some of the AIPlayers that could play the walk animation, did not play the animation.

I even increased the bounding box and the runForce.
#12
09/05/2006 (6:27 am)
Maybe your bot is either moving too slow, the framerate is too low, or the TGE's internal network is overloaded.
This is a very old issue, that never got properly addressed.

I just submitted a resource on how to fix it. It only takes two lines of code, really:
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=11218

With this you can have bots walking as slow as you want, and they'll always play the run animation properly.
#13
09/13/2006 (2:27 am)
UPDATE:

All right, i managed to get it to work...kinda

I removed all the playThread(0,"walk") and renamed the "walk" to "run" so the engine will call the "running" function automatically.

I also removed the turn function.

Now the elephant does not slide anymore.

When i inserted the turn function, the problem occured again, which means that there is something wrong with the turn function.

Do any of you guys know a better way to make the elephant turn more naturally?