Question About Godot Multiplayer

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

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
:bust_in_silhouette: Reply From: Bimi124

The PORT is definded in your server script. The IP ADRESS INPUT can be replaced with a plugin: GitHub - Wavesonics/LANServerBroadcast: Nodes for broadcasting and receiving LAN games in the Godot game engine.. Works at least for LAN-partys.

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

Bimi124 | 2020-12-18 10:30