Author Topic: TNet: Tasharen Networking Framework  (Read 107912 times)

Zaibach333

  • Guest
Re: TNet: Tasharen Networking Framework
« Reply #165 on: January 27, 2013, 02:39:24 AM »
Figured it out, I had to test without having any clients and setting all my RFC calls to straight up methods but down the line it ran into some TNManager.players issues, I just check if the index I have saved is larger than the list.

RequestFinishDeployment() was the first version of the method, now it has a counter on call which triggers 14 only when all the players have requested to finish deployment.

Thanks a bunch, it was bringing me inside your TNObject code which I don't want to change.

enzi

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 21
    • View Profile
Re: TNet: Tasharen Networking Framework
« Reply #166 on: January 27, 2013, 08:16:11 AM »
Quick question. In TNGameServer.cs every EndSend has mBuffer.EndTcpPacket even when reliable is false. Is this intended? If yes, why is that?

byerdelen

  • Guest
Re: TNet: Tasharen Networking Framework
« Reply #167 on: January 27, 2013, 10:54:21 AM »
Hi ArenMook,
I am able to communicate my devices from a non-local server. I will have two questions that I couldn't find the answers anywhere.
-I want to get some variables from the host when a device is joined. There is a send message but is there a request message from device to the host so I can get some live variables from the game managing host when the device is opened?
-Also in send message, there is Target.All, Target.Other messages. I want to reach only host or maybe a specific device-id. Is there a chance that I can specify Target.Host and Target.(deviceid)?
-I am building all my network according to a host-manager which is working inside server. To understand the server has an amount of users registered and direct user to another server, is there a way that I request information from the server which servers are more than this number? I can join servers and learn it from the host but it will connect device to servers and ask and disconnect and try it on the next server but it is not efficient so there is a way to learn it from main client in server maybe?

Thanks and sorry for my network-amateur questions if the answers are obvious.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: TNet: Tasharen Networking Framework
« Reply #168 on: January 27, 2013, 01:41:13 PM »
@enzi: Yeah it's intended. It's just for consistency. UDP packets always arrive whole, while TCP packets are fragmented and can arrive in parts, so I write the packet's size before the actual packet for TCP. This way I know how much data needs to arrive before the packet is processed. I simply kept the same logic for UDP so there is no distinction between the two as far as data processing and forwarding goes. This also makes it possible to forward a UDP packet via TCP seamlessly.

@byerdelen: Your best bet is to save the variables on the server (and echo them to everyone) by keeping them synchronized via tno.Send(ID, Target.OthersSaved, your values). This way everyone is up to date, and new players get these automatically.

There is a Target.Host already. For other players, specify a Player instead of a Target. But as I said, I recommend you just using Target.OthersSaved to keep everyone on the same page.

Yes you can design your lobby to do load balancing this way, sure. One of the features in TNet is the Discovery Client. It contains a list of known servers (TNDiscoveryClient.knownServers). You could extend the TNServerList to have an additional parameter in its data: number of players.

In fact... I've just added it. You can wait for the next version or ping me on Skype (arenmook) with your order # and I'll give you the modified version.

byerdelen

  • Guest
Re: TNet: Tasharen Networking Framework
« Reply #169 on: January 27, 2013, 02:02:51 PM »
Awesome, answer to my all questions, thanks.
I guess it will take some weeks for me to get that point to check the server player numbers, I can wait for the next update, again thanks alot for your concern.

I would like to add something to have more knowledge.
I guess you are using your array list TNet.List. This creates ambiguous reference with Generic ArrayList. Because of that, I cannot use Generic List in where I am using import Tnet; . Also I cannot use useful the generic list functions such as Contains, Sort etc.   Is there any way to solve this issue?
I need it because when I want to pass your lists as Tnet lists to other users using Send("function",Target.All,playerlists), it gives me this type of crash message and crashes my devices :
Unable to save type TNet.List`1[System.String]
UnityEngine.Debug:LogError(Object)
TNet.Tools:Write(BinaryWriter, Object[]) (at Assets/TNet/Client/TNTools.cs:250)
TNObject:SendRFC(UInt32, Byte, String, Target, Boolean, Object[]) (at Assets/TNet/Client/TNObject.cs:486)
TNObject:Send(String, Target, Object[]) (at Assets/TNet/Client/TNObject.cs:407)
ExampleChat:Start() (at Assets/TNet/Examples/Scripts/ExampleChat.cs:47)


So I cannot send your arrays, am I doing something wrong?
Thanks
« Last Edit: January 27, 2013, 02:12:53 PM by byerdelen »

zyeurgh

  • Guest
Re: TNet: Tasharen Networking Framework
« Reply #170 on: January 27, 2013, 05:08:48 PM »
Hi,
So I have my interpolation/extrapolation in place. It seems ok when I look at another player moving around but when the other player and the local player are moving in the same direction (jump at the same time for example), I get really annoying jittering on the other player.
Would you have an idea on what could cause such issues? Why just when we move in the same direction?
Cheers,

matis

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 18
    • View Profile
Re: TNet: Tasharen Networking Framework
« Reply #171 on: January 28, 2013, 08:06:36 AM »
Hi,
Iam tryed instantiate object as a child but I have problem with this when using TNManager.Create command instead Instantiate.
My code with Instantiate:
  1. (Instantiate (terrains [Random.Range (0, terrains.Length)], ter_position[i].transform.position, ter_position[i].transform.rotation) as GameObject).transform.parent = ter_position[i].transform.parent;

This is work great I know that TNManager.Create dont work like Instantiate so I must add Instantiated object as a child by another way but I cant figure out any easy way.:( If someone can give me advice as for not very skilled coder or even better code for that I will be grateful.
Thanks to all.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: TNet: Tasharen Networking Framework
« Reply #172 on: January 28, 2013, 02:23:46 PM »
@byerdelen: TNet.List is a dynamic templated type. You can't pass it as an argument to an RFC call. If you want it to be passed, use its ToArray() function first to turn it into a fixed-size array. Also, TNet.List has support for both Sort and Contain functions. It's designed to flat out replace the generic List type.

@zyeurgh: My guess is that you are not smoothing the values, or you didn't separate the renderer from the rigidbody. Look at how I set up the boxes in the Create example.

@matis: TNManager.Create is an asynchronous call and it has no return type. If you want to do anything with it, do it in an Awake() call in a script attached to the object you're instantiating. TNManager.isThisMyObject tells you if you're the one who created it.

KJIB

  • Guest
Re: TNet: Tasharen Networking Framework
« Reply #173 on: January 29, 2013, 06:27:47 AM »
I notice that, after starting the server, if you then select chat, (no clients, just the server) and then change your name to (say) "Fred" in the chat example, it informs you that "Fred is now known as Fred" as it has already overwritten the old name before displaying it...  :o

zyeurgh

  • Guest
Re: TNet: Tasharen Networking Framework
« Reply #174 on: January 29, 2013, 09:45:48 AM »
Thanks for your reply ArenMook,
I think my problem was that the local players were updating on FixedUpdate (using CharacterController) and the remote players were interpolated in Update, which was causing jittering when moving in the same direction. It's all smooth now :)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: TNet: Tasharen Networking Framework
« Reply #175 on: January 30, 2013, 07:01:18 PM »
Please start individual threads now instead of replying here -- it will be easier for others to find the information they need later.