Game Development Community

What are the Slot parameters taken by playThread(int slot, str)

by suddysud aka mrclean · in Torque Game Engine · 02/24/2006 (2:24 pm) · 8 replies

Greetings;

What are the slot parameters that can be taken by these methods below?
What does slot mean? and is it based strictly on the way animations were set up or something?



bool ShapeBase::playThread( int slot, string sequenceName)

bool ShapeBase::setThreadDir( int slot, bool isForward )

bool ShapeBase::stopThread( int slot )

bool ShapeBase::pauseThread( int slot )

-----------------------------------------------------------------------------------------------

and for the method below, what is the bool hold and bool fsp stand for ? is it specific to specific animations? what does fsp stand for?


bool Player::setActionThread ( string sequenceName[, bool hold=false, bool fsp=true])

-------------------------------------------------------------------------------------------------

Thanks again

#1
02/25/2006 (5:01 pm)
I've been messing around with both of these functions also and from What I can gather, it's something like this:

%obj.playthread(slot,sequenceName)

slot- an integer representing the thread to use (arm, movement, look, death) I think there are 4 of these, but i've only used zero for this value so far.

sequence name- the name of the animation to play. For player animations this name corresponds with the name at the end of the dsq file eg. "root", "run", "jump" check the player.cs file for more details.


I would like more info on these also. If you look in the sourcecode, setActionThread seems to even have a few other parameters:

Player::setActionThread(U32 action,bool forward,bool hold,bool wait,bool fsp, bool forceSet)
#2
02/25/2006 (8:50 pm)
H Sam;

thanks for the feedback.

correct me if I am wrong. but the only setActionThread method accessible to torquescript from player class is
ConsoleMethod( Player, setActionThread, bool, 3, 5, "(string sequenceName, bool hold, bool fsp)")
{
   bool hold = (argc > 3)? dAtob(argv[3]): false;
   bool fsp  = (argc > 4)? dAtob(argv[4]): true;
   return object->setActionThread(argv[2],hold,true,fsp);
}

additionally, here is what I discovered from playing around with the playthread slots.

try this for yourself and see what happens . run these from the console

%obj.playthread(0, "run");
%obj.playthread(1, "run");
%obj.playthread(2, "run");
%obj.playthread(3, "run");

It seems as though these slots affect different aspects of the run animation specified.
you can also try this with the jump sequence as well.

my hunch is that all these slots are connected to each other and when the sequence operates as it is supposed to it's supposed to progress from slot 0 to 1 to 2 to 3 to 4.
I think you'll notice that slots 0 might not get the full run going neither will another slot, the complete run animation only seems to happen when you hit a specific slot number.

As for setActionThread - i read a bit about that in another thread. basically they say that it works like this. IF you call setActionThread to do something like run or jump and your player is not in the appropriate motion to accomodate it, your call to setActionThread will be totally ignored. So the engine determines what call to setActionThread gets ignored and what gets played and most of the time it seems to get ignored.


From what i gather from the other thread , in order to make kork walk then go right into a wave and then a run , you would have to modify the source code or use the suggested patch .

to keep my hands out of the source i'll just call stop and call the next animation with playthread() immediately thereafter and hope it doesn't look jerky.

Anyway if anyone know more details about the slots in playthread that would be great information.
#3
02/25/2006 (9:37 pm)
If you have the same animation going on multiple threads at once you'll get weird results. The playThread stuff IIRC is to let you trigger animations on mounted objects... at least so the C++ comments say. They might be a little inaccurate though. ;)
#4
02/25/2006 (9:57 pm)
Thanks

So you are saying that the slots represent different threads.

And the comment suggest that it is for mounted object like if I had a bouncing book bag or something.

what IIRC means?


Am I right on the setActionThread() is it just kinda weird like that and most of the time the engine will just cancel your request to setActionThread
#5
02/25/2006 (10:09 pm)
If i recall correctly.
#6
02/25/2006 (10:56 pm)
Thanks i think i'm straight with this - if someone would help me out with my other question about that pushTask that would be great?

What is the reasoning behind the pushtask mechanism ? and how is that better than just sticking all the task in the scheduler one after the other?

http://www.garagegames.com/mg/forums/result.thread.php?qt=40543
#7
02/28/2006 (4:41 pm)
Threads are used to blend multiple animations together.

For example, you can have the run animation in thread slot 0 and the look animation in thread slot 1. Because the look animation is a blended animation it will layer on top of the run animation and give you the ability to show the player running forward while having his arms move up and down (the look animation). This is done automatically in the Player's C++ code but you can do similar things through script.

If this is a bit unclear I would recommend grabbing Torque ShowTool Pro and playing with the Thread Controls and the demo player's animations for a bit.
#8
02/28/2006 (6:12 pm)
Cool and what is the max number of threads that i have ?

and what does setThreadDir do ?