Optimal refresh rate for a multiplayer game based on a client server

I am making a multi-player game in C ++:

Clients simply take commands from users, calculate their player’s new position and report it to the server. The server receives such position updates from all clients and transmits them for each of them. In such a scenario, which parameters should determine the time interval between successive updates (I do not want too many updates, therefore, suffocating n / w). I thought that the maximum ping among clients should be one of the defining parameters.

Secondly, how to determine this ping / client delay? Other topics on this forum involve using raw sockets or using the system ping command and collecting data from a file .. they mean using something like system('ping "client ip add" > file') or forking and exec'ing command ping.

+6
c ++ network-programming
source share
3 answers

This answer will depend on which multiplayer game you are talking about. Sounds like you're talking about a game like MMO. If so, then it makes sense to use an "ephemeral channel", which basically means that the client can generate several motion packets per second, but only the most recent motion packets are sent to the server. If you use a similar technique, then you should base your refresh rate on the speed at which players move in the game. By doing this, you can ensure that players do not slip through walls or rush into a trigger too quickly.

The second question I would use boost :: asio to set up a service that your clients can "ping" by sending a simple packet, then the service will send a message to the client, and you can determine the time it took to return the packet.

+4
source share

If you are going to end the raw package, you can also start your own ICMP package; the structure is trivial ( http://en.wikipedia.org/wiki/Ping ).

0
source share

The enet library makes many networks for you. It also calculates the delay.

0
source share

All Articles