Jump to content

  • Log In with Google      Sign In   
  • Create Account

Peer finding best peer to initiate multiplayer


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
11 replies to this topic

#1 Rasterman   Members   -  Reputation: 206

Like
0Likes
Like

Posted 13 June 2012 - 09:31 AM

How should I match players? I first considered pinging all servers when the client downloads the server list, but after reading about implementing ping there are many caveats, ICMP requires adminstrator access on windows (no go for a game?), many networks filter out ICMP messages, ICMP messages are may not relate to UDP latency, and I would need both windows and mac implementations of a pinging system.

Another thought is to require the client to provide some sort of location information (country, state, city) and then provide this information in the master server list, then the client would have a good idea of how close another server is and they can decide for themselves.

What should I do? Should I simply not worry about it? Use ICMP anyway?

Sponsor:

#2 Waterlimon   Crossbones+   -  Reputation: 2565

Like
0Likes
Like

Posted 13 June 2012 - 10:51 AM

How should I match players? I first considered pinging all servers when the client downloads the server list, but after reading about implementing ping there are many caveats, ICMP requires adminstrator access on windows (no go for a game?), many networks filter out ICMP messages, ICMP messages are may not relate to UDP latency, and I would need both windows and mac implementations of a pinging system.

Another thought is to require the client to provide some sort of location information (country, state, city) and then provide this information in the master server list, then the client would have a good idea of how close another server is and they can decide for themselves.

What should I do? Should I simply not worry about it? Use ICMP anyway?


Cant you just ping them using UDP messages?

o3o


#3 Rasterman   Members   -  Reputation: 206

Like
0Likes
Like

Posted 13 June 2012 - 11:05 AM

From what I have found there is no UDP specification for pinging a server, if you ping a server with a UDP message it will responde with an ICMP: Destination unreachable packet so you still need to access ICMP. I cannot ping with my normal UDP means because that would require doing a NAT punch through to each server, or is that the way that most games do it still? It seems like managing all of those punch throughs would be slow and problematic though.

#4 saejox   Members   -  Reputation: 714

Like
0Likes
Like

Posted 13 June 2012 - 01:28 PM

send bunch of UDP messages, wait return for a time, say 500ms time to live.
you will have both jitter percentage and latency.
you dont need to "ping" to get latency.

#5 Rasterman   Members   -  Reputation: 206

Like
0Likes
Like

Posted 13 June 2012 - 01:50 PM

I must be missing something, shouldn't most firewalls and routers simply discard the messages, they aren't going to respond.

send bunch of UDP messages, wait return for a time, say 500ms time to live.
you will have both jitter percentage and latency.
you dont need to "ping" to get latency.



#6 frob   Moderators   -  Reputation: 21331

Like
0Likes
Like

Posted 13 June 2012 - 01:58 PM

I must be missing something, shouldn't most firewalls and routers simply discard the messages, they aren't going to respond.

That is correct.

The article linked to for Q9 in the forum FAQ describes how to handle NAT punch-through for lobby and matchmaking services. There are other articles on that linked-to site about matchmaking services that probably answer other questions you may not have thought about yet.
Check out my personal indie blog at bryanwagstaff.com.

#7 Waterlimon   Crossbones+   -  Reputation: 2565

Like
0Likes
Like

Posted 13 June 2012 - 02:04 PM

Do you mean that the servers are regular players with non-portforwarded routermodemthingies, and you need to punchthru to join a server, but dont want to have to punchthru all of them to get ping? (As in a random player is chosen to be a server)

o3o


#8 Rasterman   Members   -  Reputation: 206

Like
0Likes
Like

Posted 13 June 2012 - 02:19 PM

Do you mean that the servers are regular players with non-portforwarded routermodemthingies, and you need to punchthru to join a server, but dont want to have to punchthru all of them to get ping? (As in a random player is chosen to be a server)


correct, I have updated the thread subject to better reflect my question

Edited by Rasterman, 13 June 2012 - 02:21 PM.


#9 Rasterman   Members   -  Reputation: 206

Like
0Likes
Like

Posted 13 June 2012 - 02:24 PM

That is correct.

The article linked to for Q9 in the forum FAQ describes how to handle NAT punch-through for lobby and matchmaking services. There are other articles on that linked-to site about matchmaking services that probably answer other questions you may not have thought about yet.


Thank you, I have already read the entire FAQ and most related pages, none of them discuss what I am talking about.

#10 hplus0603   Moderators   -  Reputation: 5309

Like
1Likes
Like

Posted 13 June 2012 - 04:48 PM

If you want to measure the latency between each pair of peers in a set of players, then yes, you need NAT punch-through between all pairs of players. Additionally, not all players may be behind firewalls that accept NAT punchthrough -- those players should probably not be allowed as servers.
What you're trying to do is pretty hard to make robust. This is why the majority of games simply says "the game host == the game server," and if the server goes away, they migrate the server to whatever player had the best connectivity to the old server (basically, the old server keeps sending out packets of "if I were to go away, the next server is ....")

enum Bool { True, False, FileNotFound };

#11 Rasterman   Members   -  Reputation: 206

Like
0Likes
Like

Posted 13 June 2012 - 05:10 PM

Thanks hplus, I appreciate your advice rather than me wasting time trying to get it to work. I will simply not include pinging servers on windows or linux, since I plan on using GameCenter for the iOS/Mac versions it already includes this functionality, and the majority of users will be on these platforms. If I did want to put ping in just for windows, which looks pretty damn simple using your souce code, do you have a guestimate of how many players would return a valid ping response? If it even worth including for windows only?

#12 hplus0603   Moderators   -  Reputation: 5309

Like
0Likes
Like

Posted 13 June 2012 - 08:20 PM

Sending a UDP message to a random peer on the Internet without any form of NAT punch-through or port forwarding is unlikely to be very successful in most parts of the world. There are still some places where an ISP will hand out cable modems that give your PC a publicly visible IP address, instead of using NAT, but those are becoming increasingly less common.

If you can have the "server" users set up port forwarding, or can use a NAT introduction server/service, then you can get 99% success.

enum Bool { True, False, FileNotFound };




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