OldUnreal / UnrealTournamentPatches

Other
975 stars 29 forks source link

[469d] Rubber band warping when landing from a dodge #1612

Open BerserkerBG opened 2 weeks ago

BerserkerBG commented 2 weeks ago

When you're playing on a server, sometimes you can notice rubber band warps when you land from a dodge. Here is a video showcasing the issue, notice the warping of the last dodge landing:

https://github.com/user-attachments/assets/b1809cd1-aaba-41c5-aef6-3f9539051596

Reproduce steps:

  1. Run a local server
  2. Simulate 300 high ping (this issue happens on lower ping, but 300 ping is easier for reproduce purposes)
  3. Enter the local server and start dodging left and right. Make simple and quick double tap dodging without any extra movement mid-air.

Result: Eventually you will warp when you land from a dodge

Melle4x commented 2 weeks ago

I suspect this happens due to a SavedMove not having the correct DodgeDir.

When logging the Landed() function inside a subclass of PlayerPawn: https://github.com/UT-BT/UT99/blob/main/Engine/PlayerPawn.uc#L4146

function Landed(vector HitNormal)
{
    Log("DodgeDir = " $ GetEnum(enum'EDodgeDir', DodgeDir) $ " | bUpdating = " $ bUpdating);
    Super.Landed(HitNormal);
}

We can find multiple log events during 1 landing. When landing a dodge with ~120 ping we usually get 2-4 calls per landing:

ScriptLog: DodgeDir = DODGE_Active | bUpdating = False
ScriptLog: DodgeDir = DODGE_Done   | bUpdating = True
ScriptLog: DodgeDir = DODGE_Done   | bUpdating = True

In the example above, the 1st call had bUpdating on false, with the correct DodgeDir. On the 2nd and 3rd call, bUpdating was true, which indicates it's a SavedMove coming from ClientUpdatePosition(): https://github.com/UT-BT/UT99/blob/main/Engine/PlayerPawn.uc#L1173

The issue seems to be that during those SavedMoves, DodgeDir is not on the correct value anymore (should be DODGE_Active). Meaning that when landing a dodge, no velocity reduction is applied during those SavedMoves: https://github.com/UT-BT/UT99/blob/main/Engine/PlayerPawn.uc#L4149

This causes the client to land/slide further than it should, temporarily, for a few frames, and snap back right after. (during the SavedMoves the player is landing with full dodge velocity ~600, instead of ~60 velocity (10%))