When I set the MaxWalkSpeed of the player character on the client when the character presses the sprint input action, the server does not let the character walk faster. Initially I had thought that the client simply wasn’t able to receive a sprint input action because the client character wasn’t sprinting when the action was pressed. What I believe is happening now is that the client is in fact trying to sprint but the server is moving the client back because it doesn’t agree that the MaxWalkSpeed has changed.
When I showdebug enhancedinput in the console I see the enhanced input box jitter back and forth only when I press the sprint button, which further implies that the client is moving faster but then is getting moved back by the server. My sprint input action looks like:
bReplicates is set to true, and all other aspects of the movement replicate correctly, but the server does not seem to receive when the MaxWalkSpeed of the client changes. Sprinting works fine on the server. How do I get the server to recognize the change to MaxWalkSpeed?
To have the server recognize the change to MaxWalkSpeed, you need to use a network replication method. In your code, you can use the Multicast or Server functions to replicate the MaxWalkSpeed changes from the client to the server. For example:
This way, when the sprint input is pressed on the client, the MulticastSprintStart function will be called, which will replicate the change to MaxWalkSpeed to the server and all other clients in the network. Similarly, when the sprint input is released, the MulticastSprintEnd function will be called, replicating the change to MaxWalkSpeed back to the original value.
I tried to implement those changes but I am getting “Failed to link patch” errors. The errors are saying that those functions are already defined in my PlayerCharacter.gen.cpp.obj.