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

Pages: [1]
1
TNet 3 Support / Weird TNManager.Ping Issue
« on: January 27, 2018, 04:28:14 PM »
I was trying to get TNManager.Ping setup so I could display the player's ping to the gameserver.
I was able to successfully Ping my UdpLobbyServer with its IP and port but if I tried to ping the actual gameserver the callback was never called.
The problem is in TNGameClient, case Packet.ResponsePing.
The "ip" variable is null for some reason so my callback would not get called.
I got the gameserver ping working but I had to ignore the is "ip" null check and remove IpEndPoint ipAddress from GameClient.OnPing.
Is there going to be any problems with this solution and can anyone tell me why the "ip" was always null after pinging my gameserver?

Here is the edited TNGameClient code:
  1. public delegate void OnPing (int milliSeconds);

  1. case Packet.ResponsePing:
  2. {
  3.     int ping = (int)(mMyTime - mPingTime);
  4.  
  5.     if (onPing != null) {
  6.         onPing(ping);
  7.     } else {
  8.        mCanPing = true;
  9.        mPing = ping;
  10.     }
  11.     break;
  12. }

2
TNet 3 Support / How to use GameServer.onPlayerConnect
« on: January 19, 2018, 12:00:52 PM »
How do you use GameServer.onPlayerConnect ?

For example to print("player connected"); when a play connects to the game server.

3
TNet 3 Support / Make server create channel
« on: January 14, 2017, 07:33:37 PM »
I'm trying to make TNServer create a channel automatically when it is launched. I want channel 1 to be created when the server is launched and when a player connects they will just join channel 1. This way the channel will be created without a player having to join the server and do CreateChannel. How do I make TNServer automatically create a channel?

4
TNet 3 Support / TNet Crashing
« on: June 12, 2016, 04:57:48 PM »
When I use Application.Quit() while TNet is connecting to a server the built game crashes. How do I fix this?

5
TNet 3 Support / How to do TNManager.Create as GameObject?
« on: February 18, 2016, 08:52:58 AM »
I am trying to do this:
  1. myPlayer = TNManager.Create(playerPrefab, redPlayerSpawns[i].transform.position, redPlayerSpawns[i].transform.rotation, false) as GameObject;
but I just get this error:
Cannot convert type `void' to `UnityEngine.GameObject' via a built-in conversion
How can I do this?

6
TNet 3 Support / [SOLVED] Saved RFC Isn't Working.
« on: November 23, 2015, 04:41:12 PM »
In my script I have an int which equals 0. When a player connects if that int is still equal to 0 they send an RFC that is set to Target.AllSaved to set the int to 1.

Here's is my script:
  1. using UnityEngine;
  2. using System.Collections;
  3. using System.IO;
  4. using TNet;
  5.  
  6. public class MapLoader : TNBehaviour {
  7.  
  8.     int intToSave;    
  9.  
  10.     void Start ()
  11.     {
  12.         InvokeRepeating("CheckConnection", 0, 2);
  13.     }
  14.  
  15.     void CheckConnection ()
  16.     {
  17.         if(TNManager.isInChannel)
  18.         {
  19.             CancelInvoke("CheckConnection");
  20.  
  21.             if(intToSave == 0)
  22.             {
  23.                 print("intToSave has the default value");
  24.  
  25.                 tno.Send("SaveInt", Target.AllSaved, 1);
  26.  
  27.                 print("intToSave is now: " + intToSave);
  28.             }
  29.             else
  30.             {
  31.                 print("intToSave is: " + intToSave);
  32.             }
  33.         }
  34.     }
  35.  
  36.     [RFC]
  37.     void SaveInt (int number)
  38.     {
  39.         intToSave = number;
  40.     }
  41. }

Here is what I want to happen:  :)
- Player A connects and sets intToSave = 1
- Player A disconnects
- Player X connects later and can still see intToSave is = 1

Here is what actually happens:  :(
- Player A connects and sets intToSave = 1
- Player A disconnects
- Player X connects later and intToSave is = 0 for some reason

It seems like the RFC to update intToSave gets deleted when the player that called it disconnects.

Any suggestions?   ???
Thanks.

7
TNet 3 Support / TNManager.Create() is giving error
« on: October 20, 2015, 11:56:43 AM »
When I use TNManager.Create() I get this error:

[TNet] Failed to call RCC #1.
Did you forget to register it in Awake() via TNManager.AddRCCs?
UnityEngine.Debug:LogError(Object)
TNManager:CreateGameObject(GameObject, BinaryReader) (at Assets/TNet/Client/TNManager.cs:1357)
TNManager:OnCreateObject(Int32, Int32, UInt32, BinaryReader) (at Assets/TNet/Client/TNManager.cs:1312)
TNet.GameClient:ProcessPacket(Buffer, IPEndPoint) (at Assets/TNet/Client/TNGameClient.cs:1117)
TNet.GameClient:ProcessPackets() (at Assets/TNet/Client/TNGameClient.cs:879)
TNManager:Update() (at Assets/TNet/Client/TNManager.cs:1426)


I have no idea what to do about this error  ???
Please help :)

8
TNet 3 Support / 2.1.0b and Web Player Errors
« on: September 10, 2015, 10:50:03 AM »
When I switch the platform to Web Player I get the following errors:

Assets/TNet/Common/TNUPnP.cs(15,18): error CS0234: The type or namespace name `NetworkInformation' does not exist in the namespace `System.Net'. Are you missing an assembly reference?

Here is another topic from version 1.9.0 of TNet with a similar problem: http://www.tasharen.com/forum/index.php?topic=9524.0

9
TNet 3 Support / MMO Network Efficiency Question
« on: August 26, 2015, 01:59:18 PM »
When players get a certain distance away from my player, how do I disable them and fade them out so I can't see them and don't receive their RFC calls?

(And when they get close enough to me again, make them fade back and receive their RFC calls again)?

I am making an MMO so I think this would help put less stress on players computers so they don't render players across the map  ;D

Thanks!

Also let me just say this: TNet is amazing!

10
TNet 3 Support / TNet Newbie Help
« on: August 13, 2015, 05:28:34 PM »
Hello guys I have been using the standard Unity Networking for a while but today I bought TNet.

My questions are:

1. How would I get a server browser of all people who used TNServerInstance.Start?
2. Would those people have to port forward for other players to connect to them?
3. If my game has multiple maps do I make the server do an RFC to instantiate the map into the game or do I have different scenes for each map?

Thanks for reading  :)

Pages: [1]