MultiplayerSynchronizer Bug

Godot Version

4.3

Code

Question

I am trying to give each player a MultiplayerSpawner to spawn their character. When a character dies, it disconnects the MultiplayerSynchronizer of other spawned characters. Try clicking the following buttons on three instances:

Instance 1:
Host

Instance 2:
Join
Spawn

Instance 3:
Join
Spawn
Kill

Instance 2:
Increment Value
Print Value

My output is:

1: 0
2222222222: 1
3333333333: 0

But I expect it to be:

1: 1
2222222222: 1
3333333333: 1

Why is this the case? Is it a bug? The only fix I have found is: https://youtu.be/_ItA2r69c-Q?t=175. However, I would rather not have to manually write scripts to sync variables.

Not a bug, i think its working as intended.

One, each character has their own value instance. So if one peer changes, it will only change on their character.

Two, each character has its own menu, and signals to its own character. So it is printing the value that belongs to that character. And there are 3 different value instances because there are three different characters, one for each peer.

You can verify values in the remote tree debugger.

1 Like

For the first point, shouldn’t the MultiplayerSynchronizer sync those values? It appears to sync correctly if you don’t press the kill button on any character. My question is that calling queue free on one client’s character seems to disconnect the MultiplayerSynchronizer from ALL characters.

No, it is one to one. There are three MultiplayerSynchronizers (because there are three character instances) each with their own value instance. So they will be managed independently.

This is a terrible drawing to hopefully make it clearer

That is how I understand it, but whenever a character dies, the synchronizers stop working. The print value function prints that specific character’s value across all peers (it does not print each character’s value) so I would expect it to be the same no matter what happens since it is synced. Does that make sense? Thanks for the help!

Let me take a deeper look

1 Like

yea its probably a bug. If I change the MultiplayerSynchronizor to “on change”, I think the issue becomes more apparent.

This error occurs on host other non-authority peer, when clicking increment.

looking at the source code there are 3 potential issues. the sender is not authorized, the receiving synchronizer cannot be found, or the “synced node” does not exit in the tree.

Looking at the state of the game all three should be satisfied.

So it seems like something internal is messed up for the MultiplayerAPI scene replication cache.

My guess is the internal replication cache is getting messed up and is losing track of the synchronizer

I stuck a debugger on it and it looks like the syncer is not found.

Cool! Thanks for the effort! I posted a bug report: MultiplayerSynchronizer stops syncing node when node owned by another client is freed · Issue #100873 · godotengine/godot · GitHub.