Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
3

Client > server character management lag mitigation?

Asked by 10 years ago

So, I have a secure system set up with my character rig that works by sending the key inputs you make to the sever, which they changes the character's velocities and stuff accordingly (i.e. you press Spacebar to jump, W to go forward, etc.). This works as intended, however there can be multiple seconds of lag between when you press the key, and when you see the action happen on your screen.

Visually, my system currently looks like this: Client input > Server interprets input > Server changes character motion > Server sends changes to client and client changes animations based on the new data

This results in a delay depending on server lag and your connection. What I'd optimally like to see is a near instant change on the client, which is then corrected by the server - but because the character uses body objects, determining where it should be corrected to (and how) becomes a problem.

My question is, how can I change this so that the input is much more responsive, while doing it in a way that would be secure (aka not putting all the character movement on the client)?

1 answer

Log in to vote
1
Answered by
MrNicNac 855 Moderation Voter
10 years ago

I would think that the answer is somewhat obvious.

Bungie once demonstrated the sole solution to com-time. It's not to rely on the server (as you do for security) and wait for a response. In serious game development, this can be considered unreliable.

You have to take the clients input and create a placebo. Move the character accordingly on the client via the client. This is the fastest way. Have you ever played CoD or Halo and, during lag, sometimes notice your character jump back to a different place before? That's because that was the last point the server received the client info to check, but you appeared (on your end) to see yourself moving fine in another direction.

Ad

Answer this question