Mirror Networking
Mirror Networking
Mirror Networking
Mirror Networking
• https://mirror-networking.com
• https://mirror-networking.com/docs/index.html
Mirror Networking for Unity
• Requires Unity 2018.4 LTS and Runtime .Net 4.x (default in Unity 201
9) and .Net 2.0 Compatibility is recommended
• In Mirror’s High Level API (HLAPI) system, multiplayer games include
• Server
• Dedicated server
• This is an instance of the game that only runs to act as a server.
• Host server
• The host server creates a single instance of the game (called the host), which acts as both serv
er and client.
• Client
Host server
State Synchronization
State Synchronization
• State synchronization refers to the synchronization of values such as i
ntegers, floating point numbers, strings and boolean values belonging
to scripts.
• State synchronization is done from the Server to remote clients.
• The local client does not have data serialized to it. It does not need it, because
it shares the Scene with the server.
State Synchronization
• Data is not synchronized in the opposite direction - from remote client
s to the server. To do this, you need to use Commands.
• SyncVars
• SyncLists
• SyncDictionary
• SyncHashSet
• SyncSortedSet
Sync To Owner
• It is often the case when you don't want some player data visible to ot
her players.
• In the inspector change the "Network Sync Mode" from "Observers"
(default) to "Owner" to let Mirror know to synchronize the data only
with the owning client.
Network Discovery
Network Discovery
• Suppose your are next to a friend. He starts a game in host mode and
you want to join him. How will your phone locate his?
• Finding out his IP address is not exactly intuitive or something kids ca
n do.
Network Discovery
• When your game starts, it sends a message in your current network a
sking "Is there any server available?".
• Any server within the same network will reply and provide informatio
n about how to connect to it.