AI
From DoomRL Wiki
Outdated information! | |
This page has not been updated to version 0.9.9.8 and requires significant work in order to get there. In particular, it basically just needs a complete rewrite (don't worry about fixing this one, as it will be done by devs). Please do what you can to help and edit: until then, take everything you see here with a grain of salt. |
Technical | |
This article discusses technical aspects of DoomRL and will be of limited interest to most players. |
Most of the enemies in the game use the same AI with only small variations. The exceptions are melee-only enemies (which have lua AI since 0.9.9.3). The following table summarizes the variations.
AI Summary | |||||
Enemy | Attack Chance | Opens Doors | Uses Items | Avoids Melee | Hunts Player |
former human | 75% | yes | yes | no | no |
former sergeant | 75% | yes | yes | no | no |
former captain | 75% | yes | yes | no | no |
former commando | 75% | yes | yes | no | no |
hell knight | 40% | yes | yes | no | no |
baron of hell | 40% | yes | yes | no | no |
imp | 40% | yes | no | no | no |
cacodemon | 40% | no | no | no | no |
arachnotron | 60% | no | no | no | no |
revenant | 50% | yes | no | yes | no |
mancubus | 50% | yes | no | yes | no |
arch-vile | 50% | yes | no | yes | no |
nightmare imp | 50% | yes | no | no | no |
nightmare cacodemon | 50% | no | no | no | no |
nightmare arachnotron | 60% | no | no | no | no |
nightmare arch-vile | 60% | yes | no | yes | no |
shambler | 75% | yes | no | no | yes |
bruiser brother | 40% | yes | yes | no | yes |
lava elemental | 30% | yes | no | yes | yes |
Cyberdemon | 75% | yes | yes | no | no |
The first priority of an enemy is to use an item pack if its health is low. There are four item packs that enemies can use: the two med-packs and the two phase devices. If an enemy is carrying such a pack and its health is below half, then it will use the pack.
The next priority is to melee attack the player. If the player is in melee range, the enemy will do a melee attack (even if it normally "Avoids Melee").
Next, if the enemy can see the player, it has a chance of performing a ranged attack against the player. The above-noted attack chance is a percentage of the time that enemies will attack. On nightmare difficulty, this chance is increased by 50% (capped at 90%).
If the enemy can see the player but chooses not to do a ranged attack, then it will step closer to the player, unless it is an "Avoids Melee" enemy. "Avoids Melee" enemies will step randomly instead.
If the enemy can't see the player, usually it will wander randomly. Enemies are more likely to step towards the center of the map. This predilection increases as the enemy gets farther from the center of the map. Thus, enemies will tend to clump in the center of the map and get stuck in rooms where the door is in the opposite direction from the center of the map.
When an enemy is hit by the player, it will chase the player even once the player leaves the enemies line-of-sight. If the player is able to remain out of line-of-sight for long enough, then the enemy will stop chasing and return to its usual routine. The amount of time is random. This seems to always happen within about 25 seconds, but sometimes happens very quickly.
Enemies that can use items will approach and pick up items when the player is out of line of sight. Only some items are attractive to "Uses Items" enemies. The four usable packs are always attractive. If the enemy is not wearing armor, than any armor is attractive. If an enemy picks up armor, it will immediately equip it. Enemies do not favor any one kind of armor over another. Enemies that use "natural" weapons (barons of hell and hell knights) will also be attracted to ammunition, but enemies that use "normal" weapons (like various former humans) will not. Note that an enemy in line-of-sight will pick up an item rather than attack the player, but an enemy chasing the player from out of line-of-sight will not.
A few enemies (mostly bosses) hunt the player. This means they will chase the player even if he is out of line-of-sight and never give up. Note that on arena-type levels, about half of the enemies are put into this hunting mode. (The Cyberdemon is in this mode on Phobos Arena.)
The most notable difference for melee-only enemies is that they don't have a tendency to clump in the center of the map. Also, demons (and nightmare demons) will run through dangerous terrain to get at the player.
Some enemies have special actions. These actions take place in addition to normal AI actions. Each has a fixed chance of occurring on each turn.
Special Actions | ||
Enemy | Action Chance | Action Description |
pain elemental | 1/4 | spawns three lost souls (only when visible) |
arch-vile | 1/4 | resurrect a corpse (within distance 8) |
nightmare arch-vile | 1/3 | resurrect a corpse (within distance 8) |
shambler | 1/6 | teleport |
agony elemental | 1/4 | spawns three lost souls (1/2) or a pain elemental (1/2) (only when visible) |
lava elemental | 1/20 | teleport |
Spider Mastermind is subject to a special mechanic called staggering. The mechanic is triggered by her taking 20 or more damage from a single hit, and when this happens, she cannot attack (but can move randomly) for one action for each full 20 damage of that single hit. The effects are cumulative - if a player manages to score more than one 20+ damage hits before the staggering effect ends, then the duration from all those hits stacks.