This article's documentation is for anything that uses the Source engine. Click here for more information.

ai_moveprobe_debug

From Valve Developer Community
Jump to navigation Jump to search
English (en)Translate (Translate)

ai_moveprobe_debug is a console command available in all Source Source games. The ai_moveprobe_debug console command is a debugging tool used to examine navigation problems in NPCs. When enabled, NPCs that have been selected with the npc_select command will visualize their moveprobe results. It's primarily a tool used by programmers to determine where navigation problems lie. Some familiarity with the AI moveprobe system is needed to make use of the visualization.

A moveprobe is essentially a set of swept hull checks between two points, used to determine whether the NPC can safely move from between them. The main NPC uses for moveprobes are the following:

  • When building routes, ensuring that the NPC can get on & off the node graph.
  • While moving, detecting obstacles in the path of the NPC.

Moveprobes visualization simply draws a box showing the space occupied by the NPC's hull at the farthest point reached by the moveprobe. The color of the box tells you whether or not the moveprobe has determined the NPC can fit there:

  • Green means the moveprobe is clear, the NPC can fit there.
  • Red means the moveprobe was blocked, the NPC cannot fit there.

Additionally, moveprobes check to make sure the NPC can safely stand on the spot, to ensure NPCs don't walk off ledges, or onto objects they're not allowed to stand on. If a moveprobe fails because the NPC has determined it cannot stand on the spot, a red 3D cross will be drawn at the spot.

Building Routes

When debugging NPC route building, first ensure that the node graph is correct. Use the ai_show_connect command to make sure the NPC can find connected nodes from their current position to the target position. If the node graph looks good, check the move probes. Turn on ai_moveprobe_debug, select the NPC with npc_select, and use the npc_go command to make the NPC move to the target position. If you see any red moveprobe boxes, then the NPC has determined that an object will block his movement through that space.An example of the moveprobe visualization of route building can be seen here:

Moveprobe visualization for route building in HL2's d1_town_01.bsp

The npc_zombie on the right hand side of the image is attempting to build a route to the left of the screen. The dark blue line shows the route through the node graph that he has chosen. The green boxes show the moveprobe checks he has made. On the right hand side, he has used a moveprobe from his current position to the nearest node to make sure he can get onto the node graph. On the left hand side he has used another moveprobe to ensure he can get to the target position from its nearest node.

Triangulation

While moving along a path, NPCs use moveprobes to spot incoming obstacles ahead of them. Once found, the NPC will attempt to build a triangulation path around the obstacle. Here you can see an example of moveprobes being used while moving:

Moveprobe visualization for triangulation in HL2's d1_town_01.bsp

The npc_zombie on the right hand side of the screen is moving to the target position on the left hand side. His moveprobes ahead of him have determined that he will soon be blocked by the barrel. His navigator will use this knowledge to build a triangulation route around the barrel.

Usage

  • ai_moveprobe_debug 1
    • Enabled visualization of moveprobes for all npc_selected NPCs.
  • ai_moveprobe_debug 0
    • Disable visualization of moveprobes.

See also