Author Topic: TNet Dedicated Server  (Read 4201 times)

Entelicon

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 2
    • View Profile
TNet Dedicated Server
« on: June 15, 2017, 12:35:25 AM »
Hey everyone,

I've been recently looking into using TNet for my networking solution, and was wondering if it works well with a dedicated server/client system? I've read some reviews that it's more designed around p2p, and I'm not sure if thats accurate or not.

Also can I design my server inside of Unity using TNet, and use the Unity build as my server host on a dedicated server?

Before I purchase this product, I want to make sure it's right for me. Thanks!

WolfTechGames

  • Newbie
  • *
  • Thank You
  • -Given: 6
  • -Receive: 4
  • Posts: 35
    • View Profile
Re: TNet Dedicated Server
« Reply #1 on: June 15, 2017, 01:27:15 PM »
Hello Entelicon,

Yes, it would work well with a dedicated server/client system. The base system is designed around p2p as each channel on a server has a channel host which manages the RFCs and such. Although the way I did it was I listened for a command argument that triggers the server to be launched and I also listen to a name command which has all the servers info for example: "Sever Name_My Map_GameMode" then I split the name by the character '_' to pull all the info.

So basically:
1) Listen for the command.
2) Launch server.
3) Join channel as host. (Now you have a dedicated host)
4) Set server name
5) GG

Look at this thread for some more info if needed: http://www.tasharen.com/forum/index.php?topic=15313.0

Entelicon

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: TNet Dedicated Server
« Reply #2 on: June 15, 2017, 05:31:23 PM »
Thanks Wolf for the reply.

Anybody think they could answer the latter question aswell?

cmifwdll

  • Global Moderator
  • Sr. Member
  • *****
  • Thank You
  • -Given: 0
  • -Receive: 149
  • Posts: 285
  • TNet Alchemist
    • View Profile
Re: TNet Dedicated Server
« Reply #3 on: June 17, 2017, 08:43:54 PM »
Both WolfTechGames' post and the link he provided are about a dedicated server within the Unity build. It does require rewriting small portions of TNet. It's not supported out of the box. TNet is not designed with dedicated client/server in mind. TNet is host-authoritative, and by default the host is the first client that joins a channel. No game logic runs on the server.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: TNet Dedicated Server
« Reply #4 on: June 18, 2017, 08:15:22 PM »
Well, the term "channel host" means less and less these days. It's just a flag that designates one of the players as 'host', meaning you can use it to ensure that only one player is performing tasks such as executing the AI. I always advise using tno.isMine instead nowadays. In the current Sightseer branch of TNet I also made it possible to set TNObject's owner -- for things like players taking control of vehicles, or having vehicles follow other vehicles for example.

All that aside, TNet is indeed better for a player-authoritative approaches, where players do their own game code and the server handles communication / packet forwarding. You can certainly edit the server to add custom game code in there and offload more and more of your game code to make it more secure and prevent cheating, but it really depends on the type of game you're making. For majority of the games, going with the former approach is perfectly suitable and is much easier to boot -- which is why TNet is designed with that in mind.

Also, saying that TNet is P2P is misleading. It's not. With TNet you always connect to a server. This server can be hosted remotely on a dedicated box, or executed virtually within your game, but you always have a client-server model to work with.