Download

How to update MaxWalkSpeed on Server from client on tick

Hey y’all so I’ve been stuck on trying to replicate character movement for an unholy amount of time. Currently I’m performing a set of calculations on each tick from my PlayerCharacter class to determine their max speed which is also updated on tick by accessing and setting it through the movement component. This works perfectly for standalone and listen servers. To not burden the server with this kind of computations during tick, I’ve tried creating an RPC call from the client to run in the server from this same ExecMovement speed function. Pretty much all this call does is it takes in the final computed speed and sets the MaxWalkSpeed of the PlayerCharacter’s movement component to that value. I thought that setting the same value in the client and server would keep the player movement synchronized. The issue is that this doesn’t seem to actually work and the MaxWalkSpeed can never be increased beyond the value that is initially set. I’m happy to provide code samples and I’ll really appreciate any and all feedback on how to tackle this issue, thanks!

For something like that, you probably should be calculating it both server side and client side, assuming they both have as much data as they need to calculate it, and then have the server update it to the client occasionally. If you’re actually changing their speed every tick, though, you’re probably going to have some really out of whack movement if there’s any latency to speak of.

What’s the end goal? why are you changing the move speed every tick? That is pretty counterproductive to things like move prediction.