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

Pages: 1 ... 3 4 [5] 6
61
TNet 3 Support / Re: Massive Lag problems
« on: April 08, 2014, 03:02:28 AM »
I have a tickrate of 10, this means i send every second 10 packages.

Even if i try your SyncRigidBody Script, it still laggy.

62
TNet 3 Support / Massive Lag problems
« on: April 08, 2014, 02:28:55 AM »
I have a huge problem with the Sync of an Rigidbody.
I made everything like you said, but i cant get smooth sync.

My player prefab looks like this

  1. Rigidbody, TNObject, sync script
  2. - Collider 1
  3. - Renderer
  4.  

I tried it out with Interpolation = Laggy result (If i collide with a player, it takes around 1-3sec then we collide)
I tried to send the Players KeyStroke to the host and the host sends it back to all player = The players on Host side, works smooth, but on the client side im lagging, because i get my own keystrokes after a few seconds back.

Im at work right now, but i later i will post my interpolation script here, so maybe i made something wrong :(

63
TNet 3 Support / Exception has been thrown by the target of an invocation.
« on: February 21, 2014, 01:43:51 PM »
Hey,

i got a error when i try make smth. in the Notifications.

  1.    
  2.    /// <summary>
  3.    /// We leave the current room
  4.    /// </summary>
  5.    void OnNetworkJoinChannel(bool success, string message)
  6.    {
  7.        if(success==false)
  8.            TNManager.JoinRandomChannel("Level", false, 8, "");
  9.        Debug.Log("OnNetworkJoinChannel: " + message);
  10.  
  11.        chatScript.addGameChatMessage(playerName + " joined the game");
  12.    }

And in my FPSChat.cs
  1.     //Add game messages etc
  2.     public void addGameChatMessage(string str){
  3.         Debug.Log("AddgameChatMessage");
  4.             ApplyGlobalChatText("", str);
  5.             if(TNManager.isInChannel){
  6.                     tno.Send("ApplyGlobalChatText", Target.Others, "", str);   
  7.             }  
  8.     }

And an another question, how can i send an Audio RFC?
I got an Error, that TN can't send's AudioClips.

64
TNet 3 Support / HowTo setUp AI on a authoritative server?
« on: February 20, 2014, 02:31:53 AM »
Hey guys,

i have a question about a authoritative server.
Whats the best way to import a AI on the server? I know that Aren says, to make physical things on server is stupid.
Can someone give me maybe an other solution?

65
TNet 3 Support / Re: Custom Server/Channel Creator
« on: February 20, 2014, 02:28:49 AM »
Thank you very much Aren, got it!
Here for all people who plan to start a authoritative server.

  1.  
  2.             TcpProtocol tcpProt = new TcpProtocol();
  3.             IPEndPoint ipC = Tools.ResolveEndPoint("127.0.0.1", tcpPort);
  4.             tcpProt.Connect(ipC, null);
  5.  
  6.             Thread t = new Thread(KeepAlive);
  7.             t.Start();            
  8.  
  9.             Random r = new Random();
  10.             int rID = r.Next(0,999999999);
  11.             bool isNew = true;
  12.             Channel channel = gameServer.CreateChannel(rID, out isNew);
  13.             channel.password = "";
  14.             channel.persistent = false;
  15.             channel.level = "Level";
  16.             channel.playerLimit = 9;
  17. static void KeepAlive()
  18.  
  19.     {
  20.  
  21.         GameClient gCl = new GameClient();
  22.  
  23.  
  24.  
  25.         while (true)
  26.  
  27.         {
  28.  
  29.             gCl.ProcessPackets();
  30.  
  31.             Thread.Sleep(1000);
  32.  
  33.         }
  34.  
  35.     }
  36.  
  37.  

66
TNet 3 Support / Re: Custom Server/Channel Creator
« on: February 17, 2014, 02:22:50 PM »
I know how to get the notification on Unity thanks.
I want to connect a user over .Net not in Unity.


67
TNet 3 Support / Re: Custom Server/Channel Creator
« on: February 17, 2014, 12:28:07 PM »
Okay, how can i handle the timeout kicker?
And how can i get the OnNetworkConnect notification ?

68
TNet 3 Support / Re: Custom Server/Channel Creator
« on: February 16, 2014, 08:00:02 AM »
Thank you Aren for the good explanation.

I tried to modify the TNServer, i added the TNGameClient.cs to the project and tried to connect and create a Channel.
Connecting works, but only for 10 seconds. (The standard of your timeout kicker).
But creating a Channel doesnt work.

That's how i try to connect and create a channel:
  1. static void CreateChannel(int port, string name, string level, int maxPlayer, string password)
  2.     {
  3.         try
  4.                 {
  5.             GameClient client =  new GameClient();
  6.  
  7.             IPEndPoint ip = Tools.ResolveEndPoint("127.0.0.1", port);
  8.  
  9.             client.Connect(ip, null);
  10.             client.SetTimeout(60);
  11.  
  12.             client.JoinChannel(-1, level, false, maxPlayer, password);
  13.             //client.BeginSend(Packet.RequestSetChannelData).Write(name);
  14.             //client.EndSend();
  15.         }
  16.         catch (System.Exception ex)
  17.         {
  18.             Console.WriteLine(ex.Message);
  19.         }
  20.     }

Why i plan to do this is, i want to give away the "server logic" to other people.
And if they start the gameserver, it would create a gameserver and automatically a channel with the specific user inputs, and connect to my lobby server.
And the gameserver must be possible to run under Linux (Console) or Windows without a high end graphic card.
And i want to builtin some features like a weather system(send all players only the current ingame time and the current weather) and later a AntiCheat system.

I hope you can help me Aren, or maybe an another guy/women here with some experience with it.





69
TNet 3 Support / Re: Custom Server/Channel Creator
« on: February 14, 2014, 06:54:18 AM »
Ok so if i understand it correctly, i need to make a special build of my game that works like a "server".

In Detail:
I create a new Scene, where i create a Channel and connect to the game scene.
And if the "Server" connects first its automatic the host.

So, and i can start to send all players the actual game time, weather...
And maybe implement a AntiCheat, Ban System, right?

70
TNet 3 Support / Custom Server/Channel Creator
« on: February 13, 2014, 11:59:16 AM »
Hi,

im about to think to write a ChannelCreator in C# (not in Unity, in Visual Studio).
But i can't find any function, how to create a Channel.

Why im planing to do this, is to create a standalone server to sync my weather/day and night cycle.
And i planed to write a ban/kick function and combine it with a global ban system with the externel TNet Gameserver.

Is there any possibility?

(Or is it only possible through Unity?)

71
TNet 3 Support / Re: Start.UDP needs an open Port?
« on: February 11, 2014, 02:36:35 AM »
Thanks Aren for this, it's right logic what you say.

I tried it out yesterday, and i have some laggy moments in my game. It runs a sec smooth and than it seems to lagg and than he runs smooth again and lagg again in a sec.

I dont know why. I check every second if my player move's more than 5%...

Could you give us maybe an example how to get the best sync for a character controller? It would be really really nice

//EDIT: If i use only your AutoSync, and set it up to 6 updates per second, its quiet laggy. Is this normal?

//EDIT v2: Problem resolved.

   
  1.  
  2. private float Ntimer;
  3.     public float NTime = 0.2f;
  4.  
  5. void Start ()
  6.     {
  7.  Ntimer = NTime;
  8. }
  9.         void Update ()
  10.     {
  11.         if (tno.isMine)
  12.         {
  13.             m_movement = Vector3.zero;
  14.             LMove();
  15.             VMove();
  16.             Move(m_movement);
  17.  
  18.             if (Ntimer <= 0)
  19.             {
  20.                 tno.SendQuickly("SendPosRot", Target.Others, transform.position, transform.rotation, GetComponent<CharacterTranslation>().m_movement);
  21.                 Ntimer = NTime;
  22.             }
  23.             else
  24.             {
  25.                 Ntimer -= Time.deltaTime;
  26.             }
  27.         }
  28.  
  29.         }
  30.  
  31.     public void Move(Vector3 m_move)
  32.     {
  33.         m_cController.Move(m_move * Time.deltaTime);
  34.     }
  35.  
  36.     [RFC(255)]
  37.     void SendPosRot(Vector3 p, Quaternion r, Vector3 v)
  38.     {
  39.         m_cController.Move(v);
  40.         transform.position = p;
  41.         transform.rotation = r;
  42.     }

I must set the timer to 0.05 to get smooth sync. It's quiet to much, or Aren?

72
TNet 3 Support / Re: Start.UDP needs an open Port?
« on: February 08, 2014, 06:48:41 PM »
Aaaaah damn it... Sorry my failure...

It works now, thank you.

Whats better to use, TNAutoSync, or an self written sync?

Quote
/// <summary>
/// This script makes it really easy to sync some value across all connected clients.
/// Keep in mind that this script should ideally only be used for rapid prototyping.
/// It's still better to create custom to-the-point sync scripts as they will yield
/// better performance.
/// </summary>

Ok, but why it lags like hell, when i try my own sync?

Thats my synchronisation:
  1. using UnityEngine;
  2. using System.Collections;
  3. using TNet;
  4.  
  5. [RequireComponent(typeof(CharacterController))]
  6. [RequireComponent(typeof(CharacterFirstPersonMouseLook))]
  7. [RequireComponent(typeof(CharacterMotor))]
  8. public class Character : TNBehaviour
  9. {
  10.  
  11.     public int hp = 100;
  12.     public int updatesPerSecond = 3;
  13.     public bool localPlayer = false;
  14.     private GameLocal gamelocal;
  15.  
  16.     void Awake()
  17.     {
  18.         // Only start the coroutine if we wanted to run periodic updates
  19.         if (updatesPerSecond > 0 && TNManager.isInChannel && tno.isMine)
  20.         {
  21.             StartCoroutine(PeriodicSync());
  22.         }
  23.     }
  24.  
  25.         void Start ()
  26.     {
  27.         //gamelocal = GameObject.Find("GameLocal").GetComponent<GameLocal>();
  28.  
  29.         if (tno.isMine)
  30.         {
  31.             localPlayer = true;
  32.         }
  33.         else
  34.         {
  35.             //GetComponent<CharacterFirstPersonMouseLook>().enabled = false;
  36.             GetComponentInChildren<Camera>().enabled = false;
  37.             GetComponentInChildren<AudioListener>().enabled = false;
  38.             GetComponent<MeshRenderer>().enabled = true;
  39.         }
  40.         }
  41.        
  42.         void Update ()
  43.     {
  44.        
  45.         }
  46.  
  47.     IEnumerator PeriodicSync()
  48.     {
  49.         for (; ; )
  50.         {
  51.             tno.SendQuickly("SyncPosRot", Target.Others, transform.position, transform.rotation);
  52.  
  53.             if (updatesPerSecond > 0)
  54.             {
  55.                 yield return new WaitForSeconds(1f / updatesPerSecond);
  56.             }
  57.             else yield return new WaitForSeconds(0.01f);
  58.  
  59.         }
  60.     }
  61.  
  62.     [RFC]
  63.     void SyncPosRot(Vector3 _pos, Quaternion _rot)
  64.     {
  65.         transform.position = _pos;
  66.         transform.rotation = _rot;
  67.     }
  68. }
  69.  

And AutoSync with a period of 4, works more smooth. Whats my problem?



73
TNet 3 Support / Re: Start.UDP needs an open Port?
« on: February 08, 2014, 02:21:49 PM »
Ok, i think i found the problem, but i dont know how to resolve it.

It tried to wait about > 5 minutes, and after some time, it starts to sync the data.
What could be the problem?

Menu:
http://pastebin.com/97XLUNAf

//EDIT: I deleted the Start.UDP after Connect.

Camera Rotation:
http://pastebin.com/kapqTPFS


74
TNet 3 Support / Re: Start.UDP needs an open Port?
« on: February 07, 2014, 05:34:59 PM »
Ok Thank you very much.

I have realy big problems with my synchronisation... it doesnt work, and i try it now since three days...

Menu.cs
  1. using UnityEngine;
  2. using System.Collections;
  3. using System.IO;
  4. using System.Net;
  5. using TNet;
  6.  
  7. public class Menu : MonoBehaviour
  8. {
  9.  
  10.     public string GameLevel = "Level";
  11.  
  12.     void Start()
  13.     {
  14.         TNManager.Connect(IP, 5127); // Opened TCP port on my server/router
  15.         TNManager.StartUDP(5128); // Opened UDP port on my server/router
  16.     }

Character Controller:
  1.         void Update ()
  2.     {
  3.         if (tno.isMine)
  4.         {
  5.             m_movement = Vector3.zero;
  6.             LMove();
  7.             VMove();
  8.             Move();
  9.             tno.SendQuickly("RMove", Target.Others, m_movement * Time.deltaTime);
  10.         }
  11.  
  12.         }
  13.     [RFC]
  14.     void RMove(Vector3 move)
  15.     {
  16.         Debug.Log("Moviiing");
  17.         m_cController.Move(move);
  18.     }
  19.  

Thats it. And i dont know, why it doesnt work...

//EDIT: If i send it via TCP (tno.Send..) than it will be synchronized.  :'( Please help me
//EDIT2: Your Example3 works perfectly...

75
TNet 3 Support / Re: Start.UDP needs an open Port?
« on: February 04, 2014, 05:09:47 AM »
Ok, so, if start the TNet Server.exe with -udp 5129 and open the port 5129.

I need to write in my client Start.UDP(5129); right?

If it's so, i have some problems with my connection.

Local i have no problems, but with my remote server...
 
Remote:
Player 1 is syncing
Player 2 is not syncing, but see how Player 1 walk around.

Local:
Player 1 and Player 2 sync perfectly.

I run the TNet Server on a Linux machine, i will try it later with a Windows Server.
But i think, i made something wrong with the Ports...

//EDIT: So, if i understand it correctly, without UPnP, Network wont work?

Pages: 1 ... 3 4 [5] 6