Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

P2P network games/apps: Good choice for a "battle.net"-like matching server

I'm making a network game (1v1) where in-game its p2p - no need for a game server.

However, for players to be able to "find each other", without the need to coordinate in another medium and enter IP addresses (similar to the modem days of network games), I need to have a coordination/matching server.

I can't use regular web hosting because:

  • The clients will communicate in UDP.
  • Therefore I'll need to do UDP Hole Punching to be able to go through the NAT
  • That would require the server to talk in UDP and know the client's IP and port
  • afaik with regular web hosting (php/etc) I can only get the client's IP address and can only communicate in TCP (HTTP).

Options I am currently considering:

  • Use a hosting solution where my program can accept UDP connection. (any recommendations?)

  • UDPonNAT seems to do this but uses GTalk and requires each client to have a GTalk account for this (which probably makes it an unsuitable solution)

Any ideas? Thanks :)

like image 677
yairchu Avatar asked Jul 22 '09 11:07

yairchu


2 Answers

First, let me say that this is well out of my realm of expertise, but I found myself very interested, so I've been doing some searching and reading.

It seems that the most commonly prescribed solution for UDP NAT traversal is to use a STUN server. I did some quick searches to see if there are any companies that will just straight-up provide you with a STUN hosting solution, but if there even were any, they were buried in piles of ads for simple web hosting.

Fortunately, it seems there are several STUN servers that are already up and running and free for public use. There is a list of public STUN servers at voip-info.org.

In addition, there is plenty more information to be had if you explore SO questions tagged "nat".

like image 85
Joel Wietelmann Avatar answered Sep 28 '22 09:09

Joel Wietelmann


I don't see any other choice than to have a dedicated server running your code. The other solutions you propose are, shall we say, less than optimal.

If you start small, virtual hosting will be fine. Costs are pretty minimal.

like image 43
tomfanning Avatar answered Sep 28 '22 08:09

tomfanning