Difference between revisions of "A Chase"

From DoomWiki.org

[checked revision][checked revision]
m (External links)
(new subcategory)
Line 281: Line 281:
  
 
[[Category:Core monster AI code pointers]]
 
[[Category:Core monster AI code pointers]]
 +
[[Category:Sound effect code pointers]]

Revision as of 15:39, 3 March 2022

Pinky demons in their chase state, moving toward their target (the player). A_Chase is continually called to determine whether the monsters can attack yet.

A_Chase is a code pointer used in the normal animation for various monsters.

A_Chase is one of the most important code pointers implementing Doom's monster AI. After a target has been located for a monster (using A_Look), in transitions into its chase sequence, usually repeatedly looping through animation states that call A_Chase. The most basic thing that A_Chase does is to move the monster toward its target. Monsters always move in angles which are an exact multiple of 45 degrees relative to the map layout. A_Chase will move a monster in the same direction for several calls before sometimes picking a new direction.

A_Chase checks continually to determine whether it is possible to transition into one of its attack states. If the monster is sufficiently close to the player and has a melee attack, it will transition into its melee attack state. Otherwise, if the monster has a distance attack and can see the player, it may transition into its distance attack state (firing a weapon or launching a projectile).

In a network game, A_Chase may cause a monster to pick a new player as a target if it can no longer see its current target. Finally, it occasionally plays the monster's "active sound" if it has one - an example is the "imps nearby" sound periodically emitted by imps while they are roaming.

Uses

The A_Chase code pointer appears in the following states in Doom's state table:

Example

The following is an example of how to set the A_Chase code pointer in a Dehacked file:

Pointer 21 (Frame 34)
Codep Frame = 735

Or using BEX syntax:

[CODEPTR]
Frame 1234 = Chase

External links