Speedboost causes stutter in multiplayer

I need to implement a speedboost for a shot duration of time. Problem is that, the client stutters just when the boost is activated and just when it deactivates (ends) - that is, when the max walk speed is suddenly changed. And since the boost’s movement speed is quite fast, it also creates stutters while using it randomly. Is there a fix for this?

Hey!

How did you replicate the speed boost state to the server and clients?

If you are using a listen server and the hosts’ speed boost is working then the most likely problem is that server is overriding the actors speed as it was not authorized.

Hey!

So basically, the speedboost works for clients and the server both, that’s no issue.

The way I have implmented it is by just setting the max walk speed to a higher value, on both the client and the server.

My problem is the stutter that occurs the moment the speedboost is activated (for a very brief duration, maybe like 0.2 seconds), because obviously due to ping, the server will set the walk speed a few milliseconds later. Is there any way to work around this? so that maybe the server won’t correct the client for the brief moment until it sets the max walk speed itself?

The problem of delays is well described in this article.

You need an additional character model (without replication) for the time being until the server receives the signal to turn on speedboost. Then you can smoothly move it to the main model (interpolate) when the stuttering has stopped.

You’re using the default character class which is built on client-side prediction. All movement changes have to be applied to the client first, then RPC the server to do the same action. If done correctly the client will not jitter.

The jitter is caused by client & server fighting each other about the movement speed. Server is Authority. When it determines the client is wrong it corrects.

Correct flow is as follows.

Input -> Can I boost? [true] -> change max speed -> RPC server
Server -> Can I boost? [true] -> change max speed

You should read the docs.

1 Like

the stutter also occurs on the player who activated the boost, is there any work around for that

I have a very good understanding of multiplayer, should’ve mentioned that before, my bad. But the issue in my case is that I think the bcoz the speedboost sets the speed to quite a high value, the distance error may be a bit too big to interpolate and hence the server teleport-corrects the player just for a brief moment

and there’s also a stutter while using the boost if the player changes direction frequently, when I set “network emulation” to average. that is a bigger problem, any work arounds for that?

You need to make a more “loyal” replication system with timestamps.
The problem is that you get from the server the player’s position, where you were several frames ago.
With timestamps, you will be able to compare the character’s position on the client “in the past” with the result returned by the server, and based on this, introduce an additional offset of the position, so that it corresponds to the server’s.

alright, so no straightforward solution, gotcha

also, I found 2 variables in the character movement settings

image

I read their tooltips, kinda got an idea of what they do, but still wanted to confirm, would you recommend using these? have you used these before?

How high is the speed boost? I have done testing at 2000 cm/s with no issues.

You can use them, but remember when those are ticked a client can do movement cheats.

Hey, thanks for the reply, and insight about the variables.

The boost speed is around 1100-1300 units (different for different characters, with max limit being 1300)

Also, you said you tested it at 2000 cm/s? I’m assuming you meant m/s? Or does unreal use cm/s for movement speed?

UE uses cm.

600 cm/s → 13.4216 Mph
2000 cm/s → 44.73873 Mph

Average IRL running speed is 11 Mph (500 cm/s)

1 Like