AI Visibility

You have three ways to play with the AI view distances.  They all work at the same time, so a character's vis value is: Lua * Foliage * Region


Lua Vis Factor

You can set the overall view distance in the level lua:

	SetAIViewMultiplier(0.45)

That means that over the entire level, AI can see 45% as far as normal.


Foliage Vis Factors

You can set visibility modifiers on foliage, which, for example, allows you to hide inside bushes on endor.  Do this by adding a line into the .prp (foliage prop file) for the level. As an example, here is layer from the endor prop file ("worlds/end/world1/end.prp"):

Layer(1)
{
	SpreadFactor(0.5);
 	Mesh()
	{
		File("end_prop_fern5.msh", 30);
		Frequency(20);
		Scale(1);
		Stiffness(0.0);
		CollisionSound("foliage_collision");
		AIVisibilityFactor(0.7,1.0);	
}

 	Mesh()
	{
		File("end_prop_treeclump_1.msh", 50);
		Frequency(50);
		Scale(1);
		Stiffness(0.0);
		CollisionSound("foliage_collision");
		AIVisibilityFactor(0.35,0.6);
	}
}

The two red lines should be added. You can adjust the visibility per model, with a value for crouching and standing.

The first means that for the foliage model "end_prop_fern5", you will be 70% visible from AI if you're crouched inside it, but 100% visible if standing inside it. 

The second model ("end_prop_treeclump_1") will give you 35% visibility when crouched, and 60% when standing.


AI Vis Regions

AI Visibility Regions allow you to set regions in the world editor that affect the AI's visibility of anything inside that region.  Vis Regions work on both players and AI, but not so well on vehicles.

To make them in the editor, create a new region and hit the "Change Type" button to select the type "AIVis". 

Then set the vis multipliers for crouch and stand.  These are a multiplier on normal visibility, so 0.5 means that you're 50% covered, while 2.0 would mean that you're visible twice as far away as normal.

You can only be inside one vis region at a time, so if the regions overlap, it will randomly pick one of them and use that value.  This is fine as long as the overlapping regions all have the same values.