P2P network games / applications: a good choice for the corresponding battle.net server

I am making a network game (1v1) where in the game its p2p - there is no need for a game server.

However, in order for players to be able to β€œfind each other,” without having to coordinate work on another medium and enter IP addresses (similar to modem days of network games), I need a coordination / comparison server.

I can’t use regular web hosting because:

  • Clients will communicate in UDP.
  • So I need to do UDP Hole Punching to be able to skip NAT.
  • This will require the server to talk in UDP and know the client IP address and port
  • afaik with regular web hosting (php / etc) I can only get the client IP address and can only communicate in TCP (HTTP).

The options I'm currently considering are:

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

  • UDPonNAT seems to do this, but uses GTalk and requires every client to have a GTalk account for this (which probably makes this an inappropriate solution)

Any ideas? Thanks:)

+6
udp networking p2p hosting
source share
6 answers

First, let me say that this is good from my experience, but I was very interested, so I am engaged in search and reading.

It seems that the most common solution to bypassing UDP NAT is to use a STUN server. I did a few quick searches to find out if there were any companies that would just be happy to offer you a STUN hosting solution, but if there were any, they were buried in heaps of ads for simple web hosting.

Fortunately, it seems that there are several STUN servers that are already running and available for general use. A list of open STUN servers is available at voip-info.org .

In addition, there is still a lot of information if you are researching SO questions with nat tags .

+3
source share

I see no other choice than to have a dedicated server on which your code is running. Other solutions that you offer will be, let's say, less than optimal.

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

+3
source share

Instead of a full-scale dedicated server, you can simply get cheap shared hosting and have an application interface with a PHP page, which, in turn, interacts with the MySQL database backend.

For example, Lunarpages has a $ 3 starter pack that includes 5 GB of space and 50 GB of bandwidth. For something so simple that all you need.

Then you just ask your poll on the game list web page and send a POST request to add your game to the list.

Of course, this method requires learning PHP and MySQL, if you do not already know them. And if you do it right, you can force the PHP page to enter a kind of infinite loop to keep the connection open and just send updates to the client, rather than poll the page every few seconds and spend a lot of traffic. However, it is outside the scope of this answer.

Oh, and if you are looking for something completely free, find a free PHP host. They exist too! Even with an ad-supported host, your application can simply capture the page and ignore the ads when analyzing the list of games. I know that T35 used to be one of my favorites because their free plan does not track space or bandwidth (this limits the per- file size to exclude their use as a shared resource, but this should not be a problem for PHP files) . But of course, I think that in the end you will be better off with a paid host.

Edit: T35 also says: "Free hosting allows you to host 1 domain, and paid offers - unlimited domain hosting." Thus, you can even pay for a domain name and associate it with them! In the short term, I think your best (cheapest) bid. Of course, all of this assumes that you either know or want to learn PHP to make this happen. :)

+2
source share

There is nothing that supports every network connection. STUN is probably good, UPnP can work for this.

However, according to rumors, most firewalls can be lured to pass almost anything through UDP port 53 (DNS). You may need to argue with the OS about your access to this port.

Also check SIP , it is another protocol designed for this kind of thing. With the popularity of VOIP, there can be decent built-in support for this in more firewalls.

If you are truly committed to UDP, you can also consider tunneling through HTTP.

+1
source share

how about you breaking the problem in two - make a game-sharing client (which is different from the game) that can communicate via http with your cheap / shared web host. All players who want to use the match function of the game use this. Then the game match client launches a real game with the correct parameters (IP, etc. Etc.) After receiving information from your server.

Then the game will use the standard method for UDP punching through NAT, etc. etc. according to your network code. The game really does not need to know anything about the partner client or the responder server - in the true sense, p2p (for example, torrents, as soon as you can get your peer IP addresses, you can even disconnect from the tracker).

Thus, your problems become smaller.

+1
source share

The intermediate solution between hosting your own dedicated server and a strict P2P network environment is the gnutella model. In this model, there are superusers that act as local servers, have known IP addresses and connect to (and therefore have knowledge) more clients than a typical peer. This still requires you to run at least one superuser yourself, but it gives you the ability to allow other people to run their superusers.

0
source share

All Articles