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

Pages: [1] 2
1
TNet 3 Support / Re: Weird TNManager.Ping Issue
« on: January 28, 2018, 11:27:48 AM »
Never mind I realised TNManager.Ping is for remote servers and I can just use TNManager.ping for the current game server.

2
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. }

3
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.

4
TNet 3 Support / Re: Make server create channel
« on: January 15, 2017, 08:50:01 AM »
Edit 2: Never mind I found another way to achieve what I was looking for.

5
TNet 3 Support / Re: Make server create channel
« on: January 14, 2017, 07:44:20 PM »
Edit: I'm using a lobby server which the player connects to and then you join a game server from the server browser. Similar to CS games. I want each game server to have 1 channel.

6
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?

7
TNet 3 Support / Re: TNet Newbie Help
« on: January 09, 2017, 02:35:40 AM »
Hey I'm planning on switching from channels over to servers. How can I make the current map, current gamemode and max players show in the server browser?

8
TNet 3 Support / Re: Set channel data at channel creation ?
« on: June 13, 2016, 09:05:37 AM »
I just had a similar problem with TNManager.channelData but when I used the following code instead it was fixed. I don't get it. Whats the difference between TNManager.channelData and the following code?

  1. TNManager.client.BeginSend(Packet.RequestSetChannelData).Write(infoScript.roomName);
  2. TNManager.client.EndSend();


9
TNet 3 Support / Re: TNet Crashing
« on: June 13, 2016, 05:44:14 AM »
I have a different problem. I'm using TNet 2.1.1 and I'm on PC. When I open the game from the standalone .exe (Built game) and Use Application.Quit() after TNManager.Connect() but before it has connected successfully, the game crashes. I am not talking about TNServer.exe I mean the actual game crashes if I Quit while connecting.

10
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?

11
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?

12
TNet 3 Support / Re: Saved RFC Isn't Working.
« on: November 24, 2015, 11:51:30 AM »
Ok I fixed my problem by making the channel is persistent.
Thanks!  :D

13
TNet 3 Support / Re: Saved RFC Isn't Working.
« on: November 24, 2015, 06:03:13 AM »
I am not at home right now so I can't try it but I think my problem was that I forgot to make the channel persistent.
Thanks! :D

14
TNet 3 Support / Re: Saved RFC Isn't Working.
« on: November 24, 2015, 02:47:55 AM »
If that was the case then I shouldn't be getting the print messages but I do :P

15
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.

Pages: [1] 2