Hello,
I'm trying to build a multiplayer game using MultiplayerSpawner/Synchronizer and RPCs where there are multiple "dimensions". (Kind of like how minecraft has the overworld and the nether)
My current approach has 2 dimensions, each of them has the following structure:
Dimension: SubViewportContainer, Players: MultiplayerSpawner
While this technically seems to be working it throws some errors when switching between dimensions:
Serverside
Clientside
"Sync" and "Input" are both MultiplayerSynchronizer nodes, where the server has authority over "Sync" and the client has authority over its players "Input" node. The server currently also is a player but this will not always be the case. (and should not really matter) + Currently all dimensions exist on all peers. (Which i'm hoping to change aswell)
The (simplified) code I'm using for switching dimensions currently looks like this:
func switch_dimension(player: Player, dimension: Dimension) -> void: var player_id: int = player.player_id # Network ID player.queue_free() player = load("res://player/player.tscn").instantiate() player.player_id = player_id # Network ID for Input authority dimension.add_player(player, true) # Calls add_child on %Players in the specified Dimension self.activate_dimension_name.rpc_id(player_id, dimension.name) # Toggle visibilities of Dimensions
While all of this seems to be working I am worried about the errors it is throwing and wondering how to get rid of them or if there is a better solution for what I'm trying to do?
submitted by