Sign in to follow this  
Rasterman

Peer finding best peer to initiate multiplayer

Recommended Posts

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?

Share this post


Link to post
Share on other sites
[quote name='Rasterman' timestamp='1339601502' post='4948836']
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?
[/quote]

Cant you just ping them using UDP messages?

Share this post


Link to post
Share on other sites
[font=arial,helvetica,sans-serif]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 [/font][font=arial,helvetica,sans-serif]ICMP: Destination unreachable packet so you still need to access ICMP.[/font] 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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
I must be missing something, shouldn't most firewalls and routers simply discard the messages, they aren't going to respond.

[quote name='saejox' timestamp='1339615680' post='4948892']
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.
[/quote]

Share this post


Link to post
Share on other sites
[quote name='Rasterman' timestamp='1339617001' post='4948905']
I must be missing something, shouldn't most firewalls and routers simply discard the messages, they aren't going to respond.
[/quote]That is correct.

The article linked to for [url="http://www.gamedev.net/index.php?app=forums&module=forums&section=rules&f=15"]Q9 in the forum FAQ[/url] 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.

Share this post


Link to post
Share on other sites
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)

Share this post


Link to post
Share on other sites
[quote name='Waterlimon' timestamp='1339617849' post='4948914']
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)
[/quote]

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

Share this post


Link to post
Share on other sites
[quote name='frob' timestamp='1339617536' post='4948910']
That is correct.

The article linked to for [url="http://www.gamedev.net/index.php?app=forums&module=forums&section=rules&f=15"]Q9 in the forum FAQ[/url] 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.
[/quote]

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

Share this post


Link to post
Share on other sites
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 ....")

Share this post


Link to post
Share on other sites
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 [url="http://www.gamedev.net/topic/594412-ping-socket/page__view__findpost__p__4767839"]your souce code[/url], do you have a guestimate of how many players would return a valid ping response? If it even worth including for windows only?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this