Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Thu Sep 02, 2010 5:50 pm

All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: webinterface for changing the openttd.cfg
PostPosted: Thu Sep 06, 2007 7:19 pm 
Engineer
Engineer
Offline

Joined: Sat Jul 15, 2006 12:55 pm
Posts: 69
I have written a php-script which can be used to change some configurations about the openttd.cfg file. This can be used by server admins which often changes some settings. It allowes you to change the following options:
  • Base difficult settings (the custom one)
  • Base game options (town names, climate)
  • Some patch-settings which often get changed between new games
  • NewGRFs
The list of patch-settings to edit is hardcoded to a few settings like mapsize and vehicle limit. Imho these are the most used patch settings to edit. If you personally need other patch settings add them.

This script will not control a server in some way like start and stop it nor send it any rcon commands to the server. It isn't also used to change the whole openttd.cfg file with all possible settings. As you can activate/deactive newgrfs it doesn't do any filesystem operation to manage them like move, delete, upload and stuff. It just changed the openttd.cfg file.

Installation:
Just put it in a directory which can be reached by a browser. As it doesn't have some login-functionality you should add a login via .htaccess or other techniques. At the beginning of the php-file is the setting for the openttd-path. Change it to your actually openttd-installation, the directory which contains the openttd binary.
As this script read and write the openttd.cfg file and read the newgrfs list in the data/ directory the webserver must be allowed to do so. This means it must be got file-read-access (+r) and read + search access for the directory (+rx) to operate. You should backup the openttd.cfg file before testing it.

Please write some feedback about the script.


Attachments:
index.php.txt [22.62 KiB]
Downloaded 1464 times
config1.png
config1.png [ 51.86 KiB | Viewed 8153 times ]
Top
 Profile  
 
 Post subject: Re: webinterface for changing the openttd.cfg
PostPosted: Thu Sep 06, 2007 8:06 pm 
Engineer
Engineer
Offline

Joined: Thu Sep 06, 2007 4:36 pm
Posts: 71
Location: Peterborough, United Kingdom
Hey,

This seems a little pointless because (as far as I'm aware) changing the config file while the game is running will not affect the running server.

I think the only useful application for a webinterface is if the server has been shutdown so that the config can be changed or if you could create one using a client side programming language (java, javascript) so that general users could use it to configure their file (I'm unsure if there are many apps out there to do this already).

I might be wrong about the server needing to be stopped though so please correct me if needed.

Just an added thing this would require that the game serer would also have a webserver with php module on the same pc which I don't think is all that likely.


Top
 Profile E-mail  
 
 Post subject: Re: webinterface for changing the openttd.cfg
PostPosted: Thu Sep 06, 2007 8:12 pm 
Tycoon
Tycoon
User avatar
Offline

Joined: Mon May 02, 2005 11:05 am
Posts: 14336
Location: localhost
It is useful for when you restart the server and you want to change some settings, as happens almost every time we reset the #openttdcoop servers.

_________________
Don't panic
Image
OpenTTD: manual
#openttdcoop: blog | wiki | public server | NewGRF pack | DevZone | Coopetition ladder
My screenshots
Image


Top
 Profile  
 
 Post subject: Re: webinterface for changing the openttd.cfg
PostPosted: Thu Sep 06, 2007 8:18 pm 
Engineer
Engineer
Offline

Joined: Sat Jul 15, 2006 12:55 pm
Posts: 69
It comes from an idea for the openttdcoop servers as new games start at about every week. So they edit the config-file by hand and start a new game. But changing the config-file by hand can be annoying as you normaly must look up about the diff_custom setting and must be carefully looked at the newgrfs paths. So this script helps you to change these settings. As you said. If the openttd-server doesn't run on a server without a webserver this script is you mentioned useless ;)


Top
 Profile  
 
 Post subject: Re: webinterface for changing the openttd.cfg
PostPosted: Thu Sep 06, 2007 8:28 pm 
Engineer
Engineer
Offline

Joined: Thu Sep 06, 2007 4:36 pm
Posts: 71
Location: Peterborough, United Kingdom
Hey,

I don't know about the routines that the people running these servers use, I presumed that the server was just run continualy and that it was left and when a new game was made it would be done as a normal offline game. I also thought that there were many gui programs for editing the config which have much the same look (I'm surprised if there aren't any like this as I could do one myself in VB within a couple of hours (it takes me a while to remember VB)).

But yes fair enough for people like openttdcoop I will agree that it can be put to goo use.


Top
 Profile E-mail  
 
 Post subject: Re: webinterface for changing the openttd.cfg
PostPosted: Wed Oct 17, 2007 12:31 pm 
Chairman
Chairman
User avatar
Offline

Joined: Sun Jun 18, 2006 6:18 pm
Posts: 768
Location: Switzerland
I would use this script also for running a local game, because its much more comfortable then the NewGRF GUI of ottd self.

Here is a little patch of a small bug, with reloading grfsettings, which have parameters...
Code:
$ diff -u original_progman.php publicserver.php
--- original_progman.php        2007-09-20 16:52:33.000000000 +0000
+++ publicserver.php    2007-10-15 23:15:24.000000000 +0000
@@ -185,7 +185,7 @@
                             $to_add .= $grf."\n";
                         } else {
                             // with parameter, save them
-                            $to_add .= $grf." ".$param."\n";
+                            $to_add .= $grf." = ".$param."\n";
                         }
                     }
                     $to_add = trim($to_add);


(Edited with proper diff, thanks do DaleStan and Frosch)

Greets
Ammler

_________________
Image
Town Names: Image Swiss / Image French · Image Temperate Lumber Mill
Still work in progress: OpenGFX or/and OpenSFX - Please help!


Last edited by Ammler on Wed Oct 17, 2007 3:13 pm, edited 2 times in total.

Top
 Profile E-mail  
 
 Post subject: Re: webinterface for changing the openttd.cfg
PostPosted: Wed Oct 17, 2007 1:10 pm 
TTDPatch Developer
TTDPatch Developer
Offline

Joined: Wed Feb 18, 2004 3:06 am
Posts: 10249
Normal diffs are surpassed in evilness only by ed scripts. Always generate unified or context diffs.

_________________
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
TTDPatch NFO coding consultant. (Private messages on this topic will be ignored. Ask in public only.)


Top
 Profile  
 
 Post subject: Re: webinterface for changing the openttd.cfg
PostPosted: Mon Mar 10, 2008 12:20 pm 
Chairman
Chairman
User avatar
Offline

Joined: Sun Jun 18, 2006 6:18 pm
Posts: 768
Location: Switzerland
Hi

Yes, we still use that web interface and moved it now to our SVN Repo: http://svn.openttdcoop.org/tools/webconfig/

Participations are welcome. ;-)


Greets
Ammler

_________________
Image
Town Names: Image Swiss / Image French · Image Temperate Lumber Mill
Still work in progress: OpenGFX or/and OpenSFX - Please help!


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Debt Help | Find jobs | Find jobs | Breast Enlargement | Breast Enlargement
Powered by phpBB © 2000-2009 phpBB Group

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2010.
Hosted by Zernebok.