This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

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?

Godot version v4.0.stable!
in Engine by (143 points)

1 Answer

0 votes

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():
        get_input()

    process_input()

but what Fabio did make sense too.

by (143 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.