Author Topic: JoinChannel?  (Read 8507 times)

jkrassman

  • Guest
JoinChannel?
« on: March 03, 2013, 06:47:57 AM »
Hi,

I am now starting to get a hold of this package. Got the server up and running on EC2 and everything seems to work fine.

If i want my users to create new games (channels) how do I set it up so that they can create unique channels? I guess that I should use JoinChannel, since I cant find CreateChannel or am I totally lost here? Would be nice if the user could put a name to his game?

Joakim




ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: JoinChannel?
« Reply #1 on: March 03, 2013, 12:08:30 PM »
JoinChannel creates a new channel if it doesn't exist based on the ID you provided. There is a JoinRandomChannel when you want to join an existing random channel, and thinking about it, I'm going to add CreateRandomChannel in the next update. For now just pass -1 for the channel ID and it will create a random one.
« Last Edit: March 03, 2013, 12:11:39 PM by ArenMook »

jkrassman

  • Guest
Re: JoinChannel?
« Reply #2 on: March 03, 2013, 01:03:10 PM »
Sounds great!

Joakim

tehshawn

  • Guest
Re: JoinChannel?
« Reply #3 on: March 03, 2013, 06:37:50 PM »
I'm going to add CreateRandomChannel

*thumbs up*

jkrassman

  • Guest
Re: JoinChannel?
« Reply #4 on: March 04, 2013, 10:24:39 AM »
And don't forget "Topic name" :)

Double thumbs then!

Deozaan

  • Newbie
  • *
  • Thank You
  • -Given: 44
  • -Receive: 4
  • Posts: 42
    • View Profile
    • Deozaan.com
Re: JoinChannel?
« Reply #5 on: March 05, 2013, 01:41:03 AM »
JoinChannel creates a new channel if it doesn't exist based on the ID you provided. There is a JoinRandomChannel when you want to join an existing random channel, and thinking about it, I'm going to add CreateRandomChannel in the next update. For now just pass -1 for the channel ID and it will create a random one.

CreateRandomChannel seems a bit confusing for a name, IMO. Why would I want to create a random channel? I think I'd much rather CreateNewChannel.

jkrassman

  • Guest
Re: JoinChannel?
« Reply #6 on: March 05, 2013, 08:13:10 AM »
Well, for me it doesn't matter what the name for the function is. I just want the server to keep track of the ID since it is something that I and the player doesn't care about. CreateNewChannel (Topic, Password, NoPlayers, Persistent) would make more sense maybe :)

Joakim

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: JoinChannel?
« Reply #7 on: March 05, 2013, 12:19:00 PM »
TNManager.CreateChannel -- Creates a new channel with a random ID.
TNManager.JoinRandomChannel -- Joins a random channel with the levelName matching the specified value, or any random channel if 'null' was passed for the level name.

Deozaan

  • Newbie
  • *
  • Thank You
  • -Given: 44
  • -Receive: 4
  • Posts: 42
    • View Profile
    • Deozaan.com
Re: JoinChannel?
« Reply #8 on: March 06, 2013, 01:24:18 AM »
Is there a reason why you can't pass 1 as the channel ID in TNManager.JoinChannel(1, "MyScene");? Trying this, it never loads that scene. But if I change the ID to anything but 1, it works. Is this a bug? Is 1 reserved for some special purpose?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: JoinChannel?
« Reply #9 on: March 06, 2013, 02:43:40 PM »
Most common case: you connected to the server using the TNet's example. It creates channel 1 with a persistent flag, meaning when you join in the future from any location, it will try to restore the state (read: load the first tutorial from TNet).

If you don't have that scene added to build settings, you will see an error instead.

Delete the server.dat file to clear this saved data.

Deozaan

  • Newbie
  • *
  • Thank You
  • -Given: 44
  • -Receive: 4
  • Posts: 42
    • View Profile
    • Deozaan.com
Re: JoinChannel?
« Reply #10 on: March 06, 2013, 09:28:59 PM »
Most common case: you connected to the server using the TNet's example. It creates channel 1 with a persistent flag, meaning when you join in the future from any location, it will try to restore the state (read: load the first tutorial from TNet).

If you don't have that scene added to build settings, you will see an error instead.

Delete the server.dat file to clear this saved data.

That seems to be the problem. But I wasn't getting an error message. It was just silently failing. This was using the TNAutoJoin script.