This is my first time using TNet and overall I like how much it simplifies many of the networking details. However, I have been bumping into a few design decisions on TNet that has made my design process more difficult than it needs to be.
I'm trying to create a very simple RTS styled ready room. The important details for this are:
1) As players join they are assigned a player number in order. IE the first player (likely host) is Player 1. The second player is Player 2 and so on. If a player leaves, the next player to join takes over that vacancy.
2) All players in the same channel must "see" the exact same player number assignments. (IE we must all agree that Bob is Player 1, Sue is Player 2, etc.)
3)In the ready room, each player can make arbitrary choices such as choosing a color and choosing a faction.
4) The player numbers assigned in 1 and the data choices in 3 must be preserved through scene loads.
I have determined the following design details about TNet that relate to this:
1) RFC calls only save the most recent invocation for each object. This means I can't have all this data on a single instance of a single object (unless I want to go crazy with copy paste on RFC calls). I must have one player object for each player number I wish to assign (otherwise player number pairings and player choices are lost when "old" RFC calls are dumped)
2) If I wish to use DontDestroyOnLoad on an object with the TNObject script, I can't create that object using TNManager.Create. If I do, all kinds of strange things happen.
3) When the Host player creates the game, I am not getting an OnPlayerJoined event to fire for the host player.
Because of this (especially the part about the host not triggering OnPlayerJoined events), I'm not sure what the cleanest design for this would be. I know the player objects must be in the scene (instead of created). However I do not know the best way to detect when players join / leave. I also do not know how to handle ownership for the static objects. Dynamically created objects were nice because I could create them as players joined and they were auto destroyed when the players left.
What is the cleanest design you would recommend for this? Are there other major TNet design details that I may run into regarding this?