4-27 How to make a Vehicle Multiplayer? Physics Replication and Client Side Prediction?

Hello
I’ve just tried the multiplayer with the Vehicle Sample Project. It’s not going well, there seem to be no lag compensation leading to jittering. I’ve checked the Code and there is no client side prediction like in the CharacterMovementComponent. What would be the easiest way to solve the problem?
Do I have to create a custom movement component and implement the NetworkPredictionInterface? If so is there any more information about this.
Thanks.

From what I can see in the UE documentation, there doesn’t seem to be a complete multiplayer implementation for the Vehicle Sample Project. So, yes, you will have to implement client-side prediction on your end. I found a sample implementation in the documentation that could help you:

You could change over to Chaos Vehicles. It’s networked.

Thanks for your responses.
@anonymous_user_30ad8436 Yeah, the Interface also sent me there. I tried implementing something similar. The problem I’m facing with simulated physics, is that Client and Server are moving appart pretty fast, as the identical physics calculation on the client and server will lead to different results, which then lead to frequent serverside corrections. Even with substepping. This problem does not exist on the CharacterMovementComponent. But apprentely, the Character is not using FPhysicsInterface_PhysX, or at least I couldn’t find it. Can you or someone tell me, what kind of Physics the CharacterMovementComponent is using for the Forces? Is this just custom stuff unrelated to the physics engine?

I dind’t knew that, but after trying it does not seem to have client side prediction leading to the same problems. Is there something I’m missing? Thanks in advance.

I’m not having that issue on my build.

I’d make a vid, but I don’t have the time. Here’s a decent one that should help you.

Thank you for taking time and answer here again. The setup is not the problem and with no Ping at all it works just fine. But as soon in realistic environment, the car starts jittering and teleporting on the clients due to the ping and turnaround over the server as there is no client side prediction, especially on higher velocity, its unplayable with bad pings. The creator of the video you’ve posted has wrote that himself in the comments.

I’m not sure what you mean by “realistic environment”. Do you mean running the game between a remote server and your computer as a client? If so, do you encounter the same issues locally?

Yes exactly. Locally everything works fine. But as soon there is a ping, there is an input lag. It’s expected as there is no client side prediction.

I see. I found this thread and I think it can help you. Another guy a while back had a very similar issue and posted how he solved it, which might also work for you. The link points to his solution, but you can give the first couple of posts a read since a staff member was also participating in the thread to sort that issue out.

1 Like