Syncing properties of autoloaded nodes

Godot Version

4.2.2.stable

Question

Is there a way to sync autoloaded node parameters with a MultiplayerSynchronizer? I’m making a small game and all of the state variables are in an autoloaded GameState Node. I’m trying to add multiplayer functionality and so I’d like to synchronize some of those state variables between the clients, but I can’t figure out how to reference those parameters in the Replication tab of the MultiplayerSynchronizer.
I’ve tried these paths and all result in errors that they can’t find the object
:GameState.variable_name
:GameState:variable_name
GameState:variable_name

If this isn’t possible, what’s the standard practice in this situation to synchronize these variables?

You need an absolute node path, it may be something like

/root/Gamestate:variable_name

The other less direct way would be to setup a script that keeps track of the autoload variables and updates its own copy of the variables that it will sync, and apply those synced properties back to the autoload for clients.

1 Like

(post deleted by author)

thanks this was very helpful!

I couldn’t figure out how to sync them with the builtin system, so what I ended up doing is writing a syncClients function that calls an rpc if it’s run on the host. That rpc just has a lot of self.variable=variable statements that sync the clients’ values with the host’s values. Then I run the syncClients function whenever the state changes. It would probably be inefficient for a real time game, but mine is turn based so it works great.

Thanks for sharing!

This seems to work for me as of now thankfully