Godot Version
4.2.2
Question
I am having an awful time getting synchronization to work consistently. All I want to do is synchronize the players positions, but it seems impossible to do so. Even after going through the documentation, I can’t seem to figure out how to make the MultiplayerSynchronizers work, they just seem to not do anything.
Is there any sort of resource for synchronization? Whenever I try to look for anything I can’t find anything dedicated to that. It’s all just about general network stuff. I can get players to connect just fine, and I can assign authority just fine, the sync just keeps breaking though. And only for the player positions.
I’m willing to pay someone to teach me if anyone is willing.
Did you add the property to sync in the synchronizer?
Yes, it is set to sync the position. But the position isn’t synced. The position was synced before in a previous version of the game, but nothing changed with the MultiplayerSynchronizer node.
And its set to update “always”?
Okay can you explain more precisely what doesnt work, because your setup seems fine
The non-server players sync their position across all other games just fine, but the server’s player position never syncs. So, when the server moves their player, it only moves on their screen, not any of the other player’s screen, and the server is the only one with this issue.
Here is the function for player spawning, they all use the same scene:
@rpc ("call_local", "reliable")
func spawn_player(player_id):
var player = player_scene.instantiate()
player.name = str(player_id)
var team = NetworkManager.get_player_team(player_id)
var spawn_point
if team == NetworkManager.TEAM_BLUE:
spawn_point = blue_spawn
player.team = "blue"
player.spawn_point = spawn_point
else:
spawn_point = red_spawn
player.team = "red"
player.spawn_point = spawn_point
var character_index = NetworkManager.get_player_character(player_id)
var character = CharacterManager.get_character(character_index)
player.set_character(character["scene"], character["name"])
player.position = spawn_point.position
player.set_multiplayer_authority(player_id)
add_child(player)
Are you getting errors on any of the sessions?
May not be it since it’s working on clients but try replacing add_child(player)
with add_child(player, true)
.
1 Like