How can I set up client-trusting movement?

Hello,

I’m developing a third-person melee combat prototype, and I’m using a multiplayer system whereby one player becomes the server, and clients will dynamically join (i.e, I’m not using a dedicated server). As such, I’d like to set up the character movement component to trust the client movement and thereby default to adjusting the client character that is seen by the server to the client’s calculated self position rather than adjusting the client position as seen by the client to the server’s calculated client position - which has resulted in the client teleporting about on their own screen when using high-speed moves like dashes and such. I tried enabling “Ignore client error checks and correction” when needed, but I’ve found it’s more of a bandaid solution that still results in teleporting when disabled, and too much desync when enabled.

I realize this type of setup would typically open up to cheating, but I’m not developing anything competitive and since I’m not using a dedicated server it’s a bit of a moot point anyways.

I typically like to stick to blueprints, but I’m not averse to doing a bit of c++ if needed. Thank you!

For this you will basically need to write a good chunk of C++. Specifically the character movement component. Specifically in the character movement component look at:

UCharacterMovementComponent::CallServerMove and UCharacterMovementComponent::ServerMove_Implementation

You will also want to check into how the client combines and saves moves before sending them to the server: UCharacterMovementComponent::ReplicateMoveToServer inside of here there is FSavedMovePtr. These objects store the data for the move per tick. Additionally, these saved moves are combined if they are similar enough, and they don’t contain an important move such as wanting to crouch or pressing jump.

With this you should be able to create your own client authoritative movement system. I would recommend you have each other client validate each others moves for anti-cheat purposes but that in itself can cause issues if a cheater never validates their opponents moves.