Combat Search
OverviewEdit
Searching is handled by the combat AI. Search can be initiated in two ways:
- An actor goes into an Alert state (either by detecting an enemy between -20 and 0, or by detecting a detection event created by an enemy).
- An actor goes into the Lost state (detection on all combat targets has gone below 0 for a gamesetting amount of time).
Basics of SearchingEdit
When a search is initiated, the entire combat group is involved in the search. First, the search area is determined, then the actors split up the area to search (everywhere that they cannot see). To see this process in action, use this command:
tcd search
This will display the navmesh that is being searched -- red means they still need to search it, green means it is already searched (and/or visible and so didn't need to be searched).
In both the Alert and the Lost states, the combat groups will do N complete searches (currently 1, based on the gamesetting iCombatTargetLostRemoveSearchCount) before dropping out of combat (assuming the player remains below the detection threshold, currently -20).
A target will also be dropped and the search will end if the target has never been detected and becomes unnoticed and stays that way for fCombatSearchTargetHiddenRemoveTime( default: 10.0 ) seconds within the first fCombatSearchTargetHiddenMaxTime( default: 20.0 ) seconds of the search starting. This allows the player to react to an enemy noticing them by hiding quickly, causing the search to last only a short period of time.
Searching in the Alert stateEdit
How the search is carried out in the Alert state depends on what the actors involved are searching for:
- Almost detected an enemy (-20 to 0)
- Search will center on a point midway between the actor and the enemy. After each complete search, if the enemy remains at this detection level, recenter the search (midway between actor and enemy's current location). (Search radius gets more sophisticated when multiple actors are involved)
- Almost detected a detection event (-20 to 0)
- Same as above. New detection events will recenter the search as they occur (incorporating already-searched areas from the previous search where they overlap).
- Detected a detection event (> 0)
- Search will center on the location of the detection event. Actors will first "close distance" to the detection event (to get within a gamesetting distance of the event's location), then begin searching. New detection events will recenter the search IF the new event is detected > 0 (new "almost detected" events will be ignored).
GamesettingsEdit
- fCombatSearchInteriorMinRadius
- Minimum search radius for initial search. Used when there's only a single detection location.
- fCombatSearchInteriorMediumRadius
- Max search radius for initial search (if there are multiple detection locations); minimum search radius for subsequent searches (if iCombatTargetLostRemoveSearchCount > 1).
- fCombatSearchInteriorMaxRadius
- Max search radius for subsequent searches, if there are multiple detection locations.
(There are also separate settings for exterior searches.)
Searching in the Lost stateEdit
This is the same as searching in the Alert state, but the search will center on the location where the enemy was last detected.