Map Rotation without 0.3
Map Rotation without 0.3
Is there a way i can use map rotation with http://wiki.armagetronad.net/index.php?title=Sty (0.2.? Like maybe a script of some sort? (An already made up script?)
^Someone's mad
-
- Posts: 7
- Joined: Sun Sep 19, 2010 12:46 am
Re: Map Rotation without 0.3
I know how...By reading this http://wiki.armagetronad.net/index.php? ... g_Rotation and this to ask Zurd.
- INW
- Reverse Outside Corner Grinder
- Posts: 1950
- Joined: Tue Jul 07, 2009 4:10 pm
- Location: Charlotte, NC, USA
Re: Map Rotation without 0.3
I am pretty sure you have to have .3 for it to work. Now all you need is the .3 Armagetron server. You can still play tron with the 2.8.x version but when hosting a server, you must use .3.
Re: Map Rotation without 0.3
I'm pretty sure you can setup a rotation server using 0.2.8.x. How is what I do not know. Try asking Kyle for info on it.
<-- Proud co-leader of Rogue Tronners
- kyle
- Reverse Outside Corner Grinder
- Posts: 1876
- Joined: Thu Jun 08, 2006 3:33 pm
- Location: Indiana, USA, Earth, Milky Way Galaxy, Universe, Multiverse
- Contact:
Re: Map Rotation without 0.3
With a script
I don't really have any script fragments with just rotation, that is the problem
Mainly read in ladderlog.txt and on ROUND_COMMENCING you change the maps
use the WAIT_FOR_EXTERNAL_SCRIPT setting to help with the process
I don't really have any script fragments with just rotation, that is the problem
Mainly read in ladderlog.txt and on ROUND_COMMENCING you change the maps
use the WAIT_FOR_EXTERNAL_SCRIPT setting to help with the process
- AI-team
- Shutout Match Winner
- Posts: 1020
- Joined: Tue Jun 23, 2009 6:17 pm
- Location: Germany/Munich
- Contact:
Re: Map Rotation without 0.3
I think I once wrote a script for my server which has map rotation in it.
Let me have a look
edit: Sorry , I don't have it anymore
Let me have a look
edit: Sorry , I don't have it anymore
"95% of people believe in every quote you post on the internet" ~ Abraham Lincoln
Re: Map Rotation without 0.3
Dunno if this one is useful to anyone, it's just a quick'n'dirty PHP solution:
The above is supposed to sit in your map folder, running as a kind of cronjob every n seconds, where n=shortest possible round time (extra_round_time?). You will have to correct the (relative) paths to ladderlog.txt and everytime.cfg, though.
If you want your maps fetched from an external resource, creating dummy files with the same name as the desired maps and setting resource_repository_server should do the job.
The reason why I'm not using wait_for_whatever is that I, obviously, am unable to tell my AA to write it to ladderlog.txt. /me builds workarounds instead.
EDIT: NOTE: forgot to say this one only works correct if "NEW_ROUND" is the only thing you write to ladderlog. Mea culpa.
(I'm not sure if map_file accepts php resources which generate/select a map on-the-fly, like Username/race/mapscript.php; would be a bit easier.)
Btw, if someone needs Windows batch scripts (rotation/random) for a server at home, i have some.
General question @ all: As this topic comes up quite frequently, would it be a good idea to open a thread where admins could post their rotator/randomizer/anything scripts to share experiences and help others?
Code: Select all
<?php
/*
First make sure a list of all map files exists, otherwise create one.
*/
if(!file_exists("maplist.txt")){
$data=fopen("maplist.txt","w");
$dir=opendir(".");
while($file=readdir($dir)){
if(strstr($file,"aamap.xml"))fwrite($data,$file."\n");
}
closedir($dir);
fclose($data);
$index=fopen("count.txt","w");
fwrite($index,0);
fclose($index);
}
/*
Check the ladderlog for a NEW_ROUND. If found, write the map next
to come into everytime.cfg, write the incremented index back and
clear ladderlog.
*/
$log=file("ladderlog.txt");
if(trim($log[0])=="NEW_ROUND"){
$maps=file("maplist.txt");
$index=file("count.txt");
$pointer=$index[0];
$every=fopen("everytime.cfg","w");
fwrite($every,"map_file ".trim($maps[$pointer]));
fclose($every);
$pointer++;
if($pointer==count($maps))$pointer=0;
$index=fopen("count.txt","w");
fwrite($index,$pointer);
fclose($index);
$log=fopen("ladderlog.txt","w");
fclose($log);
}
?>
If you want your maps fetched from an external resource, creating dummy files with the same name as the desired maps and setting resource_repository_server should do the job.
The reason why I'm not using wait_for_whatever is that I, obviously, am unable to tell my AA to write it to ladderlog.txt. /me builds workarounds instead.
EDIT: NOTE: forgot to say this one only works correct if "NEW_ROUND" is the only thing you write to ladderlog. Mea culpa.
(I'm not sure if map_file accepts php resources which generate/select a map on-the-fly, like Username/race/mapscript.php; would be a bit easier.)
Btw, if someone needs Windows batch scripts (rotation/random) for a server at home, i have some.
General question @ all: As this topic comes up quite frequently, would it be a good idea to open a thread where admins could post their rotator/randomizer/anything scripts to share experiences and help others?
Last edited by Wik on Mon Dec 06, 2010 2:50 pm, edited 3 times in total.
- kyle
- Reverse Outside Corner Grinder
- Posts: 1876
- Joined: Thu Jun 08, 2006 3:33 pm
- Location: Indiana, USA, Earth, Milky Way Galaxy, Universe, Multiverse
- Contact:
Re: Map Rotation without 0.3
A lot of bugs will happen with wik's so i wrote a really quick one, untested, but should work
Note I have not tested it
to run look here
this is meant to be feed into the server
and feed laderlog.txt to it.
very generally
the maps is an array of your map files
EDIT: added \n to end of output lines
Code: Select all
#!/usr/bin/php
<?php
$maps=array("map1.aamap.xml","map2.aamap.xml");
while (1) {
$line = rtrim(fgets(STDIN, 1024));
if ( preg_match( "/^ROUND_COMMENCING/", $line ) ){
$keywords = preg_split("/ /", $line);
$map=rand (0 , count($maps )-1);
echo "MAP_FILE ".$maps[$map]."\n";
echo "WAIT_FOR_EXTERNAL_SCRIPT 0\n";
sleep(6);
echo "WAIT_FOR_EXTERNAL_SCRIPT 1\n";
}
}
?>
to run look here
this is meant to be feed into the server
and feed laderlog.txt to it.
very generally
Code: Select all
tail -f laderlog.txt | thisscript.php | armagetronad
EDIT: added \n to end of output lines
Last edited by kyle on Mon Dec 06, 2010 4:36 am, edited 1 time in total.
Re: Map Rotation without 0.3
I guess not :) It's tested successfully. Given the correct paths for the relevant files, of course, and that you have to sacrifice your other ladderlog content. Please tell me what other bugs you mean, via PM.A lot of bugs will happen with wik's
And the code has to remember somehow which map was the last one; this line
Code: Select all
$map=rand (0 , count($maps )-1);
Addendum:
Code: Select all
while (1) {
- kyle
- Reverse Outside Corner Grinder
- Posts: 1876
- Joined: Thu Jun 08, 2006 3:33 pm
- Location: Indiana, USA, Earth, Milky Way Galaxy, Universe, Multiverse
- Contact:
Re: Map Rotation without 0.3
wik the main thing is how can you guarantee that the second it runs with lots of people that the NEW_MAP will be located first in the array?
the while loop in mine will stop at "$line = rtrim(fgets(STDIN, 1024));" if there is no line to read in.
I did sort of test it just now, only think i forgot were the \n at the end of what i print out (edited it in)
also if you don't want random just keep a counter variable and reset it when it gets bigger than count
the while loop in mine will stop at "$line = rtrim(fgets(STDIN, 1024));" if there is no line to read in.
I did sort of test it just now, only think i forgot were the \n at the end of what i print out (edited it in)
also if you don't want random just keep a counter variable and reset it when it gets bigger than count
Re: Map Rotation without 0.3
Really? Since the condition "1" is always true, it would run eternally while fgets "accidentally" picks up freshly written data now and then.the while loop in mine will stop at "$line = rtrim(fgets(STDIN, 1024));" if there is no line to read in.
Presuming the server will be up 24/7, by never changing the list again once it is written using thisguarantee that the second it runs [...] the NEW_MAP will be located first
Code: Select all
if(!file_exists("maplist.txt")){
Afterwards I
in a file, that's all.just keep a counter variable
I deem it a good thing to have the maps on the game server and being independant of external (re)sources, therefore said maplist. Nothing else.
A bit improved version: 1. no maplist file needed anymore; 2. you keep your ladderlog content. Fill in the path/to/ladderlog.txt and put in where your everytime.cfg is.
(I still don't rely on stdin/stdout for some reasons.)
Last edited by Wik on Mon Dec 06, 2010 8:08 am, edited 1 time in total.
Re: Map Rotation without 0.3
Pretty good material here. I linked the wiki to it.
Re: Map Rotation without 0.3
Just did some research on it: it does. And there was much rejoicing. [Edited, typo. sry AI]I'm not sure if map_file accepts php resources
This means, you only have to write in your everytime.cfg a line like "rinclude url/to/mapdemon.php" (for example), everything else is script managed. The big advantage here is that it only runs when it's actually needed - in between rounds - leaving us much more CPU time during fights, thus smoother gameplay and less lag. (Correct me please if this assumption is wrong.)
One could not only change or generate maps this way, but do a lot of other fancy stuff (gametype voting, autosuspend TK'ers, hall of fame... off topic, I know).
Eh... writing that makes me understand how some admins do their magic. Woot.
I'll post a bit of example code, but it could take some time. Real life duties, meh.
Last edited by Wik on Mon Dec 06, 2010 4:57 pm, edited 3 times in total.
- AI-team
- Shutout Match Winner
- Posts: 1020
- Joined: Tue Jun 23, 2009 6:17 pm
- Location: Germany/Munich
- Contact:
Re: Map Rotation without 0.3
Wow thx for the info , I didn't know include could handle .php filesWik wrote:Just did some research on it: it does, and INCLUDE does, too. And there was much rejoicing.I'm not sure if map_file accepts php resources
This means, you only have to write in your everytime.cfg a line like "include mapdemon.php" (for example), everything else is script managed. The big advantage here is that it only runs when it's actually needed - in between rounds - leaving us much more CPU time during fights, thus smoother gameplay and less lag. (Correct me please if this assumption is wrong.)
"95% of people believe in every quote you post on the internet" ~ Abraham Lincoln