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.

Topics - rxmarcus

Pages: [1] 2
TNet 3 Support / Latency Spikes / Guidance
« on: October 11, 2017, 04:00:53 PM »
For the past while I've been attempting to set up dedicated servers for our game. I've have a server hosted on Linode, Digital Ocean and now one on NFO.

A consistent issue I've had is that latency for my players spikes rather high every 3 seconds or so. I'll get a good 3 seconds of 50ms ping (using TNets ping functionality) and then my ping will shoot up to 500ms, sometimes up to 1200ms. Then eventually it will come back down to 50ms.

This has been consistent across all these providers.... Is there any guidance or knowledge that anyone can share with me? Why might this be the case? Am I flooding the network with too many packets? Or is there possibly an issue with TNet?

I'm just not sure what to look at next and really want to get a solid / consistent online experience working for my playerbase.

Or is it really normal to have this much network jitter and game developers have just learned to deal with it?

TNet 3 Support / SendQuickly Issue / Usage Question
« on: September 07, 2017, 11:33:11 PM »
So in my game I've been sending player position using tno.SendQuickly.....
We had noticed with a few amount of players that their player position wasn't updating to other clients and today I realized it was because I was using SendQuickly. Now that I'm just using Send it is working for these users. If I'm not mistaken, SendQuickly uses UDP while Send uses TCP? Does that mean that these users that were having this issue had some compatibility issues with the UDP protocol?

Is it not wise to try and use SendQuickly for something like player position that I'm updating rather frequently? I need it to work with all players though so should I just be using Send?

TNet 3 Support / SetChannelData Performance / Best Practice
« on: September 05, 2017, 03:18:59 PM »
I have lots of "game match" related data in my game currently (like teams, player stats, etc) that I've been tracking manually, and I instead want to let TNet do the heavy lifting.

I'm wondering what the best practices / structuring of data using the SetChannelData method is? I assume using a DataNode is a good way to do things.... but let's say I want to update a single stat for a player.... will it be a hit on performance / bandwidth if I have a single DataNode object that holds a large number of children nodes which in turn could hold a ton of player stats nodes?

For example, a player gets a kill, so I want to update in my stats that the player has +1 kill now. Will that require that the entire node object gets serialized, sent over the network and deserialized on everyone elses clients?

Just looking for some direction / best practices with dealing with this type of data and syncing it easily using TNets toolset.

TNet 3 Support / Relative player number
« on: August 27, 2017, 03:43:20 PM »
In my game, there are 4 players in a match. While players that join have their PlayerID that TNet assigns them, I also need to keep track of a relative player number in regards to being player 1 - 4. (This number is used by an announcer in the game, and for organizing player UI, etc.)

Currently I've been tracking this myself in my GameManager as players leave and join the server, but it has become a big pain as I have to keep this data synced with players that are already on the server, and then players that later join. Also for example, player 2 could leave, and then I would want the next player to join the server to be assigned player 2 for their relative player number. (so I can't just sort by tnets playerID to determine relative 1 - 4 player numbers)

I'm just now learning more about TNet's SetPlayerData method and others, and am hoping I can get some guidance on what the best approach using these methods might be to easily sync this data across all players at all times? I thought as well about modifying tnet's source code to include a relativePlayerID, but am not sure how i'd do that....

any thoughts are appreciated

TNet 3 Support / Access Lobby Server Details Externally
« on: August 01, 2017, 10:38:26 AM »
I know this is a long shot, but figured I'd ask.

Is there any way possible that I could access the details of my Lobby Server via an HTTP request that could send me JSON for example?

I'm wanting to write a bot for my game's discord channel that will post when players host new matches on the lobby server so other players are aware.
Any thoughts are appreciated!

TNet 3 Support / JoinRandomChannel with no scene
« on: July 27, 2017, 08:00:57 PM »
Hey, is it possible to join a channel using TNManager.JoinRandomChannel without it loading a scene?

I only see the 1 overload which requires  a scene name, if I pass null I get an error of "No suitable channels found")

TNet 3 Support / OnPlayerJoin with static tno RFC error
« on: July 27, 2017, 05:22:00 PM »
I'm trying to simplify some of my netcode. Previously for certain static (already in the scene) tno's I would have a newly joined player send an RFC to the Host to request the most up to date relevant details.

Instead, I thought it'd be much cleaner and simpler, to instead subscribe to the OnPlayerJoin event inside my tno script that would send an RFC to the newly joined player. The issue I'm having though is that I get "[TNet] Trying to execute RFC #1 on TNObject #20 before it has been created." warning when the player joins and he obviously doesn't receive the RFC.

Here is my code, is there something simple that I am doing wrong here? Or are there issues with using the OnPlayerJoin subscription inside a static tno object?

  1. // My tno script
  2.     IEnumerator Start()
  3.     {
  5.         while (TNManager.isJoiningChannel) yield return null;
  7.         TNManager.onPlayerJoin += OnPlayerJoin;
  9.         if (TNManager.isHosting)
  10.             CachedCrashCamera.SetupCamera();
  11.     }
  13.     private void OnPlayerJoin(int channelID, TNet.Player p)
  14.     {
  15.         // Send an RFC with the latest Camera settings to the newly joined player
  16.         if (TNManager.isHosting)
  17.         {
  18.             tno.Send(1, p, transform.position, CachedCrashCamera.IsScrolling, CachedCrashCamera.ScrollIndex, (int)CachedCrashCamera.ScrollDir);
  19.         }
  20.     }
  22.     [RFC(1)]
  23.     public void RecieveCameraPositionAndState(Vector3 pos, bool isScrolling, int nodeIndex, int scrollDir)
  24.     {
  27.         // Do important things here
  28.     }

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!

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);
  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;
  14.         return go;
  15.     }

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?

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.

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("")))
  4.         {
  5.             TNManager.Connect();
  6.         }
  7. }
  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.     }
  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
  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.         }
  42.     }

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");
  5.         // Clean out previous items
  6.         foreach (Transform child in Content)
  7.         {
  8.             GameObject.Destroy(child.gameObject);
  9.         }
  11.         pingDictionary.Clear();
  13.         // List of discovered servers
  14.         TNet.List<ServerList.Entry> list = TNLobbyClient.knownServers.list;
  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];
  22.             var go = Instantiate(ServerListOption,, Quaternion.identity, Content);
  23.             var listOption = go.GetComponent<ServerListOption>();
  25.             //var serverDetails = JsonUtility.FromJson<ServerDetails>(;
  26.             var serverDetails ='|');
  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";
  35.             pingDictionary.Add(ent.externalAddress, listOption.Ping);
  37.             TNManager.Ping(Tools.ResolveEndPoint(ent.externalAddress.Address.ToString(), udpPort), PingCallback);
  39.         }
  40.     }

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?

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?

TNet 3 Support / TNServer Use / Explanation
« on: June 06, 2017, 12:18:38 PM »
I'm having a hard time understanding what the TNServer.exe is used for. Is it to be able to host dedicated servers? Or is it's main use to be a master server that I could put on Amazon Web Services and have players register their games with it? Could someone people give me a rundown of what it is, how to do use it? I couldn't find any documentation about it.


TNet 3 Support / How to ignore Data Saving
« on: June 02, 2017, 02:26:04 PM »
Sooo, I understand that one of the main things that TNet does is data saving / persistence (Which would make sense and be good for an MMO style game)

My game however is a simple 2D Arena shooter (Think towerfall)
As such, I don't need to save my game world between play sessions..... But I noticed that when I Create a server, I have to pass a string with a .dat file extension. Is there any way for me to avoid this? Should I just ignore it? The main reason I ask is that I was having trouble with some data being saved when I didn't want it to, so I Wondered if there is a way to just avoid it all together for my project?


TNet 3 Support / TNet 3 Right for me? (Looking for answers)
« on: June 01, 2017, 04:29:44 PM »
Hi, I couldn't find an email to directly ask the developer, but I'm hoping to have some questions answered.
I'm currently using Forge networking, which I've enjoyed, but at the moment it still has many bugs and development has halted, so now I'm looking at other networking options....

  • Would TNet work fine for a fast paced shooter based game?
  • My game has Online / Local Multiplayer, can TNet handle this without me having to write separate code for Online / Local Multiplayer?
  • Does TNet have a Master Server? Or is it able to work with the Master Server Framework found on the asset store?
  • Is TNet able to work on other platforms besides Windows such as Xbox One, PS4, Nintendo Switch?
  • Any chance there is a demo version of TNet I can try before I commit $100 to it?

Thanks for your time

Pages: [1] 2