Quake 3

I've started hacking on the ioquake3 sources, adding a Perl interface to a small number of C functions and a few callbacks from C/QVM to Perl functions. This allowed me to add an IRC logging backend and a client hack for weapon selection.

IRC Logging

The IRC logging captures game events and produces a message to be sent to IRC. The current implementation uses Net::IRC3 but this is soon going to change to AnyEvent::IRC.

The PerlQuake3 server is running on q3a.xinutec.org and events are written to the channel #q3a on irc.xinutec.org.

The following events are transferred to IRC:

IRC users can chat back into the game and it will look like it origined from irc/user where user is the nickname of the person on IRC. Quake colours are converted to IRC colours and vice versa.

Furthermore, the IRC bot has the following commands:

Client-Perl

The Quake 3 client has been enhanced to allow for prioritising weapon selection on pickup. That means, if cg_autoswitch is on, weapons are only selected if their priority is higher or equal to the priority of the current weapon.

Currently, these priorities are not user-definable, but that will soon be implemented. The code for this is absolutely trivial and can be found in Quake3.pm:

my %prefs = (
   Quake3::WP_GRAPPLING_HOOK    => 0,
   Quake3::WP_NONE              => 0,

   Quake3::WP_GAUNTLET          => 0,
   Quake3::WP_GRENADE_LAUNCHER  => 0,
   Quake3::WP_MACHINEGUN        => 1,
   Quake3::WP_RAILGUN           => 1,
   Quake3::WP_SHOTGUN           => 2,
   Quake3::WP_LIGHTNING         => 2,
   Quake3::WP_PLASMAGUN         => 2,
   Quake3::WP_ROCKET_LAUNCHER   => 3,
   Quake3::WP_BFG               => 4,
);

sub item_pickup {
   my ($curweap, $newweap) = @_;
   $prefs{$newweap} >= $prefs{$curweap} ? 1 : 0
}

Future

The current implementation and API design is below all standards (except for maybe the irssiperl one) and requires some real thinking. This interface was written in a few minutes (after needing an hour to figure out how the QVM and callbacks to C work). In the future, the API will undergo some serious changes and probably be rewritten entirely from scratch.