Network scene replication with players on multiple maps

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By jahu00

I don’t think this is a new question, but I couldn’t find much info on the subject here or elsewhere on the internet.

I want to make a multiplayer game where players can move between different maps (like in Stardew Valley, Maple story etc.). Players can be on the same map at the same time, or on different maps.

MultiplayerSpawner and Synchronizer appear to be the way to go, but all examples on networking show how to make a simple single map game (or replicate whatever scene the server is showing). I can’t wrap my head around how to structure my scenes to make it work. What little I found on the subject is that, my best bet would be to put each map inside a viewport, as this would allow me to have multiple maps running at the same time on the host/server, but I don’t know how to limit replication to a single map on the client (server might need to keep track of all the maps at the same time, but that shouldn’t be necessary for the client).

Additionally I wanted to host to be able to play the game alongside connected players (like in Terraria or again Stardew Valley), but from my limited understanding of viewports, it would mean that the host would be seeing the game rendered on a texture, while the other players would skip this part. Maybe this is a non-issue and all the players would see the game through a viewport anyway.

:bust_in_silhouette: Reply From: jahu00

After watching multiple tutorials and trying many different things, I’m almost certain that I cannot achieve what I want using current version of MultiplayerSpawner. This system appears to be designed for replicating scenes from host on client side.

If the client side doesn’t have matching nodes during connection, errors will be raised and MultiplayerSpawner cannot be initialized after the connection was established (unless it was replicated by another working MultiplayerSpawner). I could in theory drop connection on client when changing maps, but I would end up with log littered with pointless errors as attepmets at syncing data for nodes that don’t exist on client side would still happen. I’m guessing I would have a similar problem with MultiplayerSynchronizer. Apparently some changes and fixes are planned for version 4.1, but I’m not sure if those would make those node types viable for this kind of game.

Using RCP on game nodes would probably not work so great either as I would have to check whom to send the data all the time.

What I could actually do is create dedicated, central nodes for communicating between client and server (basically API). I originally wanted to use similar solution but using SignalR and C#. I gave up on using SignalR after having difficulties starting a server from inside a Godot game, but I just might be able to use RCP. I might even be able to squeeze MultiplayerSynchronizer somewhere in there in a more central role. SignalR had groups which would make things easier, but I should be able to manually simulate those.