Automatic robots, patches and scripts etc
Posted: Tue Apr 11, 2006 4:32 pm
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
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.
Now run the robot client withand 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.
Run the robot client with
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
The script is small enough to post so
The Autobot Script
This is a bit more complicated so here is the output of the --help switch
-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
If you open the script up in your favourite editor you can change the line to names you'd like for your robots.
Job done....
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
Code: Select all
cp ~/.bzf/2.0/config.cfg ~/.bzf/2.0/robot.cfg
Code: Select all
bzrobot -window botname@server:port
Code: Select all
chmod 440 ~/.bzf/2.0/robot.cfg
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
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
This is a bit more complicated so here is the output of the --help switch
-a -p -P -e -c -m -s -d -E and -h are pretty self explanitory.-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.
-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 &
Code: Select all
self.botnames=('',blah blah blah)
Job done....