Author Topic: Channel master  (Read 11116 times)

Noi14

  • Jr. Member
  • **
  • Thank You
  • -Given: 10
  • -Receive: 0
  • Posts: 57
    • View Profile
Channel master
« on: February 20, 2014, 03:53:29 PM »
Hi,
I want that every channel have a master, that starts something. Do this it's very easy because when someone creates a channel I can set him as master.
The problem is when the master user left the channel. I want, in that case, that someone else can set himself as master. Which is the best way to do this? I don't want thath more than one user can do this.

ldw-bas

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 2
  • Posts: 32
    • View Profile
Re: Channel master
« Reply #1 on: February 21, 2014, 03:39:32 AM »
I think the host functionality is what you need. Every channel has a host, this automatically is transferred to another player when the host leaves. If this is not what you need can you explain how the channel master functionality is different from the channel host functionality.

Noi14

  • Jr. Member
  • **
  • Thank You
  • -Given: 10
  • -Receive: 0
  • Posts: 57
    • View Profile
Re: Channel master
« Reply #2 on: February 21, 2014, 05:08:54 AM »
I need it for a game with webplayer that it is supported by my server. For this reason I'm using this solution

ldw-bas

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 2
  • Posts: 32
    • View Profile
Re: Channel master
« Reply #3 on: February 21, 2014, 05:39:26 AM »
I think the basic host functionality just works in a webplayer. Have a look at TNManager.isHosting and TNManager.hostID, you can also send messages to the host with TNet.Target.Host. When the host leaves the channel, the server automatically changes the host to another player. You can also set the host manually using TNManager.SetHost.

Noi14

  • Jr. Member
  • **
  • Thank You
  • -Given: 10
  • -Receive: 0
  • Posts: 57
    • View Profile
Re: Channel master
« Reply #4 on: February 21, 2014, 06:07:02 AM »
If I want to use tntmanager.ishosting user must be a real server? My game has got problem with high latency. For this reason I want to use a dedicated server but in the same time I' d like to have a unique master in each channel in order to do certain actions

ldw-bas

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 2
  • Posts: 32
    • View Profile
Re: Channel master
« Reply #5 on: February 21, 2014, 09:34:15 AM »
The host and the server are a different thing, if I remember correctly ArenMook referred to it as the server being the house and the host the owner. That quote aside I can say so sure it is possible to have a different host and server. My server for example is running on a remote server and when I join from my home pc I am the host.

Noi14

  • Jr. Member
  • **
  • Thank You
  • -Given: 10
  • -Receive: 0
  • Posts: 57
    • View Profile
Re: Channel master
« Reply #6 on: February 21, 2014, 10:11:41 AM »
I think it is what I want, but I don't found documentation about this in order to work.
Tnet's documentation should be improved...

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Channel master
« Reply #7 on: February 21, 2014, 11:37:23 AM »
Quote
Hi,
I want that every channel have a master, that starts something. Do this it's very easy because when someone creates a channel I can set him as master.
The problem is when the master user left the channel. I want, in that case, that someone else can set himself as master. Which is the best way to do this? I don't want thath more than one user can do this.
This is part of the basic functionality of TNet. When the authoritative player leaves the channel (call him "master" if you like -- TNet calls him "host"), then another one is chosen automatically. You don't need to worry about it.

Noi14

  • Jr. Member
  • **
  • Thank You
  • -Given: 10
  • -Receive: 0
  • Posts: 57
    • View Profile
Re: Channel master
« Reply #8 on: February 21, 2014, 04:50:01 PM »
Thank you for your reply.
How can I get a list of currently player in a channel?And who is the host of that list?
I'd like each user when press "TAB" on keyboard can view list of user in channel and who is host

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Channel master
« Reply #9 on: February 21, 2014, 05:05:35 PM »
List of players: TNManager.players

Getting the host:
  1. Debug.Log("Host is " + TNManager.GetPlayer(TNManager.hostID).name);

Always check TNManager's list of functions and properties first.

Noi14

  • Jr. Member
  • **
  • Thank You
  • -Given: 10
  • -Receive: 0
  • Posts: 57
    • View Profile
Re: Channel master
« Reply #10 on: February 21, 2014, 05:37:23 PM »
Thank you for your reply and your patient.
Does it exist a documentation for TNTManager? I don't found where it is or do I control file manually?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Channel master
« Reply #11 on: February 22, 2014, 11:36:53 AM »

Noi14

  • Jr. Member
  • **
  • Thank You
  • -Given: 10
  • -Receive: 0
  • Posts: 57
    • View Profile
Re: Channel master
« Reply #12 on: February 26, 2014, 06:06:13 PM »
Thank you so much, but TNManager.player returns all users exept my self.
How can I have a list with my self?

ldw-bas

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 2
  • Posts: 32
    • View Profile
Re: Channel master
« Reply #13 on: February 27, 2014, 11:25:49 AM »
I think you'll have to create such a list yourself. I am used to working around this, most of the time you use as well TNManager.players as TNManager.player. Assuming you meant TNManager.players (with an s) in the first place.

Noi14

  • Jr. Member
  • **
  • Thank You
  • -Given: 10
  • -Receive: 0
  • Posts: 57
    • View Profile
Re: Channel master
« Reply #14 on: February 27, 2014, 12:45:17 PM »
Thank you.
I've resolved it. I'm doing a list and I'm adding a currently player :D