Pawn Movement Replication Issues

Hello, everyone!
I’m having a bit of difficulty today! So, I’m trying to make my pawn replicate across the server using a floating pawn movement (and yes, I can’t use a character for multiple reasons) the rotation mechanic that runs on the same function replicates perfectly, it is purely the movement aspect. I have my actor set to replicate both with movement and standard replication, and every component tied to it.



This is all of the code located in my pawn blueprint, the enhanced input action is coming through, yes. Again, the movement is the only thing having issues. Not sure if this has any relevance but everything is set to replicate including the actor movement.

If anyone has any ideas or thoughts please don’t hesitate to respond, just throw any ideas at me that you get that may possibly fix it.

If someone needs more photos or has questions relating to it, I’ll provide them.

Anyone have any ideas?

I recommend you execute the movement logic locally, then replicate the floats.

Then 0 logic is an example. Change what you need to in that regard.
e.g. scene component rotation, float clamps etc.

I’d clamp both floats and set new locals as their reps and use those moving forward.

1 Like

Thanks!
One minor problem though, this creates an infinite loop as though on move input it triggers the function which inside triggers the server move event which then repeats by triggering move input.

And also, what’s defining X and Y? Should that be a set node at the beginning of AI Movement?

Edit:
Ok, I got the movement thing but still doesn’t replicate and even if it were to, all of a sudden my Y access controls one client while the X axis controls the other, it seems as though when I use my X axis it makes the other client drive based on the current angle of the other client.

Ok, so I found a solve, but I’m not sure how stable or cheatable it is. It involves the movement on the client and then replicating its position to the server. I don’t know how Unreal’s anti-cheat works, as to if the client can change values on their end. In which it wouldn’t be stable. But it also doesn’t collide, it simply clips through everything, I presume because I’m setting the location.

Unreal, nor any other engine has anti-cheat built in. This is something you have to code for. Multiplayer 101 is you never trust the client.

Look at UE’s character movement component. It uses client-side prediction which is essentially the client inputs movement that’s processed locally. It then saves the move and passes the result to the server. The server in turn processes the same input on its sim. It compares its results with what the client sent. If they are close enough (margin of error) the server sends back an ack for the move. Otherwise it sends a correction.

I highly recommend you read through the docs.

1 Like

Thank you for such helpful replies!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.