NPC FOV

An NPC's Field of View or FOV is the same as the Viewcone Angle (the Viewcone Length is how far the NPC can see). Both are very important in NPC Sensing AI.
== List of NPC FOVs ==
NPC FOV varies considerably between NPC classes. 
* This list is intended as a quick reference for level-designers positioning and angling their NPCs for effective AI behaviour. It is only a quick, crude reference and not (yet) empirically verified. 
* 
 Static NPCs: 			m_flFieldOfView		FOV (degrees)	
 npc_barnacle			0.5 			120 	down ?
 npc_combinecamera		0.5 			120 	down ?
 npc_missile defense		0.1			168 	up ?
 npc_spotlight			VIEW_FIELD_FULL		360 
 npc_turret			VIEW_FIELD_NARROW 	 90 
 npc_turret_ceiling		0.0f			180 
 npc_turret_floor		0.4f 			132 
 npc_vehicledriver		VIEW_FIELD_FULL		360 
 Moving NPCs: 			m_flFieldOfView		FOV (degrees)	
 npc_antlion			-0.5f 			240 	
 ANTLION_VIEW_FIELD_NARROW	0.85f 			 64 	
 npc_antlionguard		-0.4f 			228 	
 npc_combine_s			-0.2 			204 	
 npc_helicopter 			-1.0 			360 	
 npc_basescanner			0.2 			156 
 npc_npc_blob			-1.0f 			360 	
 npc_bullsquid			0.2			156 
 npc_combinedropship		0.5 			120 
 npc_combinegunship		-0.707 			270 
 npc_crow			VIEW_FIELD_FULL		360 
 npc_fastzombie			0.2			156 
 npc_headcrab			0.5 			120 
 npc_houndeye			0.5 			120 
 npc_hydra			-1.0			360 
 npc_icthyosaur			-0.707 			270 
 npc_manhack			VIEW_FIELD_FULL		360 
 npc_metropolice			-0.2			204 
 npc_playercompanion		0.02			178 
 npc_poisonzombie		0.2			156 
 npc_rollermine			-1.0f			360 
 npc_stalker			0.1			168 
 npc_strider			0.0 			180 
 npc_zombie			0.2			156 
 npc_zombine			0.2			156 
 npc_protosniper			0.2			156 
 npc_advisor			VIEW_FIELD_FULL		360 
 Characters: 			m_flFieldOfView		FOV (degrees)	
 npc_breen			0.5 			120 
 npc_dog				0.5 			120 
 npc_eli				0.5 			120 
 npc_gman			0.5 			120 
 npc_kleiner			0.5 			120 
 npc_monk			-0.707 			270 
 npc_mossman			0.5 			120 
 Oddballs : 			m_flFieldOfView		
 npc_bullseye 			keyvalue input ?
 npc_turret_ground 		cos( ((GROUNDTURRET_VIEWCONE / 2.0f) * M_PI / 180.0f) )
 npc_enemyfinder 		keyvalue input (0.5 default)
== Displaying viewcones ==
You can display viewcones in-game through the Console Command npc_viewcone.
== Source Code Variables ==
The NPC's ViewCone Angle or FOV can be inferred from the m_flFieldOfView value given in the relevant npc.cpp file, using the formula:
 FOV = (2 * acos(m_flFieldOfView)) 
=== m_flFieldOfView ===
m_flFieldOfView indicates the width of this NPC's forward view cone (as a dotproduct result). 
*Its value must be between -1.0 and 1.0. If m_flFieldOfView is negative (ie <0) then the FOV is wider than 180 degrees. 
*To calculate the m_flFieldOfView value for a desired FOV, use:
 m_flFieldOfView = (cos(0.5 * FOV))
=== VIEW_FIELD_FULL ===
Preset NPC m_flFieldOfView value defined in util.h as == 360 deg FOV.
=== VIEW_FIELD_WIDE ===
Preset NPC m_flFieldOfView value defined in util.h as == 270 deg FOV.
* 
=== VIEW_FIELD_NARROW ===
Preset NPC m_flFieldOfView value defined in util.h as == 90 deg FOV.
* A more narrow check used to set up ranged attacks
=== VIEW_FIELD_ULTRA_NARROW ===
Preset NPC m_flFieldOfView value defined in util.h as == 50 deg FOV.
* A more narrow check used to set up ranged attacks.
Category:AI