18,700
edits
m (→Pathfinding and movement: link fix) |
(continuing rewrite; if only Czech had a definite article ^_^) |
||
Line 61: | Line 61: | ||
'''Hearing''' is crucial in Oni. The majority of AI character interaction is done via the sound system. Oni recognizes these types of sound (colors in parentheses are used for sound visualization when | '''Hearing''' is crucial in Oni. The majority of AI character interaction is done via the sound system. Oni recognizes these types of sound (colors in parentheses are used for sound visualization when [[ai2_showsounds]] is set to 1): | ||
:*Unimportant (blue) - is ignored to some extent if alert level of AI is "lull", but after some period of time, the AI will register it. | :*Unimportant (blue) - is ignored to some extent if alert level of AI is "lull", but after some period of time, the AI will register it. | ||
:*Interesting (green) - raises alert level to "low" | :*Interesting (green) - raises alert level to "low" | ||
Line 119: | Line 119: | ||
==Pursuit | ==Pursuit== | ||
Now that alert and awareness levels have been covered, let's take a look at '''pursuit''' behavior. Pursuit behavior in Oni emulates the situation when a person knows "somebody is here", but does not see anybody. In Oni there are following types of '''pursuit''' behavior: | |||
:*None: No pursuit taking place | |||
:*Forget: the AI drops to the Forgotten level of awareness of this enemy | |||
:*GoTo: the AI moves to the source of the disturbance and performs 600 frames (10 seconds) of Look behavior | |||
:*Wait: the AI simply stands and waits to see/hear something more | |||
:*Look: the AI turns in place, looking all around | |||
:*Move: unimplemented; probably was meant to be similar to Look, but with character randomly moving around | |||
:*Hunt: unimplemented; probably was meant to make AI purposefully hunt around for the enemy | |||
:*Glance: the AI does not rotate its whole body, but only turns its head | |||
Plus there are three types of '''lost''' behavior (when an AI had definite contact with the enemy but the enemy managed to get away): | |||
:* | :*ReturnTo Job: the AI returns to its job | ||
: | :*KeepLooking: the AI does not return to its job, and keeps using the last used pursuit behavior | ||
:* | :*FindAlarm: the AI tries to switch to alarm behavior (see section [[#Alarm behavior|Alarm behavior]]); if it does not succeed, then it returns to its job. | ||
:* | |||
: | |||
In Oni, a character is spawned in the level from a character profile (a [[CHAR]] file). This CHAR profile contains links to: | |||
:*[[ONCC]] file, for character class, eg. Konoko or Comguy_1 | |||
:*[[CMBT]] file, for the combat profile for this character | |||
:*[[MELE]] file, for the melee profile for this character | |||
:*[[PATR]] file (OPTIONAL), for the patrol path | |||
:*[[NEUT]] file (OPTIONAL), for neutral behavior (e.g., a civilian giving the player a powerup) | |||
:Pursuit behavior is executed only within the '''Pursuit range''', which is the parameter <PursuitDistance> in the [[CMBT]] profile attached to the AI. If anything suspicious happens outside of this range, the AI only looks in the direction of the disturbance for a short time, then ignores it and returns to its job. | |||
:* | :Pursuit behavior greatly depends on the AI's level of alert. There are four parameters regarding alert levels in the CHAR profile: | ||
:* | :*Initial: the AI is spawned with the specified level of alert | ||
:* | :*Minimal: the minimal alert level this AI can have | ||
: | :*JobStart: the alert level of the AI when it starts some job (typically a patrol) | ||
:* | :*Investigate: From the alert level specified here, and all greater alert levels, the AI will tend to pursue any suspicious sound it hears or any hostile peripheral contact it makes | ||
:Also in [[CHAR]] are five fields regarding pursuit behavior: | |||
:*Lull/Low alert level and '''strong''' awareness behavior: in XML labeled as <StrongUnseen> | |||
:*Lull/Low alert level and '''weak''' awareness behavior: in XML labeled as <WeakUnseen> | |||
:*Medium/High/Combat alert level and '''strong''' awareness behavior: in XML labeled as <StrongSeen> | |||
:*Medium/High/Combat alert level and '''weak''' awareness behavior: in XML labeled as <WeakSeen> | |||
:*Lost (when an AI had a definite contact but lost it): in XML labeled as <Lost> | |||
:If an AI registers any sound or peripheral vision contact inside its pursuit range while its alert level is below the alert level set in its '''Investigate''' parameter, then this AI will only look in the direction of the disturbance for a short time, then ignore it and return to its job. However, if the alert level of the AI is high enough, the AI goes into pursuit mode. That means that the AI will get a '''strong awareness''' of the enemy (or only '''weak''' in the case of peripheral contact), go to the source of the disturbance (the center of the sound sphere in the case of a sound, or the spot where the enemy stood in the case of peripheral eye contact), and will perform the pursuit behavior Look for 10 seconds. After this initial Look mode expires, the AI will perform the pursuit behavior prescribed in its [[CHAR]] profile. | |||
:The length of each pursuit behavior's execution depends on the HostileThreat timers ([[ONCC]] file), as described in the section above. | |||
Modding hints: '''Pursuit mode complications and weird glitches''' | |||
Modding hints: '''Pursuit | :Watch [http://www.youtube.com/watch?v=OMFK5iKcZ5Q this YouTube video]. Pursuit mode is quite buggy, so when setting pursuit behaviors, there are several important things a modder has to have in mind. | ||
:[http://www.youtube.com/watch?v=OMFK5iKcZ5Q | :*The pursuit distance parameter in CMBT is important in deciding whether the character should be more of a pursuer or more of a guard. | ||
:*Within the pursuit distance, peripheral vision pursuit follows its own rules. When an AI sees an enemy with its peripheral vision, this AI always goes into weak awareness mode and either just glances in the direction of this enemy (alert level was below Investigate level) or moves to the spot and performs weak investigation pursuit behavior (alert level was at Investigate on higher). | |||
:* | :*Remember that there are TWO sets of pursuit behavior: | ||
:*Within the pursuit distance, peripheral vision pursuit | :**strong and weak pursuit for lull/low alert levels. In XML these are called <StrongUnseen> and <WeakUnseen>, however those names simply reflect how many changes were made to this part of the game. | ||
:*Remember there are TWO sets of pursuit behavior: | :**strong and weak pursuit for medium/high/combat levels, in XML called <StrongSeen> and <WeakSeen>. | ||
:**strong and weak pursuit for lull/low alert levels. In | :*From all the available pursuit behaviors, only GoTo, Look, Glance, Forget and Wait can be effectively used as CHAR pursuit behavior parameters. Hunt and Move are not finished code-wise. | ||
:**strong and weak pursuit for medium/high/combat levels, in | :*'''Remember that general pursuit behavior is simply glitched, and the parameters from CHAR are more often ignored than actually used.''' The glitchiness is somehow connected with vision. When AI vision is turned off via '''ai2_blind=1''', pursuit mechanics work as they should. However, the moment that AIs are allowed to see, then when pursuit should be performed, it results in: | ||
:*From all available pursuit behaviors GoTo, Look, Glance, Forget and Wait can be effectively used | :**pursuit values from CHAR being ignored if pursuit mode was called while the character was idle or moving along a patrol path. The AI character performs basic GoTo + timer-based Look for the whole period of pursuit behavior, for both strong and weak awareness. Looks so-so but definitely is a glitch. | ||
:*'''Remember that | :**one GoTo + timer based Look being called, but the timer for Look fails to decrement, so the AI simply stands and stares forever. This happens when pursuit mode is called while an AI stands at a job location on a patrol path. And, well... it looks really bad. | ||
:** | :**correct behavior roughly 10% of the time. It is quite random, but it looks like the AI has to be somehow disturbed while going for the source of a previous disturbance. And then Oni writes to the developer console "pursuit mode Hunt not yet implemented" ^_^. | ||
:** | :*The best way how to deal with the pursuit/vision issue is to either ignore it (so the character often gets glitched) or use a BSL script to create a small [[BSL:Manual#Looping|looping function]] where ai2_blind is set to 1 for at least one second (60 frames), then set to 0 again. It can cause funny moments of an AI completely ignoring an enemy right in front of it, but it silently fixes these pursuit problems. | ||
:** | |||
:*The best way how to deal with pursuit | |||