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

Pages: [1]
1
TNet 3 Support / [UNSOLVED] Sending a message back and forth not working
« on: February 18, 2015, 09:58:53 AM »
I am stuck with sending messages back and forth...

My Goal Is:
Client connects to server(No Lobby)( OnNetworkConnect returns True )
On client connection send message from client to server ( Not Working )
On message receive send back message to client ( Not Working )

The FromClient() in the server script does not get triggered

Unity Server Project:

Attached scripts to empty GameObject:
NetworkManager
TNOObject

  1. using UnityEngine;
  2. using System.Collections;
  3. using TNet;
  4.  
  5. public class NetworkManager : MonoBehaviour
  6.     {
  7.     TNObject    tnoObject;
  8.  
  9.     private void Start( )
  10.         {
  11.         TNServerInstance.Start( xxx1, xxx2 );
  12.         tnoObject = GetComponent<TNObject>( );
  13.         }
  14.  
  15.     private void Update( )
  16.         {
  17.         }
  18.  
  19.     [RFC] void FromClient( string myString, int playerID )
  20.         {
  21.         Debug.Log( "From Client: " + myString );
  22.  
  23.         Player p = TNManager.GetPlayer( playerID );
  24.         // tried p, p.id, p.data
  25.         tnoObject.Send( "FromServer", p.id, "TestFromServer" );
  26.         }
  27.  
  28.     private void OnNetworkConnect( bool success, string message )
  29.         {
  30.         Debug.Log( ">> OnNetworkConnect " + (     success+" <> "+ message ).ToString() );
  31.         }
  32.  
  33.     private void OnNetworkDisconnect( )
  34.         {
  35.         Debug.Log( ">> OnNetworkDisconnect " );
  36.         }
  37.     }



Unity Client Project:

Attached scripts to empty GameObject:
NetworkManager
TNManager
TNObject

  1. using UnityEngine;
  2. using System.Collections;
  3. using TNet;
  4.  
  5. public class NetworkManager : MonoBehaviour
  6.     {
  7.     TNObject    tnoObject;
  8.  
  9.     private void Start( )
  10.         {
  11.         TNManager.Connect( "xx.xx.xx.xx:xxx1" );
  12.         tnoObject = GetComponent<TNObject>( );
  13.         }
  14.  
  15.     private void Update( )
  16.         {
  17.         if( TNManager.isConnected )
  18.             {
  19.             tnoObject.Send( "FromClient", Target.Host, "TestFromClient", TNManager.playerID );
  20.             }
  21.         }
  22.  
  23.     private void OnNetworkConnect( bool success, string message )
  24.         {
  25.         Debug.Log( ">> OnNetworkConnect " + (     success+" <> "+ message ).ToString() );
  26.         }
  27.  
  28.     [RFC] void FromServer( string myString )
  29.         {
  30.         Debug.Log( "From Server: " + myString );
  31.         }
  32.     }


2
TNet 3 Support / Is TNet for me...
« on: February 17, 2015, 05:54:19 PM »
I am looking for a network engine that can support a MMO platform...

I am not really interested in network views or network instantiates... i will be using RPC/RFC's and keep track of players/objects myself...
SideQuestion: One of Unity's Networking bugs was that any dirty client could network.instantiate, the masterserver could be spammed with user made rooms, no locking etc... has this been resolved with TNet?

My preference would be to not use TNet's MasterServer but use a direct approach - Unity client as server, is this possible?

Doing the above, would that undermine what TNet stands for; is TNet for me?


Thanks!



Pages: [1]