0
\$\begingroup\$

I am developing a 2D platform and shooting video game in Unity 2D with authoritative logic / physics on the server (The physics server is also developed in Unity to be able to use the box2D library on both the client and the server).

Currently I am working on the basic communication functionality between the client and the server using socket to send the client's inputs to the server and executing the physics on it. And this is where I find myself with a question that I can't solve after searching a lot on google and forums. When should you send the client's inputs to the server? Setting a delivery tickrate or each time the user clicks on the controls?

As I have analyzed on my own, what seems more efficient at first is to send the inputs to the server each time the client presses one of the game controls. And on the other hand that the server sends the clients the status of the game (player movements, changes in physics, etc.) using a tick rate. This is a diagram of the communication and behavior that I am developing:

enter image description here

As you see this operation. Should I also set a tickrate on the client?

Thank you very much.

\$\endgroup\$
  • \$\begingroup\$ It sounds like you have a workable solution. Do you have any evidence that this causes a problem for your use case? eg. That you're wasting too much bandwidth sending individual input packets that could have been batched into messages once per tick? If not, why not proceed the way you've thought of so far? \$\endgroup\$ – DMGregory Oct 12 at 23:23
  • \$\begingroup\$ No, I don't really have any bandwidth problems at the moment. I have made this behavioral decision since I saw it in a netcode manual (send input to server directly) But in the rest of the netcode websites they talk about a tickrate also for the sending of customer inputs and that is why I had doubts about whether my approach was adequate. Thank you. \$\endgroup\$ – Antonio Agustin Oct 13 at 8:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.