Network Tips

Default Sync

ParaSpace is intended to help creators implement a multiplayer experience with ease. For this reason, the players' locations, the Animator Controller's parameters, and voice chat are all synchronized by default. Therefore, you only need to focus on the logic that handles custom content synchronization in a World.

What Needs to be Synchronized

Instead of synchronizing everything, we recommend that you synchronize as little information as possible. Think carefully about what information needs to be synchronized, so that all the clients will display the same effects. For example: If an object is moving at a constant speed, you can only synchronize its initial location and speed. There is no need for you to synchronize its location at all times.
If too much data is synchronized, players may suffer from lags and wasteful consumption of mobile data.

If any complex game logics exist, try including them in a single game object. If important logic states are shared among many game objects, differences in ownership may lead to de-synchronization.

Suggestions on Handling Data

A World sees players join and exit. Players who stay in a World may change the data in that World.
Therefore, whenever you synchronize data, you must pay attention to the following stages:

  • Initialize Data: Whenever players join a room, they can read the data of that World and then initialize the display of their clients to synchronize with other players in the room. For example: When you join the ParaSpace's World Blue Hole, you must read the data of the players that are dancing in the dance hall so that you can see them dancing on your client. After room data synchronization has been completed, the ParaNetService.OnNetworkSettled event can be used to initialize the presentation of players' clients.
  • Data Changes: Whenever the synchronized data of a room changes, the display of all the players' clients gets updated accordingly. For more details, you can review the previous chapter: Synced Variables.
  • Restore Data: If players want to leave a World on which they are having an effect, they must first restore all relevant data and synchronize it to other players. For example: If a player is driving a boat and other players see the boat moving, the player must stop the boat and synchronize the data to other players before leaving. The
    ParaScript.OnPlayerLeft event can be used to deal with this kind of situation. After the player leaves, other players in the room will then receive the event.
    Note that only the boat owner is required to process the event and then synchronize the result to other players.