Replication Server

The Replication Server is an essential part of coherence. It is an executable that replicates the state of the world to all connected Clients and Simulators.

To understand what is happening in the game world, and to be able to contribute your simulated values, you need to connect to a Replication Server.

Start a Replication Server

A Replication Server can be run in the coherence Cloud, but while developing we recommend that you first start with one running locally on your computer. coherence is designed so you can easily develop everything locally first, and then deploy to the Cloud without any change to the game.

You can start a local Replication Server from the coherence Hub, in the Replication Servers tab, just by clicking on the buttons there:

To understand the two types of Replication Server that you can run, refer to the Rooms and Worlds page.

You can also start the Replication Server from the coherence > Local Replication Server menu, or by pressing Ctrl+Shift+Alt+R (for Rooms) or Ctrl+Shift+Alt+W (for Worlds).

If you start a Replication Server locally, a new Terminal window will open.

Connect to a Replication Server

Once a Replication Server is running, connection to it can be established using a CoherenceBridge component.

The CoherenceBridge needs to know what to connect to. A simple way to connect is to use one of our Sample Connection UIs:

Sample Connection UIs scan the available Worlds and Rooms, and prepare the endpoint data so that the CoherenceBridge can find the Replication Server. You can find them in the SDK package itself, by going to Unity's Package Manager, and then exploring the package samples.

Later on, when you are developing a full game, you will probably recreate your own UI, using the Replication Server APIs.

For more information on your first time using a Replication Server, refer to the Local Development page in our getting started guide.

Send and receive frequencies

The Replication Server supports different packet frequencies for sending and receiving data.

The send frequency is the frequency that the Replication Server uses to send packets to a given Client. Each Client can be sent packets at different times, but the packet receive frequency for any Client will not exceed the Replication Server's send frequency.

The receive frequency is the maximum frequency at which the Replication Server expects to receive packets from any Client, before throttling. If a Client sends packets to the Replication Server at a higher than expected frequency, that Client will receive a command to slow down sending. If the Client doesn't respect the command to throttle packet sending then the Client is disconnected after a time. All extra packets received by the Replication Server, after a threshold based on the receive frequency, are dropped and not processed. This is to prevent malicious Clients from flooding the Replication Server. The Unity SDK handles throttling automatically.

It is possible for the Replication Server to temporarily request Clients to reduce their packet send rates if the processing load of the Replication Server is too high. This is automatic and send rates from the affected Clients are commanded to resume once the load is reduced.

Adjusting send and receive frequencies

Low and consistent send rates from the Replication Server allow for optimal bandwidth use and still support a smooth stream of updates to Clients. Try different rates during local replication tests to see what works well for your game.

For a locally hosted Replication Server, you can edit the send and receive frequencies by using the CLI arguments --send-frequency and --recv-frequency. Or by changing it in the coherence Settings -> Local Replication Server -> Send Frequency / Recv Frequency.

On the dashboard, the packet frequencies for sending and receiving data can be adjusted per project too. It is part of the Advanced Config section of Worlds create/edit and Rooms pages of the dashboard.

Adjusting the send and receive frequencies on the dashboard is available for paid plans.

Last updated