Author Topic: How to make some code working on the server side ?  (Read 7139 times)

Wonse

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 15
    • View Profile
How to make some code working on the server side ?
« 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

hippocoder

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 30
    • View Profile
Re: How to make some code working on the server side ?
« Reply #1 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.

Wonse

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 15
    • View Profile
Re: How to make some code working on the server side ?
« Reply #2 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 ?

hippocoder

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 30
    • View Profile
Re: How to make some code working on the server side ?
« Reply #3 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.

Wonse

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 15
    • View Profile
Re: How to make some code working on the server side ?
« Reply #4 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 ?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How to make some code working on the server side ?
« Reply #5 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.

Wonse

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 15
    • View Profile
Re: How to make some code working on the server side ?
« Reply #6 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 ?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How to make some code working on the server side ?
« Reply #7 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.