Tasharen Entertainment Forum

Support => TNet 3 Support => Topic started by: Wonse on September 02, 2013, 08:01:10 AM

Title: How to make some code working on the server side ?
Post by: Wonse on September 02, 2013, 08:01:10 AM
HI
I4m working on a  game. and i want to be sure, some script are working safely on the server side, always online.
how can i do this with TNET ?  my player can join and leave, easily the server, so i dont think i can let a player be the host, for this
Title: Re: How to make some code working on the server side ?
Post by: hippocoder on September 02, 2013, 11:07:56 AM
You need to host online, such as amazon EC2, Azure or leaseweb etc for the server if you do not want the authoritative player (isHosting) to close the server.
Title: Re: How to make some code working on the server side ?
Post by: Wonse on September 02, 2013, 12:31:14 PM
You need to host online, such as amazon EC2, Azure or leaseweb etc for the server if you do not want the authoritative player (isHosting) to close the server.

i have the tnetserver.exe on my server, but, even with this, a player is "isHosting" right ?
Title: Re: How to make some code working on the server side ?
Post by: hippocoder on September 02, 2013, 01:39:19 PM
If you have the .exe on your own server and isHosting player disconnects, then another player will be assigned the new host (and will return true for isHosting) and gameplay will continue without a break.

In your code, all clients will have the same code but the client who is the group leader (who returns isHosting == true) will be doing the NPC ai etc.
Title: Re: How to make some code working on the server side ?
Post by: Wonse on September 02, 2013, 05:12:30 PM
If you have the .exe on your own server and isHosting player disconnects, then another player will be assigned the new host (and will return true for isHosting) and gameplay will continue without a break.

In your code, all clients will have the same code but the client who is the group leader (who returns isHosting == true) will be doing the NPC ai etc.

but, i have to deal withj all my functions to be able to be "breaked" and passed to another player, so ?

for my pokker table, (5-10 players), if the isHosting player is leaving, another will be host, and reset the current game ?
Title: Re: How to make some code working on the server side ?
Post by: ArenMook on September 02, 2013, 05:35:53 PM
I'm going to change the term "host" to something in the next version because people keep confusing the terms "host" and "server".

Server: physical program that players connect to. Each server is capable of supporting thousands of players, and thousands of separate channels / games. If the server goes down, everyone gets disconnected.

Host: authoritative player. Each channel only has one host. If the host player leaves, another player in the channel becomes the next host and the gameplay continues as if nothing happened.
Title: Re: How to make some code working on the server side ?
Post by: Wonse on September 03, 2013, 04:47:36 AM
so, if i dont want my pokker game to be breaked is the authoritative  player leave, what can i do ?
Title: Re: How to make some code working on the server side ?
Post by: ArenMook on September 04, 2013, 03:37:37 AM
Just disconnect everyone then. You get notified when players leave, and if that player was the host, leave as well.