Godot 4 networking example

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By sygi

In the Multiplayer scene replication example project for Godot 4, Fabio creates two MultiplayerSynchronizers: one to synchronize user’s inputs (I presume to smooth the movement down) and another one to synchronize position and velocity for them to stay in sync despite network latency, etc.

Why are there two synchronizers, instead of one handling all of these properties, used?

:bust_in_silhouette: Reply From: sygi

Ok, I think I know why. We need a part of the code responsible for processing inputs to execute only on one machine, whereas the one responsible for using its results on all of the machines. One can achieve the same thing doing:

func _process(delta):
    if get_multiplayer_authority() == multiplayer.get_unique_id():

but what Fabio did make sense too.