Page 1 of 1

webinterface for changing the openttd.cfg

Posted: 06 Sep 2007 19:19
by Progman
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.

Re: webinterface for changing the openttd.cfg

Posted: 06 Sep 2007 20:06
by wickedgenius
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.

Re: webinterface for changing the openttd.cfg

Posted: 06 Sep 2007 20:12
by XeryusTC
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.

Re: webinterface for changing the openttd.cfg

Posted: 06 Sep 2007 20:18
by Progman
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 ;)

Re: webinterface for changing the openttd.cfg

Posted: 06 Sep 2007 20:28
by wickedgenius
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.

Re: webinterface for changing the openttd.cfg

Posted: 17 Oct 2007 12:31
by Ammler
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: Select all

$ 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

Re: webinterface for changing the openttd.cfg

Posted: 17 Oct 2007 13:10
by DaleStan
Normal diffs are surpassed in evilness only by ed scripts. Always generate unified or context diffs.

Re: webinterface for changing the openttd.cfg

Posted: 10 Mar 2008 12:20
by Ammler
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