Author Topic: Can't connect troubleshooting advice  (Read 25802 times)

rxmarcus

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 62
    • View Profile
Can't connect troubleshooting advice
« on: July 24, 2017, 05:07:51 PM »
So I just launched my game today.
For some users they haven't had to open any ports to connect.
Others I've had them open port 5128 and then other clients can connect to them.

And I have other users who open the port and I'm still not able to connect to them. One of them has an Ivp6 address (Which supposedly avoids port issues?) and I still cannot connect to him.

Just looking for more advice at what I can have my users do to get their games to connect. Any help is appreciated!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Can't connect troubleshooting advice
« Reply #1 on: July 24, 2017, 07:44:46 PM »
You don't need to open ports if UPnP is supported on the router. Most do, but not all, and some do in an odd way like Apple's Airport so they don't work with TNet's approach. If the user is behind more than one firewall (two routers, router + model that hasn't been set to bypass etc) then it likely won't be possible to connect to them. If you want it to always be possible to connect, have a central server you'll run yourself. You can either use it as your game server where each game instance is going to be a separate channel ID (like I did with Starlink), or just have it be your "official" game server like I did with Windward. Players can still host their own private servers with either scenario, and with Windward they will even show up on the server list (as you can register with a remote lobby) -- but they have to run the stand-alone server explicitly for this purpose. Servers launched from within the game don't show up, intentionally slow -- but of course it's still possible to use Steam's join friend's game functionality to share the server's info (ip, port) and allow direct joins. Provided their game is accessible of course -- and as I mentioned, not all players will have their machines be accessible due to the reasons mentioned.

rxmarcus

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 62
    • View Profile
Re: Can't connect troubleshooting advice
« Reply #2 on: July 25, 2017, 11:03:02 AM »
Thanks for the detailed response.

Can you give more details about running my own central server? Is that the same thing as me hosting a dedicated server on something like Amazon web services?

Is your central server an actual instance of your game on the unity engine? Or what does your "stand alone server" look like?

This sounds like the direction I'll want to head if I can understand it a bit more! :)

cmifwdll

  • Global Moderator
  • Sr. Member
  • *****
  • Thank You
  • -Given: 0
  • -Receive: 149
  • Posts: 285
  • TNet Alchemist
    • View Profile
Re: Can't connect troubleshooting advice
« Reply #3 on: July 25, 2017, 03:55:03 PM »
Yes, that's exactly it. It could be a cheap VPS, too, though, like through linode or digitalocean. TNet's server doesn't require a lot of resources, so the cheapest plan should work.

No, it's just the standalone TNet server. Nothing tied to Unity.

The standalone server should be in a zip file within the TNet asset. The zip file is called "TNetServer.zip". It's precompiled so you should be able to just run it.

I think the setup ArenMook is describing is as follows:
You have a single standalone server running. Your players connect to that. Then you split this single server into multiple channels. Each channel is its own separate instance (or "match" in your case) of the game. In this way, each channel kind of becomes its own sub-server. So, in your case, I imagine joining a match currently consists of three steps: TNServerInstance.Start for the host, then TNManager.Connect followed by TNManager.JoinChannel for everyone. With this setup it'd just be TNManager.Connect on startup (only once!) and TNManager.JoinChannel for each match.

Some batch/bash files to startup the server (I don't know what I'm doing here, but it works for me):
Windows (save as RunServer.bat):
  1. @echo off
  2. start "TNet Test Server" "TNServer.exe" -name "TNet_TestSrv" -tcp 5127 -udp 5128 -tcpLobby "127.0.0.1" "5129"
  3.  

Linux (save as RunServer.sh):
  1. #!/bin/bash
  2. echo "Starting Server"
  3. mono "TNServer.exe" -name "TNet_TestSrv" -tcp 5127 -udp 5128 -tcpLobby "127.0.0.1" "5129"
  4. echo "Server has exited"
  5.  

For linux you'll need to install mono. I think it's just sudo apt-get install mono-complete. Dunno the yum equivalent, I think you can find instructions on mono's website for a bunch of different package managers.

rxmarcus

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 62
    • View Profile
Re: Can't connect troubleshooting advice
« Reply #4 on: July 25, 2017, 05:07:42 PM »
If the "Host" is still calling TNServerInstance.Start(), then what is the purpose of the TNetServer? I currently have TNetServer running on AWS for my Lobby Server.

I changed my startup script to use your suggestion so now it is hosting a lobby server and a game server.

With the setup you guys are describing, won't I need all players including the host to connect to the IP address of my AWS TNet "Game Server"?

Sorry in advance for not understanding!

cmifwdll

  • Global Moderator
  • Sr. Member
  • *****
  • Thank You
  • -Given: 0
  • -Receive: 149
  • Posts: 285
  • TNet Alchemist
    • View Profile
Re: Can't connect troubleshooting advice
« Reply #5 on: July 25, 2017, 05:12:57 PM »
Sorry, I wasn't clear. I was comparing your current setup with the described setup. In the described setup, you only call TNManager.Connect at startup then TNManager.JoinChannel for each match. No one calls TNServerInstance.Start.

Yes, all players should connect to your standalone game server (and lobby server if you want, but only necessary if you'd like to see player-hosted servers in a server browser or something).

rxmarcus

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 62
    • View Profile
Re: Can't connect troubleshooting advice
« Reply #6 on: July 25, 2017, 05:45:08 PM »
With this setup.... how does TNManager.isHosting behave?

Every player that connects is just a client and not a host right? I've written lots of my game logic that depends on TNManager.isHosting

cmifwdll

  • Global Moderator
  • Sr. Member
  • *****
  • Thank You
  • -Given: 0
  • -Receive: 149
  • Posts: 285
  • TNet Alchemist
    • View Profile
Re: Can't connect troubleshooting advice
« Reply #7 on: July 25, 2017, 05:46:28 PM »
Exactly the same as before: the first player that joins a channel is that channel's host.

rxmarcus

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 62
    • View Profile
Re: Can't connect troubleshooting advice
« Reply #8 on: July 25, 2017, 05:54:30 PM »
Oh sweet, I didn't realize that is how it worked. I had assumed whoever called TNServerInstance.Start() was the host.

Really appreciate your quick responses! =)

Trying to switch over to this method rapidly so my players can have a better experience.

cmifwdll

  • Global Moderator
  • Sr. Member
  • *****
  • Thank You
  • -Given: 0
  • -Receive: 149
  • Posts: 285
  • TNet Alchemist
    • View Profile
Re: Can't connect troubleshooting advice
« Reply #9 on: July 25, 2017, 06:03:41 PM »
No problem. Yeah, "host" is a bit misleading: it should be named "operator" to clear up confusion. The host isn't actually hosting anything; it's just a flag that indicates authority.

Good luck with your game ^.^

rxmarcus

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 62
    • View Profile
Re: Can't connect troubleshooting advice
« Reply #10 on: July 25, 2017, 07:56:48 PM »
So I've got this basically setup now using Amazon web services, but my games are now REALLY laggy. Is amazon web services maybe not meant for hosting game servers? I'm getting about 50ms ping to the server which isn't bad, but its responding WAY slower / lagging  than it was when I was doing P2P server hosting.

Any ideas?

cmifwdll

  • Global Moderator
  • Sr. Member
  • *****
  • Thank You
  • -Given: 0
  • -Receive: 149
  • Posts: 285
  • TNet Alchemist
    • View Profile
Re: Can't connect troubleshooting advice
« Reply #11 on: July 25, 2017, 08:10:35 PM »
No idea. I've never used Amazon's services. This thread touches on EC2 instances though: http://www.tasharen.com/forum/index.php?topic=4756.0
Apparently poor latency is expected?

I'd just go with linode or digitalocean. They're just as scalable and ridiculously cheap. I've never had problems with either provider.

rxmarcus

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 62
    • View Profile
Re: Can't connect troubleshooting advice
« Reply #12 on: July 25, 2017, 11:10:03 PM »
Thanks, I got a droplet setup on Digital Ocean.

One issue I'm having when trying to start TNetServer.exe like so

  1. mono "TNServer.exe" -name "TNet_TestSrv" -tcp 5127 -udp 5128 -tcpLobby "127.0.0.1" "5129"

Is that I get an error: "TcpLobbyLink is connecting to 127.0.0.1:5129... TcpLobbyLink Error: Connection refused"

If I remove the "127.0.0.1" from the command, it starts up fine and I'm able to connect to it. BUT, I'm trying to figure out also how I can have the game server named in the lobby server. Right now it has no title.....

rxmarcus

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 62
    • View Profile
Re: Can't connect troubleshooting advice
« Reply #13 on: July 25, 2017, 11:17:01 PM »
Nevermind, it IS showing the server name now. Do I need to worry about the "127.0.0.1" issue I mentioned?

Also, how can I edit a forum post?!

cmifwdll

  • Global Moderator
  • Sr. Member
  • *****
  • Thank You
  • -Given: 0
  • -Receive: 149
  • Posts: 285
  • TNet Alchemist
    • View Profile
Re: Can't connect troubleshooting advice
« Reply #14 on: July 25, 2017, 11:28:36 PM »
That specifies a remote tcp lobby to reigster with. If you have your lobby server on another machine you'll need to specify its address and port there. Omitting an address and just using the port starts the lobby server on the same machine.

Can't edit posts - some people were editing out information that could be helpful to others in the future.