In this section, we will discuss the details of discovery while making the necessary amendments to our project. Discovery can be done statically or dynamically; statically here means that the server (and roles) are predetermined and set. In this case, when predefined, there is no need for discovery as it has already been set prior to runtime. In our case, we want the network and roles to be dynamic; we have the advantage of knowing that the peers are likely to be playing in close proximity of each other and most likely using the same network. Due to this, we can take advantage of Unity's NetworkDiscovery component. This component has two core functions, as follows:
- Broadcasting a message onto the network
- Listening out for a broadcast ...