View Issue Details

IDProjectCategoryView StatusLast Update
0006231The Dark ModCodingpublic28.01.2023 14:10
ReporterDaft Mugi Assigned Tostgatilov  
PrioritylowSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product VersionSVN 
Target VersionTDM 2.11Fixed in VersionTDM 2.11 
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.
Attached Files

Activities

Daft Mugi

Daft Mugi

25.01.2023 02:26

developer   ~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

developer   ~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

developer   ~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

developer   ~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.
nbohr1more

nbohr1more

27.01.2023 03:03

developer   ~0015909

Keep in mind that the mission "The Rift" relies on things like "jumping down from very high locations to land in the water".
I believe that some of the mitigations against full fall damage were implemented after a TDM update broke that mission.
I don't recall any other missions relying on this stuff but it's something to consider.
stgatilov

stgatilov

27.01.2023 21:07

administrator   ~0015910

There is no change to damage for an ordinary fall.
What is changed is the damage you get after a fall ends with a mantle.
On current trunk is is reduced, as if the impact velocity is diminished by 150, and this is quite arbitrary number which has nothing to do with falls and mantling.
stgatilov

stgatilov

27.01.2023 21:20

administrator   ~0015911

I committed the patch as svn rev 10263.
Daft Mugi

Daft Mugi

28.01.2023 12:27

developer   ~0015913

I feel uneasy about this change, because it makes the game harder and could potentially break a route used by players in a mission.
When a player ghosts a mission, they are not allowed to take any damage, for example.

Even though the -150 doesn't make sense, it's part of the game mechanics now.
So, I think that -150 needs to be reproduced somehow.
stgatilov

stgatilov

28.01.2023 13:22

administrator   ~0015914

That would be "Bug for bug compatibility".
Something we should do when we have to, but not more often then that.

I believe the current behavior of lower damage was never intentional (maybe not even present in the first release).
Also, I think most people usually fall from high height on their foot, so it is unlikely this is critical for any mission.
In the current state it is a bug, and if someone uses it, then it is an exploit.

I might recall a similar case.
In older TDM versions, picking a lock did not end when player moved away from the door.
The player could start picking a lock, go to another end of the level, then return and continue picking from the same place where he left, as long as he held the button all the time.
And that could easily be used to make gameplay easier: you can pick a bit, then hide from the guard, then return and continue.
Anyway, leaving it in place did not make sense.

If you think this is a big deal, we can wait until there are people complaining about how it makes some part of some mission worse.
Also, it might make sense to delay this for after 2.11: committing some changes that changes again shortly afterwards is not very nice.
stgatilov

stgatilov

28.01.2023 13:24

administrator   ~0015915

Yeah, I checked Blame: the 150 thing was a hack applied in 2018 in order to fix damage on "uncapped FPS" mode.
So that's not the original TDM behavior =)
Daft Mugi

Daft Mugi

28.01.2023 14:08

developer   ~0015916

That's good news: re 2018 hack.
And, "The Rift" came out in 2010.

I guess my vote is to keep rev 10263 and watch for complaints.
The difference in damage is pretty negligible anyway, so hopefully it won't make a difference during actual gameplay.
Daft Mugi

Daft Mugi

28.01.2023 14:10

developer   ~0015917

Thank you for all of the investigating!
This issue is much easier to understand now. =)

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
27.01.2023 03:03 nbohr1more Note Added: 0015909
27.01.2023 21:07 stgatilov Note Added: 0015910
27.01.2023 21:20 stgatilov Note Added: 0015911
27.01.2023 21:21 stgatilov Assigned To => stgatilov
27.01.2023 21:21 stgatilov Status new => resolved
27.01.2023 21:21 stgatilov Resolution open => fixed
27.01.2023 21:21 stgatilov Fixed in Version => TDM 2.11
27.01.2023 21:21 stgatilov Target Version => TDM 2.11
28.01.2023 12:27 Daft Mugi Note Added: 0015913
28.01.2023 13:22 stgatilov Note Added: 0015914
28.01.2023 13:24 stgatilov Note Added: 0015915
28.01.2023 14:08 Daft Mugi Note Added: 0015916
28.01.2023 14:10 Daft Mugi Note Added: 0015917