How To Make Peer To Peer Connection Over Internet on All Platforms

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By I reject all deals

For example we are making an online game but we dont want to use server.
We want to make game in this way: a player hosts game, after that other players can join.
And we want to do it works on all platforms (windows,android,others (mobile and pc both))
Is there is a way to do it?
For example godot have UPNP.
Is UPNP works on all platforms?
For example a mobile phones 4g connection, UPNP can work?

:bust_in_silhouette: Reply From: stormreaver

Platform issues aside, this presents what are frequently showstopping obstacles. Many people on home Internet services are unable to serve as Internet hosts because their ISP’s block most incoming ports by default. Success will be hit and miss.

Someone feel free to correct me if I’m wrong, but I don’t think there is any Internet-wide discovery protocol that doesn’t involve a central server. To the best of my knowledge, all of them (including UPNP) are designed for local networks only.

Unless Internet protocols have been introduced that I’m not aware of (which is very plausible), you have three choices (assuming no ISP problems of the nature I mentioned above):

  1. All clients connect to a host’s current IP address (most people are on addresses that change over time). This still won’t overcome the issue of ISP’s blocking incoming ports, though.

  2. You have a LAN mode where autodiscovery is possible.

  3. You make a central directory server that provides the discovery services necessary for your game, and connects players to one another. This still won’t overcome the issue of ISP’s blocking incoming ports, though.

Multiplayer Internet games use dedicated servers to overcome limitations that are sometimes inherent in the structure of the Internet, and are sometimes just an artifact of how most ISP’s behave. Peer to peer multiplayer is mostly limited to LAN’s for that reason, and Internet multiplayer uses central servers for the same reason.

It has been a number of years since I was highly knowledgeable of the current state of Internet protocols, so my information may be out of date.

Thanks for your answer. You mean to there is no way to do p2p over internet?

I reject all deals | 2023-06-02 05:50

Correct. There is no reliable way to do purely p2p over the Internet.

stormreaver | 2023-06-02 11:14