Hitscan attacks in the Doom engine are attacks which use an algorithm that traces a straight path from an origin at a given angle, collects intercepted objects along that path, and then determines the first line or thing hit. A hitscan attack is determined to either hit or miss a target instantaneously, and therefore cannot be dodged. There are no projectiles involved, invisible or otherwise.
All bullet attacks in Doom work like this, in addition to the player's fist and chainsaw weapons. The tracer rays from the BFG are also hitscan attacks. Up to Doom 1.4, demons used short-range hitscan attacks, but this was changed to range-checked direct damage in v1.5.
Most hitscan attacks have a range of 2048 units. The BFG tracers have a range of 1024 units. Damage determination is done separately from the process of scanning for a hit, and is calculated before the scan takes place. Most of these determinations are done randomly. In Doom, player bullet damage is calculated as (P_Random ()%3+1)*5; this returns a value which can be 5, 10, or 15. For monster hitscans, the formula is ((P_Random()%5)+1)*3, returning a value which can be 3, 6, 9, 12, or 15.
Range-checked direct damage
Monster melee attacks use a simple range check. If the target of such an attack is within "melee range" of its target - 64 units in Doom - damage will be dealt directly and unavoidably. Contrary to hitscan attacks, a range-checked melee attack has no ability to hit an unintended target. If the intended target is out of range, no actual attack takes place regardless of the attacking monster's animation.
Demons used a short-range hitscan attack in Doom 1.4 and earlier versions, allowing for occasional demon-started infighting. This was changed to a range check in v1.5, consistent with the imp, cacodemon, and baron of hell melee attacks. Some console ports, notably for the Sony PlayStation, retain the pre-v1.5 behavior, which they inherit from Jaguar Doom.
The lost soul in the beta version of Doom used a direct damage telepathic attack consisting merely of a sight check. If its target could be seen at all, it would be damaged. While this appeared similar to a hitscan, it also had no capability of hitting an unintended target, and functioned like a long-ranged melee attack.
- PrBoom+ using v1.2 emulation (plays back with -complevel 0). , recorded in