The Source engine is a 3D game engine developed by Valve Corporation. Its unique features include a large degree of modularity and flexibility, an artist-driven, shader-based renderer, accurate lip sync and facial expression technology, and a powerful, efficient and completely network-enabled physics system.

Report article RSS Feed HD Video Tutorial - NPC Navigation

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

Posted by Silverfisk on Nov 30th, 2009
Intermediate Mapping/Technical.

Rundown
First, we learn how to best place the info_node entities around our maps.

Then we learn how to edit the nodes ingame, as well as how to debug the navigation by using the console to order a NPC around the map.

Useful console commands
map_edit 
developer 1
npc_select
npc_route
npc_go
npc_go_do_run 0 or 1


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

Post comment Comments
Croco15
Croco15 Dec 1 2009, 12:01am says:

Thanks for the tutorial, it great!

+2 votes     reply to comment
NullSoldier
NullSoldier Dec 1 2009, 2:06am replied:

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)

+3 votes     reply to comment
Croco15
Croco15 Dec 1 2009, 4:29pm replied:

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"...

+2 votes     reply to comment
Silverfisk
Silverfisk Dec 1 2009, 9:20pm replied:

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?

+1 vote     reply to comment
Silverfisk
Silverfisk Dec 1 2009, 9:10pm replied:

Thank you Croco!

+1 vote     reply to comment
Chrissstrahl
Chrissstrahl Dec 1 2009, 7:25am says:

@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.

+3 votes     reply to comment
Silverfisk
Silverfisk Dec 1 2009, 9:22pm replied:

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

+1 vote     reply to comment
Chrissstrahl
Chrissstrahl Dec 1 2009, 11:59pm replied:

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

+1 vote     reply to comment
cW#Ravenblood
cW#Ravenblood Dec 1 2009, 7:51am says:

thx also from moddb

+2 votes     reply to comment
wazanator
wazanator Dec 1 2009, 5:43pm says:

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

+2 votes     reply to comment
Silverfisk
Silverfisk Dec 1 2009, 9:09pm replied:

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

+2 votes     reply to comment
Jike
Jike Dec 2 2009, 3:49pm says:

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...

+1 vote     reply to comment
Silverfisk
Silverfisk Dec 2 2009, 11:13pm replied:

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

+1 vote     reply to comment
absalom
absalom Apr 29 2010, 8:54am says:

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!

+1 vote     reply to comment
Post a Comment
click to sign in

You are not logged in, your comment will be anonymous unless you join the community today (totally free - or sign in with your social account on the right) which we encourage all contributors to do.

2000 characters limit; HTML formatting and smileys are not supported - text only

Platforms
Windows, PS3, X360, XBOX
Company
Valve
Contact
Send Message
Official Page
Valvesoftware.com
Licence
Commercial
Release Date
Released Oct 31, 2004
Engine Watch
Track this engine
Tutorial
Browse
Tutorials
Report Abuse
Report article
Related Engines
Source
Source Commercial Released Oct 31, 2004
Related Groups
Level Design Group
Level Design Group Hobbies & Interests group with 556 members
The Human Pond
The Human Pond Hobbies & Interests group with 9 members
Valve
Valve Developer & Publisher