Jump to content
The Dark Mod Forums

Path Nodes


Springheel

Recommended Posts

Information on the wiki is a bit sparse on this.

 

I'd like to have a guard that mostly stands in one place playing his idle animations, but will randomly wander off to one of two different locations and then come back to the same spot. I'm pretty sure AI can already be given a random chance of choosing between two locations, but I'm not sure exactly how to set it up.

 

Let's say X is the guard's main location, and A and B are the other two pathnodes (which I assume would be regular path_corner entities). I want him to spend most of his standing at X, but occasionally patrol to A or B.

 

 

 

 

 

A ---------------- X ------------------ B

 

 

 

Do I have to put a node at X? If so, what kind of node? Does the AI have to target both A and B? How do I make sure he stands in place at X idling for a while (path_cycleanim?)?

 

I read that the "wait" keyword works on path_cycleanim, does that mean "random" does as well?

Link to comment
Share on other sites

I think X does need to be a path node, yes. You might use a path_wait for that, which can have them wait for a random amount of time. I believe this procedure should work to set up what you want:

 

0. Create a path_wait at point X and path_corners at A and B.

1. Set the AI's target to point X initially (assuming that's where you want them to start out).

2. Set up the time you want the AI to wait at point_x by editing the path_wait spawnargs (it can be random, see below:)

"editor_var wait"		"Minimum time to wait (seconds)."
"editor_var wait_max"	"Maximum time to wait (seconds).  Set to 0 if you never want it to wait more than the minimum

3. When a path_* entity has more than one target, the AI will choose randomly between them. So to get the AI to go randomly to A or B with a 50/50 chance, just have the path_wait target both path_corners at points A and B. Unfortunately there doesn't seem to be a way to adjust the probability (yet), it just chooses randomly from its list of targets with the same chance for each one.

4. The path_corners at points A and B should both target the path_wait at point X. This will make the AI return back to point X once they reach point A or B.

 

So the target diagram should look something like this (where the arrows represent target lines in the editor)

A(path_corner)<----------X(path_wait)-------->B(path_corner)
|........................^^.............
......|
\-----------------------/  \------------------/

Link to comment
Share on other sites

Thanks Ish, I'll try that out. From the way it was described I was worried that the AI would be dormant (not playing any animations) at a path_wait .

Link to comment
Share on other sites

"Waiting" in this context just means not continuing on to the next path node. It shouldn't affect the normal idle animations being played. (If it does, I'd call that a bug.)

My games | Public Service Announcement: TDM is not set in the Thief universe. The city in which it takes place is not the City from Thief. The player character is not called Garrett. Any person who contradicts these facts will be subjected to disapproving stares.
Link to comment
Share on other sites

4. The path_corners at points A and B should both target the path_wait at point X. This will make the AI return back to point X once they reach point A or B.

You also need a path_corner at point X to make them walk back. The path_wait will just make them wait where they are at the moment.

	  ---------------->  X(path_corner) <---------------	 
 |						 |						|
 |						 v						|
A(path_corner)<----------X(path_wait)-------->B(path_corner)

Link to comment
Share on other sites

Angua, I don't understand that part. If you target the path_wait directly from B, what would happen? The AI would get to to B, and then wait *there*? I've always assumed that AI go to the pathnode location before activating whatever behaviour (cycle_anim, wait, etc) that pathnode has associated with it; is that not correct?

Link to comment
Share on other sites

If you target the path_wait directly from B, what would happen? The AI would get to to B, and then wait *there*?

Yes, that would happen. You have to link "B" with "X" AND THEN with "wait"

Those actions linked to the path-corners (wait, hide, face object, eat shoe etc...) are activated after the AI comes to this path corner and then checks what to do at this point.

Link to comment
Share on other sites

Huh. That would explain some difficulties I've had in the past. So I presume the path entities that show up as small boxes (compared to path_corner) are essentially 'behavoiur' nodes, rather than 'pathing' nodes?

 

Btw, I notice that the path_corner entities have directional arrows on them...do these actually mean anything?

Link to comment
Share on other sites

Btw, I notice that the path_corner entities have directional arrows on them...do these actually mean anything?

 

I haven't noticed any difference in the direction they're pointing.

|=-=------=-=|

happycheeze.deviantart.com

 

Moddb

 

Gamers Outreach, a nonprofit that uses videogames to raise money for chairty.

|=-=------=-=|

Link to comment
Share on other sites

Btw, I notice that the path_corner entities have directional arrows on them...do these actually mean anything?
No, they are common to many of these entity symbols in the editor. They do have meaning in some, such as there is one to turn the AI to face a certain direction. With path_corners they have no effect but you can turn them to help you visualize the next direction he would go if desired.
Link to comment
Share on other sites

Yeah, I plan on adding things to the wiki once I get a chance to try them out.

Link to comment
Share on other sites

Can you not add more than two targets to a pathnode? When I have the following it seems to work:

 

"target" "path_corner_1"

"target_2" "path_corner_2"

 

but if I try to add a "target_3" "path_corner_3" it just draws a target line to the map origin instead. I can add a "target_3" that links to a "path_wait" ok, but not a "path_corner".

 

edit: I'm not sure I have things set up properly, as my AI is just standing there not patrolling (and he's facing an odd direction).

 

Here's an image of the pathnodes:

 

pathfinding1.jpg

 

The AI is targetted at X. The small box is the path_wait_1 node, which X is targetted at. Both A and B are targetted at X and X is targetted at them. But when I run the map, the guard is just standing at X, facing north(?) for some reason. He doesn't go anywhere.

 

I'm still getting a warning that AAS32 is out of date when starting the map, would that have an impact? How do you go about finding out whether AAS areas are set up properly (whatever that even means)?

 

(Btw, is there no visual difference between entity A that is targetted by B, and entity A that both targets *and* is targetted by B?)

Link to comment
Share on other sites

The path_wait_1 node needs to be targeted at A and B, rather than X being targeted at A and B. path_wait_1 is still the AI's "current pathfinding node" even though it's not standing at the node's physical location, so you need to make links from path_wait_1 to A and B before the AI will continue on to A/B.

 

Slightly unintuitive I know, but probably more flexible this way.

 

path_wait_1 goes to A, A goes to X, X goes to path_wait_1

path_wait_1 goes to B, B goes to X

 

(Like in angua's diagram, though she's marked both the path_corner and the path_wait as "X".)

My games | Public Service Announcement: TDM is not set in the Thief universe. The city in which it takes place is not the City from Thief. The player character is not called Garrett. Any person who contradicts these facts will be subjected to disapproving stares.
Link to comment
Share on other sites

One clumsy way to dabble with probabilities is to add more points. So if you wanted the AI to go to B twice as often as A then add C also at position B.

 

But I seem to be able to target only two path_corners. if I try to add a "target_3" "path_corner_3" it just draws a target line to the map origin instead. I can add a "target_3" that links to a "path_wait" ok, but not a "path_corner".

Link to comment
Share on other sites

Maybe there is a limit of only two targets if the randomizer can only choose between two. In which case you have to branch. Let's see... branch to two waits instead of one and one of those branches to two while the other only goes to one.

 

wait1 goes to A

wait2 goes to B and C

Link to comment
Share on other sites

There should be no limit for the number targets one entity can point to. What Springheel encounters is probably a DarkRadiant bug.

 

However, I'd need to look at the code for path_corners to see if the probability actually changes if you target one entity more than once - I think the algorithm catches this case and doesn't insert it, IIRC.

Link to comment
Share on other sites

I'm surprised target_2 works at all

 

It does work, but I'll try it without the spaces too and see what happens.

 

I've got it set up pretty much the way I want it now. The only thing is that the AI just stops at X and stays whatever way he was facing when he got there. I'd really like him to turn and face a particular direction. I suppose I could do that by making a new path corner that forces him to take a few steps in the direction I'd like him to face, but that seems awkward.

 

I assume path_turn will do what I want, but again, I'm not sure of the order here. Would I target path_turn from X, and then path_wait from path_turn? Or do I target both path_wait AND path_turn from X?

 

The wiki definitely needs some more info on this. :)

Link to comment
Share on other sites

You have to link them in this order: "x" -> "Path_turn" -> "wait"

The guard will go to "x", then turn around and then wait

If you link it like this: "x" -> "wait" -> "Path_turn"

Then the guard will go to "x", wait there for an amount of time and then turn around (for a second)

Edited by Silencium18
Link to comment
Share on other sites

And as I recall you orient path_turn the way you want the AI to face but there is an alternative, something like path_face and I think you name an entity or something or maybe an angle - maybe a choice. I think I used that to face the statue in SL.

Link to comment
Share on other sites

Wow, the node system is so counter-intuitive. Why didn't they just make path_corners able to take a "wait" property?

Link to comment
Share on other sites

There should be no limit for the number targets one entity can point to. What Springheel encounters is probably a DarkRadiant bug.

 

However, I'd need to look at the code for path_corners to see if the probability actually changes if you target one entity more than once - I think the algorithm catches this case and doesn't insert it, IIRC.

Yeah, I seem to recall that the code that adds targets to the entity only stores unique targets, so adding one more than once probably won't work.

 

We could probably add some code that uses an additional spawnarg on the path_* entity to set the probability of each of the targets, so you would have something like:

"target_1" "node_A"
"target_2" "node_B"
"prob_1" "0.8"
"prob_2" "0.2"

To say there's an 80% chance they'll go to/perform the action in A first, and 20% chance of going to/performing B.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • Ansome

      Finally got my PC back from the shop after my SSD got corrupted a week ago and damaged my motherboard. Scary stuff, but thank goodness it happened right after two months of FM development instead of wiping all my work before I could release it. New SSD, repaired Motherboard and BIOS, and we're ready to start working on my second FM with some added version control in the cloud just to be safe!
      · 0 replies
    • Petike the Taffer  »  DeTeEff

      I've updated the articles for your FMs and your author category at the wiki. Your newer nickname (DeTeEff) now comes first, and the one in parentheses is your older nickname (Fieldmedic). Just to avoid confusing people who played your FMs years ago and remember your older nickname. I've added a wiki article for your latest FM, Who Watches the Watcher?, as part of my current updating efforts. Unless I overlooked something, you have five different FMs so far.
      · 0 replies
    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
×
×
  • Create New...