Visual scan: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
Angua (talk | contribs)
New page: This article describes the routine used to detect whether the AI can see the player, and to alert it if this is the case. Each frame, a probability check depending on lightgem brightness...
 
Angua (talk | contribs)
No edit summary
Line 12: Line 12:


The alert increase also depends on lightgem brightness, player distance and acuity and is currently between 4 and 10 units (currently hard coded, but will become a spawnarg soon). This means, that an idle AI should go to observant for a single low alert, but into searching if the player was spotted in bright light.
The alert increase also depends on lightgem brightness, player distance and acuity and is currently between 4 and 10 units (currently hard coded, but will become a spawnarg soon). This means, that an idle AI should go to observant for a single low alert, but into searching if the player was spotted in bright light.
{{ai}} {{coding}}

Revision as of 13:29, 21 May 2008

This article describes the routine used to detect whether the AI can see the player, and to alert it if this is the case.

Each frame, a probability check depending on lightgem brightness, player distance and the AI's visual acuity is used to detect whether the AI has spotted the player.

The base probability, clampVal is calculated from the light gem value itself. The value should represent the probability to be seen within half a second (so with a clampVal of 0.1, you would be spotted approximately once in 5 seconds). I used a polynomial function for this, since the AI were not sensitive enough with a linear increase. The clampVal is scaled with the AI's visual acuity.

Within the clampDistance, the probability stays constant, and it decreases linearly towards zero at the saveDistance. Both distances are scaled with the clampVal, so that you have to be really close to the AI in ambient light to be spotted at all. The maximum values for full brightness are given by the Cvars "tdm_ai_sightmin" (default: 11 meters) and "tdm_ai_sightmax" (default: 60 m).

returnVal is the resulting probability depending on the player distance. With this probability, a random check is performed each frame whether the AI has spotted the player. If this succeeds, the AI has caught a glance of the player and becomes alerted.

The alert increase also depends on lightgem brightness, player distance and acuity and is currently between 4 and 10 units (currently hard coded, but will become a spawnarg soon). This means, that an idle AI should go to observant for a single low alert, but into searching if the player was spotted in bright light.