Download

Replicating button / input event state from client -> server.

Hey all,

I have set up my abilities so that they can dictate player velocity. Essentially abilities can set a custom movement mode on the character movement component and within this custom movement mode we ask the ability each frame what its desired velocity is for the player. The wrinkle comes in when the velocity we calculate changes based on whether the player has their stick deflected in a certain direction, or whether they’re holding down a specific button. Since we don’t currently replicate button state from client->server the server will always have unset values, resulting in the client and server version of the ability requesting different velocities for the player. This of course causes the player to rubber band as the server starts to correct the autonomous proxy back to where it thinks it should be.

So the big question is how do I get button states from client to server? I’ve dug and dug in this forum and on the nets but can’t seem to get a straight answer. My initial approach is to cache the “pressed” state of my custom input events, pack them into something efficient like a uint16, send them up through the character movement component in ReplicateMoveToServer() / saved moves. In the process of trying to do this I feel like the engine is yelling at me that I’m going about this the wrong way.

Looking for the “right” way!

Thanks!

Servers have no HUD so there’s nothing to replicate.
Client must send a RPC to server process the inputs.

As I mentioned I’m not networking button states for HUD feedback I’m networking the button states to sync velocity calculation on client/server when that calculation is dependent on button state. If anyone else has an opinion I’d love to hear it!

Ah I see you’re being pedantic. Thanks so much! If anyone else has an opinion I’d love to hear it!