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

neonx
Engineer
Engineer
Posts: 11
Joined: 04 Jul 2003 16:06
Location: Norway

Post by neonx »

I have been using this on my server since you released it.
But, the latest versjon looses track of how many clients that is connected. It ended up on -2 clients yesterday.
Can't you script som sort of automatic "recount clients"? Make it recount every 5 minutes or so?
User avatar
Brianetta
Tycoon
Tycoon
Posts: 2566
Joined: 15 Oct 2003 22:00
Location: Jarrow, UK
Contact:

Post by Brianetta »

I've done this, but it's been in heavy testing until now.

Version 1.3, which I'll put on the first post of this thread, supports automatic recounting. This happens about every five minutes by default, but can be changed.

This wasn't a trivial change, so the testing period was much longer. It does seem to be rock steady, though, having been tested extensively on my nightly (and a slightly modified version on the #openttdcoop sandbox).

Let me know how it works for you.

I'm thinking of adjusting the count command, since as it stands you can't say "count on it" to the chat from the dedicated console...
PGP fingerprint: E66A 9D58 AA10 E967 41A6 474E E41D 10AE 082C F3ED
ebik
Engineer
Engineer
Posts: 83
Joined: 19 Jul 2005 08:14
Location: Prague, Czech Republic

Post by ebik »

Please, can you distinguish between players and spectators? I joined #openttdcoop sandbox as spectator, there was 1 player (who probably left his computer with running game), and game unpaused!

Also there may be problem, that when game pauses, the player that is not leaving is probably editing (demolishing) some tracks, and he cannot fix this until some other player joins (which can happen next day). (This caused megajam on sandbox recently). Maybe, this shouldn't be solved by your script, but by communication between players.
User avatar
Brianetta
Tycoon
Tycoon
Posts: 2566
Joined: 15 Oct 2003 22:00
Location: Jarrow, UK
Contact:

Post by Brianetta »

ebik wrote:Please, can you distinguish between players and spectators? I joined #openttdcoop sandbox as spectator, there was 1 player (who probably left his computer with running game), and game unpaused!
Unfortunately, autopilot can't distinguish between players and spectators at the moment. The code to do that would slow the welcome script down very much, possibly to the point of missing people. This is because it would have to reads the join message, then use a status command to find out more about the player who just joined. It's not something I want to do anyway, because personally, when I spectate a game, I prefer the game to be running.
ebik wrote:Also there may be problem, that when game pauses, the player that is not leaving is probably editing (demolishing) some tracks, and he cannot fix this until some other player joins (which can happen next day). (This caused megajam on sandbox recently). Maybe, this shouldn't be solved by your script, but by communication between players.
On the #openttdcoop sandbox, the autopilot is modified to pause the game when there are less than two people connected. This is a special case, and won't be released by me (it also has some database code to log the in-game chat).

The #openttdcoop sandbox rules are simple. It's for practising cooperative play. This means that when you're alone on the server, you're not supposed to be doing stuff anyway (and you're supposed to be attempting to follow the Wiki's guidelines, or developing upon them). You're quite right that this should be solved by communication between players, not the script.
PGP fingerprint: E66A 9D58 AA10 E967 41A6 474E E41D 10AE 082C F3ED
ebik
Engineer
Engineer
Posts: 83
Joined: 19 Jul 2005 08:14
Location: Prague, Czech Republic

Post by ebik »

Brianetta wrote:
ebik wrote:Please, can you distinguish between players and spectators? I joined #openttdcoop sandbox as spectator, there was 1 player (who probably left his computer with running game), and game unpaused!
Unfortunately, autopilot can't distinguish between players and spectators at the moment. The code to do that would slow the welcome script down very much, possibly to the point of missing people. This is because it would have to reads the join message, then use a status command to find out more about the player who just joined. It's not something I want to do anyway, because personally, when I spectate a game, I prefer the game to be running.
Okay, maybe I'll see the source, and try to issue asynchronicity to the autopilot. (I have following in my mind: autopilot will see player connecting/disconnecting -> it queries server about all players. And from the response result it pauses/unpauses game. This may be difficult only in case that querying server about all players cannot be done by one request+reply. Then second query (as second player may be connecting during first query) must be postponed after finish of first one.

Hmm, maybe I'll write own autopilot with perl+expect, as I hate that some (few) constructs are long in tcl.
chrissicom
Route Supervisor
Route Supervisor
Posts: 415
Joined: 07 Oct 2004 10:05

Post by chrissicom »

hmmm I have installed ActiveTCL which includes Expect on my Windows 2003 server but the command "expect" still isn't available. I have never worked with ActiveTCL before only Perl. So how can I install this and run this on a Windows Server?
User avatar
Brianetta
Tycoon
Tycoon
Posts: 2566
Joined: 15 Oct 2003 22:00
Location: Jarrow, UK
Contact:

Post by Brianetta »

You can't. Although the only change required is the line to load the Expect libraries, ActiveTCL doesn't believe that OpenTTD is a Windows 32 bit console application, and so cannot control the console. There is no work-around as far as I know. Perhaps some other Tcl/Expect product might work on the platform.
PGP fingerprint: E66A 9D58 AA10 E967 41A6 474E E41D 10AE 082C F3ED
User avatar
Rysiek
Engineer
Engineer
Posts: 43
Joined: 19 Mar 2005 16:41
Location: Poland, Biala Podlaska
Contact:

Post by Rysiek »

How install? I have dedicated server on the linux!
Image

polish forum
about openttd

http://openttd.prochy.pl - zapraszam.
User avatar
Brianetta
Tycoon
Tycoon
Posts: 2566
Joined: 15 Oct 2003 22:00
Location: Jarrow, UK
Contact:

Post by Brianetta »

Copy the file into your openttd directory, and then:

Code: Select all

$ chmod u+x autopilot.txt
You can run it with:

Code: Select all

$ ./autopilot.txt
You need Tcl and Expect, as I stated earlier.
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 »

Hello,

autopilot does not work any more with MiniIn greater -r5838 ?
Please Help, Autopilot is a great Work for my Server.

sorry for my bad english ;)

cu Picknicker
User avatar
osai
Traffic Manager
Traffic Manager
Posts: 132
Joined: 22 Sep 2004 14:56
Location: 10.0.1.254
Contact:

Post by osai »

Brianetta is not available these days,
but you could already write what exactly not works!
Maybe someone else can help you too!
Picknicker
Engineer
Engineer
Posts: 20
Joined: 31 Aug 2006 15:28

Post by Picknicker »

Since MiniIN version -r5476 I pursue a INet server. No Problems.
And now with version -r6027 or greater quit autopilot after start.
Otherwise, nothing was changed.

Code: Select all

bzt@debian3164m:~/OTTD-miniin$ ./startserver
Starting new game
exp_spawn ./openttd -c openttd1.cfg -D


*** AUTOPILOT ENGAGED ***

dbg: [NET][Core] Starting network...
dbg: [NET][Core] Network online. Multiplayer available.
dbg: Detected broadcast addresses:
dbg:  0) 33.122.35.233
debug_level net=0
net_frame_freq 10
pause
expect: spawn id exp6 not open
    while executing
"expect -nobrace -re {
} {*\* .* hat das Spiel betreten
         exp_send "unpause\n"
         set output $expect_out(0,string)
         set output..."
    invoked from within
"expect {
      -re "\n\\\*\\\*\\\* .* hat das Spiel betreten\r" {
         exp_send "unpause\n"
         set output $expect_out(0,string)
         set..."
    ("while" body line 7)
    invoked from within
"while true {
   if $recount_trigger {
      set auto_flag 1
      exp_send "echo recount clients\n"
      set recount_trigger false
   }
   expect {
 ..."
    (file "./startserver" line 89)
bzt@debian3164m:~/OTTD-miniin$      
thanx for help

cu
Picknicker
richk67
Tycoon
Tycoon
Posts: 2363
Joined: 05 Jun 2003 16:21
Location: Up North
Contact:

Post by richk67 »

r6027 was an accidental mid-development build, and should not be used. It will crash games left right and centre. Later builds should be OK.
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
Picknicker
Engineer
Engineer
Posts: 20
Joined: 31 Aug 2006 15:28

Post by Picknicker »

Hello richk67,

First, thank you for the great work on MiniIN.
MiniIN versions -r6027 , r6028 and r6134 finish themselves after the start over autopilot Script.
Without autopilot the versions well work (Topically Version r6134).

r5838 was the last version them has worked with autopilot.

cu
Picknicker
Last edited by Picknicker on 02 Sep 2006 11:57, 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 »

osai wrote:Brianetta is not available these days
Oh yes I am (:
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 »

Can nobody help me? No one idea?

cu
Picknicker
User avatar
Brianetta
Tycoon
Tycoon
Posts: 2566
Joined: 15 Oct 2003 22:00
Location: Jarrow, UK
Contact:

Post by Brianetta »

Which operating system are you using?
What output are you seeing?
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 use Debian 3.1 AMD64 Stable

my output:

Code: Select all

bzt@debian3164m:~/OTTD-miniin$ ./startserver
Starting new game
exp_spawn ./openttd -c openttd1.cfg -D


*** AUTOPILOT ENGAGED ***

dbg: [NET][Core] Starting network...
dbg: [NET][Core] Network online. Multiplayer available.
dbg: Detected broadcast addresses:
dbg:  0) 33.122.35.233
debug_level net=0
net_frame_freq 10
pause
expect: spawn id exp6 not open
    while executing
"expect -nobrace -re {
} {*\* .* hat das Spiel betreten
         exp_send "unpause\n"
         set output $expect_out(0,string)
         set output..."
    invoked from within
"expect {
      -re "\n\\\*\\\*\\\* .* hat das Spiel betreten\r" {
         exp_send "unpause\n"
         set output $expect_out(0,string)
         set..."
    ("while" body line 7)
    invoked from within
"while true {
   if $recount_trigger {
      set auto_flag 1
      exp_send "echo recount clients\n"
      set recount_trigger false
   }
   expect {
 ..."
    (file "./startserver" line 89)
bzt@debian3164m:~/OTTD-miniin$     
MiniIN versions -r6027 , r6028 and r6134 finish themselves after the start over autopilot Script.
Without autopilot the versions well work (current Version r6134).

r5838 was the last version them has worked with autopilot.
0.4.8 also works perfectly, with the same autopilot Script.

sorry for my bad english :?

cu Picknicker
User avatar
Brianetta
Tycoon
Tycoon
Posts: 2566
Joined: 15 Oct 2003 22:00
Location: Jarrow, UK
Contact:

Post by Brianetta »

Interesting that it is simply quitting like that. The only thing that autopilot has done to the server at this point is run the following:

Code: Select all

debug_level net=0
net_frame_freq 10
pause
I have never even so much as downloaded the MiniIN. Do these commands work properly with the dedicated server, without crashing it?

If they do cause it to quit, I'd suggest removing these lines from your startserver script (and logging a bug with Rich). If they don't, then I'm not sure what's wrong at all.
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 »

With nightly r6358 does not function autopilot also any more.
I suppose something it was changed in the code (openTTD), so that cannot be pursued openTTD any more with expect??
Post Reply

Return to “General OpenTTD”

Who is online

Users browsing this forum: No registered users and 4 guests