0 votes

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?

Godot version 3.2.3
in Engine by (15 points)

2 Answers

+1 vote
Best answer

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.

by (104 points)
selected by

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) ?

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.

+1 vote

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.

by (9,376 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.