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
16
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.     {
  4.  
  5.         while (TNManager.isJoiningChannel) yield return null;
  6.  
  7.         TNManager.onPlayerJoin += OnPlayerJoin;
  8.  
  9.         if (TNManager.isHosting)
  10.             CachedCrashCamera.SetupCamera();
  11.     }
  12.  
  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.     }
  21.  
  22.     [RFC(1)]
  23.     public void RecieveCameraPositionAndState(Vector3 pos, bool isScrolling, int nodeIndex, int scrollDir)
  24.     {
  25.         Debug.Log("SHOULD GET CAMERA DETAILS, BUT FAILING!");
  26.        
  27.         // Do important things here
  28.     }
  29.  

17
TNet 3 Support / Re: Post Match Cleanup
« on: July 27, 2017, 05:00:12 PM »
Woah yea, that is really strange. The code and comment say

  1. // Network objects should only be destroyed when leaving their channel
  2.                         go.transform.parent = null;
  3.                         DontDestroyOnLoad(go);
  4.  

I did not add this, I am on version 3.0.9

18
TNet 3 Support / Re: Can't connect troubleshooting advice
« on: July 26, 2017, 11:07:36 PM »
Sorry, one more question. So with using a Server hosted somewhere like Digital Ocean, really that adds a decent amount of latency as now all game packets are routed through it rather than directly from player to player correct?

19
TNet 3 Support / Re: Can't connect troubleshooting advice
« on: July 26, 2017, 10:38:35 PM »
yea, I was hoping to still allow players to host their own games if they wanted to with their buddies for example, rather than joining the quick play "region" server

20
TNet 3 Support / Re: Can't connect troubleshooting advice
« on: July 26, 2017, 09:54:35 PM »
Perfect, that is a great help.

So, right now I have my user connect to my "region" server that I'm hosting on digital ocean right when the game starts up.
This way I can call TNManager.GetchannelList() to display all of the open "matches" on the server.

BUT, if I want a player to then start his own private server, I need to call TNManager.Disconnect() to disconnect from my region server and then run TNServerInstance.Start() ?

That's what I'm attempting at the moment and am still working through some issues, but is there a better way to handle the situation?

21
TNet 3 Support / Re: Can't connect troubleshooting advice
« on: July 25, 2017, 11:36:36 PM »
Ok that makes sense.

So with having 1 "dedicated" server, that has multiple channels for allowing multiple "matches".... I am pretty limited in the details that I can share with a user right?

Is there any way to tell the player how many players are connected to my dedicated server or how many channels (matches) there are or anything like that? Or only server name?


22
TNet 3 Support / Re: Can't connect troubleshooting advice
« 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?!

23
TNet 3 Support / Re: Can't connect troubleshooting advice
« 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.....

24
TNet 3 Support / Re: Can't connect troubleshooting advice
« 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?

25
TNet 3 Support / Re: Can't connect troubleshooting advice
« 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.

26
TNet 3 Support / Re: Can't connect troubleshooting advice
« 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

27
TNet 3 Support / Re: Can't connect troubleshooting advice
« 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!

28
TNet 3 Support / Re: Post Match Cleanup
« on: July 25, 2017, 03:47:53 PM »
Here is the call stack from Awake() on my Network Controller object

Quote
Network Controller Spawned!
UnityEngine.Debug:Log(Object)
NetworkController:Awake() (at Assets/$ProjectAssets/Scripts/Forge/NetworkController.cs:34)
UnityEngine.Object:Instantiate(GameObject)
TNet.UnityTools:Instantiate(GameObject) (at Assets/TNet/Client/TNUnityTools.cs:224)
RefreshManager:NetworkControllerCreate(GameObject) (at Assets/RefreshManager.cs:78)
System.Reflection.MethodBase:Invoke(Object, Object[])
TNet.CachedFunc:Execute(Object[]) (at Assets/TNet/Client/TNRFC.cs:80)
TNet.TNManager:OnCreateObject(Int32, Int32, UInt32, BinaryReader) (at Assets/TNet/Client/TNManager.cs:1825)
TNet.GameClient:ProcessPacket(Buffer, IPEndPoint) (at Assets/TNet/Client/TNGameClient.cs:1255)
TNet.GameClient:ProcessPackets() (at Assets/TNet/Client/TNGameClient.cs:943)
TNet.TNManager:<ProcessPackets>m__5() (at Assets/TNet/Client/TNManager.cs:587)
TNet.TNManager:Update() (at Assets/TNet/Client/TNManager.cs:1918)

And I instantiate it like so, so it shouldn't be persistent

TNManager.Instantiate(1, "NetworkControllerCreate", "NetworkController", false);

The cleanup issue is happening with all my tno objects as well, including my player avatars, and weapon drops that happen when they die.

29
TNet 3 Support / Re: Post Match Cleanup
« on: July 25, 2017, 03:41:24 PM »
Hey cmifwdll!

I just finished putting together a small sample project that illustrates the issue I'm having. Hoping you or ArenMook can take a look at it.

It has a main menu, which loads a Game scene, which loads Levels and dynamically instantiates a Network Controller tno, but you'll see it doesn't get cleaned up by TNManager.LoadLevel.

It's a really simple sample so I'm hoping you can see what silly thing I must be doing wrong.

Here is a dropbox link to the project (Unity 5.6):  {snip}

I'll try the debug log you've suggested right now.

30
TNet 3 Support / Re: Post Match Cleanup
« on: July 25, 2017, 01:34:08 PM »
Sorry to be resurecting this thread again, but I never actually got this working as it should. (I've had to keep manual references to my tno objects and then call DestroySelf() on each one in a foreach loop at the end of my matches)

One thing I thought might be an issue is that I don't load the scenes where my tno objects are created with TNManager.LoadLevel (Each client just loads using unity's standard scene loading). Do I have to use that to load my levels for TNet to then be able to handle cleaning up any tno objects when I then call TNManager.LoadLevel at the end of my match?

Pages: 1 [2] 3 4 5