Author Topic: TNet over php  (Read 2298 times)

ChronoAS

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
TNet over php
« on: June 10, 2014, 01:46:51 PM »
Hello. My goal is to make a turn based online game.

I would definitely use TNet for a chat purposes, however I am curious for the game part.

My players make some actions and then end their turn, however that action performs once in 30 seconds. As I could understand, Master Server makes updates 15 times in a second and that's overkill.

So the question is: should I even use TNet for updating my game objects or just make some php scripts to set and recieve data from the SQL database every few seconds?

And another question: can TNet master server save incoming data in a database?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: TNet over php
« Reply #1 on: June 11, 2014, 06:09:41 AM »
Master server updates 15 times per second? Where did you get this figure from? Also, "Master server" is a Unity feature, not TNet.

TNet sends data when you tell it to send data via tno.Send. It keeps the connection alive by sending periodic pings, but that's it.

No, you won't be able to get TNet to talk to PHP. The two have nothing in common.

TNet doesn't have a master server. TNet has lobby server and game server features. Both can be active from the same executable, and can even be launched from within Unity without having to create any stand-alone executable. In either case, TNet has no database connectivity. If you need it, you will need to add it yourself by modifying the TNet's server component.

Rexima

  • Jr. Member
  • **
  • Thank You
  • -Given: 7
  • -Receive: 2
  • Posts: 78
    • View Profile
Re: TNet over php
« Reply #2 on: June 16, 2014, 02:52:24 AM »
Im making an interface for my game
https://www.dropbox.com/s/rq2s1tf5z3yba4v/Screenshot%202014-06-16%2009.43.49.png

And i want to make real time updates, something like you give an player a new Item or ban him from the server and so one.

Is it possible to speak to TNet over PHP UDP Sockets?
I wrote TNManager.StartUDP(Port); to my Start.

Connection via Telnet works.

And now im on the point, that i dont know how to communicate with PHP through this socket, could you help me maybe?
Or can you give me an another solution how to communicate with an existing gameserver? (My Gameserver's are all dedicated, no listen gameserver)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: TNet over php
« Reply #3 on: June 16, 2014, 09:21:26 AM »
Hmm... well, it's theoretically possible to communicate via UDP if you keep it to simple types (integer, float, byte array, etc). Start by examining TNet's packets. You will want to add a custom packet as you won't be able to mimic RFC calls.

You won't be able to communicate via TCP without some major reverse engineering because I'm betting C# and PHP send data types differently. This isn't something I can be of much help with.

Rexima

  • Jr. Member
  • **
  • Thank You
  • -Given: 7
  • -Receive: 2
  • Posts: 78
    • View Profile
Re: TNet over php
« Reply #4 on: June 16, 2014, 09:46:03 AM »
Thank you very much, i will try it :)