Howto get Serverdetails?

OpenTTD is a fully open-sourced reimplementation of TTD, written in C++, boasting improved gameplay and many new features.

Moderator: OpenTTD Developers

ConiKost
Engineer
Engineer
Posts: 69
Joined: 02 Jun 2002 15:21

Howto get Serverdetails?

Post by ConiKost »

Hi There!
How can I get on my own Site to Display the Serverdetails as here:
http://www.openttd.org/server_detail.php?id=2211 ?
Seven Force
Engineer
Engineer
Posts: 84
Joined: 22 May 2005 09:45
Location: United Kingdom

Post by Seven Force »

Usually, if the server is set to "advertise" and can be accessed, it will appear on the servers list and can be queried for game info.
ConiKost
Engineer
Engineer
Posts: 69
Joined: 02 Jun 2002 15:21

Post by ConiKost »

But how I do it myself ?
IvanDK
Engineer
Engineer
Posts: 12
Joined: 09 Aug 2005 10:12
Location: Aalborg, Denmark
Contact:

Post by IvanDK »

*delete*
Last edited by IvanDK on 16 Jan 2006 14:42, edited 1 time in total.
User avatar
Brianetta
Tycoon
Tycoon
Posts: 2566
Joined: 15 Oct 2003 22:00
Location: Jarrow, UK
Contact:

Post by Brianetta »

I'd like to display the current year, version, etc. on my own web site, too. Unfortunately it doesn't seem to be possible.
PGP fingerprint: E66A 9D58 AA10 E967 41A6 474E E41D 10AE 082C F3ED
Sacro
Tycoon
Tycoon
Posts: 1145
Joined: 18 Jun 2005 21:08
Location: Here
Contact:

Post by Sacro »

Isn't it just basic PHP?
We Am De Best

Host of ThroughTheTube site
User avatar
Brianetta
Tycoon
Tycoon
Posts: 2566
Joined: 15 Oct 2003 22:00
Location: Jarrow, UK
Contact:

Post by Brianetta »

Sacro wrote:Isn't it just basic PHP?
OK, smarty - how does my PHP script find out what year my server is at, or what version of the software it's running?

The only way I have right now would seem to be to write a proxy metaserver, and get the local DNS server to misdirect my server's metaserver connection to that proxy before sending it on to the real metaserver.

Actually, I'm planning to get my dedicated server autopilot to populate a web page with all sorts of in-game info (like who's playing, etc) so it would be nice if the console had a bit more information available. I can only get a company name from the console by getting the server to send a message to the company.

I'd really like to see some extra info (version, date, company list) available to the dedicated server console. It would certainly make life esaier for me as a server admin who can't start the game up to look at this stuff whilst at work, for example.
PGP fingerprint: E66A 9D58 AA10 E967 41A6 474E E41D 10AE 082C F3ED
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Post by TrueBrain »

Brianetta wrote:I'd like to display the current year, version, etc. on my own web site, too. Unfortunately it doesn't seem to be possible.
Current year, version and stuff is accessable for everyone, I don't see why you have to call someone a 'smarty' for it, because he is right: with PHP for example you can poll any server you want, via the OTTD Protocol.. easy as that...

For your information: the MasterServer-Updater uses PHP.
Last edited by TrueBrain on 10 Jan 2006 19:15, edited 1 time in total.
User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Post by Darkvater »

You could do it the same way the OpenTTD Master Server does it. The server advertises itself to the master server, then that queries your server to find out the details. This querying is done in simple PHP.

http://svn.openttd.org/cgi-bin/trac.cgi ... update.php

If you rip out the appropiate parts to query your own server, or any other server it'll work :)
TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
jetthe
Engineer
Engineer
Posts: 5
Joined: 14 Aug 2005 12:58
Location: Lkpg, SWE
Contact:

Post by jetthe »

And if you're lazy, http://brutus.ath.cx/ottd/ (link to the source at the bottom). Not the most beautiful piece of code, but it will get you started.
IvanDK
Engineer
Engineer
Posts: 12
Joined: 09 Aug 2005 10:12
Location: Aalborg, Denmark
Contact:

Post by IvanDK »

*delete*
Last edited by IvanDK on 16 Jan 2006 14:40, edited 1 time in total.
User avatar
Brianetta
Tycoon
Tycoon
Posts: 2566
Joined: 15 Oct 2003 22:00
Location: Jarrow, UK
Contact:

Post by Brianetta »

I got mine working, eventually. I had to turn off all the checks (it claimed not to have a response from the server when, strangely enough, the return arrays had actually been populated). I gave up trying to get the client details (company value, etc) because nothing I did came back with info. jetthe's script was an excellent start, but simply didn't work on my server the way it obviously does on his.
PGP fingerprint: E66A 9D58 AA10 E967 41A6 474E E41D 10AE 082C F3ED
jetthe
Engineer
Engineer
Posts: 5
Joined: 14 Aug 2005 12:58
Location: Lkpg, SWE
Contact:

Post by jetthe »

I will try to extend the script with some more detailed error checking and hopefully test it some more tonight. Too bad it wouldn't work out-of-the-box for all of you.
User avatar
Smoky555
Engineer
Engineer
Posts: 97
Joined: 06 Jan 2005 05:22
Location: Russia, Volgograd
Contact:

Post by Smoky555 »

jetthe wrote:I will try to extend the script with some more detailed error checking and hopefully test it some more tonight. Too bad it wouldn't work out-of-the-box for all of you.
may be the reason is in the file (openttd.inc.php) that you are using?
can you post it here?
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
jetthe
Engineer
Engineer
Posts: 5
Joined: 14 Aug 2005 12:58
Location: Lkpg, SWE
Contact:

Post by jetthe »

Smoky555 wrote:
jetthe wrote:I will try to extend the script with some more detailed error checking and hopefully test it some more tonight. Too bad it wouldn't work out-of-the-box for all of you.
may be the reason is in the file (openttd.inc.php) that you are using?
can you post it here?
Ahhhh the shame! I didn't test my script with the latest openttd.inc.php, the old version is available here: http://brutus.ath.cx/ottd/openttd.inc.phps

Edit: All functions to retrive company details have been removed from http://svn.openttd.org/cgi-bin/trac.cgi ... td.inc.php , so using the old openttd.inc.php from my website should be considered as an permanent fix.
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Post by TrueBrain »

jetthe wrote:
Smoky555 wrote:
jetthe wrote:I will try to extend the script with some more detailed error checking and hopefully test it some more tonight. Too bad it wouldn't work out-of-the-box for all of you.
may be the reason is in the file (openttd.inc.php) that you are using?
can you post it here?
Ahhhh the shame! I didn't test my script with the latest openttd.inc.php, the old version is available here: http://brutus.ath.cx/ottd/openttd.inc.phps

Edit: All functions to retrive company details have been removed from http://svn.openttd.org/cgi-bin/trac.cgi ... td.inc.php , so using the old openttd.inc.php from my website should be considered as an permanent fix.
Yeah, someone (ahum) removed that for some reason ;) It currently is no longer used for the MasterServer, and the code was buggy... but oh well :) Someone should rewrite everything anyway :)
neonx
Engineer
Engineer
Posts: 11
Joined: 04 Jul 2003 16:06
Location: Norway

Post by neonx »

grrr...

what has changed with the new version (0.4.5), my server-info script don't work anymore...
ConiKost
Engineer
Engineer
Posts: 69
Joined: 02 Jun 2002 15:21

Post by ConiKost »

Has anybody a new solution?
User avatar
Brianetta
Tycoon
Tycoon
Posts: 2566
Joined: 15 Oct 2003 22:00
Location: Jarrow, UK
Contact:

Post by Brianetta »

ConiKost wrote:Has anybody a new solution?
Yes. Expand upon my autopilot script, so that it writes company information, etc., into a database. The database support is there already. Unfortunately you'll still need to use the openttd.inc.php functions to get the game's current date, landscape and dimensions (that info's not available to the console). Everything bu the date can be inferred from the config, but if a saved game is loaded there's no guarantee that the config reflects the game.

Once it's in the database, a PHP script can display the results to a web browser.
PGP fingerprint: E66A 9D58 AA10 E967 41A6 474E E41D 10AE 082C F3ED
Post Reply

Return to “General OpenTTD”

Who is online

Users browsing this forum: No registered users and 2 guests