So there’s something that I must be missing, but it sounds like the very simplest case I could think of replicated physics doesn’t behave as I would expect it to.
The setup is as follows:
- BP Actor + Static Mesh Component
- Actor Replicates and Replicates Movement = true
- Tried setting the component to replicates on/off, no difference.
- Component is set to Simulate Physics, and Linear Drag is set to 0.
I also have a flying player character to follow along. On BeginPlay I apply a Physics Linear Velocity to the Actor, setting it’s velocity to a fixed value, let’s say 15000,0,0.
Now I would expect this to be replicated and work flawlessly, server sends the client the velocity, and periodic location updates/corrections. But that’s not the case, the Velocity jitters.
As you can see from the following logs, the velocity at the server is constant, yet the client’s velocity varies randomly above or below the set value.
LogBlueprintUserMessages: [BP_TEST_C_UAID_50EBF62291BF856E01_1521310727] Server: TEST = X=15000.000 Y=0.000 Z=0.000
LogBlueprintUserMessages: [BP_TEST_C_UAID_50EBF62291BF856E01_1521310727] Client 1: TEST = X=14901.105 Y=-0.000 Z=0.000
LogBlueprintUserMessages: [BP_TEST_C_UAID_50EBF62291BF856E01_1521310727] Server: TEST = X=15000.000 Y=0.000 Z=0.000
LogBlueprintUserMessages: [BP_TEST_C_UAID_50EBF62291BF856E01_1521310727] Client 1: TEST = X=15005.309 Y=0.000 Z=0.000
LogBlueprintUserMessages: [BP_TEST_C_UAID_50EBF62291BF856E01_1521310727] Server: TEST = X=15000.000 Y=0.000 Z=0.000
LogBlueprintUserMessages: [BP_TEST_C_UAID_50EBF62291BF856E01_1521310727] Client 1: TEST = X=14901.103 Y=-0.000 Z=0.000
LogBlueprintUserMessages: [BP_TEST_C_UAID_50EBF62291BF856E01_1521310727] Server: TEST = X=15000.000 Y=0.000 Z=0.000
LogBlueprintUserMessages: [BP_TEST_C_UAID_50EBF62291BF856E01_1521310727] Client 1: TEST = X=15005.307 Y=0.000 Z=0.000
LogBlueprintUserMessages: [BP_TEST_C_UAID_50EBF62291BF856E01_1521310727] Server: TEST = X=15000.000 Y=0.000 Z=0.000
LogBlueprintUserMessages: [BP_TEST_C_UAID_50EBF62291BF856E01_1521310727] Client 1: TEST = X=14901.102 Y=-0.000 Z=0.000
LogBlueprintUserMessages: [BP_TEST_C_UAID_50EBF62291BF856E01_1521310727] Server: TEST = X=15000.000 Y=0.000 Z=0.000
LogBlueprintUserMessages: [BP_TEST_C_UAID_50EBF62291BF856E01_1521310727] Client 1: TEST = X=14797.620 Y=-0.000 Z=0.000
LogBlueprintUserMessages: [BP_TEST_C_UAID_50EBF62291BF856E01_1521310727] Server: TEST = X=15000.000 Y=0.000 Z=0.000
LogBlueprintUserMessages: [BP_TEST_C_UAID_50EBF62291BF856E01_1521310727] Client 1: TEST = X=15005.305 Y=0.000 Z=0.000
LogBlueprintUserMessages: [BP_TEST_C_UAID_50EBF62291BF856E01_1521310727] Server: TEST = X=15000.000 Y=0.000 Z=0.000
LogBlueprintUserMessages: [BP_TEST_C_UAID_50EBF62291BF856E01_1521310727] Client 1: TEST = X=14901.100 Y=-0.000 Z=0.000
LogBlueprintUserMessages: [BP_TEST_C_UAID_50EBF62291BF856E01_1521310727] Server: TEST = X=15000.000 Y=0.000 Z=0.000
LogBlueprintUserMessages: [BP_TEST_C_UAID_50EBF62291BF856E01_1521310727] Client 1: TEST = X=14797.619 Y=-0.000 Z=0.000
Now the only more or less reasonable explanation I can find is that the Velocity itself is not being replicated, but calculated on the client based on the position delta reported, and this somehow introduces some error?
Of course the higher the speed, the more noticeable this error is.
I would had expected for the server to replicate the bodies velocity, and both simulation to run in sync.
The result of this discrepancy is that there’s some jittering visible on the moving object relative to the player’s character (it “rubber-bands”).
I would appreciate if anyone can shed some information on this mystery.
Cheers!