Author Topic: Remote Lobby server problem  (Read 8122 times)

sloopernine

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 47
    • View Profile
Remote Lobby server problem
« on: August 27, 2013, 04:13:55 PM »
  1. using UnityEngine;
  2. using System.Collections;
  3. using TNet;
  4.  
  5. public class startServer : MonoBehaviour
  6. {
  7.  
  8.         // Use this for initialization
  9.         void Start ()
  10.     {
  11.            
  12.         }
  13.        
  14.         // Update is called once per frame
  15.         void Update ()
  16.     {
  17.        
  18.         }
  19.  
  20.     void OnGUI()
  21.     {
  22.         if(Input.GetKeyDown("space"))
  23.         {
  24.             TNServerInstance.Start(5127, 5128, “server.dat”, TNServerInstance.Type.Tcp, Tools.ResolveEndPoint(“some.address.com”, 5129));
  25.         }
  26.     }
  27. }

I get error

Quote
startServer.cs(24,100): error CS1525: Unexpected symbol `<internal>'

And that is the exact line from http://www.tasharen.com/?page_id=4523

Quote
TNServerInstance.Start(5127, 5128, “server.dat”, TNServerInstance.Type.Tcp, Tools.ResolveEndPoint(“some.address.com”, 5129));

Why does this happen? I have TNManager attached aswell in the scene aswell.

Some complementing questions

Can I change the "server.dat" to just "" if I dont want to use that file?

TNServerInstance.Type.Tcp is that what kind of server that the host creates? If so, what if I want to use tcp for chat etc, and udp for game mechanics like position etc ?

The tools.ResolveEndPoint return a string, how would I write that string if I want to give a ip from start ? "213.242.21.234:5129" ?

Thanks in advance!
« Last Edit: August 27, 2013, 07:29:43 PM by sloopernine »

sloopernine

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 47
    • View Profile
Re: Remote Lobby server problem
« Reply #1 on: August 28, 2013, 10:30:04 AM »
Is there really no one that can tell me why it complains about that line of code?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Remote Lobby server problem
« Reply #2 on: August 28, 2013, 11:23:51 PM »
Well, first of all, don't use OnGUI to process input. Do it in Update instead.

Second, what you are trying to do here is start a local server instance, and register it with a non-existing IP address (some.address.com) running a TCP lobby on port 5129. My guess is this is not what you're wanting to do, is it?

sloopernine

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 47
    • View Profile
Re: Remote Lobby server problem
« Reply #3 on: August 29, 2013, 01:54:27 AM »
That was not my problem, the problem is that it complains in the IDE, I cant even compile the project, I had another domain there before pointing to my TNet server application.

(And I have another web adress I put there, but it still gave me errors so I couldnt even compile/play)
And the idea is to use amazon EC2 for a lobby server only, and let players host servers on their own...

Here is an image of the problem I have


Quote
Assets/_Scripts/startServer.cs(11,48): error CS1525: Unexpected symbol `<internal>'
« Last Edit: August 29, 2013, 06:54:45 AM by sloopernine »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Remote Lobby server problem
« Reply #4 on: August 29, 2013, 03:30:40 PM »
Copy/paste error. Look at the quotes around the text. They are word quotes, not "" quotes. Fix it and the issue will disappear.

sloopernine

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 47
    • View Profile
Re: Remote Lobby server problem
« Reply #5 on: August 29, 2013, 04:21:08 PM »
Oh embarrassing mistake, thanks!

About the other question

Can I change the "server.dat" to just "". If I dont want to use the save function, or do I do it wrong then?



ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Remote Lobby server problem
« Reply #6 on: August 29, 2013, 04:22:22 PM »
Change it to 'null'. That should work.

sloopernine

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 47
    • View Profile
Re: Remote Lobby server problem
« Reply #7 on: August 29, 2013, 05:12:03 PM »
Shouldnt the TNet server console ( running as  udp lobby server on port 5129) give some kind of message if I register my game server to it? Like when it gives messages when I connect to it as client and use it the TNet server console as the game server?

  1. using UnityEngine;
  2. using System.Collections;
  3. using TNet;
  4.  
  5. public class startServer : MonoBehaviour
  6. {
  7.     public string lobbyServerAdress;
  8.  
  9.         // Use this for initialization
  10.         void Start ()
  11.     {
  12.         Debug.Log(Tools.ResolveEndPoint(lobbyServerAdress));
  13.  
  14.         TNServerInstance.Start(5127, 5128, null, TNServerInstance.Type.Udp, Tools.ResolveEndPoint(lobbyServerAdress, 5129));
  15.        
  16.         }
  17.        
  18.         // Update is called once per frame
  19.         void Update ()
  20.     {
  21.        
  22.         }
  23. }
  24.  

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Remote Lobby server problem
« Reply #8 on: August 29, 2013, 07:08:30 PM »
Lobby server does say when a new server gets registered, yes. Do you actually have the lobby server running? The line you're using starts a local server. Lobby server must be started from the command line. Run TNServer.exe to find out more.

sloopernine

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 47
    • View Profile
Re: Remote Lobby server problem
« Reply #9 on: August 30, 2013, 03:10:18 AM »
Yup started the TNServer.exe on amazon ec2 with

Quote
C:\Users\Administrator\Documents\GameServer\TNServer.exe -name "LobbyServer" -udpLobby 5129
as target.

I was just concerned that TNServer didnt register my game server, as the console of TNServer didnt give any message  of it.

That would be a nice feature for TNServer in coming updates, that it writes in console when new game server register to it, for easier debug.

Also

Quote
TNServerInstance.Type.Udp
in

Quote
TNServerInstance.Start(5127, 5128, null, TNServerInstance.Type.Udp, Tools.ResolveEndPoint(lobbyServerAdress, 5129));

Is that for telling TNServer what type of protocol game server are using or is it to tell game server what type of protocol lobby are using?

##EDIT##

I have made some progress, but got a new question in addition of the other ones ->

When starting a new server and register it to the lobby server at amazon I see this in the lobby server console



Why are the clien/gameserver hammering/repeating the register part? If it is to check if server still online, where do I change the interval of the check?

Here are the code for I have so far...

  1. using UnityEngine;
  2. using System.Collections;
  3. using TNet;
  4.  
  5. public class startServer : MonoBehaviour
  6. {
  7.     public string lobbyServerAdress;
  8.  
  9.         // Use this for initialization
  10.         void Start ()
  11.     {
  12.         Debug.Log(Tools.ResolveEndPoint(lobbyServerAdress, 5129));
  13.         if (!TNServerInstance.isActive)
  14.         {
  15.             Debug.Log("Starting server");
  16.             TNServerInstance.Start(5127, 5128, null, TNServerInstance.Type.Udp, Tools.ResolveEndPoint(lobbyServerAdress, 5129));
  17.         }
  18.         else
  19.         {
  20.             Debug.Log("Server already started");
  21.         }
  22.        
  23.         }
  24.        
  25.         // Update is called once per frame
  26.         void Update ()
  27.     {
  28.             if(Input.GetKeyDown(KeyCode.Space))
  29.         {
  30.             Debug.Log("Server shutdown");
  31.             TNServerInstance.Stop();
  32.         }
  33.         }
  34. }
« Last Edit: August 30, 2013, 08:16:14 AM by sloopernine »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Remote Lobby server problem
« Reply #10 on: August 30, 2013, 01:17:33 PM »
You get a registration message every time the number of players changes. The server updates the lobby server with this information.

sloopernine

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 47
    • View Profile
Re: Remote Lobby server problem
« Reply #11 on: August 30, 2013, 02:35:30 PM »
But the updates on the picture are same client all time? Seems like they come in a interval of about 3 seconds until I disconnect again

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Remote Lobby server problem
« Reply #12 on: August 30, 2013, 03:30:40 PM »
UDP updates periodically as there are no connections established. TCP updates only when something changes.

sloopernine

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 47
    • View Profile
Re: Remote Lobby server problem
« Reply #13 on: August 30, 2013, 04:49:35 PM »
Ah thanks for the info, learned something new!
Then I guess TCP are the way to go,  to keep down bandwidth.