Rotating Maps

Place for people to discuss public servers, and also for admins to lay out the details of their servers
Post Reply
User avatar
ducatiwannabe
Private First Class
Private First Class
Posts: 3258
Joined: Tue Aug 10, 2004 3:55 pm
Location: Planet Earth
Contact:

Rotating Maps

Post by ducatiwannabe »

How could I go about putting my rotating server together? I have my conf, which I will only change a few things on for each rotation, and I have my maps. How do I put it together, or make it so it changes to another map?
Guest

Post by Guest »

Do you want to know how to run a server?
If you just want to change whats on your server, you just close bzfs, change the map/conf and rerun bzfs...
User avatar
ducatiwannabe
Private First Class
Private First Class
Posts: 3258
Joined: Tue Aug 10, 2004 3:55 pm
Location: Planet Earth
Contact:

Post by ducatiwannabe »

NO.......I am trying to figure out how to get rotating maps, like some servers. So I don't have to keep going and changing settings.
User avatar
LouMan
Chief Sgt. of Cartography
Chief Sgt. of Cartography
Posts: 338
Joined: Mon Jan 31, 2005 3:05 am
Location: Michigan, USA

Rotating maps

Post by LouMan »

There have been several people that have asked how I set up the rotating maps on my server and I thought it might be helpful to explain exactly how I have done this in this thread.

First of all, my servers run on linux (Mandrake with KDE front end) and I use the kalarm application within KDE as a task scheduler/manager. This particular application is based on crontab and allows easy scheduling of tasks based on time to start, duration, repeats, etc. I would assume that any task scheduler available for any operating system would also be able to do the same.

In order for kalarm to initiate the server for a particular map, I had to write a very simple shell script for each map I wanted to run. For example, the shell script for my "Bridges" map is called "Bridges.sh" and contains the following simple script:

exec /home/louman/bin/bzfs -conf "/home/louman/bzflag/Bridges.conf"

Obviously, the location of the bzfs application and name(s) of the files would be server specific. I have created separate, similar shell scripts created for each map I want to run in the rotation.

I have the maps on my server rotating every 2 hours. I have found that the only way I can "cleanly" terminate the bzfs application after each map has run for 2 hours is to use a timed game for each map, with the following settings in the .conf file for each map:

#Set time limit on each game [s]: 7140 seconds = 1 hour, 59 minutes
-time 7140

#Serve one game and exit: needed to have bzfs "cleanly" shut itself down
-g

This will terminate the bzfs application after 1 hour and 59 minutes. I did not use the full 2 hours, because I didn't want any scheduling conflicts with the next map in the rotation.

When I first tried this, I thought that the map rotation was working properly and everything seemed to be functioning correctly. I soon found out, though, that a timed game with the -g setting in the .conf file will terminate after a player joins, and then leaves (1 game served). Obviously, I did not want a single player killing the server by joining and leaving anywhere during the map rotation. My solution to this was to create a "dummy" player on the server that would join shortly after the server started and stay there until the server's time had expired. To do this, I again created a simple shell script to run a bzadmin application instance for the server. For example, the shell script for my server's bzadmin is called "joinadmin5150.sh" and contains the following simple script:

exec /home/louman/bin/bzadmin Admin@louman.homelinux.net:5150 "/password_XXXXXXX"

Not being entirely satisfied with the behavior of the flags on some of my servers, I also set up kalarm to initiate automatic flag resets (unused) after regular periods of time. To do this, I wrote a shell script very similar to the one above called "flagreset5150.sh" that contained the following script:

exec /home/louman/bin/bzadmin flagreset5150@louman.homelinux.net:5150 "/password_XXXXXXX" "/flag reset unused" "/quit"

The last script I wrote as a courtesy to those not familiar with timed games. Although BZFlag clearly shows time remaining on the HUD, I would assume that some people do not know what that timer represents. So, the last script I called "timewarning.sh" that contained the following script:

exec /home/louman/bin/bzadmin timewarning@louman.homelinux.net:5150 "Warning - approx. 10 minutes left in game..." "/quit"

The task scheduling in kalarm was then set up in the following manner (for example):

Alarm 1: run "Bridges.sh" starting at 12:00, repeat every 8 hours
Alarm 2: run "joinadmin5150.sh" starting at 12:01, repeat every 2 hours
Alarm 3: run "flagreset5150.sh" starting at 12:30, repeat every 1 hour
Alarm 4: run "timewarning.sh" starting at 13:50, repeat every 2 hours
Alarm 5: run "Camelot.sh" starting at 14:00, repeat every 8 hours
Alarm 6: run "ColumnsAndRivers.sh" starting at 16:00, repeat every 8 hours
Alarm 7: run "IslandHopping.sh" starting at 18:00, repeat every 8 hours

With my kalarm set this way, the final timing would look something like:

12:00: kalarm "Bridges.sh" will initiate map server
12:01: kalarm "joinadmin5150.sh" will join bzadmin player to map server
12:30: kalarm "flagreset5150.sh" will execute a flag reset on server
13:30: kalarm "flagreset5150.sh" will execute a flag reset on server
13:50: kalarm "timewarning.sh" will execute a 10 minute time warning
13:59: "Bridges" map server will terminate from -time setting in .conf file
14:00: kalarm "Camelot.sh" will initiate map server
14:01: kalarm "joinadmin5150.sh" will join bzadmin player to map server
14:30: kalarm "flagreset5150.sh" will execute a flag reset on server
15:30: kalarm "flagreset5150.sh" will execute a flag reset on server
15:50: kalarm "timewarning.sh" will execute a 10 minute time warning
15:59: "Camelot" map server will terminate from -time setting in .conf file
16:00: kalarm "ColumnsAndRivers.sh" will initiate map server
16:01: kalarm "joinadmin5150.sh" will join bzadmin player to map server
16:30: kalarm "flagreset5150.sh" will execute a flag reset on server
17:30: kalarm "flagreset5150.sh" will execute a flag reset on server
17:50: kalarm "timewarning.sh" will execute a 10 minute time warning
17:59: "ColumnsAndRivers" map server will terminate from -time setting in .conf file
18:00: kalarm "IslandHopping.sh" will initiate map server
18:01: kalarm "joinadmin5150.sh" will join bzadmin player to map server
18:30: kalarm "flagreset5150.sh" will execute a flag reset on server
19:30: kalarm "flagreset5150.sh" will execute a flag reset on server
19:50: kalarm "timewarning.sh" will execute a 10 minute time warning
19:59: "IslandHopping" map server will terminate from -time setting in .conf file
.
.
. (repeats)


Although this looks like a lot of work, it is fairly simple to accomplish. Once you know the system, it's easy - I can change the rotation of the maps, add a new map to the lineup, etc. within a matter of minutes.

I hope this can help somebody!
User avatar
Dervish
Private First Class
Private First Class
Posts: 651
Joined: Thu Dec 05, 2002 12:39 am
Location: public void

Post by Dervish »

Nice info LouMan, thanks! Any data I can absorb about running bzfs in new ways on Linux helps me, even if someone else initiates the question. :) I've been wondering what command magic they use for automatic cycling of the maps.
protected object myTank(){
foreach(noob in this.game){return frag(noob);}}
Image
User avatar
ClayOgre
Private First Class
Private First Class
Posts: 227
Joined: Mon Apr 18, 2005 3:17 am
Location: Southern Indiana (originally from Alaska)

Thank you as well

Post by ClayOgre »

I shall have to take a look into doing this. I run a "bootleg" server on the LAN at work. The computers are all Windows XP, but I load up a Knoppix3.8 disk in console mode on an unused computer, put bzfs and my maps into the Knoppix ramdisk from a USB key, then run the Knoppix sshstart script. I start and stop the server by running PuTTy on whatever windoze box I happen to be on at the time. I only have three players including myself and we all use the windows bzflag client. I'd like to get it to run automatically and switch maps. I shall have to give the information in your tutorial a try.
User avatar
ducatiwannabe
Private First Class
Private First Class
Posts: 3258
Joined: Tue Aug 10, 2004 3:55 pm
Location: Planet Earth
Contact:

Post by ducatiwannabe »

Does anybody know how to make rotating maps on windows?
User avatar
DTRemenak
General
General
Posts: 625
Joined: Thu Jan 16, 2003 4:54 am
Location: U.S.
Contact:

Post by DTRemenak »

DW, check the other thread on this topic ("Server rotation bash script").
Post Reply