Ideal message size

We are structuring our message input logic in the server runtime and we are curious on what is the ideal way of sending updates to all connected users.

In our case:

  • Each connected player sends a position update ten times a second
  • The server processes the input at a fixed tick rate (in this case the same 10 times a sec)
  • After doing some distance calc to send updates for visible opponents only, it should send to each user the position of the players close to him.

In that case, is it better to compose a single big message with all the visible players and send it to the user? Or send smaller messages, one for each visible player?

We are aware of the generic rule keep the messages small and flowing, though in this case we are tempted to pack everything together.

Any idea?

Generally your messages should be as small and infrequent as possible. When you can’t do both then the balance depends on the game design, purpose of the messages etc.

In your case the authoritative match handler is the perfect place to handle logic that cuts down and merges messages: have the server decide what data is relevant to each player, place that data into a single message, and send it to a particular user. Your message flow in this model would be at most 1 message in and 1 message out per tick between each client and the server.