The Human Pond is a recently started blog, we are three guys who write about games, movies, music, art and what ever we feel like writing about. This group is our link into the ModDB community.

Report RSS HD Video Tutorial - NPC Navigation

Learn how to use the info_node entity to enable NPCs on your maps to navigate properly.

Posted by on - Intermediate Mapping/Technical


Please give me a comment telling me what you think.
Also, don't forget to give me tutorial requests!

Post comment Comments
Croco15
Croco15 - - 1,240 comments

Thanks for the tutorial, it great!

Reply Good karma Bad karma+2 votes
NullSoldier
NullSoldier - - 973 comments

Very interesting although I would love to have had a simple explanation on how the entire AI system works with nodes. You've explained how to do it but not how it works which I feel is the most important part. Although I can gather that some how Source builds the node graph using it's own algorithms and then when an NPC is supposed to move to a node destination it uses the node graph to pick which nodes to use to travel.

(I did not mean to reply to the freaking dog guy. I hate that dog it always stares me in the face like a ******* freak as if it wishes to take my very soul)

Reply Good karma Bad karma+3 votes
Croco15
Croco15 - - 1,240 comments

Lol, yeah, Gino tends to do that when he wants food. I also noticed that I didn't put an S at the word "it"...

Reply Good karma Bad karma+2 votes
Silverfisk Author
Silverfisk - - 1,080 comments

Thanks NullSoldier!
I felt that the part I had most problems with myself when learning this was how to actually place the nodes.

The AI works with the nodes like this:
1. Get a destination.
2. Find the closest node to self and destination.
3. Calculate path between destination and closest node.
4. Go the path.

* It avoids collision with dynamic (physics for example) objects by doing colission test in front of itself all the time, if an object is in the way it will try to go around it.

Is that what you wanted to know?

Reply Good karma+1 vote
Silverfisk Author
Silverfisk - - 1,080 comments

Thank you Croco!

Reply Good karma+1 vote
Chrissstrahl
Chrissstrahl - - 411 comments

@Silverfisk
Good Tutorial good Voice.
If you like you can use the information given below.

@NullSoldier - LOL, it's just a little dog!
The AI-Nodes are connected when the map is loaded for the first time or when the nodes have changed. Connected means that each node is targeting each other and so on as long as they are in valid range of 249 units.

When the AI is placed outside of the connected node field the AI should be able to get to the target-destination or closest node if there are no blocking objects.

Nodes which are not connected will not work!

The AI does not follow the nodes strictly unless it is instructed to, it uses the shortest path between the connected nodes and avoids objects which are in the way by orientating on the nearest node leading to the target destination.

30 unites distance(or slightly more) from each object is ideal, because the Bounding-box of the AI is used for collision detection(with walls and other entities) and if the floor is not exactly plain, as for example if there are stairs, the AI should be able to use stairs which are under 32 units in height.

This is how it works in ef2, I'm pretty sure it's the same with hl2, maybe the nodes distance has changed, but the rest shouldn't have.

Reply Good karma Bad karma+3 votes
Silverfisk Author
Silverfisk - - 1,080 comments

Thanks man!
Doesn't look like you had much use of it though. ;D
Nice explaining!

Reply Good karma+1 vote
Chrissstrahl
Chrissstrahl - - 411 comments

Well, I did I learned that the nodes get drooped to the floor, that never occurred to me before. :)

Reply Good karma Bad karma+1 vote
cW#Ravenblood - - 6,703 comments

thx also from moddb

Reply Good karma Bad karma+2 votes
wazanator
wazanator - - 761 comments

Very nice tutorial

You might also want to create a tutorial that shows people how they can place and move props in game then have it save it in hammer

Reply Good karma Bad karma+2 votes
Silverfisk Author
Silverfisk - - 1,080 comments

Thanks!
That's for another tutorial though, this one was just about navigation.

Reply Good karma+2 votes
Jike
Jike - - 177 comments

Dont forget to say, that autosaving has to be off for that to work!! :D

Oh, and maybe I can just tell you my request here: I'd like to get flying npcs to work, but I dont know how...

Reply Good karma Bad karma+1 vote
Silverfisk Author
Silverfisk - - 1,080 comments

That's a good point.
Thank you for the request also!

Reply Good karma+1 vote
absalom
absalom - - 1 comments

excellent.

I also have a request - couldn't figure out how custom animations for custom NPCs can be implemented in the game (for a better description please follow this link: halflife2.net/forums/showthread.php?t=168469). I really don't need a tutorial for this problem but couldn't find anything about it on the net, so if you'aware of the problem I'd appreciate even a simple text explanation :)

Thanx!

Reply Good karma Bad karma+1 vote
Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: