PathManager ideas
by Steve Nelson · in RTS Starter Kit · 09/28/2005 (9:48 am) · 9 replies
I just started using the RTS Kit a few days ago and i'm finally wrapping my head around how it all works. I'm thinking about building my first bit of complex code and saw the PathManager is incomplete.
Has anyone extended the PathManager in the SDK? I can't seem to find any threads on this, but maybe i'm looking in the wrong place.
My first thought is that there needs to be a global Array of waypoints for each moving object. So i was going to add a PathManager::setWaypoints(%obj, %waypointArray) function which assigns an array of waypoints to an object. Then I'll update the getNextWayPoint() to look up the object's array, grab the next waypoint and return it.
Am I on the right track? Anyone have some other thoughts?
I'm suddenly getting excited about Torque.
Steve Nelson
Has anyone extended the PathManager in the SDK? I can't seem to find any threads on this, but maybe i'm looking in the wrong place.
My first thought is that there needs to be a global Array of waypoints for each moving object. So i was going to add a PathManager::setWaypoints(%obj, %waypointArray) function which assigns an array of waypoints to an object. Then I'll update the getNextWayPoint() to look up the object's array, grab the next waypoint and return it.
Am I on the right track? Anyone have some other thoughts?
I'm suddenly getting excited about Torque.
Steve Nelson
#2
I'm really having trouble doing common programming tasks in torque script. Simple stuff like Array length has been unbelievably hard to get around. So looping over an array has been a Herculian challenge. As dumb as it sounds, global counter variables has worked. Very very kludge.
I just came across a few code bits with vector specific functions: VectorSub, VectorNormalize, VectorScale, VectorLen. But there don't appear to be functions like ArrayLen, ArrayPop ArrayPush etc. None of this appears to be documented, is there hidden documentation somewhere?
Steve Nelson
09/28/2005 (8:13 pm)
Honestly, me neither. I just don't know what i'm doing yet!I'm really having trouble doing common programming tasks in torque script. Simple stuff like Array length has been unbelievably hard to get around. So looping over an array has been a Herculian challenge. As dumb as it sounds, global counter variables has worked. Very very kludge.
I just came across a few code bits with vector specific functions: VectorSub, VectorNormalize, VectorScale, VectorLen. But there don't appear to be functions like ArrayLen, ArrayPop ArrayPush etc. None of this appears to be documented, is there hidden documentation somewhere?
Steve Nelson
#3
SimSets are the fundamental abstract data structure that should be used in TorqueScript for a very large portion of the container-type objects you find yourself needing. The primary reason is that they work with the SimObject's smart referencing capability, which allows SimObjects to auto-magically handle deletion notification, as well as a host of other underlying internals so you don't need to.
I would highly suggest doing a bit of research on SimSets and what they can do for you...I'm pretty confident you'll be getting rid of the concept of arrays entirely, at least for a vast majority of the work you want to do!
09/29/2005 (1:24 am)
Well, arrays aren't normally the technique you want to use within TorqueScript, so the functions aren't necessarily exposed/enhanced.SimSets are the fundamental abstract data structure that should be used in TorqueScript for a very large portion of the container-type objects you find yourself needing. The primary reason is that they work with the SimObject's smart referencing capability, which allows SimObjects to auto-magically handle deletion notification, as well as a host of other underlying internals so you don't need to.
I would highly suggest doing a bit of research on SimSets and what they can do for you...I'm pretty confident you'll be getting rid of the concept of arrays entirely, at least for a vast majority of the work you want to do!
#4
It's pretty buggy though, and the patch proposed in the comments doesn't fix all of the problems, but it's easilly fixed.
--
Hans
09/29/2005 (1:37 am)
I can recommend this resource, when you want to start sorting and the such.It's pretty buggy though, and the patch proposed in the comments doesn't fix all of the problems, but it's easilly fixed.
--
Hans
#5
09/30/2005 (6:34 pm)
Excellent! Now we're talking. Thanks I'll read up on it. My copy of 3D Game programming just arrived today. If i can just finish my real work i can start playing!
#6
Seems like it could get very processor intensive checking the distance of every unit every time a unit moves.
thanks again
Steve Nelson
09/30/2005 (6:39 pm)
Another question... Do you have any suggestions on making the pathfinder script go around objects such as buildings/trees etc? i.e. if a unit is close to another unit have it turn left/right move X distance then turn up/down Y distance?Seems like it could get very processor intensive checking the distance of every unit every time a unit moves.
thanks again
Steve Nelson
#7
09/30/2005 (7:24 pm)
I'm pretty sure they are working on fixing VisManager, to allow collision and units to walk around objects and such.
#8
FYI, the visManager re-write is designed to allow for more performant vis checking, and can be used to help implement collision checking as well, but is basically unrelated to pathfinding/avoiding objects.
09/30/2005 (7:26 pm)
There is a big difference between the visManager re-write, and implementing A* pathfinding. There are a couple of tutorials/resources here on GG discussing A*, as well as hundreds of white papers on the 'net.FYI, the visManager re-write is designed to allow for more performant vis checking, and can be used to help implement collision checking as well, but is basically unrelated to pathfinding/avoiding objects.
#9
09/30/2005 (7:50 pm)
Oh in that case.. I'll write something up in the next few weeks to move around objects. I'll post the changes here.
Torque 3D Owner Stephen Zepp