Need help understanding the network

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

I have a pretty basic understanding of the network.
After reading the official tutorial I end up with more questions than I would like to have.


Question 1

As far as I know there are 2 main ways to do network:

What model is using godot? I would really like the answer to be the model on the left, since the impact on the bandwidth (for the clients) is exponential for the model on the right.

I was wondering since when sending an rpc all network entities are informed, so are they informed directly (right schema) or is the server informed first and then it broadcasts the call to all clients (left schema)?


Question 2

When using the rpc_id function, are all the network entities receiving the call and checking if they are the target, or is just the target entity receiving the call?


Question 3

Are the IPs private? I think it pretty much depends on the previous questions, the server ip has to be known by the clients, but I would like to know if the ips are private, if none of the clients can see others client’s ip?

Thank you.

:bust_in_silhouette: Reply From: dant4

Hello Ploppy,
My answer is made only by reading the source code and adding few breakpoint, so I could be wrong, but the code is not really complex.

Godot uses client/server model.
When a client sends a rpc, the message is always sent to the server, then the server will broadcast, or unicast to the right peer. It’s very simple.

So, when you specify the network id using rpc_id, the following will happen:

  1. The client sends a message to the server, with a target = id
  2. The server receives the message, extracts the target, then if the id exists (the target could be disconnected at this point), a new message is sent, if the id is the server itself it will process the message.
  3. The target receives the message

And yes, IPs look private, since the only information the server sends to the other peers, is the network id (which a generated number).

Thank you very much. You nailed it.

Ploppy | 2018-10-25 09:11