View Issue Details

IDProjectCategoryView StatusLast Update
0006231The Dark ModCodingpublic26.01.2023 21:31
ReporterDaft Mugi Assigned To 
PrioritylowSeverityminorReproducibilityalways
Status newResolutionopen 
Product VersionSVN 
Summary0006231: Delayed fall damage on mantle
DescriptionIf the player jumps from a tall location, falls/jumps down,
and lands in a mantle instead of landing on their feet,
the player will not receive fall damage before or throughout the mantle animation.
Instead, the fall damage is applied after the mantle animation is complete.

(Note: This is a common technique/exploit in Thief to fall long distances without taking fall damage.)

Attached screenshot sequence.
Steps To Reproduce1. Start Training Mission.
2. Go to 1000.11 -261.05 628.25 40.6 -9.2 0.0.
3. Jump off towards the boat and end the jump in a mantle onto the boat.
(This takes precision. Do not land on your feet.)
TagsNo tags attached.

Activities

Daft Mugi

Daft Mugi

12.01.2023 01:28

reporter  

Daft Mugi

Daft Mugi

25.01.2023 02:26

reporter   ~0015881

Another good place to test this in the Training Mission is at:
1169.84 -807.46 757.25 41.6 -90.3 0.0
Walk (not run) and jump, and then mantle onto the bridge.

Attached screenshot.
Left circle: Tends to have fall damage.
Right circle: Is more likely to have fatal fall damage. Good for testing death animation on mantle.

The Painter's Wife mission is another good mission for testing.
Daft Mugi

Daft Mugi

25.01.2023 02:46

reporter   ~0015882

The attached patch has fixed this issue for me, and I haven't noticed any other issues.

This patch will need a good review, though.

Some things to consider while reviewing:
1. There are different types of mantling, such as a short push, long push, or hang. Does it behave correctly and look right?
2. There's also taking fatal damage from the fall when entering a mantle. Does it cancel the mantle? Is the player death animation correct, including their body falling to the ground?
3. Does a regular mantle still feel the same as before the patch?

In my testing, everything felt correct.
r10261-fix-delayed-fall-damage-on-mantle.diff (727 bytes)   
diff --git game/physics/Physics_Player.cpp game/physics/Physics_Player.cpp
index e610f28..78419e9 100644
--- game/physics/Physics_Player.cpp
+++ game/physics/Physics_Player.cpp
@@ -4376,6 +4376,14 @@ void idPhysics_Player::StartMantle
 		}
 	}
 
+	// #6231: Delayed fall damage on mantle
+	// Zero out all velocity sooner than at the end of the mantle so
+	// that the player receives damage feedback immediately on impact
+	// from a fall rather than at the end of the mantle animation.
+	// Also, zeroing out all velocity at mantle start makes sense,
+	// because the animation is stop, mantle, stop.
+	current.velocity.Zero();
+
 	m_mantlePhase = initialMantlePhase;
 	m_mantleTime = GetMantleTimeForPhase(m_mantlePhase);
 
Daft Mugi

Daft Mugi

25.01.2023 21:41

reporter   ~0015889

Bikerdude was very kind and made a test map for this.
Good thing, too. Because it exposed a difference in falling damage with the above patch.

With the above patch, there's slightly more damage inflicted on the player on mantle.
I imagine that difference is due to the damage being calculated with the player being slightly lower to the ground.
Without the patch, the damage is calculated with the player's feet on the platform rather than the player's feet dangling below the ledge, if I understand correctly.

Can't just be a single line fix, huh?
mantle.pk4 (249,012 bytes)
stgatilov

stgatilov

26.01.2023 20:30

administrator   ~0015897

Last edited: 26.01.2023 20:33

Damn, how do you even reproduce this thing? =)
I managed to get this once out of 10+ attempts.
And on two attempts I simple died, although ordinary fall does not kill me.

I think the exact amount of damage of ledge-grabbing is rarely an important thing and nobody depends on it.
Ordinary fall damage is another thing: mapper can specifically tune some height to make player barely survive.
But fall with mantle rarely happens naturally, and is too difficult to pull off (and should not reduce damage compared to ordinary fall).

UPDATE: it is much easier to reproduce on the exact location specified in this issue.
stgatilov

stgatilov

26.01.2023 20:44

administrator   ~0015899

Hmm... isn't 50 damage closed to what player receives for falling from that height than 18 damage that he gets on mantle with trunk code?

I see that in idPlayer::Damage:
  savedVelocity.z = -860 that's how fast player is falling
  currentVelocity.z = -150 on trunk
  currentVelocity.z = 0 with the patch

I wonder where this -150 comes from, but most likely it should be 0 and thus get more damage?
stgatilov

stgatilov

26.01.2023 20:47

administrator   ~0015900

One thing that might be wrong is that the velocity of the object you fall down onto is not taken into account.
Not in the case of boat, but in general.
If you fall onto an elevator going down, the velocity difference is lower than if the elevator was standing still.
stgatilov

stgatilov

26.01.2023 20:58

administrator   ~0015901

Here is where -150 comes from:
        // FIXME: if they can't slide down the slope, let them walk (sharp crevices)
        // make sure we don't die from sliding down a steep slope
            if ( current.velocity * gravityNormal > 150.0f ) {
                current.velocity -= ( current.velocity * gravityNormal - 150.0f ) * gravityNormal;
            }
Basically, it is totally meaningless.
Also, I see that at the end of mantle velocity is reset to zero.

I'm pretty sure the proposed fix is good.
The only thing that's probably worth investigating is when we fall+mantle onto a moving elevator.
On ordinary fall, player's final velocity and damage depends on the velocity of the elevator.
On fall+mantle, it does not depend both on trunk and with the patch.
stgatilov

stgatilov

26.01.2023 21:03

administrator   ~0015902

If someone wants to take velocity of the mantled entity into account, then it was to be done in idPhysics_Player::UpdateMantleTimers as well.
That's the place where velocity is zeroed.
However, I don't see any info about mantled entity there =(
Given how rare fall+mantle is, probably just ignore the problem.

I think we should just commit the proposed patch.
Daft Mugi

Daft Mugi

26.01.2023 21:17

reporter   ~0015904

Fall mantling is commonly used by veteran Thief players, and that technique can be seen a lot in YouTube videos.
And, I've been experiencing this issue a lot.

I wonder if a mapper has created a fall mantle scenario that is just above getting damaged (without the patch).
So, with the patch, the player will now get damaged.
I hope a mapper hasn't done that!

During your investigation, did you find a way to make the fall damage match what the player would have received before the patch?
stgatilov

stgatilov

26.01.2023 21:31

administrator   ~0015907

No, but I found that reduced damage on the current trunk makes no sense.
Better get rid of it than reproduce it.

Issue History

Date Modified Username Field Change
12.01.2023 01:28 Daft Mugi New Issue
12.01.2023 01:28 Daft Mugi File Added: training_mission (2023-01-11 18-22-51) (1000.11 -261.05 628.25) edited2.jpg
25.01.2023 02:26 Daft Mugi Note Added: 0015881
25.01.2023 02:26 Daft Mugi File Added: training_mission (2023-01-24 19-47-40) (1169.84 -807.46 757.25) edited.jpg
25.01.2023 02:46 Daft Mugi Note Added: 0015882
25.01.2023 02:46 Daft Mugi File Added: r10261-fix-delayed-fall-damage-on-mantle.diff
25.01.2023 21:41 Daft Mugi Note Added: 0015889
25.01.2023 21:41 Daft Mugi File Added: mantle.pk4
26.01.2023 20:30 stgatilov Note Added: 0015897
26.01.2023 20:33 stgatilov Note Edited: 0015897
26.01.2023 20:44 stgatilov Note Added: 0015899
26.01.2023 20:47 stgatilov Note Added: 0015900
26.01.2023 20:58 stgatilov Note Added: 0015901
26.01.2023 21:03 stgatilov Note Added: 0015902
26.01.2023 21:17 Daft Mugi Note Added: 0015904
26.01.2023 21:31 stgatilov Note Added: 0015907