Feature request: redirect to clone on full

What do you want to see in Armagetron soon? Any new feature ideas? Let's ponder these ground breaking ideas...
Post Reply
User avatar
~z~
On Lightcycle Grid
Posts: 22
Joined: Sat Jul 18, 2009 5:46 pm

Feature request: redirect to clone on full

Post by ~z~ »

Is it possible to redirect players to another server (a clone or a waiting server) when your server becomes full? If not, would this be interesting enough for the devs to pick it up?
User avatar
DDMJ
Reverse Outside Corner Grinder
Posts: 1882
Joined: Thu Jun 08, 2006 12:15 am
Location: LA, CA, USA, NA
Contact:

Re: Feature request: redirect to clone on full

Post by DDMJ »

There's a MOVE_TO command. Just make a script that reads the number of players and executes the MOVE_TO command when a new client enters.
User avatar
~z~
On Lightcycle Grid
Posts: 22
Joined: Sat Jul 18, 2009 5:46 pm

Re: Feature request: redirect to clone on full

Post by ~z~ »

How would I go about scripting something like this? Does AA have some of platform for writing plugins or do I have to edit the source? I actually was more hoping to do this for popular servers so that I wouldn't have to wait for WWctf to empty :roll:, as opposed to using the feature myself.
User avatar
AI-team
Shutout Match Winner
Posts: 1020
Joined: Tue Jun 23, 2009 6:17 pm
Location: Germany/Munich
Contact:

Re: Feature request: redirect to clone on full

Post by AI-team »

sty+ct is what you should be looking for =)
  
 
"95% of people believe in every quote you post on the internet" ~ Abraham Lincoln
 
 
Luke-Jr
Dr Z Level
Posts: 2246
Joined: Sun Mar 20, 2005 4:03 pm
Location: IM: luke@dashjr.org

Re: Feature request: redirect to clone on full

Post by Luke-Jr »

This is a fairly simple feature to implement. As of now, it's available on servers I host (on request). I will also push it to trunk next time I do something there. For a one-time $15, I will publish my 0.2.8 branch with it or (at your option) send it only to you. ;)

For $25 (total), I'll even assign the copyright on the code to implement this feature to you. The only practical value to this is if someone wants to license it outside the GPL terms (for example, to make an X-Box or iPhone port), they will need to include you in their negotiations (or strip out the feature...). Might also be worth bragging rights depending on the community. ;)
User avatar
~z~
On Lightcycle Grid
Posts: 22
Joined: Sat Jul 18, 2009 5:46 pm

Re: Feature request: redirect to clone on full

Post by ~z~ »

AI-team wrote:sty+ct is what you should be looking for =)
I haven't found such a feature on sty+ct.
Luke-Jr wrote:This is a fairly simple feature to implement. As of now, it's available on servers I host (on request). I will also push it to trunk next time I do something there. For a one-time $15, I will publish my 0.2.8 branch with it or (at your option) send it only to you. ;)

For $25 (total), I'll even assign the copyright on the code to implement this feature to you. The only practical value to this is if someone wants to license it outside the GPL terms (for example, to make an X-Box or iPhone port), they will need to include you in their negotiations (or strip out the feature...). Might also be worth bragging rights depending on the community. ;)
I'm good thanks. If you won't charge me, could you please bump this thread next time you commit to trunk?
User avatar
AI-team
Shutout Match Winner
Posts: 1020
Joined: Tue Jun 23, 2009 6:17 pm
Location: Germany/Munich
Contact:

Re: Feature request: redirect to clone on full

Post by AI-team »

~z~ wrote:
AI-team wrote:sty+ct is what you should be looking for =)
I haven't found such a feature on sty+ct.
There's is none. You have to code it yourself :D

Code: Select all

<?php

$max_clients = 32; // EDIT THIS LINE
$server_move_to = "IP ADDRESS"; // EDIT THIS LINE
$port_move_to = "SERVER PORT"; // EDIT THIS LINE

$num_players = 0; // the rest should be kept as it is 

while (1) {
      $line = rtrim(fgets(STDIN, 1024));


      if (preg_match("/^PLAYER_ENTERED/", $line)) {
            $keywords = preg_split("/ /", $line);
            $player_id = trim($keywords[1]);
            $player_ip = $keywords[2];
            $player_name = "";

            if ($num_players == $max_clients) {
                  echo "MOVE_TO $player_id $server_move_to:$port_move_to\n";
                  break 2;
            }

            $num_players +=1;
      }

      if (preg_match("/^PLAYER_LEFT/", $line)) {
            $num_players -=1;
      }
}
?>
I assume you know how to start a server with a parser.
If not: http://crazy-tronners.com/wiki/index.ph ... g_a_Server
Last edited by AI-team on Wed Aug 11, 2010 4:55 pm, edited 4 times in total.
  
 
"95% of people believe in every quote you post on the internet" ~ Abraham Lincoln
 
 
User avatar
kyle
Reverse Outside Corner Grinder
Posts: 1963
Joined: Thu Jun 08, 2006 3:33 pm
Location: Indiana, USA, Earth, Milky Way Galaxy, Universe, Multiverse
Contact:

Re: Feature request: redirect to clone on full

Post by kyle »

actually that won't necessarily work, and $max_clients would have to be 1 less than full. Unless you update the $num_players on PLAYER_ENTERED before the check.

This should be PLAYER_LEFT

Code: Select all

          if (preg_match("/^PLAYER_ENTERED/", $line)) {
                $num_players -=1;
          }  
Image
User avatar
AI-team
Shutout Match Winner
Posts: 1020
Joined: Tue Jun 23, 2009 6:17 pm
Location: Germany/Munich
Contact:

Re: Feature request: redirect to clone on full

Post by AI-team »

Ops , copy-paste fail :P

EDIT: I also noticed the break fail (missing 2 ) :)
  
 
"95% of people believe in every quote you post on the internet" ~ Abraham Lincoln
 
 
Luke-Jr
Dr Z Level
Posts: 2246
Joined: Sun Mar 20, 2005 4:03 pm
Location: IM: luke@dashjr.org

Re: Feature request: redirect to clone on full

Post by Luke-Jr »

Committed to trunk in bzr-etrunk-rev 996 (I didn't have anything else to push, but it's been long enough to know nobody cares to sponsor this development...)
Post Reply