Author Topic: How to check player count before entering server  (Read 3734 times)

vzdemon

  • Guest
How to check player count before entering server
« on: March 02, 2013, 10:26:51 AM »
Hi, im programming a matchmaking system for a soccer game. so i have this server list like in the ExampleMenu scene that comes with tnet. now i want to run a check on each server to check how many poeple are connected to it before joining since a soccer match can only be between two teams (aka two players). also i would like to know how i can setup a master server for online play not just LAN games, so that one person hosts a game and the other can connect to his hosted game from the other end of the globe. thanks for reading :)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How to check player count before entering server
« Reply #1 on: March 02, 2013, 12:08:58 PM »
A server can have many channels, thus can host many games. I think what you need is a list of channels, which is described here: http://www.tasharen.com/forum/index.php?topic=2925.msg14786#msg14786

If you actually want only one channel per server, then you will want a server list -- and the TNLobbyClient.knownServers list will tell you how many players are connected to each server (ServerList.Entry.playerCount).

vzdemon

  • Guest
Re: How to check player count before entering server
« Reply #2 on: March 05, 2013, 08:23:04 AM »
i prefer server list because channels are not unlimited (from what i understand each channel sits on a different port). but i dont want to have to pay for all these servers, i want to pay for one master server where people can browse for games hosted by other people so that it will be p2p gaming.

jkrassman

  • Guest
Re: How to check player count before entering server
« Reply #3 on: March 05, 2013, 10:43:15 AM »
i prefer server list because channels are not unlimited (from what i understand each channel sits on a different port). but i dont want to have to pay for all these servers, i want to pay for one master server where people can browse for games hosted by other people so that it will be p2p gaming.

From what I understand....

I have just set up one gameServer in the amazon cloud and have one port open. That server can hold several of games and it is just using that single port. User can join each others games and you can specify how many players there should be in each channel. I am maybe wrong but thats how I think it works...So that cloudserver is my master, that holds all games within the channels.

Joakim

 

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How to check player count before entering server
« Reply #4 on: March 05, 2013, 12:16:26 PM »
Each channel is just that -- a virtual channel. There is no additional port involved. When in doubt, think IRC.

vzdemon

  • Guest
Re: How to check player count before entering server
« Reply #5 on: March 08, 2013, 06:32:15 AM »
so with channels i can have limitless games on one server? sounds great but i want the games to run p2p, and use the one server just so the two devices can find each other. what i have set up now is that each client get's a server list, if it's empty he begins a server. if the list is not empty he will join the first server available. once the server's player count is equal to 2 it calls the funtion MakePrivate(). will this system work the way i want it to, or will the players not find each other? because on local host they find each other perfectly. and if it wont work, how can i make it so that they can find each other? i used code from the ExampleMenu script btw.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How to check player count before entering server
« Reply #6 on: March 08, 2013, 07:08:01 PM »
Yes, you can have many channels, you don't have to. If you have a fixed channel ID the game chooses, such as "123", then you will effectively have only one channel on the server, which sounds like what you want. That's how the menu example works. Each scene has its own specific channel ID. That's how they find each other.