Author Topic: Channels  (Read 6694 times)

Raj1v

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 15
    • View Profile
Channels
« 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.

gg67

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 66
    • View Profile
Re: Channels
« Reply #1 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.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Channels
« Reply #2 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.

Raj1v

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 15
    • View Profile
Re: Channels
« Reply #3 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.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Channels
« Reply #4 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.

Raj1v

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 15
    • View Profile
Re: Channels
« Reply #5 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.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Channels
« Reply #6 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.

gg67

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 66
    • View Profile
Re: Channels
« Reply #7 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...

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Channels
« Reply #8 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.

Raj1v

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 15
    • View Profile
Re: Channels
« Reply #9 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.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Channels
« Reply #10 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.