A collection of frequently asked questions, and where to find the answers
All Clients have to connect to a Replication Server, which can run locally or in our cloud.
There is no specific place to designate a special player Prefab. Any script can create it, by just instantiating a Prefab.
Spawning is done by simply instantiating a Prefab that has a CoherenceSync, using the Instantiate()
API. Same for removing entities, using the Destroy()
API. Read more about instantiating and destroying.
Syncing individual values of the supported types can simply be done using the CoherenceSync component. If a type is not supported, you can send the value using a Network Command as an index, or by reducing it to a byte array, and reconstructing it on arrival.
ClientConnections provide a view on who is connected at any given time.
To make all connected Clients move to a new scene, you can create a method that loads the scene and mark it as a Network Command. Then, from one of the Clients you would send that Network Command on all others (and to themselves) by selecting as destination MessageTarget.All
.
To allow client-side prediction, start by disabling automatic updates on the properties you want to do prediction for. Implement your prediction code, and listen for incoming updates by hooking into update callbacks. When the update arrives, you can reconcile the predicted state and the new, incoming sample in a way that fits your game best.
To create a simple in-game chat functionality, you can leverage Network Commands to send strings (or byte arrays) to all connected Clients.
Messages (or RPCs) in coherence are called Network Commands. We also have a video on Authority and Commands.
Servers in coherence are called . You can also watch an Overview of Simulators.
A pre-game chat can also be created by leveraging .