Which peer is the best to host game for others?

Started by
13 comments, last by savail 10 years, 10 months ago

Hey,

I would like to know if there is any way to find out who of the peers in a particular group is the most appropriate among others. So far all of them are connected to external server which now has to make decision about who of them would be best to host game for others. Can external server somehow examine who would be best? I guess RTT only is not enough becouse I still lack information about direction of peers(They can be in the same direction or in the opposite in relation to server's location)

I would be very grateful for help!

Advertisement
Hmm, maybe you can let all clients measure the RTT to all other clients and send the data to the server. Then the server could use that information to decide which client to choose.

You could choose the client with the smallest RTT sum, or the client with the smallest maximum RTT value, or something more complex, not sure what is best.

Assuming you must choose the host out of a fixed group of players that will all play the same game (not a big pool of players that needs grouping into games such that everyone has good RTT with their host)

You could:

1.Connect all the players together

2.Measure round trip times, possibly bandwidth and other data

3.Use some algorithm to sort everyone based on how good hosts they are. Combine the above RTT etc. data along with player data you have recorded earlier (like how often they disconnect mid game, frequent problems with connection...)

4.Pick the best one

For sorting you might want to measure, in order of importance:

-Connectivity - can all players connect to the host

-Bandwidth (can the player handle the required traffic at all)

-RTT (best playing experience for all players. Minimum RTT, minimum variance in RTT)

-Quality of connection (occasional slowdowns, quitting mid game, corrupted/lost packets)

So first make sure he can act as a host, then look into the quality of the connection.

o3o

@Wooh: well yeah, that's a solution but it hardly appeals to me becouse it requires a lot of work on both sides of connection (the master server and peers). Maybe there's some algorithm which uses RTT values from each peer to match-making server and could calculate which client would be best regardless of server's and peers' location?

@Waterlimon: Hmm, that seems like a lot of work to do as well, but I guess it's all necessary? Now I know why I load into some games so long :P.

Ok, so I have another question. To measure the RTT between each peer I have to send to each of them their addresses and ports, so Is that fine in the matter of security?

If someone is playing a game that allows remote servers, then they are by definition OK with that game going through their firewall to get to those remove game servers. In this case, each remote player peer is a "game server" for the duration of the measurements. If you're not OK with that, then don't use peer-to-peer servers.

enum Bool { True, False, FileNotFound };

hmm I'm fine with that :P. But if all players know each other's addresses I'm wondering if is there anything I can do (or have to do) in order to secure players so that no-one will be able to hack into their computers by my game?


But if all players know each other's addresses I'm wondering if is there anything I can do (or have to do) in order to secure players so that no-one will be able to hack into their computers by my game?

That is two issues.

For the first issue, if you have a peer-to-peer system every machine needs to know the address of the peers. That is just how networking works. It must happen if you choose that route.

For the second issue, that would be possible on ANY network connection if you are careless in your programming. Most games require a very simple communications protocol. Always validate the input. That is enough to mitigate the problem.

Thanks for answer. Do you know maybe some popular games which use peer to peer (1 peer hosts game for others)? I'm asking becouse I actually haven't heard about hacking into sombody's computer becouse of knowing its address from peer-to-peer game and wouldn't like my game to be worse :p. I don't know but I think that League of Legends might be peer-to-peer and never heard about hacking into sb's computer using this game... Can that actually happen? Do hackers tend to do such things?;p

The only way to determine the quality of the connection between two machines is to test it.

You can use testing between the matchmaker and a client to eliminate it from consideration (for example, it might not have the bandwidth necessary), but you cannot determine if it will have acceptable connections to all of the other machines from the client/matchmaker interaction.

As far as hackers attacking games, I'd recommend that you look here: http://aluigi.altervista.org/poc.htm and here: http://revuln.com/research.htm#casestudies

Games that use user-hosted servers will sometimes suffer from flooding, where some sore loser will turn on a network packet flood to bring down the internet connection of the user hosting the game.

The only way to somewhat insulate players from other players is to host the servers yourself, and not letting players get information about other players. Of course, players will often trade information through chat on their own, and sometimes they might end up regretting it at some point.

The internet is a scary place.

enum Bool { True, False, FileNotFound };

This topic is closed to new replies.

Advertisement