Dedicated server autopilot (current version: 2.0.4)

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

Moderator: OpenTTD Developers

Picknicker
Engineer
Engineer
Posts: 20
Joined: 31 Aug 2006 15:28

Post by Picknicker »

@ glx
With which OpenTTD version have you tried it?

cu
Picknicker
User avatar
glx
OpenTTD Developer
OpenTTD Developer
Posts: 622
Joined: 02 Dec 2005 15:43
Location: Drancy(93) - France
Contact:

Post by glx »

Brianetta wrote: I see you changed the \n to \r after each command that the autopilot sends. Was that necessary? If so, I shall modify the new version appropriately. I'd have thought that the actual correct behaviour in Windows would be to send both.
It was necessary. exp_send_user() works with \n but exp_send() needs \r.
Brianetta wrote: Any reason why you changed the expect_out array index from 0 to 1 and added parentheses?
I did that because exp_send() needs to send a \r after the command. With the parentheses, I skip the \n :)

And don't forget the "package require Expect" at the beginning, it's needed for windows version.


@Carnalito: yes, you need to get sources from svn (r6418 but other rev should work too), apply the patch, and compile.

@Picknicker: I used a modified r6418 version (see above :) )
User avatar
Brianetta
Tycoon
Tycoon
Posts: 2566
Joined: 15 Oct 2003 22:00
Location: Jarrow, UK
Contact:

Post by Brianetta »

glx wrote:And don't forget the "package require Expect" at the beginning, it's needed for windows version.
I can forget it if I like - it's practically the first line I added when I began coding 2.0 (which is a complete rewrite). The new version has support for specifying the syntax of the command you use to start openttd, and ts output can be easily translated through the use of external language files (although it still currently requires an English language dedicated server).

I'll assume that this patch of yours might make it into the trunk and will add some line termination magic to the current design. At the moment, it pops up a message if you try to run it in Windows telling you it won't work, unless you add a specific option to the config file.
PGP fingerprint: E66A 9D58 AA10 E967 41A6 474E E41D 10AE 082C F3ED
User avatar
glx
OpenTTD Developer
OpenTTD Developer
Posts: 622
Joined: 02 Dec 2005 15:43
Location: Drancy(93) - France
Contact:

Post by glx »

For windows users who don't want to apply my patch and compile, I made a little app that converts openttd.exe from GUI to console (and vice versa). Just run convert.exe in the same dir as openttd.exe. Works for all versions (nightlies and releases).
The source is included in the zip.

See http://www.tt-forums.net/viewtopic.php?p=489470#489470 for windows compatible autopilot script and how to use it.

EDIT: new version attached. Now it really works with all openttd versions :) (thx Ploes)
Attachments
convert.zip
converts openttd.exe from GUI to console and vice versa
(3.55 KiB) Downloaded 913 times
Last edited by glx on 16 Sep 2006 00:48, 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 »

2.0 is running on #openttdcoop's sandbox server right now. The code will be released to the public very soon, although it will be non-Windows only for the time being. I'm not releasing it tonight because I haven't transferred the documentation from paper to computer yet.

This version is significantly more complex than the old one, and requires documentation.
PGP fingerprint: E66A 9D58 AA10 E967 41A6 474E E41D 10AE 082C F3ED
Picknicker
Engineer
Engineer
Posts: 20
Joined: 31 Aug 2006 15:28

Post by Picknicker »

Great ;) I wait impatiently.
I hope the new version works here with topical miniIN and nightly version.

Does somebody have here autopilott with a current version of MiniIn or nightly in use?

sorry for my bad english 8)
User avatar
Brianetta
Tycoon
Tycoon
Posts: 2566
Joined: 15 Oct 2003 22:00
Location: Jarrow, UK
Contact:

Post by Brianetta »

There's no real reason why it shouldn't work. I don't believe the miniIN has any major modifications to the dedicated server console.
PGP fingerprint: E66A 9D58 AA10 E967 41A6 474E E41D 10AE 082C F3ED
Picknicker
Engineer
Engineer
Posts: 20
Joined: 31 Aug 2006 15:28

Post by Picknicker »

I do not know it, i have 2 Debian 3.1 Server

1.) i386 Pentium (local development)
2.) AMD64 (I-Net Server)

On both Server works autopilot with follow MiniIn archives:
change amd64 with i386 for Server 1.

Code: Select all

OTTD-dedicated-linux-amd64-MiniIN-r5476-MiniIN.tar.bz2
OTTD-dedicated-linux-amd64-MiniIN-r5530-MiniIN.tar.bz2
OTTD-dedicated-linux-amd64-MiniIN-r5588-MiniIN.tar.bz2
OTTD-dedicated-linux-amd64-MiniIN-r5722-MiniIN.tar.bz2
OTTD-dedicated-linux-amd64-MiniIN-r5838-MiniIN.tar.bz2
work not:

Code: Select all

OTTD-dedicated-linux-amd64-MiniIN-r6027-MiniIN.tar.bz2 <- Bad Version,  i know
OTTD-dedicated-linux-amd64-MiniIN-r6028-MiniIN.tar.bz2
OTTD-dedicated-linux-amd64-MiniIN-r6134-MiniIN.tar.bz2
OTTD-dedicated-linux-amd64-MiniIN-r6362-MiniIN.tar.bz2
OTTD-dedicated-linux-amd64-MiniIN-r6401-MiniIN.tar.bz2
OTTD-dedicated-linux-amd64-MiniIN-r6403-MiniIN.tar.bz2
Otherwise, nothing was changed. I delete the old .cfg file after upgrade.
What should I else do?
User avatar
Brianetta
Tycoon
Tycoon
Posts: 2566
Joined: 15 Oct 2003 22:00
Location: Jarrow, UK
Contact:

Post by Brianetta »

Bring it up with RichK67. I don't think this is an autopilot problem, if it's the same as the one you described last time.
PGP fingerprint: E66A 9D58 AA10 E967 41A6 474E E41D 10AE 082C F3ED
Picknicker
Engineer
Engineer
Posts: 20
Joined: 31 Aug 2006 15:28

Post by Picknicker »

O.k. thx, I think this is an OpenTTD problem, with nightly its the self problem.
With whom does Nightly/MiniIn with autopilot work? Am I only with problems?

EDIT: sice Nightly r5953 work not with autopilot.
r5934 work correct with autopilot.

All Version MiniIn/Nightly work without autopilot perfectly.
User avatar
osai
Traffic Manager
Traffic Manager
Posts: 132
Joined: 22 Sep 2004 14:56
Location: 10.0.1.254
Contact:

Post by osai »

We are running running our servers with autopilot and nightly r6280 and we dont have any problems!
But Brianetta did all the work :P
User avatar
Brianetta
Tycoon
Tycoon
Posts: 2566
Joined: 15 Oct 2003 22:00
Location: Jarrow, UK
Contact:

Post by Brianetta »

OK, it's out.

Attached to the first post of this thread is the brand spanking new and shiny autopilot version 2.0

It's half one in the morning, and I'm tired, ao I am bound to have forgotten something important. If you find out what it is, please let me know.

It's all practically untested. It should work on a (properly modified) Windows version of OpenTTD. it should definitely work on Linux, BSD ans Mac OS X. Of course, there were a couple of last minute minor, nay, trivial, changes that I made. As a result it might not work at all, but as I said, I'm tired.

There's a manual here. It's probably not as helpful as it seemed to me when I wrote it, but then, I am tired and I just finished it.

Well, there you go, folks. 2.0. Give it a go, and if you find bugs please tell me all about it.
PGP fingerprint: E66A 9D58 AA10 E967 41A6 474E E41D 10AE 082C F3ED
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

From a quick read-through, the docs look fine to me.
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
User avatar
glx
OpenTTD Developer
OpenTTD Developer
Posts: 622
Joined: 02 Dec 2005 15:43
Location: Drancy(93) - France
Contact:

Post by glx »

I made some changes and now it works fine on windows :) (using my patch or the convert tool)
Attachments
autopilot.diff
changes for windows
(2.2 KiB) Downloaded 328 times
Picknicker
Engineer
Engineer
Posts: 20
Joined: 31 Aug 2006 15:28

Post by Picknicker »

osai wrote:We are running running our servers with autopilot and nightly r6280 and we dont have any problems!
But Brianetta did all the work :P
Under which OS runs the server?
Can you say to me which version of Expect works?
thx ;)
User avatar
Brianetta
Tycoon
Tycoon
Posts: 2566
Joined: 15 Oct 2003 22:00
Location: Jarrow, UK
Contact:

Post by Brianetta »

glx: That diff is interesting. Has starting_date in the config file really been replaced with starting_year? In which revision did this happen? I'm confused.

Is it actually necessary to include the -d to get the the Windows version's output to be read correctly? openttd -h and openttd -d -h are identical in Linux, so if this is the case I shall incorporate this change in the code.

I'll test your changes to the expect strings for loading in the maximum companies variable, etc. If they work with the Linux version, I shall keep the changes in there.

The final change, mapping \n to \r, is messy. There must be a better way of doing that, because in Windows when you press return you are, in fact, sending both (it's the user's own input that you are altering there, not autopilot's output). Mapping one to the other, as you have done, will send the enter key twice after each manually entered command at the console.
PGP fingerprint: E66A 9D58 AA10 E967 41A6 474E E41D 10AE 082C F3ED
User avatar
Brianetta
Tycoon
Tycoon
Posts: 2566
Joined: 15 Oct 2003 22:00
Location: Jarrow, UK
Contact:

Post by Brianetta »

Brianetta wrote:glx: That diff is interesting. Has starting_date in the config file really been replaced with starting_year? In which revision did this happen? I'm confused.
OK, I've just learnt that this changed in revision 5915. Furthermore, I have found that the old value of starting_date is simply discarded and the new starting_year is initialised at 1950 if an old openttd.cfg file is used.

This is lame behaviour, and the dev in question should hang their head in shame.

I've updated the file in the original post. It should work on all platforms. Most of glx's changes were used, the rest were implemented but in a slightly different way. Thanks, glx.
PGP fingerprint: E66A 9D58 AA10 E967 41A6 474E E41D 10AE 082C F3ED
richk67
Tycoon
Tycoon
Posts: 2363
Joined: 05 Jun 2003 16:21
Location: Up North
Contact:

Post by richk67 »

Brianetta - also notice that the date format changed at r5999. :)
OTTD NewGRF_ports. Add an airport design via newgrf.Superceded by Yexo's NewGrf Airports 2
Want to organise your trains? Try Routemarkers.
--- ==== --- === --- === ---
Firework Photography
User avatar
Brianetta
Tycoon
Tycoon
Posts: 2566
Joined: 15 Oct 2003 22:00
Location: Jarrow, UK
Contact:

Post by Brianetta »

[11:16] <rachel> Starting year is 1970

That's pretty much all autopilot uses it for, so the format isn't that important. What did surprise me is that using the config file from my nightly started the game at 1950, which is almost 30 years later than intended. (:
PGP fingerprint: E66A 9D58 AA10 E967 41A6 474E E41D 10AE 082C F3ED
User avatar
Brianetta
Tycoon
Tycoon
Posts: 2566
Joined: 15 Oct 2003 22:00
Location: Jarrow, UK
Contact:

Post by Brianetta »

New bugfix release - 2.0.2 is out, and on the first post.

Many thanks to glx for working with me on this one. We have code here which will run on a glx-patched Windows server with ActiveTcl, and a regular unix-style server with regular (sourceforge) Tcl and Expect.

It's all good. There are a couple of servers running with autopilot at the moment. If anybody has trouble setting up the database module, or setting up a web based chat viewer application, do let me know - I make huge assumptions about people's ability with MySQL, and it's not obvious at first glance how it goes together.

A web based set of PHP scripts for the database stuff is on my to-do list, but it's not at the top. I'm also looking at the feasibility of putting this thing in a revision control mechanism of some sort, so that others can collaborate on it.
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 13 guests