Posted: Wed Apr 12, 2006 3:43 am |
|
I was thinking, for random dz's, walls, etc... map_file ed/fortress/map.cgi?round=9&mode=1&etc...
Then could use cgi to generate each map
Problem is, the map HAS TO BE $mapname$ + '-' + $version$ + '.aamap.xml'
It can't have anything after the '.aamap.xml'
Also, FAT file systems, and Windoze shell (even XP on a NTFS partion) both have trouble with oddly named files, so question marks and qual signs are out.
I'll have to think more about this rotating, randomly generated maps (or walls, or what not). Probably will have to be done through the tail command :/
Unless you want to get hacky and set your /resources/ed/fortress/ 404 page to a cgi script that returns a text/xml document, based on the requested name. <-- this is probably the easiest way to return randomly generated maps, with the least amount of effort.
#!/bin/bash
# default initial sub_sub_ver
SUB_SUB_VER=0;
while true
do
line=""
read line
echo $line
# get the latest sub_sub_ver
if [ -f /tmp/sub_sub_ver.atrond ]
then
let "SUB_SUB_VER=$(cat /tmp/sub_sub_ver.atrond)+1"
fi
echo -n $SUB_SUB_VER > /tmp/sub_sub_ver.atrond
# Now just test for '[0] Go (round '
if [ "$line" == '[0] Go (round ' ]
then
# sed out the round number (regardless of the number of rounds)
ROUND=$(echo $line | sed -rn 's/\[0\] Go \(round ([0-9]+) of [0-9]+ \)\!/\1/;p')
# Set the map file to a 404 error page that will use the round information to decide on what map to generate.
echo "MAP_FILE ed/fortress/random_maps_${ROUND}-0.2.0_${SUB_SUB_VER}.aamap.xml" > /usr/local/var/games/armagetronad-dedicated/var/everytime.cfg
fi
done
|
In the cgi 'error page hack' script you simply grab the appropriate ENV{} parameter to pick out 'random_maps_${ROUND}-0.2.0_${SUB_SUB_VER}.aamap.xml' in the request. s/// out the round number and generate the xml file. do a print "Content-Type: text/xml; charset=UTF-8\n\n"; and then start printing out the generated map.
Ofcourse the problem with ~any~ randomly generated map, is the amount of 5 to 10k files that will be permanently stored on the clients computer. (I'm up to 1.2MB in my resource directory, and I don't play randomly generated maps! Imagine how big that could get if I played wild with this script, for one day straight! almost noticable,

, but still, some people don't even have 20 Gig HDs).