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.
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.