Tasharen Entertainment Forum

Support => TNet 3 Support => Topic started by: Suvu on February 16, 2013, 11:57:03 AM

Title: Confused by channels
Post by: Suvu on February 16, 2013, 11:57:03 AM
Hey all,
I've run though the example scenes, documentation and 'getting started' page, but i'm still having a bit of trouble understanding how to get things setup or how things are SUPPOSED to be set up.

I've been working on a multiplayer game for a while but using Unity's built-in networking.
The way I started a server/connected to a game was pretty simple :

To create a server

To connect to a server

But now switching to TNet, I find it confusing....
I can start a server, and connect to it, just like the way it's shown in the ExampleMenu.
But then the channels throw me off. I previously had the server 'tell' newly joined clients which level to load, but with TNet, when you join a channel you need to specify the level to load. And no communication can take place before you join a channel.

I think i'm getting completley the wrong idea here >< How does the client know which level to load (the level the server is currently on)
Title: Re: Confused by channels
Post by: krissebesta on February 16, 2013, 12:24:57 PM
Hey Sevu, the first client that hosts the game can call TNManager.JoinChannel() and specify the level to load for all other clients to load when they join (they can leave the level parameter a blank string, "").

See this thread for more details.

http://www.tasharen.com/forum/index.php?topic=2925.0

Cheers! - Kris

Title: Re: Confused by channels
Post by: Suvu on February 17, 2013, 08:17:15 AM
Ahhh ok, thanks for that Kris!
I should have tried that before posting ><
That makes much more sense now, I also read a post from Arenmook over on the Unity forums where he likened it to IRC.

Thanks again for the help!
Title: Re: Confused by channels
Post by: krissebesta on February 17, 2013, 07:44:59 PM
@Suvu: I did some additional research this morning and noted that the channel list is, in fact, stored in the TNGameServer class.

Also, I have re-worked the examples that come with TNet to use channels.  If you want I can post the code.  Just let me know if you want it.

Cheers! - Kris
Title: Re: Confused by channels
Post by: Suvu on February 18, 2013, 09:30:55 AM
Hey Kris, I think i've got my head around it now thanks :) but it might be worth posting an example for anyone else who has the same problem.
I still have a couple of other questions but i'll start a new thread about them.

Cheers!