Changing Character Speed with replication [Blueprint]

Lets take a moment here are discuss what happens in your case.

Lets say You have 3 players

Server

Client1

Client2

When Client1 calls the “Run on Server” event that changes the movement speed of your character, the movement speed changes only on Server. For Server its fine. For Client2 it is also fine because it does not control or influence Client1’s character at all, it only believes about Client1 what Server wants it to believe.

However, on for Client1, things are not the same. This is because it is doing its own simulation of the character and complies with updates from Server. Now if server think that Client1’s character is running at 1000 speed and Client1 thinks the character is running at 500, Client1 will move it at 500 speed and then when an update comes from Server it will teleport the character to the location that the Server told it.

In your case, try changing it on client like a singleplayer game and then also calling a function that also updates it on server. This will ensure that both parties will think that character is more or less in the same place when the next update hits.

Precisely because your Client1 had not changed its movement speed locally are you seeing it trying to walk in place while server bumps him back to where he should be.

Good luck, hope this helped

So, I recently decided to try my hand at replication/networking in UE4. After some time reading/watching tutorials and documentation I thought I had a grasp on it and I can do some basic stuff and have it work on Client and Server. All was dandy until I started hashing out my character blueprint. What’s a game without a sprint feature right? That’s where I hit my snag. Doing what I thought was accurate doesn’t seem to work and after taking my issue to Google and searching around in the help section I’m left scratching my head. I thought that in order to change the speed in order to reflect a sprinting action I’d have the client press a button, which would call a Custom Event with “run on server” as the replicated method. All works fine at first glance but then I noticed, all is not fine at all. The client stutters or downright doesn’t “sprint”. Checking against what I’ve found in the answer hub and other places the basic setup always seems to be telling me to do exactly what I’m doing. So, next step was to weed out any unwanted variables. I started a new project, Third Person Example, and tried the same basic, “Input → Replicated Event Call-> change values” and received the same weird behavior.

So, what am I doing wrong and how should I go about fixing it? Everything I’ve seen says it’s super simple and I see people saying, “thanks! that fixed it!” but on my end it’s totally non-functional. For a prime example of how this is bugging out, setting the Max Walk Speed to 0 from client to Server displays the character standing still on the Server side and to other clients but the client itself sees the character walking weirdly in-place.

This is what I’ve seen as a suggested fix but I’ve so far not had any luck with it.

What does seem to work, and I’m not sure if accurate, is to do that check if the sprint button is held on the server, then multicast and change the speed but that doesn’t seem accurate to me. I know that changing it one the client and then running the replicated custom event also works but again, that doesn’t seem accurate. Have I found my answer(s) or can somebody point me in a better direction?