Author Topic: Tnet vor very basic stuff at first  (Read 2053 times)

Salmakis

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Tnet vor very basic stuff at first
« on: August 31, 2017, 03:09:35 PM »
Hi, i bought tnet and i tried some of the turorials and they are fancy.
But it seems like its all a very high purpose api,

is it possible to use very rather low api stuff aswell?

Like connect to a server, and send/recieve basic stuff like serialized objects and streams?

There are some things that i want to have authorative controlled, so i cant do the clientside creation of objects for some things, and since the server is not in a unity project i would like to manage some data by myself serverside and send objects and events to clients.

But i got a hard time to find a place to start with such basic things.
(i dont want a lobby, or channels or such stuff for the start^^, just give an ip of a server and connect)

cmifwdll

  • Global Moderator
  • Sr. Member
  • *****
  • Thank You
  • -Given: 0
  • -Receive: 149
  • Posts: 285
  • TNet Alchemist
    • View Profile
Re: Tnet vor very basic stuff at first
« Reply #1 on: August 31, 2017, 06:46:47 PM »
Hah, it's funny that you perceive TNet as being a very high level API :) I got addicted to it for the exact opposite reason!

You can use TNManager.BeginSend and TNManager.EndSend for writing & sending your custom packets. This allows you to write whatever data you'd like however you'd like to write it. Be sure to make a CustomPacketHandler on the server, too, and subscribe to its own onCustomPacket delegate in Start() (and unsubscribe in Stop()).

Though I have to say you'll be rewriting a lot of TNet to make it fully server authoritative. Are you sure that's what you want to do? TNet comes with the idea of a "host" (which is actually just the channel operator). Typically, making something host-authoritative is good enough. So in an RFC you'd simply check TNManager.isHosting and immediately return if false.

Salmakis

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: Tnet vor very basic stuff at first
« Reply #2 on: September 05, 2017, 12:21:37 PM »
hey, thank you ill dig into that tonite =)

the things that i want to have authorative are just some things like map data, win conditions, enemy spawns on positions etc (stuff that is enerated by the server)