Scoreboard for TGE with multiple servers
by Jules · in Torque Game Engine · 07/16/2007 (12:59 am) · 8 replies
Is it possible to create a scoreboard that can update a web server even if they are not on the same network? I know you can hit F2, to view the score. What I'm looking for is to implement the following:
2 Dedicated TGE servers on seperate server hosting
1 web server on another host, with PHP Mysql
Each Game on the servers has a time limit of 20 minutes before resetting, at the end of each play, the scores from each of the game servers are recorded on the web server, and added to every game that is played, giving some score history on previous games. The web server will have php and mysql on to record this. How would I go about pushing the players names, score over to this web server that is not part of the same network using a php script that is on the web server?
With regard to security, this can be implemented via IP checking, and a username and password from the TGE servers, so that the scoreboard is secure.
2 Dedicated TGE servers on seperate server hosting
1 web server on another host, with PHP Mysql
Each Game on the servers has a time limit of 20 minutes before resetting, at the end of each play, the scores from each of the game servers are recorded on the web server, and added to every game that is played, giving some score history on previous games. The web server will have php and mysql on to record this. How would I go about pushing the players names, score over to this web server that is not part of the same network using a php script that is on the web server?
With regard to security, this can be implemented via IP checking, and a username and password from the TGE servers, so that the scoreboard is secure.
#2
So for example:
1 TGE server in USA
1 TGE server in UK
1 Web Server or shared hosting (for scoreboard) in CANADA
Edit:bearing in mind that the web server has security enabled so that outside mysql connections are not possible unless called through a php script on the same webserver. I'm just trying to avoid multiple mysql/php installations and to have one central point for recording scores and stats. It's kind of in reverse, so I could have a script on the TGE servers that passes HTML form data into the php script on the remote web server. So for each users score, its placed into an array or something, then a POST command from the FORM action posts the results using the php script located elsewhere to insert the information into the database. (This is probably my answer, but if anyone else has any better ideas, please let me know! )
07/16/2007 (6:53 am)
Thanks mb, although I do believe this resource is for local mysql implementations. What I'm trying to achieve is using TGE on two servers that are also remote but at different locations to call a php script on a web server that is hosted at another remote location with php mysql on that passes the score information from TGE onto it. The web server would only allow specific IP address to connect to it, and also a username and password defined in TGE that it authenticates with, without having to setup VPN connections between the game servers and the web server.So for example:
1 TGE server in USA
1 TGE server in UK
1 Web Server or shared hosting (for scoreboard) in CANADA
Edit:bearing in mind that the web server has security enabled so that outside mysql connections are not possible unless called through a php script on the same webserver. I'm just trying to avoid multiple mysql/php installations and to have one central point for recording scores and stats. It's kind of in reverse, so I could have a script on the TGE servers that passes HTML form data into the php script on the remote web server. So for each users score, its placed into an array or something, then a POST command from the FORM action posts the results using the php script located elsewhere to insert the information into the database. (This is probably my answer, but if anyone else has any better ideas, please let me know! )
#3
What makes you think that? I've never heard of anyone using mysql on a local machine except for testing. Even so, the local machine still uses an IP to connect.. a local IP IE: 127.0.0.1. You just change that loopback address to your servers IP. So I'm not sure where you got the idea its local.
edit: if you look at the code in that link I sent bool MySQL::Connect()
That pretty much tells you it connects to whatever host you want... host/user/pass/db/port
What I'm trying to achieve is using TGE on two servers that are also remote but at different locations to call a php script on a web server that is hosted at another remote location with php mysql on that passes the score information from TGE onto it.
You wouldn't need to call a PHP script from TGE. You use the mysql code from within TGE to connect directly with the database. You would use PHP if you were using your web browser to access the database.
07/16/2007 (8:04 am)
I do believe this resource is for local mysql implementationsWhat makes you think that? I've never heard of anyone using mysql on a local machine except for testing. Even so, the local machine still uses an IP to connect.. a local IP IE: 127.0.0.1. You just change that loopback address to your servers IP. So I'm not sure where you got the idea its local.
edit: if you look at the code in that link I sent bool MySQL::Connect()
if (!mysql_real_connect (&m_Instance, m_sHost, m_sUserName, m_sUserPwd, m_sDatabase, m_iPort, NULL, iFlags))
That pretty much tells you it connects to whatever host you want... host/user/pass/db/port
What I'm trying to achieve is using TGE on two servers that are also remote but at different locations to call a php script on a web server that is hosted at another remote location with php mysql on that passes the score information from TGE onto it.
You wouldn't need to call a PHP script from TGE. You use the mysql code from within TGE to connect directly with the database. You would use PHP if you were using your web browser to access the database.
#4
Do you know if the players name and score into a HTML form that then posts the data into a php script hosted elsewhere?
07/16/2007 (8:15 am)
The problem I have is that the web servers are hosted elsewhere, and they do not allow direct mysql connections straight into the database, for security reasons. So it can only be done through a php script, making the above resource not viable.Do you know if the players name and score into a HTML form that then posts the data into a php script hosted elsewhere?
#5
07/16/2007 (8:22 am)
I have no problems on the connection. I'm a php/mysql developer too :) Just need to know how I can get the player+score information from TGE into a php/mysql web server hosted somewhere else that does not allow direct access to the database. Maybe my explaination of my first post was a bit too long!
#6
Can I implement something like this into a torque script? I don't know the variable name for defining the score and players name yet. So the ones I have used are just examples.
07/16/2007 (8:32 am)
Maybe I can break this down a bit...Can I implement something like this into a torque script? I don't know the variable name for defining the score and players name yet. So the ones I have used are just examples.
%players.score; %players.name; <FORM action="http://www.my-web-server.co.uk/score-results.php" method="post"> <input type="hidden" name="players_score[]" value="%players.name"> // inserting torque script into html <input type="hidden" name="players_name[]" value="%players.score"> // inserting torque script into html </FORM> ... code to automatically submit the results from the above arrays to the php script on another web server out on the internet somewhere.
#7
07/16/2007 (8:39 am)
I've found something to do with HTTPObject with get and post - I'll go give that a try... thanks for your help.
#8
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=4085
07/16/2007 (8:51 am)
This is exactly what I've been looking for, for those of you who need the same solution.www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=4085
Torque 3D Owner mb