Difference between revisions of "A Chase"

From DoomWiki.org

[checked revision][checked revision]
(Adding new page for code pointer)
 
m (External links)
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
{{DISPLAYTITLE:A_Chase}}
 
{{DISPLAYTITLE:A_Chase}}
{{stub}}
+
[[File:E2M2_chaingun.png|thumb|right|Pinky demons in their chase state, moving toward their target (the player). <code>A_Chase</code> 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 a [[code pointer]] used in the normal animation for various monsters.
 +
 +
<code>A_Chase</code> 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 <code>A_Chase</code>. The most basic thing that <code>A_Chase</code> 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. <code>A_Chase</code> will move a monster in the same direction for several calls before sometimes picking a new direction.
 +
 +
<code>A_Chase</code> 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, <code>A_Chase</code> 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 [[imp|imps]] while they are roaming.
  
 
== Uses ==
 
== Uses ==
Line 271: Line 277:
 
== External links ==
 
== External links ==
 
* {{DoomSrc|file=p_enemy.c|line=672|text=A_Chase}} in the Doom source code.
 
* {{DoomSrc|file=p_enemy.c|line=672|text=A_Chase}} in the Doom source code.
 +
* {{zdoomwiki|title=A_Chase}}
 +
* {{eterwiki|title=Chase}}
  
[[Category:Code pointers]]
+
[[Category:Core monster AI code pointers]]

Revision as of 18:11, 17 March 2020

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