I'm writing a server and a client.
Each client, sends a NetOutgoingMessage every 50 ms, that's equal to 20 messages per second. This message cointains 4 variables, which represent the current player's position and rotation.
The server, after receiving this message, calculates the next position of the player, then sends it back to all connected players from that match, using the following line:
server.SendMessage(outMessage, connectionsList, NetDeliveryMethod.Unreliable, 0);
(connectionsList is a list of NetConnection objects, not an array)
Also, the server constantly sends an update of the current position of another object, a ball, every 30 ms; that's equal to 33 times per second. The message is sent by a separate thread.
The problem is:
I get intense delay when running over 3 instances of the client on the same machine, or a different machine in the local network. It looks like the network messages are getting stuck in a stack of messages, because even after I close the other clients, the messages from those disconnected clients take too long to arrive at the client that's still running.
Are the messages being sent too frequently? What's going on?
(I'm using the latest version of the library, and coding the client on Unity)