Author Topic: lobby server  (Read 446 times)

DioAlias

  • Jr. Member
  • **
  • Thank You
  • -Given: 60
  • -Receive: 1
  • Posts: 62
    • View Profile
lobby server
« on: January 04, 2018, 05:52:49 AM »
whenever Clients create their own server - how automatically registrate it on lobby Server? (for other players can find it later)

I finded info about taking list of Servers:
  1. ServerList sList = TNLobbyClient.knownServers;

registrate in lobbyServer:
  1. TNServerInstance.Start(5127, 5128, null, TNServerInstance.Type.Tcp, Tools.ResolveEndPoint(lobbyServerIPport))

but,
how connect to lobbyServer and take knowsServerList?
how run lobbyServer?
it is possible to check NAT posibility connection before registrate it on lobby Server?
« Last Edit: January 05, 2018, 02:15:19 AM by Elmo »

cmifwdll

  • Global Moderator
  • Sr. Member
  • *****
  • Thank You
  • -Given: 0
  • -Receive: 149
  • Posts: 285
  • TNet Alchemist
    • View Profile
Re: lobby server
« Reply #1 on: January 05, 2018, 04:22:10 AM »
Launching a dedicated lobby server:
Launch the dedicated server as you normally do, but specify the lobby port (udpLobby is valid too).
  1. @echo off
  2. start "TNet Test Lobby Server" "TNServer.exe" -name "TNet_TestLobbySrv" -tcpLobby 5129
  3.  

Registering dedicated game servers with your lobby server:
Simply launch the dedicated server using a batch file like this:
  1. @echo off
  2. start "TNet Test Server" "TNServer.exe" -name "TNet_TestSrv" -tcp 5127 -udp 5128 -tcpLobby "192.168.1.2" "5129"
  3.  

Registering runtime-created servers with your lobby server:
Launch the server as you normally do but pass in the endpoint for your lobby server.
  1. TNServerInstance.Start(5127, 5128, "", Type.TCP, new IPEndPoint(IPAddress.Parse("192.168.1.2"), 5129), true)
  2.  

Connecting to the lobby server and retrieving list of registered servers:
Attach a TNTcpLobbyClient component to any gameobject. Then, in your code, use TNLobbyClient to access lobby data. It just works.


And for your last question, I'm not sure. You can pass a callback to UPnP's Open function and see if UPnP was able to automatically port-forward, but UPnP failing doesn't necessarily mean the user is unable to host a server (they could have manually forwarded their ports or they aren't behind NAT). The only way I can think of is writing a super small client & server. Client takes in your gameserver's port and sends it to server. Server attempts to connect to port. If connection fails, notify client. Client notifies caller. Host the server somewhere remote. You could build this into TNet's lobby server, actually, so you wouldn't even need to write the client part.

cmifwdll

  • Global Moderator
  • Sr. Member
  • *****
  • Thank You
  • -Given: 0
  • -Receive: 149
  • Posts: 285
  • TNet Alchemist
    • View Profile
Re: lobby server
« Reply #2 on: January 05, 2018, 10:38:47 PM »
I'm not sure what you're asking. You can launch a TNet server that acts as both a game server and lobby server:
  1. @echo off
  2. start "TNet Test Server" "TNServer.exe" -name "TNet_TestSrv" -tcp 5127 -udp 5128 -tcpLobby 5129
  3.  

That should start a game server on ports 5127 and 5128 and a lobby server on port 5129. The game server part will automatically register itself with the lobby server part.

DioAlias

  • Jr. Member
  • **
  • Thank You
  • -Given: 60
  • -Receive: 1
  • Posts: 62
    • View Profile
Re: lobby server
« Reply #3 on: January 06, 2018, 03:10:47 AM »
I found the answer, just set udpLobby(there I can receive this server itself in TNLobbyClient.knownServers - but tcpLobby is not), like:

  1. -name "Europe" -tcp 5127 -udp 5128 -udpLobby 5129 -http

cmifwdll

  • Global Moderator
  • Sr. Member
  • *****
  • Thank You
  • -Given: 0
  • -Receive: 149
  • Posts: 285
  • TNet Alchemist
    • View Profile
Re: lobby server
« Reply #4 on: January 07, 2018, 08:58:55 AM »
Must be a bug in the tcp lobby then.