[4.2.3] Splash damage is occasionally dealt twice

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
User avatar
StroggVorbis
Posts: 866
Joined: Wed Nov 08, 2017 4:23 pm
Graphics Processor: nVidia with Vulkan support
Location: Germany

[4.2.3] Splash damage is occasionally dealt twice

Post by StroggVorbis »

Steps how to reproduce:
1. Start Hexen as Fighter
2. Load MAP04 Guardian of Fire
3. Warp to coordinates X= 670, Y= -880
4. Kill the FireDemon via console (the ettins mustn't wake up!)
5. Face the chain switch
6. Give yourself grenade flechettes (give all/give artifacts)
7. Throw a flechette in such a way that it bounces off the floor first before hitting the wall
8. If after bouncing back it directly hits an ettin it may die at full health, even though they have 175 HP and flechettes only deal 128.

I recommend making a quicksave between steps 6 and 7, this can take multiple tries.

Note: I remember this already occuring in previous GZDoom versions. I'd have completely forgotten about it if it wasn't for Doomreal. The Autocannon deals 2400 damage total with the altfire, yet I managed to kill a maulotaur (3000HP) in one trigger pull.

Note 2: I enabled DamNums' Shotgun Spray option to double check and indeed it shows. Credits to Marisa Kirisame for the idea. Screenshot below.

_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: [4.2.3] Splash damage is occasionally dealt twice

Post by _mental_ »

The problem is in the way radius damage is applied.

During blockmap iteration, ettin spans two blocks when it's damaged.
Depending on randomization, it may move a bit, and when this happens, it occupies only one block.
Because of this, the same actor can be returned twice, the first one is here and the second one is here.

I'll try to check how Chocolate Hexen works in this case, but I cannot promise a quick solution.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [4.2.3] Splash damage is occasionally dealt twice

Post by Graf Zahl »

This was an optimization made by Randi, it's definitely ZDoom-based.
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: [4.2.3] Splash damage is occasionally dealt twice

Post by _mental_ »

In such case, I have nothing else to propose except to remove this code.

Unrelated to screwed blockmap iteration, I have noticed that hitting ettins with flechettes does not wake them sometimes.
Honestly, I have no idea is it original behavior or another bug.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [4.2.3] Splash damage is occasionally dealt twice

Post by Graf Zahl »

That code was added when the validcount variable was replaced with an array in which all already checked actors were put. The main problem I see here is that changing this can become a major performance drag because it is a fundamental optimization in performance critical code.

TBH, I think the entire algorithm needs to be changed to first collect all actors within radius and only then process the compiled list to reduce the side effects at play here. In that case it can use validcount again and completely omit the expensive checking loop. That may in some cases collect a bit more but the way this code works is essentially broken.
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: [4.2.3] Splash damage is occasionally dealt twice

Post by _mental_ »

Is it about radius attack only, or blockmap iteration in general? If the former, I guess it can be fixed like this.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [4.2.3] Splash damage is occasionally dealt twice

Post by Graf Zahl »

It is about blockmap iterations in general, but I'd be careful with such a fix because the side effects of such things are to be taken seriously. For radius attacks something needs to be done immediately, though, so I'd say for now this is fine.
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: [4.2.3] Splash damage is occasionally dealt twice

Post by _mental_ »

Indeed, for iteration in general it will be rather complicated to verify. I doubt that it’s possible to do this reliably in a reasonable amount of time. Even for radius damage it’s hard to validate that something doesn’t depend on that side effect.
User avatar
StroggVorbis
Posts: 866
Joined: Wed Nov 08, 2017 4:23 pm
Graphics Processor: nVidia with Vulkan support
Location: Germany

Re: [4.2.3] Splash damage is occasionally dealt twice

Post by StroggVorbis »

Since this is mentioned in 4.2.4's changelog to be fixed, I guess this can be moved to Closed Bugs :)
Post Reply

Return to “Closed Bugs [GZDoom]”