A handful of question about UNET.

So I got some questions here I am trying to figure out if anyone could help, would be appreciated.

  1. At what rate do syncvars refresh? Will it try to send a syncvar network call for every frame it shows it as dirty? So if the game is going 90 fps would a syncvar send 90 network commands a second if changed every frame? Do I need to put in my own logic to limit the rate at which syncvars change?

  2. Kind of same as before, but for command methods. If I call a command method every frame and the game is 90 fps, does that mean 90 network messages are sent?

  3. Can the user be a server and a client? Meaning if a user hosts their own server and is playing in it, will IsServer and IsClient both return true for that person?

  4. For LocalPlayerAuthority on NetworkIdentity. I just always leave that checked if I want it controlled by the local player? I don’t need to uncheck that on the object being spawned if it isn’t the local player, correct?

  1. By default, it’s 0.1. This can be changed with a network setting attribute on the class.
  2. They get pushed to the transport instanty but there is message combining, check the max send delay for the actual value
  3. Yes, NetworkManager.StartHost()
  4. I don’t understand your question. Authority means you are allowed to invoke rpcs and cmds. You can spawn objects with authority to a client.

LocalPlayerAuthority mean that if you spawn an object with it checked with a connection, it mean that connection and only that connection has authority on it.

If unchecked, the server also have authority on it (not other connections).

What is “Max Send Delay”?

If my class is synchronizing it’s sync vars at a rate of .1, does this mean I only want to make command method calls to update those syncvars at a rate of .1?

Is there someway to synchronize the command method call to rate that the syncvars will get pushed?

You will need to keep track of time and check if the time passed since the last command call exceeds the network send interval. So, for example if you are sending the command from Update:

float timestamp;

void Update() {
    if (timestamp > GetNetworkSendInterval()) {
        // send command
        timestamp = 0;
    }
    timestamp += Time.deltaTime;
}

Command, message, rpc seem to not be pushed to transport instantly. For an obscure reason the Hlapi also have a delay…

This is in order to combine messages and reduce bandwidth related to Headers.

But NetworkTransport do it also …
With the hostTopology

https://docs.unity3d.com/ScriptReference/Networking.NetworkTransport.SendQueuedMessages.html

Yes, the HLAPI has no such thing as Send delay AFAIK. That is handled by the Transport. The network setting tho is Legacy and is for the Old network system AFAIK.

But in fact, when you dig into the HLAPI, you can see that it has a delay and packet buffering too.

This HLAPI… :x my god.