So I have Player 1 (P1) and Player 2 (P2). P1 creates a game and loads Scene1. P2 joins the game and also loads Scene1. This is as far as most tutorials/examples/etc go. Let me know if any of the following is incorrect:
From here we use channels to divide the network traffic - generally 1 channel per scene and another channel for things like chat. So P1 and P2 are in channel1 together in scene1. P2 wants to go ahead and goes to the "load scene2" trigger, which then makes P2 leave channel1 and join channel2 (for scene2). Now, scene2 has some things that need to be generated on load, like which enemies to spawn - which should be done on the server/host - in this case P1.
Is it possible for P1 to be in scene1 (and channel1) while feeding state information of scene2 (over channel2) to P2? Would this be done through RFC / RPC calls? What's the best way to handle a situation like this?
Let's say I [...] had one channel per scene. If P1 is hosting and P2 is in a different scene, in a separate channel, how would the host know to update the scene P2 is in?
Would P2 just have to tell P1 that it's the first/only player in the scene, so it will be taking over the reigns for that specific scene?
I'm not sure if you fully understand the difference between Server, Host, and Client as far as TNet is concerned.
Server: Software that facilitates routing packets back and forth between players over the network.
Host: The player (a client) who first joins/creates a channel. If the host leaves the channel, a new host is automatically selected from among the remaining players in the channel.
Client: Any player connected to the Server.
Note that a player can be acting as server and client/host at the same time!
In your scenario, when P1 joins Ch1, P1 will become the Host of that channel. And when P2 joins, he will be a regular client.
But once P2 joins/creates Ch2, P2 will become Host of Ch2 (assuming nobody else is already in Ch2). P1 will continue to be Host of Ch1 until he leaves that channel. Basically, each channel will have its own Host: one of the clients currently connected to that channel.
I hope that was clear. And correct. (c: