Hi Guys,
Hoping you can help out with clarifying my high level understanding of TNet. Please correct my understanding below if I've made a mistake, omission or perhaps think that you could add some further value by adding to the points below:
1.) In order for TNet to function at all, a TNManager object needs to be part of the scene
ArenMook's Edit: This is no longer the case.
2.) Any network object i'm hoping to manage through TNet has to be added to the list prior to runtime. Is this correct? Is there no way to dynamically add new types? Or not yet known objects (for example, streamed items that do not exist ingame yet)
ArenMook's Edit: Can instantiate by string Resources name.
3.) The object added to the TNManager, has to be a prefab.
ArenMook's Edit: Yes, but not needed. Use string instantiation as per #2.
4.) This prefab has to contain a TNObject with a unique identifier.
5.) If the object is TNManger.CreateEx(...) I can leave the id 0 as it will be auto assigned. If the object is not being instantiated by TNet, I need to assign this id myself.
6.) In order to syncronise my prefab across the network, all I need to do is add the TNAutoSync object to the parent object of the prefab. Is this correct or does it belong on the object that contains the rigidbody.
7.) Following point 6, Only one TNAutoSync object is required per prefab to sync.
8.) All code relating to input and camera control needs to be controlled with own custom code, using the property TNManager.isMine?
ArenMook's Edit: tno.isMine
9.) By doing all of the above, to get two networked clients communicating. They join the same channel, then instantiate their own version of the prefab using TNManager.CreateEx(). In doing so, the first players create is buffered? For when the next player joins? The next player joining when their own player is instantiated, TNet automatically updates the host (and all other players) - without needing any additional code?
10.) When a player leaves the room, their instantiated object is automatically removed and all other clients are updated? Is this the case or does this code have to be written manually.
11.) Following on from 10. If the host leaves the room, all other player objects and their own are destroyed automatically? The rest of the players in the room only receive the destroy on the player leaving though?
I am asking all of the above, because based on the above, this is how I've implimented TNet in my game - however, all the assumptions above mostly do not work for me.
1.) When I join the channel and instantiate my local player, that works fine.
2.) When I load up another client and join the same one, they own player is instantiated.
However...
3.) the host (point 1) receives the instantiated object from (point 2), on the host there are now, 2 players
4.) the other client (point 2) never receives anything to tell it that the host is there. On this client, I have 1 player. As if they started the channel (they didn't because checking the channel list, shows 2 players).
5.) the host (point 3) if they leave, their local player is not automatically TNManager.Destroy(...)'d - neither is the other players (remember the host got the update that player 2 joined).
6.) the other client, (point 4) now becomes host, as he is the only player in the room. If he leaves, their object isn't destroyed either.
As you can see from the above recount of my own understanding of the framework. There are gaps - gaps which are resulting to me not understanding the outcome of my use case below it. Please add your comments to this thread to assist me and others in future.