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.

Post tutorial Report content 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 on - 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!

Comments
Croco15
Croco15

Thanks for the tutorial, it great!

Reply Good karma Bad karma+2 votes
NullSoldier
NullSoldier

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

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

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

Thank you Croco!

Reply Good karma+1 vote
Chrissstrahl
Chrissstrahl

@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

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

Reply Good karma+1 vote
Chrissstrahl
Chrissstrahl

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

thx also from moddb

Reply Good karma Bad karma+2 votes
wazanator
wazanator

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

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

Reply Good karma+2 votes
Jike
Jike

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

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

Reply Good karma+1 vote
absalom
absalom

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
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.

Platforms
Windows, VR, X360, XBOX, PS3
Company
Valve
Contact
Send Message
Licence
Commercial
Release date
Engine watch
Start tracking
Tutorial
Browse
Tutorials
Share
Related Engines
Source
Source Commercial
Related Groups
Level Design Group
Level Design Group Hobbies & Interests
The Human Pond
The Human Pond Hobbies & Interests
Valve
Valve Developer & Publisher