It is currently Thu May 01, 2025 11:35 am

RUNNING WITH RIFLES Multiplayer

test

Game servers 47 List provided by EpocDotFr | Players online 145


All times are UTC




Post new topic Reply to topic  [ 22 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
PostPosted: Thu May 23, 2013 8:21 pm 
Offline
Site Admin

Joined: Mon Jun 27, 2011 11:59 am
Posts: 2856
Actually, to gain access to any of those old hacky commands used directly in the server console, we could have one chat command that just routes anything after it as a server console command.

Didn't test this one the slightest bit:

Code:
...

      } else if (check_command($message, "command")) {
         $this->handle_console_command($message);
      }

...
   // --------------------------------------------
   function handle_console_command($message) {
      // TODO: remove this
      $this->metagame->comms->send("say 1");

      // get everything given after the command name
      $command = substr($message, strlen("command ") + 1);

      $this->metagame->comms->send("say sending " . $command);
      $this->metagame->comms->send($command);
   }



With this (or something like that, not sure if it runs), you can say "/command max_soldiers 123" in the chat, I think.


Top
 Profile  
 
PostPosted: Sat May 25, 2013 3:24 pm 
Offline
Site Admin

Joined: Mon Jun 27, 2011 11:59 am
Posts: 2856
Here's something we might try in tomorrow's match, to handle some balancing manually. /faction 0 or /faction 1 to switch the faction.

Code:

...
      $message = $event->getAttribute("message");
      // for the most part, chat events aren't commands, so check that first
      if (!starts_with($message, "/")) {
         return;
      }

      $sender = $event->getAttribute("player_name");
      $sender_id = $event->getAttribute("player_id");

      if (check_command($message, "faction")) {
         $this->handle_change_faction($message, $sender_id);
      }
...

   // --------------------------------------------
   function handle_change_faction($message, $sender_id) {
      // just for debugging, this shows to everyone
      //$this->metagame->comms->send("say switch!");

      // get faction as parameter, no validation here, server should rule out mistakes
      $faction_id = substr($message, stripos($message, " ") + 1);

      $command =
         "<command class='update_player' player_id='" . $sender_id . "' faction_id='" . $faction_id . "'/>\n";

      $this->metagame->comms->send($command);
   }


Top
 Profile  
 
PostPosted: Sat May 25, 2013 6:59 pm 
Offline
User avatar

Joined: Tue Mar 05, 2013 12:25 am
Posts: 193
I tested the kick and faction change commands and both worked.
Just remember to hit space to respawn after doing the faction change.
It looks like the game's about to crash sice everything freezes up for a bit :P , but in reality everything is ok.
Perhaps add a chat message that tells the player to do just that?

http://pastebin.com/f2PfGtD5 <- There is the updated basic_command_handler.php for easy copypasting for anyone else that wants to test it. ;)


Top
 Profile  
 
PostPosted: Sat May 25, 2013 7:52 pm 
Offline
Site Admin

Joined: Mon Jun 27, 2011 11:59 am
Posts: 2856
Hmm, freezes up? Interesting.

Here faction change gets me killed, as if normally getting killed, and I think it suggests to press space to respawn as usual (though I have to say I'm not 100% sure about the last bit now).

The server I had was a normal game build server, not a dedicated one.

What was your setup? I could try it for the freezing, it certainly shouldn't have any hiccups.


Top
 Profile  
 
PostPosted: Sat May 25, 2013 8:10 pm 
Offline
User avatar

Joined: Tue Mar 05, 2013 12:25 am
Posts: 193
pasik wrote:
What was your setup? I could try it for the freezing, it certainly shouldn't have any hiccups.


This was a dedicated server using the basic_command_handler.php I posted.
It freezes up just like it does when you can't spawn when joining in inva. Once you hit space you spawn normally in the other faction.

I started it now btw, so you can test it yourself in "Dooms Personal Hell" ;)


Top
 Profile  
 
PostPosted: Sat May 25, 2013 10:09 pm 
Offline
User avatar

Joined: Tue Mar 05, 2013 12:25 am
Posts: 193
I also did a little tweak to include an ai_multiplier.
Didn't make a command to change it on the fly yet but at least it's an easy way of controlling the general bot amount on the server while retaining the proportions between the maps.

Code:
...
$ai_accuracy = 0.94;
$ai_multiplier = 0.1; // new value for the ai_multiplier
$player_ai_compensation = 1;
...

...
$start_game_command =
"<command class='start_game'" .
"   vehicles='1'" .
"   max_soldiers='" . (300 * $ai_multiplier) . "'" . // changed to include multiplier
"   player_ai_compensation='" . $player_ai_compensation . "'" .
"   xp_multiplier='" . $xp_multiplier . "'" .
"   rp_multiplier='" . $rp_multiplier . "'" .
"   base_capture_system='" . $base_capture_system . "'" .
"   friendly_fire='" . $friendly_fire . "'>\n" .
"   <faction initial_over_capacity='0' ai_accuracy='" . $ai_accuracy . "' />\n" .
"   <faction initial_over_capacity='0' ai_accuracy='" . $ai_accuracy . "' />\n" .
"</command>\n";
...


Top
 Profile  
 
PostPosted: Wed Jun 05, 2013 10:35 pm 
Offline
User avatar

Joined: Mon Feb 25, 2013 12:24 pm
Posts: 283
OK, need some help here guys. Below is my current basic_command_handler.php file. I have modified it to allow me to change maps in game (which works - amazingly, lol) but when I try to add the kick, switch and server command bits I break it :D

Could someone please add in the switch command so everyone can use it, and the kick and server commands so that only admin can use them? Cause I am fecked if I can get it to work, and I really do not want to start learning PHP as it will end in tears, lol.

Code:
#!/usr/bin/php -q
<?php

include_once("internal/tracker.php");
include_once("internal/helpers.php");
include_once("internal/admin.php");

// --------------------------------------------

class BasicCommandHandler extends Tracker {
        protected $metagame = NULL;

        // --------------------------------------------
        function __construct($metagame) {
                $this->metagame = $metagame;
        }

   // ----------------------------------------------------
   protected function handle_chat_event($doc) {
      // player_id
      // player_name
      // message
      // global
      $event = $doc->firstChild;

      $message = $event->getAttribute("message");
      // for the most part, chat events aren't commands, so check that first
      if (!starts_with($message, "/")) {
         return;
      }

      $sender = $event->getAttribute("player_name");
            
      // admin only from here on
      if (!is_admin($sender)) {
         return;
      }

      // it's a silent server command, check which one
      if (check_command($message, "test")) {
         $this->metagame->comms->send("say test yourself");

      } else if (check_command($message, "defend")) {
         // make ai defend only, both sides
         for ($i = 0; $i < 2; ++$i) {
            $command =
               "<command class='commander_ai'" .
               "   faction='" . $i . "'" .
               "   base_defense='1.0'" .
               "   border_defense='0.0'>" .
               "</command>";
            $this->metagame->comms->send($command);
         }
         $this->metagame->comms->send("say defensive ai set");

      } else if (check_command($message, "grey_win")) {
         $this->metagame->comms->send("declare_winner 1");
         
      } else if (check_command($message, "map1")) {
         $this->metagame->comms->send("map1") ;
         
      } else if (check_command($message, "map2")) {
         $this->metagame->comms->send("map2") ;
            
      } else if (check_command($message, "map3")) {
         $this->metagame->comms->send("map3") ;
         
      } else if (check_command($message, "map4")) {
         $this->metagame->comms->send("map4") ;
      
      } else if (check_command($message, "map5")) {
         $this->metagame->comms->send("map5") ;
      }
   }

        // --------------------------------------------
        function has_ended() {
                // always on
                return false;
        }

        // --------------------------------------------
        function has_started() {
                // always on
                return true;
        }
}


?>


Cheers!

_________________
Image


Top
 Profile  
 
PostPosted: Fri Jun 07, 2013 10:42 am 
Offline
User avatar

Joined: Mon Feb 25, 2013 12:24 pm
Posts: 283
Anyone help here? Pwease? Don't make me break my servers again :D

_________________
Image


Top
 Profile  
 
PostPosted: Fri Jun 07, 2013 10:54 am 
Offline
User avatar

Joined: Tue Jan 03, 2012 9:58 am
Posts: 1662
Location: Western Europe
{SAS}DocStone wrote:
Anyone help here? Pwease? Don't make me break my servers again :D


If you need instant help you might just jump into IRC, this is for sure the fastest help you can get :)


Top
 Profile  
 
PostPosted: Fri Jun 07, 2013 11:06 am 
Offline
User avatar

Joined: Mon Feb 25, 2013 12:24 pm
Posts: 283
JackMayol wrote:
{SAS}DocStone wrote:
Anyone help here? Pwease? Don't make me break my servers again :D


If you need instant help you might just jump into IRC, this is for sure the fastest help you can get :)

Hell no, IRC is a delicious trap, once you enter you cannot leave, and all of a sudden all the work you were meant to be doing gets forgotten about :D And I posted it on Wednesday, lol, I would be happy with eventual help :D

_________________
Image


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 22 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group