Godot Version
4.6
Question
I have a goal of setting up multiple world simulations on a godot multiplayer server.
I somewhat understand that it’s possible to have multiple enet server peers with different ports, but I didn’t really want to use that, just don’t want to flood the ports.
I read this discussion: Implementing lobby / room based system in the godot-3d-multiplayer-template - #8 by pennyloafers
And I came to believe that Synchronizer Vilibility should affect MultiplayerSpawner actually spawning nodes. I have tried it out, and the nodes were still always spawning.
So what I have is a player scene with a MultiplayerSynchronizer where public Visibility is turned off,
Then when the client connects and loads the map (the map also contains the spawner, each map is suppose to be a separate world simulation) the player is spawned into the map.
This player scene gets multiplayer authority set for the peer that has just connected.
And to my surprise, this player scene is actually also spawned on the client, not only on the server
but at least it’s position is not synchronised to the server (because of the public visibility)
Then, when I connect another client to the server the server already is sending information about the spawned player to the new client and new client gets confused and does not do anything good (because it has not loaded the spawner yet).
But also this player scene is spawned on the first client (so I guess visibility does not affect the MultiplayerSpawner?)
I have also tried setting the visibility_filter
this is how it looks:
func _visibility_filter(peer_id: int) -> bool:
return peer_id == 1
this happens when the Syncrhonizer enters the tree:
func _enter_tree() -> void:
add_visibility_filter(_visibility_filter)
update_visibility(0)
does nothing new.
Are spawners really not controllable? Is there really no way to control what nodes are spawned for what client? Because in the MultiplayerSynchronizer it says this: “MultiplayerSpawners will handle nodes according to visibility of synchronizers as long as the node at root_path was spawned by one.” but it does not seem to be the case at all?
Or maybe I am missing something?