0 votes

Hey All,

I am trying to make a gamepad app using Godot's built-in High-level Multiplayer. So a computer would run the game and host the server, and then people would download an app on their phone which is a controller made in Godot and is thus a client.

So far the confusing part for me is how you get the IP address and Port that the server will use. (I don't know anything about this lol). Like, I would want this to be usable by other people in their games, so would they have to go and look up their IP address and port and then enter that in?

Ideally, I would like the server and clients to be able to connect as long as they are on the same wifi. I also would not want them to have to enter anything in, but rather just have Godot figure out which IP and Port belong to the current wifi network and use that.

Is this possible? Again, I have no experience in setting up servers, communicating via TCP/UDP, etc. and I don't really know what I am doing haha.

I tried IP.get_local_adresses, but this returns tons of IPs. Only one is in the correct format, 192.x.x.x, so can I just say:

var IP_to_use = null

for address in IP.get_local_addresses():
     if '192' in address:
          IP_to_use = address
Godot version 3.2.3
in Engine by (616 points)
edited by

1 Answer

0 votes

The PORT is definded in your server script. The IP ADRESS INPUT can be replaced with a plugin: https://github.com/Wavesonics/LANServerBroadcast. Works at least for LAN-partys.

by (82 points)

Oh and I think yea, you can try to say this. It will return LOCAL adresses.

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 Frequently asked questions and 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 [email protected] with your username.