Syncing remote objects
With each player controlling their respective paddle in their own game instance, we have a small problem. The opponent’s paddle will not update its movement because we ensured that both its physics and input processes were disabled after we assigned a new multiplayer authority. Due to that, the ball may also bounce on the opponent’s paddle and create a different movement trajectory in each player’s game instance. We need to ensure that players are sharing the same game world and, for that, we are going to sync the objects across the network using MultiplayerSynchronizer
. In the next section, we are going to start the syncing of the ball.
Updating the ball’s position
The first thing we are going to do is ensure the ball’s position is synced across all peers. This is because we want to prevent players from dealing with different balls in their game instances, since this may lead them to make decisions based on wrong information...