## Recommended Posts

Anyone ever calculate the exact outer limit of the barrel explosion's effective radius? I've been to http://doom.wikia.com/wiki/Barrel but it doesn't go there. The number and nature of the gradients of damage as you stand closer to the erupting barrel is also of interest.

I guess I could set up a test map but I'm currently busy finale stages testing of Plasmaplant so I thought I'd just throw the quick question out there...

```dx = abs(thing->x - bombspot->x);
dy = abs(thing->y - bombspot->y);

dist = dx>dy ? dx : dy;
dist = (dist - thing->radius) >> FRACBITS;

if (dist < 0)
dist = 0;

if (dist >= bombdamage)
return true;    // out of range```
which means it looks at the larger of the two differences in coordinates between you and the barrel. I forget what they call this metric (supremum metric is it?) but for an "explosion radius" I think it gives you a square of side 2*bombdamage centred on the barrel.

(At least that's the ideal case. There are probably complications introduced by scanning the blockmap...)

Edit: I should say, in the case of a barrel, bombdamage is 128

RjY said:

```dx = abs(thing->x - bombspot->x);
dy = abs(thing->y - bombspot->y);

dist = dx>dy ? dx : dy;
dist = (dist - thing->radius) >> FRACBITS;

if (dist < 0)
dist = 0;

if (dist >= bombdamage)
return true;    // out of range```
which means it looks at the larger of the two differences in coordinates between you and the barrel. I forget what they call this metric (supremum metric is it?) but for an "explosion radius" I think it gives you a square of side 2*bombdamage centred on the barrel.

(At least that's the ideal case. There are probably complications introduced by scanning the blockmap...)

Edit: I should say, in the case of a barrel, bombdamage is 128

Texels?

Danx dyde!

Cybermind from the Russian forums calculated this a long time ago and somehow I still had that *.txt on my drive:

this is assuming that the player and the barrel are on the same X or Y coordinate. first number is the distance but I'm not sure if it's the distance from the center of the barrel to the center of the player or maybe the distance between their bounding boxes?

136 - 8 damage
140 - 4 damage
142 - 2 damage
143 - 1 damage
144 or more - no damage

Memfis said:

Cybermind from the Russian forums calculated this a long time ago and somehow I still had that *.txt on my drive:

this is assuming that the player and the barrel are on the same X or Y coordinate. first number is the distance but I'm not sure if it's the distance from the center of the barrel to the center of the player or maybe the distance between their bounding boxes?

136 - 8 damage
140 - 4 damage
142 - 2 damage
143 - 1 damage
144 or more - no damage

Wow, if that's true it peters out rather abruptly. I thought it might have a randomizer added on the end of that - like the weapons damage... I mean sometimes shots seem to "crit", like when you one-shot a lost soul with a singlebarrel...

EDIT: Uhm, I meant two singlebarrel shots to down a lost soul, not one. My apologies, I blame my brain being sweaty at the time, from pre-christmas level design crunch.

Basically, the maximum damage is equal to the maximum distance, which is 128 units. If you are 128 units away from the exploding barrel, you take 128-128=0 damage. 127 units away? 1 damage. 8 units away? 120 damage.

Your radius is taken into account, and a player's radius is 16. So your player's center point needs to be 128+16=144 units away to get no damage.

And the distance being computed simplistically only as the greater of the two distances on the X and Y axes means that if you are 100 units away on the X axis and 100 units away on the Y axis, you aren't further away than if you are 100 units away on either axis and 0 units away on the other, even if trigonometry would tell you that in the former case, you are actually 141 units away from the center of the explosion. So the apparent distance, depending on the angle, can be greater than the effective distance.

Note that 128 damage/128 distance means that this is identical to a rocket's splash damage. This is the standard splash damage in Doom, only the arch-vile's blast differs. The rocket does deal an additional amount of random damage, but only if you get a direct hit -- the splash damage itself is never random and depends only on the distance.

Of course, some ports allow to change that. For example, ZDoom allows to define a distance within which full damage are applied, and you can use random values for the parameters.

Is the barrel's own radius taken into account and could you therefore increase the damage range of the explosion in vanilla by increasing the radius?