Project

General

Profile

Bug #919

[Doom] Blast damage algorithm

Added by gobhuo almost 14 years ago. Updated about 7 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Vanilla emulation
Target version:
Start date:
2010-06-10
% Done:

0%

Tags:

Description

Responding to your last comment in http://sourceforge.net/tracker/?func=detail&aid=2929822&group_id=74815&atid=542099 ;
I think that the new method is still incorrect, as it treats z-axis differently from x and y. In effect, to calculate damage, you calculate distance from a blast to a "concentric" horisontal square. This violates the rule: if explosion happens on object's bounding box, it deals full damage. I think you should use the distance from bounding box instead.

I just thought that arch-vile's attack damage could be incorrect because of this. And indeed: with "server-game-radiusattack-nomaxz 1" damage is usually 82 (practically correct), with "server-game-radiusattack-nomaxz 0" it's usually 78. In PrBoom+, v1.9 compatibility, it's 84. Tested on MAP11 @ doom2.wad, standing still.

Labels: Gameplay

History

#1 Updated by vermil almost 14 years ago

One should test in the original Doom2.exe and not PrBoom+ or any other source port.

#2 Updated by vermil almost 14 years ago

Indeed, I've just tested in Doom2.exe and Doom95 and got 83 every time.

Hence PrBoom+ 's 84 is wrong as well.

#3 Updated by danij almost 14 years ago

The world up axis is treated the same as the other axes it just depends on the value of server-game-radius-attack-nomaxz as to how many axes are involved in the distance calculation.

Vanilla DOOM does it in 2D (same as server-game-radius-attack-nomaxz=1) whereas we do it in 3D by default.

Here is the actual code in question:

dx = fabs(thing->pos[VX] - bombSpot->pos[VX]);
dy = fabs(thing->pos[VY] - bombSpot->pos[VY]);
dz = fabs((thing->pos[VZ] + thing->height / 2) - bombSpot->pos[VZ]);
dist = (dx > dy? dx : dy);
if(!cfg.netNoMaxZRadiusAttack) // "server-game-radiusattack-nomaxz" 
dist = (dz > dist? dz : dist);
dist = (dist - thing->radius);

The dist value is then fed into the damage equation:

damage = (bombDamage * (bombDistance - dist) / bombDistance) + 1;

#4 Updated by gobhuo over 13 years ago

dx = fabs(thing->pos[VX] - bombSpot->pos[VX]);
dy = fabs(thing->pos[VY] - bombSpot->pos[VY]);

dist = (dx > dy? dx : dy);
dist = (dist - thing->radius);//subtract thing's radius here instead of in dx and dy expressions as an optimisation;
//hence it must precede z-related modification of dist.

dz = fabs((thing->pos[VZ] + thing->height / 2) - bombSpot->pos[VZ]) - thing->height / 2; //it was wrong here and in the location of dist = (dist - thing->radius) expression
if(!cfg.netNoMaxZRadiusAttack) // "server-game-radiusattack-nomaxz"
dist = (dz > dist? dz : dist);

//This should truly treat all axes the same.

#5 Updated by danij over 13 years ago

I can see the radius subtraction is incorrectly placed but your other changes don't make sense to me.

#6 Updated by danij over 13 years ago

Got it now, dunno why I didn't see it earlier.

...comment formatting here at sf is pretty awful however.

#7 Updated by skyjake over 13 years ago

Anything happened to this?

#8 Updated by danij about 12 years ago

Not as yet no, this still needs addressing.

#9 Updated by skyjake over 10 years ago

  • Tags set to PlaySim, Physics, Doom
  • Category set to Vanilla emulation
  • Target version deleted (1.9.0-beta6)

#10 Updated by skyjake about 7 years ago

  • Target version set to Modding

#11 Updated by skyjake about 7 years ago

  • Target version changed from Modding to Vanilla / Gameplay

Also available in: Atom PDF