Export a multiplayer game

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By FOX WORK

I am currently working on a multiplayer game with no experience in networking.
The game works great on computers that are on the same network but not at all with other networks

How do make my game playable from anywhere with anyone?

:bust_in_silhouette: Reply From: netimu

I assume you are working with ENet.
In that case if your setup makes one of the players act as the server, then one solution is to have this player(server):

  1. forward the used port on their router
  2. Make their local IP static,
  3. share his public IP address with the others so they can connect to the game.

You can look into port forwarding and have an instructions scene where you explain it to users.

Another case is where you made your server independent from the clients. In this case you need to:

  1. make sure the scene structure on your server matches that of the clients in order for it to work correctly
  2. host the server on your PC and use your public IP every time the players are trying to play or use a DNS service (for example noIP) so that the url of the server is the same and so the players wouldn’t have to get your public IP every time,
  3. or you can opt for a hosting service of your choice.

I hope it makes sense, I tried to sum it up, but this should set you off on the right track.

Thank, this will be helpful.

Sorry for being such a noob but how do I host a server on my PC (I only can found how to host a website, don’t know if it’s the same) ?

FOX WORK | 2021-02-11 09:10

You need to:

  1. make a dedicated server (same scene structure as stated in the answer) and export it,
  2. forward the appropriate port on your router,
  3. launch the server on your machine.

and at this point for the clients to be able to connect, you either need to constantly share your public IP (which is not really a good solution); or: use a dynamic DNS (I’ve given the example of no-IP because I’ve used it before), and that’s going to replace your public IP for clients.

netimu | 2021-02-11 11:25

:bust_in_silhouette: Reply From: Calinou

If you want your game to be playable by anyone without requiring players to host servers, you need to host one or more dedicated servers yourself (or let community members do that).

See Exporting for dedicated servers in the documentation.