I want to be able to run a co-operative network multiplayer (not MMO) where each player can move around to different "rooms" of the game each being a scene. I want to have one player hosting the server which will take decide all the actions of things going on in each room/scene. I came across this question which seems to be doing something similar. However, the details about the answer at this question are not very specific. I'm under the impression that I should have the server create a viewport for each room/scene independently being used by a player, so that all of those scenes can be processed at the same time by the server. From here, the server needs to display the correct viewport to the player who's playing on the server instance. To actually implement this, I plan to use a root scene which will have a list of viewports in it. As players move to another room/scene, the server will load up that new resource, create a new viewport, and stick the scene in that viewport. Finally, it will remove any viewports for scenes that no players are in.
Firstly, does this seem like a reasonable way to approach this problem? Next, I've tried a simple test of a viewport in a root scene, and the output clearly shows some print statements from the child viewport scene running correctly. However, I'm not sure how to then display this child viewport to the server user. Here's what this simple test root node looks like.
var viewport = Viewport.new()
viewport.world = World2D.new()
var a_room = load('res://test.tscn').instance()
Finally, if this is the approach I end up using, are there any significant problems to look out for using this method? For example, I could see trouble arising from the fact that the viewport the server user is viewing is always a sub-viewport rather than the main one. Might this cause a problem? And should it be done some other way to prevent such problems? Thank you for your time!