Tasharen Entertainment Forum
Support => TNet 3 Support => Topic started 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.
-
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.
-
I always suggest looking at TNet like you would look at IRC. But channel = room is also fine.
-
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.
-
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.
-
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.
-
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.
-
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...
-
You can either check the channel list periodically, or just do a broadcast to notify everyone connected that the list has changed.
-
So, who will host all those static channels? I want them to be already up and running before the first player joins them.
-
In your case, judging by the other thread, you wouldn't be using channels, but actual game servers.