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 - rxmarcus

Pages: 1 2 [3] 4 5
31
TNet 3 Support / Re: Can't connect troubleshooting advice
« 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! :)

32
TNet 3 Support / 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!

33
TNet 3 Support / Re: TNManager.Instantiate position issues
« on: July 03, 2017, 12:44:33 PM »
It gives (0,0) for the client and it should give the position of the players gun something like (5, 8) in the game world. (Which it does for the Host).

I didn't fully resolve my LoadLevel issue yet. It seems to be working for me to manually call tno.DestroySelf() on my player network objects before I call LoadLevel so I left off there. However I'd like to get it working the correct way as I'm sure TNet can save me headaches in regards to cleaning up properly.

34
TNet 3 Support / TNManager.Instantiate position issues
« on: June 29, 2017, 07:24:17 PM »
I'm hoping I can get some advice on what I might be doing wrong here.

Basically I'm spawning a grenade object like so

  1. TNManager.Instantiate("GrenadeCreated", "GrenadeProjectile", false, playerNumber, playerCharacterController.weaponBone.transform.position, Quaternion.Euler(0, 0, aimAngle), grenadeVector);
  2.  
  3. [RCC]
  4.     static GameObject GrenadeCreated(GameObject prefab, int playerNumber, Vector3 pos, Quaternion rot, Vector2 velocity)
  5.     {
  6.         Debug.Log("Spawning grenade at: " + pos);
  7.         // Instantiate the prefab
  8.         GameObject go = prefab.Instantiate();
  9.         go.GetComponent<Script_GrenadeProjectile>().ProjectilePNum = playerNumber;
  10.         go.transform.position = pos;
  11.         go.transform.rotation = rot;
  12.         go.GetComponent<Rigidbody2D>().velocity = velocity;
  13.  
  14.         return go;
  15.     }
  16.  

The issue I'm having is that on the other clients (not the owner of the tno) the grenade seems to spawn at 0,0,0. As you can see in the provided screenshot. (I have a trail renderer on the grenade so you can see it spawns at 0,0,0 and quickly whips over to the positions that the owner are updating to sync the transforms position.



Any thoughts why my grenades are spawning at 0,0,0 rather than what I've set in my [RCC] method?

35
TNet 3 Support / Re: Post Match Cleanup
« on: June 28, 2017, 01:38:59 PM »
Thanks for the guidance.
I am noticing however that when my host calls TNManager.LoadLevel(1, "sceneName") that while this triggers all clients to load the level, that the network objects that have been created on the same channel are not being cleaned up. Is that for sure how TNManager.LoadLevel should act? It seems that I need to manually call tno.DestroySelf() on network objects that were dynamically created.

36
TNet 3 Support / Post Match Cleanup
« on: June 26, 2017, 12:48:38 PM »
It seems TNet is geared more towards a MMO persistent type game, so I'm hoping to get some direction on how I might handle the cleanup of my 2D arena shooter game which has short 5 minute matches which load a new map and reloads fresh characters each match.

Does TNet have any built in functionality to automatically cleanup dynamically created network objects? Or do I need to keep track of those myself and call tno.DestroySelf() on those objects before I change scenes and load up a new match?

Just looking for some general guidance on best practices for a game that is creating / destroying player avatars frequently.

37
TNet 3 Support / Re: Pinging game servers
« on: June 23, 2017, 12:54:43 AM »
Thanks for your help, after some blind tinkering the error no longer pops up. I removed a TNManager.StartUDP I was calling in my OnConnect method and now only call it the 1 time inside my server browser.

38
TNet 3 Support / Re: Pinging game servers
« on: June 22, 2017, 12:14:39 AM »
Thank you, I was able to get it to respond to my Ping by adding TNManager.StartUDP(UnityEngine.Random.Range(10000, 40000)); to the Start method of my serverBrowser script.

I did notice now that after I connect to a game I get  the error
Quote
The object was used after being disposed. (Game Client)
UnityEngine.Debug:LogError(Object)
TNet.UdpProtocol:Error(IPEndPoint, String) (at Assets/TNet/Common/TNUdpProtocol.cs:420)
TNet.UdpProtocol:OnReceive(IAsyncResult) (at Assets/TNet/Common/TNUdpProtocol.cs:222)
System.Net.Sockets.Worker:ReceiveFrom()

I tried adding TNManager.StopUDP() to my OnDestroy of my ServerBrowser script (as it gets destroyed when the player connects to a match) but that doesn't seem to help.

Also, I am calling TNManager.StartUDP(UnityEngine.Random.Range(10000, 40000)); in my OnConnect event method, is this an instance where I want to use my static port of 5128 instead of random?

39
TNet 3 Support / Re: Pinging game servers
« on: June 21, 2017, 03:04:19 PM »
Forgive my ignorance as I'm a TCP vs UDP and ports noob.

So I tried to follow your instruction and still am out of luck, here is what I have:

  1. public void SetupServer()
  2.     {
  3.        
  4.         if (TNServerInstance.Start(5127, 5128, null, TNServerInstance.Type.Tcp, Tools.ResolveEndPoint("xx.xxx.xx.xx:5129")))
  5.         {
  6.             TNManager.Connect();
  7.         }
  8.     }
  9.  
  10. public void SetupClient(string ip)
  11.     {
  12.  
  13.         if (ip == "")
  14.             ip = directConnectIp.text;
  15.  
  16.         // Connect to the remote server
  17.         TNManager.Connect(ip, 5127);
  18.     }
  19.  
  20.     private void OnJoinChannel(int channelID, bool success, string message)
  21.     {
  22.         if (success)
  23.         {
  24.             if (TNManager.isHosting)
  25.             {
  26.                 TNManager.Instantiate(1, "NetworkControllerCreate", "NetworkController", false);
  27.                 TNManager.SetPlayerLimit(4); // Only allow 4 players in an online match
  28.             }
  29.         }
  30.         else
  31.         {
  32.             LoadingScreen.Instance.HideLoadingScreen();
  33.             MessageWindow.DisplayMessageWindow(message);
  34.         }
  35.        
  36.     }
  37.  
  38. void OnConnect(bool result, string message)
  39.     {
  40.         if (result)
  41.         {
  42.             TNManager.StartUDP(UnityEngine.Random.Range(10000, 40000));
  43.             TNManager.JoinChannel(1);
  44.         }
  45.         else
  46.         {
  47.             LoadingScreen.Instance.HideLoadingScreen();
  48.             MessageWindow.DisplayMessageWindow(message);
  49.         }
  50.     }
  51.  

And inside my serverBrowser.cs
  1. TNManager.Ping(new IPEndPoint(ent.externalAddress.Address, 5128), PingCallback);
  2.  

When you say "Only the client should bind to the random port.", should I then in my OnConnect method wrap the StartUDP in a (!isHosting) conditional?
Also TNManager.StartUDP(UnityEngine.Random.Range(10000, 40000)); is returning True for me.

40
TNet 3 Support / Pinging game servers
« on: June 20, 2017, 11:01:22 PM »
I've been searching through the forum and have found a few threads talking about Pinging game servers from a Lobby to get their latency but I'm stuck and am hoping someone can help me see what mistake I've made.

- Here is what my code looks like
  1. public void SetupServer(){
  2. udpPort = UnityEngine.Random.Range(10000, 40000);
  3.         if (TNServerInstance.Start(5127, udpPort, null, TNServerInstance.Type.Tcp, Tools.ResolveEndPoint("xx.xxx.xx.xx:5129")))
  4.         {
  5.             TNManager.Connect();
  6.         }
  7. }
  8.  
  9. void OnConnect(bool result, string message)
  10.     {
  11.         if (result)
  12.         {
  13.             TNManager.JoinChannel(1, null, false, 5128, null);
  14.         }
  15.         else
  16.         {
  17.             LoadingScreen.Instance.HideLoadingScreen();
  18.             MessageWindow.DisplayMessageWindow(message);
  19.         }
  20.     }
  21.  
  22. private void OnJoinChannel(int channelID, bool success, string message)
  23.     {
  24.         if (success)
  25.         {
  26.             if (TNManager.isHosting)
  27.             {
  28.                 TNManager.Instantiate(1, "NetworkControllerCreate", "NetworkController", false);
  29.                 TNManager.SetPlayerLimit(4); // Only allow 4 players in an online match
  30.                
  31.                 // Make it possible to use UDP using a random port
  32.                 if (!TNServerInstance.isLocal && TNManager.isHosting)
  33.                     TNManager.StartUDP(udpPort);
  34.             }
  35.         }
  36.         else
  37.         {
  38.             LoadingScreen.Instance.HideLoadingScreen();
  39.             MessageWindow.DisplayMessageWindow(message);
  40.         }
  41.        
  42.     }
  43.  

I then attach the udpPort to my server name and parse it out when accessing in my serverBrowser script:
  1. public void UpdateServerList()
  2.     {
  3.         Debug.Log("Updating server list");
  4.  
  5.         // Clean out previous items
  6.         foreach (Transform child in Content)
  7.         {
  8.             GameObject.Destroy(child.gameObject);
  9.         }
  10.  
  11.         pingDictionary.Clear();
  12.  
  13.         // List of discovered servers
  14.         TNet.List<ServerList.Entry> list = TNLobbyClient.knownServers.list;
  15.  
  16.         // Server list example script automatically collects servers that have recently announced themselves
  17.         for (int i = 0; i < list.size; ++i)
  18.         {
  19.             //Debug.Log("Server " + i);
  20.             TNet.ServerList.Entry ent = list[i];
  21.  
  22.             var go = Instantiate(ServerListOption, Vector3.zero, Quaternion.identity, Content);
  23.             var listOption = go.GetComponent<ServerListOption>();
  24.  
  25.             //var serverDetails = JsonUtility.FromJson<ServerDetails>(ent.name);
  26.             var serverDetails = ent.name.Split('|');
  27.  
  28.             listOption.Ip = ent.externalAddress.ToString();
  29.             listOption.Name.text = serverDetails[0];
  30.             listOption.GameType.text = serverDetails[1];
  31.             listOption.Map.text = serverDetails[2];
  32.             int udpPort = int.Parse(serverDetails[3]);
  33.             listOption.PlayerCount.text = ent.playerCount.ToString() + "/4";
  34.  
  35.             pingDictionary.Add(ent.externalAddress, listOption.Ping);
  36.  
  37.             TNManager.Ping(Tools.ResolveEndPoint(ent.externalAddress.Address.ToString(), udpPort), PingCallback);
  38.            
  39.         }
  40.     }
  41.  

However I always get the error:"The socket is null. Did you forget to call UdpProtocol.Start()?"

I'm calling TNManager.StartUDP with the same port number that my ServerBrowser script then tries to use when pinging the game server....
I'm using TNTcpLobbyClient, do I need to be using TNUdpLobbyClient instead?
I have my Lobby server hosted on Amazon Web Services

Any other ideas what I might be doing wrong?

41
TNet 3 Support / Re: Updating Lobby Details Dynamically
« on: June 18, 2017, 11:54:05 AM »
Thanks to cmifwdll for the help!

Here is what the syntax looks like to update the server name for anyone that might need help. (I didn't know how to do this)
  1. BinaryWriter writer = TNManager.BeginSend(Packet.RequestRenameServer);
  2. writer.Write("Server name here");
  3. TNManager.EndSend();
  4.  


42
TNet 3 Support / Updating Lobby Details Dynamically
« on: June 11, 2017, 09:30:11 PM »
Is there a way to update a Server's details (name for example) dynamically with the Lobby server? In my case I'm going to be sending mapName and gameMode properties through my Lobby server so a player can know what the map and gametypes are before joining. How can I update these details as the online matches are played, and new matches / gametypes are loaded up on a server?

43
TNet 3 Support / Re: TNServer Use / Explanation
« on: June 11, 2017, 09:24:15 PM »
I ended up realizing that I had added a property to TNServerList.cs as I wanted to display a mapName to the user. (Which apparently the lobby server didn't like)
I realized as well I instead can just pack everything I want into a string and split it with a character like |
Hopefully that helps someone else.

44
TNet 3 Support / Re: TNServer Use / Explanation
« on: June 11, 2017, 01:06:44 PM »
So I downloaded that latest exe, and I'm noticing now a warning that is being thrown from TNTcpLobbyClient

Failed to read past end of stream.
UnityEngine.Debug:LogWarning(Object)
TNet.TNTcpLobbyClient:Update() (at Assets/TNet/Client/TNTcpLobbyClient.cs:107)

Any idea what is wrong here?

45
Soooo.... did the bug found here by @mythikos recieve a fix in the official TNet build in the asset store? I'm running V3.0.9 and currently am unable to get any servers in the knownServers list. (My lobby server hosted on AWS does register a game when I host it).

I'm trying to resolve this with the code I've seen around on the forum but it doesn't match up with what I have in my TNTcpLobbyServer.cs. So has this been fixed in the asset store release @ArenMook?

Pages: 1 2 [3] 4 5