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

Pages: [1]
1
TNet 3 Support / Re: Call functions over server.
« on: December 05, 2014, 05:39:20 PM »
Ah great! I'm making progress here. Although no I've encountered an error "UPnP discovery failed. TNet won't be able to open ports automatically." I've port-forwarded TCP-5127 to 5127 and UDP-5129 to 5129 and still nothing. Also when I try running the external sever I get a gateway not found:



2
TNet 3 Support / Re: Call functions over server.
« on: December 05, 2014, 04:17:30 PM »
Hey, I'm having some trouble understating this. Why would TNManager.isHosting be true when offline? Would it not make more sense if it was false. What's the simplest way of starting and join a server in which both players can communicate? Thanks a lot!  :)

3
TNet 3 Support / Call functions over server.
« on: December 02, 2014, 05:07:02 PM »
Hey, so I'm really new to TNet and I'm have some real trouble grasping how everything works haha. I made a really simple project to practice in which all that happens is that you can start a sever or join a server. When you do I simply want the console to say "Player joined server" or something. This is the scripts:

Main menu script:
  1. using UnityEngine;
  2. using TNet;
  3. using System.IO;
  4. using System.Collections;
  5. using UnityTools = TNet.UnityTools;
  6. using UnityEngine.UI;
  7.  
  8. public class Network_Manager : MonoBehaviour {
  9.  
  10.     public string SPSceneName;
  11.  
  12.     public string inputIP;
  13.  
  14.     public bool connected;
  15.  
  16.     public Text ipTextField;
  17.  
  18.     public int serverTcpPort = 5127;
  19.  
  20.     void Update()
  21.     {
  22.         inputIP = ipTextField.text;
  23.     }
  24.  
  25.     void Start()
  26.     {
  27.         ipTextField.text = Tools.externalAddress.ToString();
  28.  
  29.         if (Application.isPlaying)
  30.         {
  31.             // Make it possible to use UDP using a random port
  32.             TNManager.StartUDP(Random.Range(10000, 50000));
  33.         }
  34.     }
  35.  
  36.     public void Quit_Button()
  37.     {
  38.         Application.Quit();
  39.     }
  40.  
  41.     public void Create_Server()
  42.     {
  43.         int udpPort = Random.Range(10000, 40000);
  44.  
  45.         TNServerInstance.Start(serverTcpPort, udpPort);
  46.         if (TNManager.isHosting)
  47.         {
  48.             print("Hosting server.");
  49.             TNManager.LoadLevel("Game");
  50.         }
  51.     }
  52.  
  53.     public void Join_Server()
  54.     {
  55.         TNManager.Connect(inputIP);
  56.         if (TNManager.isTryingToConnect)
  57.         {
  58.             print("Trying to connect...");
  59.         }
  60.     }
  61.  
  62.     void OnNetworkConnect(bool success, string message)
  63.     {
  64.         if (success)
  65.         {
  66.             TNManager.JoinChannel(123, SPSceneName);
  67.             print("Connected!");
  68.             success = true;
  69.         }
  70.         else
  71.         {
  72.             success = false;
  73.             print(message);
  74.         }
  75.     }
  76. }
  77.  

and this is the game scene script:
  1. using UnityEngine;
  2. using System.Collections;
  3. using TNet;
  4.  
  5. public class PlayerJoin : TNBehaviour
  6. {
  7.  
  8.     private void Start()
  9.     {
  10.         tno.Send("PlayerJoin", Target.All);
  11.     }
  12.  
  13.     [RFC]
  14.     public void PlayerJoin()
  15.     {
  16.         Debug.Log("Player joined game");
  17.     }
  18. }

Unfortunately none of this works, Any idea why?

4
TNet 3 Support / Re: Where and what is the server.dat?
« on: November 30, 2014, 03:49:38 PM »
It's just a data file it uses to save the server's state into. All persistent channels and RFCs get saved there. It's basically your "save file" for your game. I use it in Windward to save the entire world, for example. I have no save functionality in Windward beyond what's already there in TNet, which is convenient to say the least.

So where is it located and can it be opened to see what's saved in it?

5
TNet 3 Support / Where and what is the server.dat?
« on: November 29, 2014, 09:59:57 PM »
Hey, so I've been looking into adding multiplayer into my game and so far so good but I've encountered the code which starts a sever in "Example Menu" which has this:
  1. TNServerInstance.Start(serverTcpPort, udpPort, "server.dat");
What is that file "server.dat". I assume its the sever data where you can save player locations? Where is it located and how specifically do you load and save to it? Thanks.

6
NGUI 3 Support / How could I make a FOV slider for a camera?
« on: July 28, 2014, 04:19:47 PM »
Hey, so I've been doing the options menu and I went on to do the fov slider which I thought I could just use the sliders but I noticed I can't seem to change the start and end values on them. Meaning the fov can only be picked from 0-100. Also how could I simply link the slider to the camera. I thought of just dragging the camera into the on value change but no result.

Pages: [1]