This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

I want to have a server (Windows) and a client (HTML5). The client needs to send a Vector2 of 2 floats every frame to the server.

  1. What networking protocol should I use for the communication?
  2. How do I use it? (Please don't link Godot's documentation, it's confusing for me)
  3. What IP address should I use to connect the peers? (192.168.###.### or the one with entirely random numbers, ###.###.###.###, the peers will always be in the same network)
  4. How do I get the correct IP addresses? (to display it on screen to help the user connect the devices)
  5. Does HTML5 even support IP.getlocaladdresses()? When I tried, it didn't seem to work.
Godot version 3.2.3
in Engine by (57 points)
edited by

1 Answer

0 votes
Best answer

.1. https://docs.godotengine.org/en/stable/tutorials/networking/webrtc.html
3. If you use your own computer for both the server and the client, use localhost (127.0. 0.1). Otherwise use the IP of the server you are using.
4. Easiest way it so hard-code the server's IP (from answer #3) into your code, so the player won't have to deal with IP addresses.
5. Normally the client is the one which initiates the connection, and not the server. Therefore you won't need to know the client's IP in advance, only the server's IP.

by (176 points)
selected by

Thank you, that will help me a lot.

But I can't use localhost as the client is on my laptop and the server is on my desktop. Also, which IP address will I connect to? 192.168.###.### or the actually random one ###.###.###.###)?
3. Might as well hard-code it in, but that will ruin my plans on publishing this software for public usage.

  1. I'm not an expert about building networks at home. You will have to consult other resources, sorry.
  2. Don't you plan to have a single server that all clients will use?
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.