18,700
edits
(continuing rewrite) |
(continuing rewrite) |
||
Line 247: | Line 247: | ||
== | ==Basic combat behaviors== | ||
[[File:combatRanges.PNG|thumb|right|alt=Example of combat ranges.|Combat ranges of an AI character.]] | [[File:combatRanges.PNG|thumb|right|alt=Example of combat ranges.|Combat ranges of an AI character.]] | ||
Of course an action game like Oni is not complete without guns blazing and fists flying through the air. But combat in real life is usually very fickle and everything has to be considered. How can Oni AI possibly deal with such a complex task? | Of course, an action game like Oni is not complete without guns blazing and fists flying through the air. But combat in real life is usually very fickle and everything has to be considered. How can Oni's AI possibly deal with such a complex task? | ||
:Oni | :An AI in Oni has to have a definite awareness of the enemy in order to actively attack him. The alert level of an AI when in combat mode is Combat (duh). Definite awareness can be achieved by these ways: | ||
:* | :*The enemy is seen in this AI's central vision field. | ||
:*AI | :*The AI is made to attack the enemy by the BSL function ai2_attack. | ||
:*AI | :*The AI is hurt by the enemy, be it melee or gun damage. | ||
Once combat mode is entered, then as long as HostileThreatDefinite timer for this enemy does not reach zero, AI | Once combat mode is entered, then as long as the HostileThreatDefinite timer for this enemy does not reach zero, an AI will always know the exact location of this enemy and will attempt to attack it. The moment HostileThreatDefinite timer is depleted, the AI loses the privilege of knowing the enemy's exact location, its awareness decreases from definite to strong, and the AI either switches from combat mode to pursuit mode with this enemy (see section [[#Pursuit|Pursuit of enemy]]) or, in case of another enemy being present in its central vision field, picks this new enemy as a target to attack and keeps the old enemy in strong (and later weak, then forgotten) awareness. | ||
:Since | :Since the means of combat depends on the distance between the participants, some sort of spacing is needed. Oni uses a system of three radii around the AI, called combat ranges. See picture on right. The size of these radii can be set in the [[CMBT]] profile. | ||
:These ranges work as "triggers" to make the AI character execute various behaviors | :These ranges work as "triggers" to make the AI character execute various behaviors based on the enemy's proximity. Moreover, Oni can distinguish between an enemy entering a specified range or exiting a specified range. All the range possibilities in Oni which can be assigned some combat behavior are: | ||
:*Short | :*Short: enemy is close to the AI. | ||
:*Medium | :*Medium: enemy is approaching the AI and crossed from Long Range into Medium Range. | ||
:*Long | :*Long: enemy is approaching the AI starting at the Long Range. | ||
:*Medium Retreat | :*Medium Retreat: enemy is retreating from Short Range to Medium Range. | ||
:*Long Retreat | :*Long Retreat: enemy is retreating from Medium Range to Long Range. | ||
:Well of course nothing is perfect and in Oni there is a bit of an issue with proper switching between combat ranges, so Long and Medium ranges are used only once at the beginning of enemy approach. Only Short, Medium Retreat and Long Retreat ranges are used on regular basis in | :Well, of course nothing is perfect, and in Oni there is a bit of an issue with proper switching between combat ranges, so Long and Medium ranges are used only once at the beginning of an enemy approach. Only Short, Medium Retreat and Long Retreat ranges are used on a regular basis in combat. Even when an enemy runs into Long Retreat and goes back to to Medium range, the engine does not switch the AI's behavior range to Medium, but (contrary to its name) to Medium Retreat. | ||
OK, we have positioning | OK, we have positioning down; now for the actual behaviors that an AI can be set to execute within these ranges. There are fourteen possible combat behaviors (in brackets are the XML strings): | ||
:*None (None) | :*None (None): simply nothing. | ||
:*Stare (Stare) | :*Stare (Stare): the AI stands and stares; it does not even rotate to face the enemy. | ||
:*Hold and fire (HoldAndFire) | :*Hold and fire (HoldAndFire): the AI stands still and fires a weapon. If this character does not have a weapon, then it switches to melee. | ||
:*Firing charge (FiringCharge) | :*Firing charge (FiringCharge): the AI runs toward the enemy and fires a weapon. If this character does not have a weapon, then it switches to melee. | ||
:*Melee (Melee) | :*Melee (Melee): the AI always uses melee, even when it holds a loaded weapon. | ||
:*Barabbas shoot (BarabasShoot) | :*Barabbas shoot (BarabasShoot): the AI stands still and fires a weapon with hardcoded three-second pauses between shots. If this character does not have a weapon, then it switches to melee. If this character meets certain conditions, it can start regenerating health. More detailed info about regeneration mechanics [[Barabas' regeneration|can be read here.]] | ||
:*Barabbas advance (BarabasAdvance) | :*Barabbas advance (BarabasAdvance): the AI runs toward the enemy and fires a weapon using the '''secondary trigger''' (as if the player pressed right mouse button). If this character does not have a weapon, then it switches to melee. If this character meets certain conditions, it can start regenerating health. More detailed info about regeneration mechanics [[Barabas' regeneration|can be read here.]] | ||
:*Barabbas melee (BarabasMelee) | :*Barabbas melee (BarabasMelee): the AI uses melee, even with a loaded weapon in hand. If this character meets certain conditions, it can start regenerating health. More detailed info about regeneration mechanics [[Barabas' regeneration|can be read here.]] | ||
:*Superninja fireball (SuperNinjaFireball) | :*Superninja fireball (SuperNinjaFireball): Mukade's long range behavior. With this behavior, an AI cannot shoot weapons and cannot use melee; it simply runs toward the enemy. However, if a weapon is in hand, the character can use melee (probably something from the weapon melee override). The AI is occasionally teleported behind the enemy (AnimType 222 - Teleport In) if the distance to the enemy is greater than 100 world units (however, something is screwy with this teleportation mechanic). Anyway, to add more to this behavior, the AI executes two special [[TRAM]]s (animations): | ||
:**AnimType 224 - Ninja Fireball, | :**AnimType 224 - Ninja Fireball (Mukade's heat-seeking Devil Star); after using this, there is a 20-second cool-down before this can be used again. | ||
:**AnimType 225 - Ninja Invisible | :**AnimType 225 - Ninja Invisible (grants a 10-second cloak); after using this, there is a 20-second cool-down before this can be used again. | ||
::'''IMPORTANT''' There is an annoying problem with this behavior. When it is called, it checks character's position height-wise from the origin of the game world (coordinates 0,0,0) and if the height is below 550, this character is automatically moved to height 550 (which in almost all cases means death by falling). | ::'''IMPORTANT''' There is an annoying problem with this behavior, which was coded with the Rooftops boss fight in mind. When it is called, it checks the character's position height-wise from the origin of the game world (coordinates {0, 0, 0}) and if the height is below 550, this character is automatically moved to height 550 (which in almost all cases means death by falling). | ||
:*Superninja advance (SuperNinjaAdvance) - Mukade's medium range behavior. With this behavior AI cannot shoot weapons and cannot use melee | :*Superninja advance (SuperNinjaAdvance) - Mukade's medium range behavior. With this behavior, an AI cannot shoot weapons and cannot use melee; it simply runs toward the enemy. However, if a weapon is in hand, the character can use melee (probably something from the weapon melee override). This behavior also allows the use of AnimType 225 - Ninja Invisible. In order to be able to use this ability, the AI has to be at least 50 (or 40?) world units away from its enemy. The cool-down for this special technique is 20 seconds. Again, the annoying "over 550" height check is present. | ||
:*Superninja melee (SuperNinjaMelee) | :*Superninja melee (SuperNinjaMelee): Mukade's short range behavior. With this behavior, the AI cannot shoot weapons, but <u>can</u> use melee. This behavior allows the use of AnimType 225 - Ninja Invisible. In order to be able to use this ability, the AI has to be at least 50 (or 40?) world units away from its enemy. The cool-down for this special technique is 20 seconds. This behavior also grants the ability to teleport away from the enemy to a certain distance (around 100 world units) if any one of these conditions is met: | ||
:**About 35 points of damage dealt to this character in a short time (exact amount of damage and exact timing not known). | :**About 35 points of damage dealt to this character in a short time (exact amount of damage and exact timing not known). | ||
:**This character get thrown | :**This character get thrown. | ||
::Again, annoying | ::Again, the annoying "over 550" height check is present. | ||
:*Run for alarm (RunForAlarm) | :*Run for alarm (RunForAlarm): see section [[#Alarm behavior|Alarm behavior]]. | ||
:*Mutant Muro melee (MutantMuroMelee) | :*Mutant Muro melee (MutantMuroMelee): the AI is only allowed to melee, not fire weapons. This behavior places "chenille" (the overpower effect) on the user. In order to see this visual effect, the character has to have <HasDaodanPowers> set to 1 in their [[ONCC]]. This chenille mode does not grant the actual damage overpower effect. If the ONCC has both <HasDaodanPowers> and <HasSuperShield> set to 1, the chenille mode called by this behavior grants "super shield". | ||
::Chenille mode lasts forever if it is not terminated either via BSL or by AI | ::Chenille mode lasts forever if it is not terminated either via BSL or by the AI performing a TRAM which has a DisableShield flag. After a 10-second interval, chenille is turned back on. Another specialty of this behavior is an automatic backward-evasion move when about 35 points of damage or a throw are inflicted on the AI. Chenille mode is turned off if this AI switches to some other combat behavior because the enemy moved to some other combat range. | ||
:*Mutant Muro thunderbolt (MuroThunderbolt) | :*Mutant Muro thunderbolt (MuroThunderbolt): Upon initial contact, the AI turns on chenille mode and runs toward the enemy. If chenille mode is turned off then, until definite awareness of the enemy is lost, this behavior will not cast chenille mode again. This behavior also allows the AI to use a special long range attack: the character turns off chenille, goes into AnimState 69 - Thunderbolt, and loops a special TRAM animation of AnimState 69 - Thunderbolt and AnimType 231 - Muro_Thunderbolt. That lasts for 10 seconds. Then the AI stops the animation for 5 seconds and runs toward the enemy. If, after those 5 seconds, the AI is still executing Mutant Muro thunderbolt behavior, the AI resumes the looping TRAM between AnimType 231 and 69. | ||
::This behavior's special | ::This behavior's special looping animation continues even when an enemy enters some another combat range, with the exception of Short range. If the enemy enters Short range while the looped animation is running, the loop is forced to stop and the AI starts using Short range behavior. | ||
Modding hints: Combat behaviors can have severe impact on AI performance in a fight | Modding hints: Combat behaviors can have a severe positive or negative impact on AI performance in a fight. | ||
:*Remember: due to a glitch, crucial behaviors for combat are Short, MediumRetreat and LongRetreat. Long | :*Remember: due to a glitch, the crucial behaviors for combat are Short, MediumRetreat and LongRetreat. Long and Medium are used only at the beginning of an encounter. | ||
:*In general, use common sense. There is little use in setting Firing Charge as Short range behavior. | :*In general, use common sense. There is little use in setting Firing Charge as the Short range behavior. | ||
:*Barabbas Shoot and Barabbas Melee behaviors have access to | :*Barabbas Shoot and Barabbas Melee behaviors have access to a healing ability which can be a great asset for introducing mutants or stronger enemy units. However, remember that Barabbas Shoot limits rate of fire to one shot per three seconds. | ||
:*Barabbas Advance is the only behavior which allows AI to fire a weapon | :*Barabbas Advance is the only behavior which allows an AI to fire a weapon in its secondary fire mode. However the behavior is quite glitchy (the AI often looks away and fires stray shots). Still, with the proper gun and proper setup it can be useable for boss fights. | ||
:*Superninja's behaviors sound excellent for cunning enemy units, however annoying check for character's minimal allowed height from world origin and subsequent forced | :*Superninja's behaviors sound excellent for cunning enemy units, however the annoying check for a character's minimal allowed height from the world origin, and subsequent forced re-positioning, severely impact these behaviors' usefulness. With a level which is deliberately raised to the correct height, the behavior will not cause random AI character re-positioning. Then it can be used to its fullest. | ||
::One other important thing about these behaviors | ::One other important thing about these behaviors: if the AI does not have required the TRAMs in its [[TRAC]], the AI can get stuck if it uses these behaviors. | ||
:*If there is no console with ALARM | :*If there is no console with the ALARM CONSOLE flag within the Alarm search distance, then the behavior "Run For Alarm" will make an AI just stand and stare. Choose this behavior with caution, and consider using a workaround where Medium and Short combat ranges have very close radii, with Run For Alarm being the MediumRetreat behavior, so that the Run For Alarm behavior is executed only for a brief amount of time as the AI almost immediately switches to LongRetreat. Even one frame is enough, because if an alarm is found, the AI is requested to perform an alarm run which can override combat (see section [[#Alarm behavior|Alarm behavior]] for more info). | ||
:*MutantMuro melee can be used to create tricky foes which have to be | :*MutantMuro melee behavior can be used to create tricky foes which have to be fought from a distance because if the player comes up close then the AI will turn on its (super)shield and won't put it away (by providing no TRAM with the DisableShield flag). That would make the player put some distance between him and the AI in order to make it disable the shield. | ||
:*MutantMuro thunderbolt should NEVER be assigned | :*MutantMuro thunderbolt should NEVER be assigned as the Short range behavior, as that will negatively affect its special attack. Set it as LongRetreat or MediumRetreat. This kind of behavior (with proper TRAMs) can be used to create foes who will perform a special long range attack if the player tries to keep his distance. This ranged attack does not have to be the same as Muro's tractor thunderbolt. For example, an AI could be made to fire an aggressive energy-beam type of attack. | ||
== | ==Extra combat behaviors== | ||
Combat ranges and various AI combat behavior was discussed in previous section. Even with combat ranges, there are still other parts of combat to be taken care of - picking up weapons from the ground, melee overrides of weapons, behavior if character is unarmed and of course, firing weapons or using hand to hand combat. Files inspected in this section will be [[CMBT]] profiles and [[ONCC]] files. | Combat ranges and various AI combat behavior was discussed in previous section. Even with combat ranges, there are still other parts of combat to be taken care of - picking up weapons from the ground, melee overrides of weapons, behavior if character is unarmed and of course, firing weapons or using hand to hand combat. Files inspected in this section will be [[CMBT]] profiles and [[ONCC]] files. | ||