Jump to content

  • Log In with Google      Sign In   
  • Create Account


Which peer is the best to host game for others?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
14 replies to this topic

#1 savail   Members   -  Reputation: 333

Like
0Likes
Like

Posted 25 June 2013 - 04:49 AM

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!



Sponsor:

#2 Wooh   Members   -  Reputation: 611

Like
0Likes
Like

Posted 25 June 2013 - 06:56 AM

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.

#3 Waterlimon   Crossbones+   -  Reputation: 2464

Like
1Likes
Like

Posted 25 June 2013 - 07:08 AM

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


#4 savail   Members   -  Reputation: 333

Like
0Likes
Like

Posted 25 June 2013 - 07:12 AM

@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?


Edited by savail, 25 June 2013 - 07:21 AM.


#5 hplus0603   Moderators   -  Reputation: 5164

Like
0Likes
Like

Posted 25 June 2013 - 11:11 AM

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 };

#6 savail   Members   -  Reputation: 333

Like
0Likes
Like

Posted 25 June 2013 - 11:41 AM

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?



#7 frob   Moderators   -  Reputation: 20270

Like
1Likes
Like

Posted 25 June 2013 - 12:19 PM


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.


Check out my personal indie blog at bryanwagstaff.com.

#8 savail   Members   -  Reputation: 333

Like
0Likes
Like

Posted 25 June 2013 - 03:22 PM

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



#9 Dave Weinstein   Members   -  Reputation: 495

Like
0Likes
Like

Posted 25 June 2013 - 06:07 PM

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


Edited by Dave Weinstein, 25 June 2013 - 06:08 PM.


#10 hplus0603   Moderators   -  Reputation: 5164

Like
0Likes
Like

Posted 25 June 2013 - 07:01 PM

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 };

#11 savail   Members   -  Reputation: 333

Like
0Likes
Like

Posted 28 June 2013 - 08:24 AM

hmm ok thanks for answers. I've decided to judge which peer is best to host game by 2 values: average RTT and average RTT variance. Does anyone know any algorithm which could help me calculate which peer would be most suitable based on this info?



#12 hplus0603   Moderators   -  Reputation: 5164

Like
0Likes
Like

Posted 28 June 2013 - 10:29 AM

The simplest algorithm will work:

 

1) Send packets

2) Receive responses

3) Measure timing

4) Calculate RTT and variance


enum Bool { True, False, FileNotFound };

#13 savail   Members   -  Reputation: 333

Like
0Likes
Like

Posted 28 June 2013 - 12:24 PM

yeah, I already measured both of these things and now I thought I could combine them into 1 value and judging by it I could choose the best host, hmm? But how to combine those 2 values into one? Add them? In what ratio, etc? Or maybe that's not a good approach?



#14 hplus0603   Moderators   -  Reputation: 5164

Like
1Likes
Like

Posted 28 June 2013 - 06:09 PM

yeah, I already measured both of these things and now I thought I could combine them into 1 value and judging by it I could choose the best host, hmm? But how to combine those 2 values into one? Add them? In what ratio, etc? Or maybe that's not a good approach?

 

There is no "one size fits all" here. Adding them with some kind of weighting factors would probably work okay. If you really worry about jitter, you might weight the standard deviation by a factor 20 compared to the RTT, and choose the smallest value. If you don't worry as much about jitter, you might add standard deviation by a factor of 1.

 

For what it's worth, if the jitter is Gaussian distributed (it may or may not be,) adding one standard deviation gets you to about 65% of the curve; two standard deviations 95%, and three standard deviations to 99.7%, IIRC.

 

And Standard Deviation is the square root of variance, and a better unit to compare to the actual average, because it has the same unitless cardinality as the average -- variance is the square, by contrast.

 

So, to start somewhere, I'd calculate "RTT + 2 * SDEV" and pick the host that has the smallest value.


enum Bool { True, False, FileNotFound };

#15 savail   Members   -  Reputation: 333

Like
0Likes
Like

Posted 29 June 2013 - 03:23 AM

Thanks a lot! I can now choose my host reasonably : D






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS