-
Posts
7386 -
Joined
-
Last visited
Single Status Update
See all updates by baja blast rd.
-
On Discord, we got to talking about the longest distance over which an archvile will initiate an attack unprovoked, and I got really curious about exactly what it was. (Someone mentioned a speedrun that relied on an AV jump and how it'd be really useful to know the exact distance.)
"About 1024 map units" is the commonly understood distance that I've seen referred to the most.
Like, it's what mappers have historically used when making cursed challenge encounters that spam ridiculous numbers of perched viles and place corpses as a cue so you can stay out of vile attack range to escape a horrific death. (When I say mappers I mean Dubbz.)
Some references give the value 896 -- the Wiki as I'm typing right now, but possibly will be fixed later; and a highly watched Doomtube video -- but outside of any ports that alter the behavior, that number is wrong and based on a misreading of the source code.
Focusing on these lines in the source code would suggest 896:
if (actor->type == MT_VILE) { if (dist > 14*64) return false; // too far away }
But that glosses over these lines that come before it.
dist = P_AproxDistance ( actor->x-actor->target->x, actor->y-actor->target->y) - 64*FRACUNIT; if (!actor->info->meleestate) dist -= 128*FRACUNIT; // no melee attack, so fire more dist >>= 16;
Which basically mean the check (if (dist > 896)) only happens after we subtract 64 and then 128 from the distance -- which would mean its true range is 1088 (896+64+128 = 1088). Thanks Rayziik for spotting the 64 too.
It's worth testing stuff like this because taking the code at face value can hide a misreading. It's pretty easy to empirically check that 896 is way off and "about 1024" is correct (but not precise). But verifying the exact range was harder.
In a test wad where I placed the player start some distance from a carefully monster blocked vile, I can get the vile to attack 1088 units away. This is easy on -skill 5 since the vile will go into its attack with no delay, but on UV the archvile moves around a bunch and will spend most of its time slightly further than 1088 units away from the player and not able to attack. You might want to use DSDA-Doom with the game sped up. I got up and got something to drink instead and eventually heard myself being attacked, showing that was in range. With the player start 1089 units away instead, even the NM vile just jiggles around forever, so that's out of range.
Also, it's not quite as simple as there being a consistent maximum range.
The P_AproxDistance function basically maps to something shaped like this:
The range is at its highest at direct cardinal directions (1088) and falls off to about ~1024 at 45-degree offsets from that.
But yeah, it seems like the theoretical maximum unprovoked range is 1088. The way it works out in practice, it has a steep dropoff in its likelihood of attacking you that far away outside of NM (and still kind of a dropoff on -fast), since it can't be perfectly monster-blocked without being stuck, and it'll be too busy backing slightly out of range pulling off its sick dance moves.