Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - MCoburn

Pages: 1 ... 3 4 [5]
61
TNet 3 Support / Re: Stuttering, dropping frames at 20 AI objects?
« on: September 29, 2014, 10:52:25 PM »
It comes from TNObject.Send() all the way through to TcpProtocol.SendTcpPacket(). See http://gyazo.com/4e2be9e97dc3921e3cdc13407702eced

Does this mean TNet cannot support 20 or so networked objects? How do fix this problem? I don't really know what I'm looking at.

Thanks again,
I think you're spamming TCP packets, and TNet has to do a lot of work to accept them all. Try using the SendQuickly approach, which uses UDP.
TCP has to be acknowledged by the server/host before it's accepted, so if you have high latency, then you can get the stutter. UDP is "droppable", and should be used for non-critical things where you can tolerate some packet loss (ie. movement). You could also be having bandwidth limitations.

62
It might. It might not. Try it. ;)
However you may encounter issues that can only be fixed by upgrading. I use a beta of 4.6 (b17) and it works like a champ.

63
TNet 3 Support / Re: Connecting to lobby server to get server list?
« on: September 25, 2014, 10:00:02 PM »
I solved the issue, with the help of Aren over skype. I needed to pass the -tcpLobby <porthere> to the server for it to work. Then, I realized that I was connecting to the gameserver port instead of the lobby port! After fixing this, I checked the vars in the code:

  1. TNTcpLobbyClient.isActive is true.
  2. TNTcpLobbyClient.error is null/empty. (This changes with the error message if I kill the server via 'q' and enter or close the window).
  3. TNTcpLobbyClient.knownServers.list.size is 0.
  4.  

The question is now, will that server list be updated as soon as a new server gets registered to the lobby server (the standalone TNet executable)?
Since that's out the way, now I can focus on actual server logic. Woohoo!

64
TNet 3 Support / Re: Connecting to lobby server to get server list?
« on: September 24, 2014, 08:53:06 PM »
I would appreciate some sample code, as I cannot get this working as intended. Even on my own development box, the Lobby server sees the client, but has the "Connect, Time Out, Disconnect" cycle. OnNetworkConnect() doesn't return anything helpful. Even using the stock lobby server that comes with TNet without any mods still has the same issue. ???

I am almost tempted to say that 1.9.9's lobby server build is broken.

EDIT: New scene, 2 objects (Camera and gameObject). GameObject has 2 scripts: Network Manager and TCP Lobby Client. No additional scripts. Just those.
TNET Lobby Server standalone running on 5127 - 5129 (default TNet TCP/UDP Ports). Still getting this:
  1. Local IPs: 1
  2.   1: 192.168.0.9 (Primary)
  3.  
  4. Gateway IP:  192.168.0.1
  5. External IP: 59.x.x.9
  6.  
  7. UDP Lobby Server started on port 5129 using interface 0.0.0.0
  8. Game server started on port 5127 using protocol version 12
  9. Press 'q' followed by ENTER when you want to quit.
  10.  
  11. UPnP: TCP port 5127 was opened successfully.
  12. UPnP: UDP port 5128 was opened successfully.
  13. UPnP: UDP port 5129 was opened successfully.
  14. 127.0.0.1:52342 has connected
  15. 127.0.0.1:52342 has timed out
  16. 127.0.0.1:52342 has disconnected
  17. 127.0.0.1:52350 has connected

EDIT 2: I can kill the server ('Q' in console and ENTER) which will spit out "A connection was forcibly disconnected" followed by "No connection was able to be made due to the target machine actively rejecting it". So some how it does handle the connection, but never establishes it fully. Could I roll back to a older version of TNet to confirm if something broke?

I'm going to put the tools down for the rest of the day. I bet it's something I'm overlooking.

65
TNet 3 Support / Re: connected ... timed out ... disconnected
« on: September 24, 2014, 07:11:08 PM »
Sounds like the issue I'm having in my thread. Although you say when you build the client, it works. It seems there might be something in the editor that is nerfing TNet. Although in my experience, 1.9.9 does initialize with [TNET]... stuff in the console.

Although on the client build, it does the same connect, disconnect, etc.

66
TNet 3 Support / [SOLVED] Connecting to lobby server to get server list?
« on: September 23, 2014, 11:26:47 PM »
I'm trying to poll the TNet Lobby server for the list of servers, so my players can click one to join.

On my gameobject that controls the main menu, I've assigned the "TNet Network Manager" script and a "TNUdp Lobby Client". In the latter, I set the lobby server to my remote box's hostname (it's a Amazon Micro Win2K12) and made sure Windows Firewall allows the compiled binary (I took the one included with the UnityPackage and did some minor adjustments). Server ports are 31337, 31338 and 31339.

Here's what the current gameobject looks like. Hostname obscured for privacy/security reasons.


When clicking play, this comes out of the console:
  1. [TNet] Local IPs: 1
  2.   1: 192.168.0.9 (Primary)
  3. UnityEngine.Debug:Log(Object)
  4. TNManager:Awake() (at Assets/TNet/Client/TNManager.cs:905)
  5.  

Which I assume means that TNet is awake. Sometimes the UPNP Gateway says "Not found, can't open ports automatically", sometimes it's quiet, sometimes it reports back the gateway IP. Dunno if that's a issue with a stuck port, or what. Now, in the code...

  1. void Start() {
  2. TNManager.client.packetHandlers[(byte)Packet.ResponseChannelList] = OnChannelList;
  3. refreshHostList();
  4. }
  5. <....>
  6. void refreshHostList(){
  7. isBusy = true;
  8.         TNManager.client.BeginSend(Packet.RequestChannelList);
  9.         TNManager.client.EndSend();
  10. }
  11.  
  12. void OnChannelList (Packet response, BinaryReader reader, IPEndPoint source){
  13.         Debug.Log("If you can see this, we have channels. Maybe.");
  14.         // The first integer represents the number of entries to follow
  15.         int channels = reader.ReadInt32();
  16.  
  17.         // Read all incoming channel data
  18.         for (int i = 0; i < channels; ++i)
  19.         {
  20.             int id              = reader.ReadInt32();
  21.             int players         = reader.ReadUInt16();
  22.             int limit           = reader.ReadUInt16();
  23.             bool pass           = reader.ReadBoolean();
  24.             bool persistent     = reader.ReadBoolean();
  25.             string level        = reader.ReadString();
  26.             string data         = reader.ReadString();
  27.  
  28.             // TODO: Do something with this data here
  29.         }
  30. isBusy = false;
  31. }
  32.  
The OnChannelList code was pulled from here with a slight edit to see if TNet will actually get the stuff. However, it never says the Debug output.

I'm baffled at what I need to do. Do I need to use TNManager.Start(port) to start listening for info between the server and client? Or what am I missing? Note that a good chunk of the code is cut out because I'm not going to paste the entire script.

PRE-POST EDIT: Okay, so I switched to TCP Lobby Client and it seems to be better. However, on the server, I'm getting things like:
  1. <my public dev box IP>:<randomport> has connected.
  2. <my public dev box IP>:<randomport> has timed out.
  3. <my public dev box IP>:<randomport> has disconnected.
  4. <my public dev box IP>:<old port plus 2> has connected.
  5. <.....>
  6.  


At least this output is better than nothing, that's for sure.
Can anyone provide pointers on what could possibly be going wrong?

67
TNet 3 Support / Re: TNet: Network Level Loading
« on: September 23, 2014, 08:19:18 PM »
Thank you for confirming. Well, you have a purchase!

So, when clients connect to the server, will they automatically be created on the client-side? I remember there was a "Auto Create" script going back a few builds that would auto create objects in the scene when it loaded?

68
TNet 3 Support / Re: Local server
« on: September 23, 2014, 12:14:20 AM »
I think what he means that he's connected to the outside world by his 3G internet modem and he doesn't have LAN network.

If you use the public IP of the 3G Modem, let's say 50.x.x.x, TNet should automatically realize that is your computer connecting to itself, and it would be like a loopback - no actual packets going to some random host on the internet then back to your connection.

Some ADSL modem routers do the same thing, you punch in your external IP and they treat it like a internal network connection.

69
TNet 3 Support / Re: TNet: Network Level Loading
« on: September 22, 2014, 05:23:05 PM »
Thanks for the quick response. This clears the confusion a fair bit. ;)
If I am not mistaken, does TNet automatically reply to client 2's joining notification with the level ID when client 1 is hosting? Or would I have to fire a RFC or custom packet to client 2?

70
TNet 3 Support / TNet: Network Level Loading
« on: September 21, 2014, 07:24:25 PM »
Hi,

I'm one of the two guys working at [in]Sanity Interactive, a co-op game development crew that is currently working on a shooter project, which will feature both dedicated server and private matches where the player hosting the match is able to play as well. We have been using Unity's built-in framework (RakNet) and we've had troubles trying to get the network layer to work correctly when sending RPCs back to clients so they can load the right level.

I was wondering if you could confirm if TNet has server-instructed level loading capabilities, and if you could post a snippet of code that would be the basis of the server telling the client what to load.

When the player connects to the server hosting the game, before the client should do anything, the server sends a message (let's for arguments sake say "clientLoadLevel") to the client, with a string of it's level that is currently loaded (called from Application.levelLoadedName, etc). The client must then accept this message and start loading the level (I see TNet has TNet.LoadLevel which is nice!) otherwise I intend to kick the client saying "Wrong level loaded" to prevent really weird stuff happening.

So, in pseudo code:

Server: Client connects > Client, clientLoadLevel("mp_testlevel") > *waits for client response * > Okay, you've loaded, welcome to the game
Client: Connect to server from mainmenu > Server, what is the level? > Okay, I'll load mp_testlevel > Yay!

The thing here, is that in our current Unity RPC implementation, is that the RPC gets fired in a different scene since the server has loaded the level (let's say mp_testlevel) and since the client is on the main menu, it freaks out and errors or doesn't load the level and weird stuff starts happening.

So, this is one of the things I'm looking at in TNet. Plus, for shooters, I need a robust and reliable solution because I don't want major network glitches due to bugs in Unity's set-up. I realize that TNet is only the networking cake, and my game is the icing on top of that, but if you can confirm I can do the level loading as shown above, then you pretty much have a purchase.

Cheers!

Pages: 1 ... 3 4 [5]