Skip to main content
Clarification in summary.
Source Link

I'm by no means a networking or Java expert but I'll give it a shot.

Does the issue get worse the more clients you add? If so, I ran into a similar issue using node and websockets (I don't have any java experience).

For me, the problem was that I was simply sending too many packets to the server. On localhost it would work fine for up to two clients, but more, or a remote server, made everything very laggy.

I fixed my issue by only sending a client's input state to the server if the input actually changed. The server can just assume a client is still doing the same if it was not notified of any changes.

Server-Side it was also key to notify the clients only of the info they absolutely needed to reconstruct any changes that happened. Using interpolation for the other players was also a must (as 60t/s was neither feasible nor required for my scenario), introducing a frame or two of delay, but greatly reducing server-load.

So, to summarize:

  • Try to only send updates to the server on input changes
  • ifIf required, try lowering the rate at which you update clients about other clients, but keep reading a client's input changes at 60t/s.
  • useUse inter/extrapolation to try and cover up the "holes" of data about the other players.

I'm by no means a networking or Java expert but I'll give it a shot.

Does the issue get worse the more clients you add? If so, I ran into a similar issue using node and websockets (I don't have any java experience).

For me, the problem was I was simply sending too many packets to the server. On localhost it would work fine for up to two clients, but more, or a remote server, made everything very laggy.

I fixed my issue by only sending a client's input state to the server if the input actually changed. The server can just assume a client is still doing the same if it was not notified of any changes.

Server-Side it was also key to notify the clients only of the info they absolutely needed to reconstruct any changes that happened. Using interpolation for the other players was also a must (as 60t/s was neither feasible nor required for my scenario), introducing a frame or two of delay, but greatly reducing server-load.

So, to summarize:

  • Try to only send updates to the server on input changes
  • if required, try lowering the rate at which you update clients about other clients, but keep reading a client's input at 60t/s.
  • use inter/extrapolation to try and cover up the "holes" of data about the other players.

I'm by no means a networking or Java expert but I'll give it a shot.

Does the issue get worse the more clients you add? If so, I ran into a similar issue using node and websockets (I don't have any java experience).

For me, the problem was that I was simply sending too many packets to the server. On localhost it would work fine for up to two clients, but more, or a remote server, made everything very laggy.

I fixed my issue by only sending a client's input state to the server if the input actually changed. The server can just assume a client is still doing the same if it was not notified of any changes.

Server-Side it was also key to notify the clients only of the info they absolutely needed to reconstruct any changes that happened. Using interpolation for the other players was also a must (as 60t/s was neither feasible nor required for my scenario), introducing a frame or two of delay, but greatly reducing server-load.

So, to summarize:

  • Try to only send updates to the server on input changes
  • If required, try lowering the rate at which you update clients about other clients, but keep reading a client's input changes at 60t/s.
  • Use inter/extrapolation to try and cover up the "holes" of data about the other players.
Source Link

I'm by no means a networking or Java expert but I'll give it a shot.

Does the issue get worse the more clients you add? If so, I ran into a similar issue using node and websockets (I don't have any java experience).

For me, the problem was I was simply sending too many packets to the server. On localhost it would work fine for up to two clients, but more, or a remote server, made everything very laggy.

I fixed my issue by only sending a client's input state to the server if the input actually changed. The server can just assume a client is still doing the same if it was not notified of any changes.

Server-Side it was also key to notify the clients only of the info they absolutely needed to reconstruct any changes that happened. Using interpolation for the other players was also a must (as 60t/s was neither feasible nor required for my scenario), introducing a frame or two of delay, but greatly reducing server-load.

So, to summarize:

  • Try to only send updates to the server on input changes
  • if required, try lowering the rate at which you update clients about other clients, but keep reading a client's input at 60t/s.
  • use inter/extrapolation to try and cover up the "holes" of data about the other players.