Author Topic: Tnet Synchronization  (Read 3770 times)

dale.golby

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Tnet Synchronization
« on: April 30, 2014, 02:42:48 AM »
Hi I was hoping someone could help me out with syncing data across the network.
For the last couple of weeks I have been playing around with different ways of networking - Unity master server, photon cloud server, and now Tnet - with using the Unity Master Server I used OnSerializeNetworkView to stream out and read in Position/Rotation/and whole bunch of other variables across the network.

My Question is, does Tnet have a similar method to that using different naming conventions and have I just missed it along the way?

Any help in the matter would be greatly appreciated, thanks.
Dale.

djray2k

  • Jr. Member
  • **
  • Thank You
  • -Given: 4
  • -Receive: 4
  • Posts: 74
  • Blockey Hockey!
    • View Profile
    • Walking Talking Grilling Bear Studios
Re: Tnet Synchronization
« Reply #1 on: April 30, 2014, 09:31:20 AM »
TNet does this as well. It uses Remote Function Calls.

It involves sending a message on one end:
  1. tno.Send("OnSyncPosition", Target.All, position.x, position.y);

and receiving it on another:
  1. [RFC]
  2. void OnSyncPosition(float x, float y)
  3. {
  4.     position.x = x;
  5.     position.y = y;
  6. }
  7.  

There's a lot more control in what you can send, but it's set up easy enough to do communications without hassle.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Tnet Synchronization
« Reply #2 on: April 30, 2014, 07:08:48 PM »
Streams are always one-way, and TNet doesn't have them. RFCs are bi-directional. You can send them from any client you wish, and you can save them on the server so that when new players arrive, RFCs get sent to them automatically -- which makes RFCs far more flexible than streams.

dale.golby

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: Tnet Synchronization
« Reply #3 on: April 30, 2014, 10:44:35 PM »
Ahk then, I think I understand, I definitely have to play around with it more to get a better understanding that's for sure.
Thanks for the help :)