[Bug Report] Physics replication regression in 4.20

Hello ,

I have an issue with the new physics replication implementation in 4.20 and 4.20.1. It seems the new error accumulation does not work as intended. Also, it seems that primitive component “dormancy/sleep” is not replicated correctly.

There are a lot of comments and TODOs in the new PhysicsReplication.ccp module. These out-commented lines caught my attention: PhysicsReplication.cpp#L346. Don’t really know what to look for here but this module does not look as production-ready as most other modules in the engine.

video: - YouTube

The pop at ~0.09 seems to be causing some desync that results in a lot of error accumulating

project: phys420

Same behavior has been seen at ~4 different machines and was not present in 4.19.

Edit: perhaps someone has found a workaround for this? This seems to be the new way of configuring the physics replication:

[/Script/Engine.PhysicsSettings]
PhysicErrorCorrection=(PingExtrapolation=0.100000,
    ErrorPerLinearDifference=1.000000,
    ErrorPerAngularDifference=1.000000,
    MaxRestoredStateError=1.000000,
    PositionLerp=0.000000,
    AngleLerp=0.400000,
    LinearVelocityCoefficient=100.000000,
    AngularVelocityCoefficient=10.000000,
    ErrorAccumulationSeconds=0.500000,
    ErrorAccumulationDistanceSq=15.000000,
    ErrorAccumulationSimilarity=100.000000)

As opposed to:

[/Script/Engine.Engine]
PhysicErrorCorrection=(LinearDeltaThresholdSq=5.000000,
    LinearInterpAlpha=0.200000,
    LinearRecipFixTime=1.000000,
    AngularDeltaThreshold=0.628319,
    AngularInterpAlpha=0.100000,
    AngularRecipFixTime=1.000000,
    BodySpeedThresholdSq=0.200000)

Has anyone found a way to tweak the new values to remove the accumulating errors?

Edit2:

Found a workaround after looking at the code a bit more. It’s hopefully in line with how the devs meant this to be used. However, it should be said, this workaround will only slightly help to re-stabilize the simulation. I think the new “physics manager” approach is a step in a direction where it’s possible to implement things like prediction-correction (as in e.g. Rocket League or Overwatch), but none of that is currently in the engine:

The new physicsreplication module has that config set mentioned above. However, it’s not used by the engine since there is a set of cvars overriding them if not configured to be < 0.0. In our case we want to change the PositionLerp setting to help things stabilize. PositionLerp defaults to exactly 0.0, which means it will override settings in the config. This means we need to either:

[/Script/Engine.PhysicsSettings]
PhysicErrorCorrection=( ... ,PositionLerp=0.020000, ... )

[SystemSettings]
p.PositionLerp=-1 ;; <-- something smaller than 0

or just:

[SystemSettings]
p.PositionLerp=0.02

Took me a while to figure that out. I think perhaps a general rule to prevent these kind of issues being time sinks would be to avoid having cascading settings like this in the engine. Or, at least, be very explicit (as in documentation) about it.

Hello,

We’ve recently made a switch to a new bug reporting method using a more structured form. Please visit the link below for more details and report the issue using the new Bug Submission Form. Feel free to continue to use this thread for community discussion around the issue.

https://epicsupport.force.com/unrealengine/s/

Thanks

Not sure if completely related, but SkeletalMesh physics replication is totally broken in 4.20.1 (haven’t tested 4.20). Server works properly, but client gets sliding and snapping all around. Even the snap (which I guess tries to sync the client up to the server position) fixes itself to an invalid position on the client.

And as an additional bug, detach from component doesn’t seem to replicate properly and retains some sort of attachment which fights with the server replication.

Neither of these happened with 4.19.2

Did enter a report there as well. Was reproduced + added to issues: Unreal Engine Issues and Bug Tracker (UE-62714)

May have made a mistake in pointing out a specific line of code though. There’s more to this than just sleeping an object correctly

Why is the bug report gone?

It’s all broken >:(

hmm, yeah. seems to be removed again. Perhaps it’s edited/duped? @A :diamonds::diamonds:, do you have a link to an issue we can vote on?

edit: that is the correct url above, don’t know why the link did not work. updated my comment with a working link

Is there an issue somewhere that exists that we can track and vote on?