Difference between revisions of "Category:Detection"

3,143 bytes added ,  06:20, 9 December 2014
m
imported>JRoush
m (fixed error concerning fSneakMaxDistance)
imported>Saebel
 
(19 intermediate revisions by 5 users not shown)
Line 1: Line 1:
Detection is Oblivion's stealth mechanic.  The concept isn't complicated: every actor has a degree of awareness of every other nearby actor, called a ''detection level''.  If this detection level is above a certain threshold then the searching actor (the "detector") is fully aware of the hiding actor (the "target").  The detector can then attack, offer a greeting, report the target's crimes, etc.  If the detection level falls below the threshold again, the detector "loses" the target and can no longer interact with it.
Detection is Oblivion's stealth mechanic.  The concept isn't complicated: every actor has a degree of awareness of every other nearby actor, called a ''detection level''.  If this detection level is above a certain threshold then the searching actor (the "detector") is fully aware of the hiding actor (the "target").  The detector can then attack, offer a greeting, report the target's crimes, etc.  If the detection level falls below the threshold again, the detector "loses" the target and can no longer interact with it.


Quite a few factors go into calculating detection levels.  They fall into three basic categories: Sight, Sound, and Sneak Skill.  Sight factors basically describe how well the detector can see the target, and only matter if the detector actually has a direct line-of-sight.  Sound factors measure how much noise the target is making, from movement and from being in combat.  Skill factors measure the ''relative'' sneak skill of the two actors.  In all three cases, the distance from the detector to target plays a very important role.  Whether or not the target has attacked the detector can make an enormous difference as well.
Quite a few variables go into calculating detection levels.  They fall into three basic categories: Sight, Sound, and Sneak Skill.  Sight describes how well the detector can see the target, and only matter if the detector actually has a direct line-of-sight.  Sound measures how much noise the target is making from movement and from being in combat.  Skill measures the sneak skills of the detector  and the target.  In all three categories the distance from the detector to target plays a very important role.
 
Some of the conditions in the formula are still under investigationIn particular, the detection does not always correctly recognize when the target is in combat.  Whether this is specific to the player or due to some other bug is not yet known.
   
   
The complete list of factors and their values is below.  Note that each factor is given a 'shorthand' name for use in other formulasAlso note that many of the factors are conditional - they take a "default" value some times and a more complicated value at others. Some formulas even have conditional parts - an extra multiplier or additive bonus that is used only under certain circumstances.  These conditions are given as clearly as possible in the formulas; just be sure to read them carefully.
The complete formula for Detection Level is given below.  Because the formula is so complicated, it is broken into smaller pieces and organized in a tableConditional terms are enclosed in square brackets, e.g. "[ + 400, if target is yellow]" means "add 400 if the target is yellow, otherwise ignore this term".
 
=== Detection Level Formula ===
{| cellpadding=3 cellspacing=0 border=1 style="text-align:center"
 
|- style="background:#efefef;"
! scope="col" width="100" | Factor
! scope="col" width="100%" | Value


{|border="1" cellpadding="5" cellspacing="0"
|-
|-
! style="background:#efefef;" | <center> Distance </center>
| '''Detection Level'''
! style="background:#efefef;" | <center> Shorthand </center>
| align="left" |  
! style="background:#efefef;" | <center> Value </center>
If target is farther from the detector than MaxDetectionRange, and has not attacked the detector:
0
If target is invisible or has 100% Chameleon:
-100
Otherwise:
[[fSneakBaseValue]]
[ + [[fSneakTargetAttackBonus]], for a single frame the first time the target attacks the detector]
[ + SoundBonus, if target is not swimming]
[ + [[fSneakSleepBonus]], if detector is sleeping]
[ + SightBonus, if detector is awake and has line-of-sight to target]
+ SkillBonus
 
|-
| '''Sound Bonus'''
| align="left" |
[[fSneakSoundsMult]] * DistanceFactor *
(
  [ MovementFactor, if target is moving and target Sneak mastery < Expert]
  [ + [[fSneakTargetInCombatBonus]], if target is in combat]
)
[ * [[fSneakSoundLosMult]], if detector has no line of sight to target]
The sound bonus cannot be negative.  If it is less than zero, it is set to zero.
|-
|-
| <center> Max Detection Distance </center>
| Movement Factor
| <center> maxDist </center>
| align="left" |
| [[fSneakMaxDistance]] * ([[fSneakExteriorDistanceMult]], for exterior cells)
(
  [[fSneakBootWeightBase]]
  [ + ([[fSneakBootWeightMult]] * (tgt boot weight)), if tgt Sneak mastery < Journeyman ]
)
[ * [[fSneakRunningMult]], if target is running ]
 
|-
| '''Sight Bonus'''
| align="left" |
[[fSneakLightMult]] * DistanceFactor * LightFactor * ChameleonFactor * BlindnessFactor
[ * [[fSneakSwimmingLightMult]], if target is swimming]
The sight bonus cannot be negative.  If it is less than zero, it is set to zero.
|-
|-
| <center> Distance Factor </center>
| Light Factor
| <center> distMult </center>
| align="left" |
| 1 - (distance between detector and target) / maxDist
[[fDetectionSneakLightMod]] +
(
  (light level on target)
  [ * [[fDetectionNightEyeBonus]], if detector has Night Eye]
)
 
'light level on target' measures the ambient light, plus changes from the Darkness effect.  Falls in range from 0 to 100.
 
|-
| Chameleon Factor
| align="left" |
1 - (Chameleon level of target)/100
Chameleon Factor is forced into the range [0 - 1]
 
|-
| Blindness Factor
| align="left" |
1 - (Blindness level of detector)/100
Blindness Factor is forced into the range [0 - 1]
 
|-
| '''Skill Bonus'''
| align="left" |
[[fSneakSkillMult]] *
(
  (detector Sneak skill * DistanceFactor)
  [ - target Sneak skill, if target is sneaking and not in combat]
)
 
|-
|-
! style="background:#efefef;" | <center> Sound </center>
| '''Distance Factor'''
! style="background:#efefef;" | <center> Shorthand </center>
| align="left" |
! style="background:#efefef;" | <center> Value </center>
1 - (distance between detector and target) / MaxDetectionRange
|-
 
| <center> Line-of-Sight Sound Factor </center>
| <center> losSound </center>
| 1.0 if detector has line of sight to target
[[fSneakSoundLosMult]] otherwise
|-
| <center> Swimming Sound Factor </center>
| <center> swimSound </center>
| 0.0 if target is under water
1.0 otherwise
|-
| <center> Running Factor </center>
| <center> running </center>
| [[fSneakRunningMult]] if target is running
1.0 otherwise
|-
| <center> Movement Bonus </center>
| <center> moving </center>
|
[[fSneakBootWeightBase]] + [[fSneakBootWeightMult]] * (target boot weight) if target is moving
0.0 if target is stationary
|-
| <center> In-Combat Bonus </center>
| <center> combat </center>
| [[fSneakTargetInCombatBonus]] if target is in combat
0.0 otherwise
|-
| <center> '''Overall Sound Bonus''' </center>
|
| [[fSneakSoundsMult]] * distMult * losSound * swimSound * (running * moving + combat)
|-
! style="background:#efefef;" | <center> Sight </center>
! style="background:#efefef;" | <center> Shorthand </center>
! style="background:#efefef;" | <center> Value </center>
|-
| <center> Line-of-Sight Factor </center>
| <center> losSight </center>
| 1.0 if detector has line of sight to target
0.0 otherwise
|-
| <center> Swimming Sight Factor </center>
| <center> swimSight </center>
| [[fSneakSwimmingLightMult]] if target is under water
1.0 otherwise
|-
| <center> Light Factor </center>
| <center> light </center>
| [[fDetectionSneakLightMod]] + (light level on target) * ([[fDetectionNightEyeBonus]], if detector has Night Eye)
Light Factor is capped at 100
|-
| <center> Invisiblity Factor </center>
| <center> invis </center>
| 0.0 if target has Invisibility
1.0 - (target's Chameleon level, max 100) / 100.0, otherwise
|-
| <center> Blindness Factor </center>
| <center> blind </center>
| 1.0 - (detector's Blindness level, from "Blindness" stat) / 100.0
|-
| <center> '''Overall Sight Bonus''' </center>
|
| [[fSneakSleepBonus]] if detector is sleeping
[[fSneakLightMult]] * distMult * losSight * swimSight * light * invis * blind, otherwise
|-
! style="background:#efefef;" | <center> Skill </center>
! style="background:#efefef;" | <center> Shorthand </center>
! style="background:#efefef;" | <center> Value </center>
|-
| <center> '''Overall Skill Bonus''' </center>
|
| [[fSneakSkillMult]] * [(detector's Sneak skill) * distMult - (target's Sneak skill, if target is sneaking)]
|-
! style="background:#efefef;" | <center> Detection Level </center>
! style="background:#efefef;" | <center> Shorthand </center>
! style="background:#efefef;" | <center> Value </center>
|-
|-
| <center> '''Overall Detection Level''' </center>
| '''Max Detection Range'''
|
| align="left" |  
|
[[fSneakMaxDistance]]
-100.0 if invis >= 100.0 (i.e. target has Invisibility or 100% Chameleon)
[ * [[fSneakExteriorDistanceMult]], if in exterior cell]


0.0 if target didn't attack detector -AND- (distance between target and detector) > maxDist
|}


[[fSneakBaseValue]] + ([[fSneakTargetAttackBonus]], if target attacked detector) + '''Overall Sound Bonus''' + '''Overall Sight Bonus''' + '''Overall Skill Bonus''', otherwise
=== Detection Thresholds ===
|-
|}


If the '''Overall Detection Level''' is greater than a certain threshold, the detector can becomes aware of the target.  The thresholds are:
If the '''Detection Level''' is greater than a certain threshold, the detector can becomes aware of the target.  The thresholds are:
{|border="1" cellpadding="5" cellspacing="0"  
{|border="1" cellpadding="5" cellspacing="0"  
|-
|-
! style="background:#efefef;" | <center> Threshold </center>  
! style="background:#efefef;" | <center> Threshold </center>  
! style="background:#efefef;" | <center> Used By </center>
! style="background:#efefef;" | <center> Used By </center>
|-
| 0
| Zero seems to be an upper limit for detection thresholds.  If the detection level is greater than zero, the target is always(?) detected.
|-
|-
| [[fSneakUnseenMin]]
| [[fSneakUnseenMin]]
| all actors that are unaware of target
| all actors that are unaware of target
all non-hostile actors
all non-hostile actors
|-
| [[fSneakNoticedMin]]
| actors are aware that target is near and speak accordingly
|-
|-
| [[fSneakLostMin]]
| [[fSneakLostMin]]
Line 130: Line 127:
A final note: The target-is-in-combat bonus is fairly significant.  Combined with the much lower combat threshold, this can make it ''very'' difficult for an actor to return to hiding once a hostile actor has seen them.
A final note: The target-is-in-combat bonus is fairly significant.  Combined with the much lower combat threshold, this can make it ''very'' difficult for an actor to return to hiding once a hostile actor has seen them.


==Performance==
Every NPC/Creature that is high processing makes a round of detection calls every .3 seconds.  Those detection calls will be made against everyone within the detection range of the actor, not just against the player.  It also doesn't matter whether the target is sneaking or not.  Sneaking merely modifies the target's ability to be detected.


Therefore, as the number of active actors in an area increase, the number of detection calls made increases exponentially.
{|border="1" cellpadding="5" cellspacing="0"
|-
! style="background:#efefef;" | <center> # of actors in the area </center>
! style="background:#efefef;" | <center> # of detection calls </center>
! style="background:#efefef;" | <center> ~ # per second </center>
|-
| 1 actor + player
| 1
1 call vs player
| 3
|-
| 2 actors + player
| 4
2 calls vs player, 1 call per NPC vs other NPC
| 12
|-
| 3 actors + player
| 9
3 calls vs player, 2 calls per NPC vs other NPCs
| 27
|-
| 4 actors + player
| 16
4 calls vs player, 3 calls per NPC vs other NPCs
| 48
|-
| 10 actors + player
| 100
10 calls vs player, 9 calls per NPC vs other NPCs
| 300
|-
| 15 actors + player
| 225
15 calls vs player, 14 calls per NPC vs other NPCs
| 675
|-
| 20 actors + player
| 400
20 calls vs player, 19 calls per NPC vs other NPCs
| 1200
|-
| 30 actors + player
| 900
30 calls vs player, 29 calls per NPC vs other NPCs
| 2700
|}
In the above examples, this assumes that everyone is within the detection range of everyone else.
In exterior locations, actors are rarely so clumped together except in high traffic areas such as the Market District.  But then again, exteriors have default range of 2x the interior detection distance, which is roughly four times the area.
With default Oblivion, you will rarely run into large numbers of NPCs/creatures that are densely packed.  But in a heavily modded Oblivion, this can have a noticeable effect on performance when the player enters highly populated areas.  Detection is probably not the only Oblivion feature that behaves like this, but it's the one that we for sure know behaves this way consistently all the time.
Any mod that alters the detection formula (such as SDR) in combination with mods that increase the population density will therefore potentially impact performance as well, depending on how the mod is designed and implemented.
==Detection Functions==
[[IsActorDetected]] does not appear to call the detection formula, since it does not require both the target and detector to function.  It is the simplest method of determining whether an actor is being detected at any given time.
[[GetDetectionLevel]] does not appear to call the detection formula either, and may be the most efficient method of determining the detection result of a detector/target pair, especially when a mod that alters detection (like SDR) is in the load order.  Although it is unknown whether or not the result is based on Oblivion's native detection results or the detection altering mod's results.  The theory is that each detection result of target to detector is tracked internally, and is merely looked up by the GetDetectionLevel function.
[[GetDetected]], on the other hand, forces Oblivion to run the entire detection formula, and therefore any mod that alters or hooks that formula will have its sub-scripts called.  Depending on how often it is used, this could potentially cause performance issues.
==Notes==
* Dead actors seem to have their detection status "locked in" at whatever value it was when they died. This means an actor aware of the player when the player kills him, will ''always'' be considered aware of the player (though this does not matter since the actor is dead). It is therefore important in scripts which check detection levels to also make sure that the "detector" is, in fact, alive, in addition to checking other detection settings.
* The bug above also applies when [[SetUnconscious]] is used on an actor, until the effects of that command are reverted.


==See Also==
==See Also==
[[Sneak]]
[[Sneak]]
[[GetDetectionLevel]]
[[GetDetected]]
[[IsActorDetected]]




Anonymous user