Page 1 of 1

Automatic robots, patches and scripts etc

Posted: Tue Apr 11, 2006 4:32 pm
by Teppic
I did say when 2.0.6 was released I'd publish the robot client patch and associated automation scripts, so here they are.

Instructions for the patch
Download the 2.0.6 tarball and unpack it
Copy the patch file to the base bzflag-2.0.6 directory
Run

Code: Select all

patch -p1 < tep-bot.patch
./configure
make
su [enter password]
cp src/bzflag/bzflag $(which bzflag|sed 's/bzflag/bzrobot/')
exit
You need to make a copy of your config.cfg file specifically for the robot to use. This means you can turn off the sound drivers and turn down the graphics options (for the second or so the window is on the screen), set the bot email string etc.

Code: Select all

cp ~/.bzf/2.0/config.cfg ~/.bzf/2.0/robot.cfg
Now run the robot client with

Code: Select all

bzrobot -window botname@server:port
and after it minimises, re-open the window and change the settings as you want them, and exit bzrobot. Now I tend to change the permissions on the config file so it can't be written to by accident.

Code: Select all

chmod 440 ~/.bzf/2.0/robot.cfg
Run the robot client with

Code: Select all

bzrobot -window botname@server:port

Rotation script

It's pretty simple, put a seperate config file (filename ending in .conf) for each map you want to rotate into an empty directory, edit the script so that '/home/andy/.bzf/confs/' points to this directory, also edit '/usr/games/bin/bzfs' so it points to your bzfs binary.
Put the script in your path (either /usr/local/bin or ~/bin) and run it with

Code: Select all

bzrotate mypassword
The script is small enough to post so

Code: Select all

#!/bin/bash
while true
do
        for conf in /home/andy/.bzf/confs/*.conf
        do
                #echo $conf
                /usr/games/bin/bzfs -conf $conf -passwd $1 -d >/tmp/bzfs.log
        done
done
The Autobot Script
This is a bit more complicated so here is the output of the --help switch
-a or --serveraddress <server ip>: Listen ip of server, default <127.0.0.1>
-p or --port <port>: Listen port of server, default <5154>
-P or --password <password>: servers main admin password, for bzadmin /ban access, default <password> *** SET THIS OPTION***
-c or --confsdir <path>: Path to bzfs log file, default </tmp/bzfs.log>
-l or --logfile <path>: File to log server output to, default <none>
-e or --exepath <path>: Path to bz executables folder, default </usr/bin>
-m or --maxbots <int>: Maximum number of bots to spawn on a server, default <6> max <19> (0=option off)
-s or --startbots <int>: Number of bots to spawn on server startup, default <3>
-b or --bantime <int(minutes)>: Length of time to ban admin/cop askers, default <0> (0=option off)
-d or --display <X display>: Set the DISPLAY environment variable, so script can run in tty with robots i n X
-h or --help : Show this helpfile
-E or --echo : Echo server output to stdout
-A or --abusefile <path>:File containg callsigns of players known to abuse the autobot scripts.
-a -p -P -e -c -m -s -d -E and -h are pretty self explanitory.
-c is a little non-intuitive, but it's an old switch I converted to do something new, point it to the logfile specified in the rotate script.
-l is if you want a permanent server log from all the maps.

I run mine with

Code: Select all

bzwrap-1.3 -P myserverpassword -c /tmp/bzfs.log -e /usr/games/bin -E -A /home/andy/.bzf/abusers.txt &
If you open the script up in your favourite editor you can change the line

Code: Select all

self.botnames=('',blah blah blah)
to names you'd like for your robots.
Job done....

Posted: Tue Apr 11, 2006 4:35 pm
by A Meteorite
Wow! Thanks Teppic! I think some of us could use these. :D

Posted: Tue Apr 11, 2006 4:38 pm
by Theme97
Wow.

/me wishes he had Linux...

Posted: Tue Apr 11, 2006 5:03 pm
by Teppic
Just as a side note, these instructions presume you have 2.0.6 allready installed, if you did so from source then just patch the sources and recompile, no configure step.

Posted: Thu Aug 03, 2006 10:01 pm
by a dead man
in what order do you run the scripts/apps?

is it rotate.sh->bzrobot->bzwrap or bzrobot->bzwrap->rotate.sh etc....

or does it matter at all?

seems to work, but depends on the TOD :)

running on OSX 10.4.7

Posted: Fri Aug 04, 2006 3:32 pm
by Teppic
Good point.

rotate.sh should be run first, this starts the server and logging etc, then bzwrap
bzrobot doesn't need to be run, as it is run by the wrapper script when needed.

EDIT:I just tested he patch on the 2.0.8 sources, seems to work ok with that too.

Posted: Mon Aug 07, 2006 10:04 pm
by a dead man
er just one quick question, probably a no brainer but i musta missed it somewhere, what is the command to add bots to the game? i have tried some of what looks like the commands in bzwrap but keep getting unknown command

sheepishly staring at shuffling feet javascript:emoticon(':)')

Posted: Mon Aug 07, 2006 11:23 pm
by CannonBallGuy
Run bzflag in your command line and add -solo 3 to the end, for 3 bots as an example.

Like this:

Code: Select all

/path/to/bzflag -solo 6
(6 bots).

Posted: Wed Aug 09, 2006 9:13 am
by a dead man
i am aware of how to do it with the client, this script is for the server side. I thought that the command to add bots was xrobotsplease where x is the number of bots, but it dont seem to work.

Posted: Wed Aug 09, 2006 9:20 am
by The Knights Who Say Ni
that is the command for a plugin

Posted: Wed Aug 09, 2006 10:07 pm
by Teppic
When the scripts were written originally it did everything from python, run the server, rotate the maps, add the robots, kick people asking to be admin/cop.
Then I split it into two, one to run the server and one to do the rest, mainly because I had some dodgy nvidia drivers at the time and whenever X crashed the server went down :cry:

Once the server is up and running, run bzwrap, log into the server with a normal client and look for 'TheBot Daddy' in the observers, if he isn't there then you did something wrong.
The server watches the log file for specific key phrases that it uses to trigger events. <quickly opens script to look them up.......>

Code: Select all

#robotplayers                                                          sets the currnt number of robots on the server to #

norobotsplease                                                        sets the currnt number of robots on the server to 0

/nobotcontrolfor {player}                                         stops player being able to set the number of bots

/nobotcontrolfor {player} permanently                      stops player being able to set the number of bots and adds them to your bot abuser file for future reference

can i be admin                                                         gets you kicked off the server

can i be cop                                                             gets you kicked off the server
In addition the script will return warnings to players who try to set too many bots (ie above the maximum level), if they ignore the warnings twice more they also get kicked.