Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → Making synced AI follow a path...
Making synced AI follow a path...
2000-10-07, 5:50 AM #1
I have a slight dillemma which has actually held up the release of a mod I'm working on for 7 months (because I got frustrated and didn't work on it for 6 months [http://forums.massassi.net/html/biggrin.gif]). Here's the problem:

This is for the iWac mod (you can get more info at Ultipla's website... http://www.jedilegacy.net/ultipla/). What I basically need is to have a bunch of moronic little creatures, Ewoks or Jawas, who will wander aimlessly around levels, but only through particular areas. I don't want the Ewoks, for example, to wander off their treetop platforms.

I have 2 basic ideas for how to pull this off. I've tried both unsuccessfully.

1. Set up a series of waypoints. When the AI sees one of these, it will walk directly towards it. When it reaches the waypoint it will turn and align itself in the direction the waypoint is facing, which would presumably lead to the next waypoint. This would get them through trickier areas. The waypoints would be ghosts- the problem was that I could never get them to consistantly see and head toward the ghosts, and couldn't get them to turn in the right direction once they got there.

The second idea is a bit simpler and probalby wouldn't work as well in practice, but I thought it might work: Simply flag all the sectors except the ones it could enter with some sector flag ( probably that "No AI" flag) and then at each pulse have the cog check the sector flags for the AI. It never even registered that it was in a sector with those flags, so that failed.

Anyone have any ideas or suggestions on how to make these work?

Thanx...

-Lik
2000-10-07, 12:02 PM #2
Rbots uses a series of ghost objects (path nodes) to create 'paths' to determine where to go next. The exact order is entered into a 'nav' cog via JED.

At startup, the bot sends a request to the nav cog asking for the closest node. It then moves towards this node until it gets to within a certain distance and then sends a request to the nav cog saying 'I'm here' and asking for another node to move towards.

Actually the Rbots code is a little more complex than this to incorporate intersecting paths, changing directions, making decisions etc.

You are more than welcome to dissect the Rbots code and use any part of it you like, as long as you mention the origin.

Hope this helps...

Raynar


------------------
... the Jedi I admire the most, met up with Darth Maul, now he's toast ...
Rbots - a project to develop a working Bot for Jedi Knight... download the latest development version here
Pagewizard_YKS: "making your own lightsaber doesn't make you a nerd... "
Raynar - the man with a 10.75" ePenis
2000-10-07, 3:26 PM #3
The problem is I don't really need anything that complex... I'd much rather use visual contact as the signal to move towards the node, and then just aligning itself with the direction of the node...

would it be possible to set up a ghost so that when the AI sights this specific class of ghost it would move towards it?

In addition, is it possible to point the AI in the direction of the pathnode it's moving toward when the AI finally reaches node? I've tried a lot of stuff, but it's only worked sporadically, and frequently not at all.

Thanks for you help so far... I appreciate it.

-Lik

[This message has been edited by LikWid (edited October 07, 2000).]
2000-10-07, 7:37 PM #4
Ok, here's an idea.

I think you need to create a new 'ghost' class of objects, so it doesn't get confused with other ghost ibjects for sound location etc. Copy the ghost template and name it to something like 'pathnode'.

Now using a pulse() in your ai cog, look for the nearest or most direct node using getthingtemplate(). Set it to face the node and off it goes.

Once it gets there, you can point the ai to the direction the node is facing, using 'GetThingLVec(node)' and setting the ai direction from that.

Just an idea and I picking up ideas for the bots too [http://forums.massassi.net/html/smile.gif]

Cheers...

Raynar


------------------
... the Jedi I admire the most, met up with Darth Maul, now he's toast ...
Rbots - a project to develop a working Bot for Jedi Knight... download the latest development version here
Pagewizard_YKS: "making your own lightsaber doesn't make you a nerd... "
Raynar - the man with a 10.75" ePenis
2000-10-08, 3:45 AM #5
Thanx... I'll try that...

Only 1 more question- since you seem to know what you're doing w/ this sort of stuff, what technique would you use for determining when the AI's reached the node? VectorDist? I can't think of anything else right this second...

I think that once it reaches the node and turns in the direction it should go next, I should give it a push... so it doesn't see the node it just reached and home on that.

Thanx for your help... I appreciate it.

-Lik
2000-10-08, 8:40 PM #6
Here's a snippet from Rbots...

Code:
if (VectorDist(GetThingPos(rbot), GetThingPos(newpos)) < .25)
{
  // look for new position code here
}


Cheers...

Raynar


------------------
... the Jedi I admire the most, met up with Darth Maul, now he's toast ...
Rbots - a project to develop a working Bot for Jedi Knight... download the latest development version here
Pagewizard_YKS: "making your own lightsaber doesn't make you a nerd... "
Raynar - the man with a 10.75" ePenis

↑ Up to the top!