Automatic robots, patches and scripts etc

Place for people to discuss public servers, and also for admins to lay out the details of their servers
Post Reply
User avatar
Teppic
Private First Class
Private First Class
Posts: 575
Joined: Mon Mar 07, 2005 10:00 pm
Location: The North Block
Contact:

Automatic robots, patches and scripts etc

Post by Teppic » 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

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....
Attachments
RobotStuff.tar
Robot client patch and scripts for 2.0.6
(20 KiB) Downloaded 98 times

User avatar
A Meteorite
Private First Class
Private First Class
Posts: 1786
Joined: Thu Apr 28, 2005 12:56 am
Location: California, U.S.
Contact:

Post by A Meteorite » Tue Apr 11, 2006 4:35 pm

Wow! Thanks Teppic! I think some of us could use these. :D
Image
Owner @ BZFX
Core Admin @ CAN

Email me: bzmet…@gmail.com

Theme97
Private First Class
Private First Class
Posts: 221
Joined: Fri Nov 11, 2005 8:04 pm
Contact:

Post by Theme97 » Tue Apr 11, 2006 4:38 pm

Wow.

/me wishes he had Linux...
Image

User avatar
Teppic
Private First Class
Private First Class
Posts: 575
Joined: Mon Mar 07, 2005 10:00 pm
Location: The North Block
Contact:

Post by Teppic » Tue Apr 11, 2006 5:03 pm

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.

User avatar
a dead man
Private First Class
Private First Class
Posts: 33
Joined: Tue Jan 31, 2006 7:50 am
Location: Canberra, Australia

Post by a dead man » Thu Aug 03, 2006 10:01 pm

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

User avatar
Teppic
Private First Class
Private First Class
Posts: 575
Joined: Mon Mar 07, 2005 10:00 pm
Location: The North Block
Contact:

Post by Teppic » Fri Aug 04, 2006 3:32 pm

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.

User avatar
a dead man
Private First Class
Private First Class
Posts: 33
Joined: Tue Jan 31, 2006 7:50 am
Location: Canberra, Australia

Post by a dead man » Mon Aug 07, 2006 10:04 pm

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(':)')

User avatar
CannonBallGuy
Private First Class
Private First Class
Posts: 2083
Joined: Wed Apr 12, 2006 1:31 am
Contact:

Post by CannonBallGuy » Mon Aug 07, 2006 11:23 pm

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).
Image

Merry Christmas!

"Look, if I don't buy booze for the kids, I don't get any incriminating pictures to show to their parents, my business goes down the sink, my girlfriend leaves me and the baby goes on ebay. So help me search..."

"go Play With Toys urself in a dark alley u donkey ******" - Lt-Kirby2007

User avatar
a dead man
Private First Class
Private First Class
Posts: 33
Joined: Tue Jan 31, 2006 7:50 am
Location: Canberra, Australia

Post by a dead man » Wed Aug 09, 2006 9:13 am

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.

User avatar
The Knights Who Say Ni
Private First Class
Private First Class
Posts: 556
Joined: Mon Sep 26, 2005 7:21 pm
Location: Uplyme, England
Contact:

Post by The Knights Who Say Ni » Wed Aug 09, 2006 9:20 am

that is the command for a plugin
Image
Sig Made By AlliedArmour

TGPH

User avatar
Teppic
Private First Class
Private First Class
Posts: 575
Joined: Mon Mar 07, 2005 10:00 pm
Location: The North Block
Contact:

Post by Teppic » Wed Aug 09, 2006 10:07 pm

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.

Post Reply