Tasharen Entertainment Forum

Support => TNet 3 Support => Topic started by: Raj1v on December 27, 2013, 06:49:02 PM

Title: Channels
Post by: Raj1v on December 27, 2013, 06:49:02 PM
Hi,

I'm getting started on TNet, but I've no idea on how to use channels. What functions should I use? How to channels work? I would be really happy if someone would help me with this and if someone could properly document TNet sometime.
Title: Re: Channels
Post by: gg67 on December 27, 2013, 07:45:57 PM
I'd recommend looking at the Example Menu scene that's included with TNet, that's how I was able to understand them a little bit.

Assuming you don't know what a channel is, the way I think about it is a server is a house where channels are completely different rooms. A house can have as many rooms as you want. Rooms can also have names, passwords and can limit the number of people in them at any given time.
Title: Re: Channels
Post by: ArenMook on December 28, 2013, 02:11:47 AM
I always suggest looking at TNet like you would look at IRC. But channel = room is also fine.
Title: Re: Channels
Post by: Raj1v on December 28, 2013, 06:35:22 AM
Yeah, I understand that. But how do I use them. I do I use the join room function, how do I create a room etc.
Title: Re: Channels
Post by: ArenMook on December 28, 2013, 05:09:55 PM
TNManager.JoinChannel joins a channel of the ID you specified, or creates a new one if it's not present. Everyone in the same channel can communicate using RFCs.
Title: Re: Channels
Post by: Raj1v on December 28, 2013, 07:15:19 PM
I want a like a static channel list. The channels are started as soon as the server starts, then later players can join those channels. And is it possible to specify more information with a channel, like a name, allowed items in the channels, etc.
Title: Re: Channels
Post by: ArenMook on December 29, 2013, 01:31:58 AM
I suggest you use hard-coded channel IDs for something like that. I am doing that for Windward 2 myself. The world is made up of "maps", where each map is a 512x512 playable area. The player can travel from one map to another, and each map has a "position" in the global world that's an integer-based Vector2. I convert that to a single UInt16, and use that as the channel ID -- so as the players moves to another map, the same logic running on all clients ensures that they all end up in the same place on the TNet server.
Title: Re: Channels
Post by: gg67 on January 04, 2014, 09:28:42 PM
Once a user creates a channel and TNManager.CreateChannel(..) is called, how do I tell the Server about the new channel so it can update the channel list for other clients to see? I imagine I use the channelID somewhere...
Title: Re: Channels
Post by: ArenMook on January 05, 2014, 09:16:47 AM
You can either check the channel list periodically, or just do a broadcast to notify everyone connected that the list has changed.
Title: Re: Channels
Post by: Raj1v on January 12, 2014, 02:50:08 PM
So, who will host all those static channels? I want them to be already up and running before the first player joins them.
Title: Re: Channels
Post by: ArenMook on January 12, 2014, 06:03:20 PM
In your case, judging by the other thread, you wouldn't be using channels, but actual game servers.