Author Topic: Network traffic routing  (Read 3396 times)

Notepid

  • Guest
Network traffic routing
« on: September 06, 2013, 05:32:40 AM »
Hello guys (and gals).

I bought TNet yesterday, and had a play with it. It looks very promising, even with the utter lack of documentation.

One thing that I have not completely grasped is the channels. I "get" that it is like IRC where you subscribe to an information channel, and exchange information on that channel for everyone else to see (if I am wrong about this, please correct me).

One thing I do not get is what is actually happening behind the scenes here. Will all network traffic be routed though the server (host)? Say if I want to setup a match making , or master server, for a game where players are to host games on their private computers, should I then use a central server for channels that the players can advertise their hosted games? Or would that make all the network traffic go through that master server.

I guess what I am asking is "where is the network HUB for a game that is created".

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Network traffic routing
« Reply #1 on: September 06, 2013, 11:13:37 PM »
Yes you are correct, and yes the traffic is routed via the server (not the host). Going with IRC example, server is the executable you run allowing others to connect, and "host" means "channel operator" -- who is just another player, and there can be only one host per channel.

Advertising channels isn't needed. You can get a list of channels from the server.

You connect to a server (the executable!), and that server can have thousands of channels -- each channel being a unique game.

Notepid

  • Guest
Re: Network traffic routing
« Reply #2 on: September 07, 2013, 03:26:20 AM »
Thank you. I get it now :)

And to setup a master server it is simply having the "game hosting client" connect to the UDP-lobby or TCP-lobby on the master server and announce its presence. So when other clients want to grab a list of available "game hosting clients" they can query the master server. Correct?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Network traffic routing
« Reply #3 on: September 07, 2013, 10:59:41 PM »
If you don't know which server to connect to, you should use the TNet.LobbyServer and client.

Lobby server would generally be hosted somewhere publicly accessible -- such as the free Amazon EC2 instance. You can do so by executing TNServer.exe on it with appropriate parameters, telling it to start only the lobby server.

When players start their own servers, or someone starts a dedicated server, you'd then specify that lobby server as the remote lobby (look at TNTcpLobbyClient, TNUdpLobbyClient).

This will make TNet register servers with that lobby automatically. It will also allow you to retrieve a list of game servers from the lobby server, which will then allow you to connect to those servers now that you know where they are.

-------------------

That said, if you are just getting a hang of it and can get away with one hosted server, do just that -- simply launch TNServer.exe with the default parameters on an Amazon EC2 instance or somewhere else that can be accessed by the wide internet, and have your clients connect to it. Don't bother with lobbies.

As I said, each game server is fully capable of having thousands of games active inside it, each game having its own channel.

Notepid

  • Guest
Re: Network traffic routing
« Reply #4 on: September 09, 2013, 03:12:21 AM »
Perfect, thanks :)