Tutorial: All about info_nodes Last edited 1 year ago2023-02-17 10:33:40 UTC

This guide teaches you all about the usage of info_node. There is actually a bit more to it than just tossing a few of them into your map, so here we go:

1. What is a node?

A node is a navigation point used by the AI to help them move around in your map. You might have seen the message "Rebuilding Node Graph" when loading up a new map. At this stage the server is creating a network of lines between all nodes, so monsters and NPCs know where valid paths are from one node to another.

2. Nodes and AI

Even without the nodes, the AI in the GoldSrc engine knows how to walk through 3D space and navigate around small objects. This first example scenario puts the Zombie behind the counter. It will want to walk towards the player but it will fail since it can't determine a clear path. The AI might be smart enough to navigate past smaller objects but this large counter is too much for it to handle.
User posted image
Let's add some info_node (yellow squares). These points will generate a network of paths for the Zombie to take. As soon as it spots the player and it can't directly engage him, it will look to the node network for guidance and determine the fastest path from its current node to the node the player is currently closest to (indicated by the red line).
User posted image
Another example of the usage of nodes is to help the AI execute its special behavior. The AI code of this Grunt for instance, tells it to find cover when it is taking damage. It will look to the node network to find this spot, so I've placed a strategic node behind the sandbag.
User posted image

3. Node Networks

As we've established, nodes are important for the AI to function properly. But how is the network built? The server will determine if there is a straight visual line between two nodes and if there is, a link is made. I've placed four nodes in this room, and the links will look like this:
User posted image
You can actually see these links in game. Walk to a spot where you know a node is at and type impulse 199 into the console. This will show you all links for this node for a limited amount of time. Mind that it will only show this information for nodes you are close enough to, it will not show you the network for the entire map.
User posted image
A single node can hold very many link to the rest of the network. As long as there is a possible line of sight, there shall be another link.
User posted image
The visibility between the nodes can be blocked by solid world geometry and also by func_walls, as long as the wall is higher than 32 units.
User posted image
The point where the node will be created will always float at 32 units above ground level, so if a wall is 32 units or lower there will be a link. The server will also create links through non-solid brushes no matter how high they are.
User posted image

4. Four different types

Now we know how the network is built, we can expand on this knowledge by introducing the different types of monsters. There are four types: When the node network is built, it will also determine if a certain monster type can actually use the paths. A passage might be too small for a Large sized creature, so it will not establish a usable link between the nodes. You can highlight the different types by use of the other impulse commands. Small creatures will use the default path visible with impulse 199. impulse 197 will show you the paths for Normal sized creatures, impulse 196 for Large sized Creatures and impulse 195 for all airborne creatures (more on them later!).

In the following example you can see how the node network for Normal sized creatures (highlighted as a pink beam) doesn't extend under the low beam, because the brush blocks the way. Small sized creatures would however be able to crawl under it and use the default node link to find their way.
User posted image

5. How to properly place info_nodes

Now that we know how the node network works, we can move on to placing our nodes. What are good practices to get the most out of our nodes?

When the map starts, all info_node entities will fall to ground level, so it does not matter how high above the ground you place them. Node points will always be created 32 units above the ground where you place your info_node entity. Just make sure that the origin on the info_node is not inside the floor because this might cause the server to overlook them.
User posted image
So where to place your nodes? We've seen that AI can get into trouble whenever there is an obstacle or no clear line between it and the player. So it's good to add a few nodes to help them navigate around (green). You can see those nodes at the door and around the counter. Next to that it's good to place a few 'anchor points' (blue) in the room. This will give the AI a starting point to navigate from and it can serve as a spot for special AI behavior (such as the Grunt running for cover earlier).
User posted image
Some guides might tell you to place an info_node every X units. This is not strictly necessary. The server also doesn't require it. You can place two nodes at a distance of 9000 units from each other and they will still create a link, as long as they have a line of sight to each other. You just have to place enough nodes for the AI to have enough anchor points. If you do not have enough, you might encounter undesirable AI behavior. For instance, if the node a Grunt is falling back to is too far away, it will not resume its normal behavior for a long time. If the node is closer, it will then decide on a new course of action once it has reached the node.

As mentioned before, nodes will only create a link where there is a visual line of sight between two nodes. Luckily, it ignores movable brush entities, such as func_doors, so you can place this door in between the nodes and there still will be a link.
User posted image
The nodes will link through most brush entities that are movable, such as func_train, func_rotating, func_button, but also func_breakables. Next to that it will go through all non-solid entities such as func_illusionary and everything that uses zhlt_noclip 1.

6. info_node_air

Airborne monsters use a special type of node called the info_node_air. Just as regular info_node, these are used for navigation and AI behavior. However, you might find that airborne monsters are not as good as finding their way to the player as land creatures, since they also have to navigate in upward and downward directions. info_node_air will not drop down to ground level and info_node_air and info_node will not create links to each other.

Especially the Alien Controller will hardly move on its own without the help of air nodes. To make sure it will float down or up to engage players on their level, you'll need enough air nodes on that same level. Without these, the Alien Controller will just hover there, not knowing how to get to the player under the ledge. So when you use these monsters, it's good to place extra nodes.
User posted image
Other flying creatures that use the air nodes are the Stukabat and the Flyer Flock but also swimming creatures make use of them, such as the Leech and the Ichthyosaur. So make sure you place enough info_node_air entities in the waters that house them.
User posted image
The Apache and the Osprey technically also use the air nodes network for navigation, however, the Osprey will only function with path_corners to guide it (the game crashes without). The Apache will use air nodes to find its way to the player but isn't very good at it and will just weirdly wobble after the player. Setting up a network of path_corners for the Apache will make it behave far more realistically and it will then require no air nodes for its navigation.

7. Less is more

As we've established, you just need enough nodes for the monsters to find their way around. But often maps are littered with nodes that serve hardly any function at all. The example below shows you the route (red line) the Grunt has to take to find its way to the player. It only needs those four nodes to get there, so each node in between is just an extra unnecessary step. So if we remove all of those and leave a few nodes as anchor points for navigation and AI behavior, we can do with almost a third of the nodes we started with.
User posted image
Having less nodes is good in multiple ways. First, it uses up less entity slots (which are limited). Secondly, it makes the node graph calculation faster and finally, it makes the node network far less complex. This can benefit the performance of your map, since each monster has to do route calculations. For only a handful of monsters this will not be a problem but imagine a large map with many active roaming enemies accessing the node network constantly.

8. Misc. info

The info_node entity also has an Activity and Hint type keyvalue. These currently have no function. Judging from the source code, Valve planned to put extra information into nodes, so the AI could use them for specific purposes. Imagine a node that suggests to a Grunt that this is a place to find cover. These hint nodes actually ended up being used in Half-Life 2. In HL1 the code for hint nodes is only found for the Houndeye, where it can investigate buzzing machinery and blinking lights.

Comments

You must log in to post a comment. You can login or register a new account.