Previous Section  < Day Day Up >  Next Section

Hack 67 Watch Online Games with MatchEd

figs/beginner.gif figs/hack67.gif

Many online gamers use IRC to organize battles and discuss tactics. MatchEd lets you watch the progress of a game from the safety of IRC.

Online gaming is becoming an increasingly popular form of recreational computing. With the widespread introduction of broadband Internet connections for home users, many more people are able to play these online games with acceptable responsiveness. Counter-Strike is one such game and has proven to be very popular among online communities. This team-based game pitches terrorists against counterterrorists. Sets of players often form themselves into clans—groups of people who play as a team against other clans. Clan members may be geographically distant, so IRC provides a suitable way of letting clans discuss their tactics and plan future events.

While clan members are busy chatting away in their IRC channel, they may find it useful to know what is going on while other people play on their Counter-Strike server.

MatchEd is an IRC bot that lets you watch the progress of a game of Counter-Strike, Action Half-Life, Natural Selection, Fire Arms, Death Match Classic, or Front Line Force. MatchEd is designed to be platform independent and can be run on any platform that supports Java. MatchEd uses very little CPU time, which makes it ideal for running on the same machine as the game server, making it permanently available. See it monitoring a game of Counter-Strike in Figure 10-4.

Figure 10-4. MatchEd reporting on a game of Counter-Strike

MatchEd works by reading the logs directed via the Half-Life server logaddress command. To use this, you must have rcon access to the server.

You can download MatchEd from To run it, you will need to have a Java Runtime Environment installed.

10.5.1 Configuring MatchEd

Configuration of MatchEd is done in the file. The following information must be set.


The IRC server the bot will connect to (e.g.,


The nickname the bot will use when connecting to the IRC server.


The channel the bot will join when it connects to the IRC server.


The password to access the bot's administrations features.


The password for the game server administrators to use. Note that this is not the actual rcon password.


The IP address of the game server to use for reporting.


The port number of the game server to use for reporting.

10.5.2 Starting MatchEd

Let's assume the following variables are set up in the file:

BotName = MatchEd

AdminPassword = power

RconAuthPassword = fubar

    - etc -

Most commands can be accessed only if you have been authorized as an administrator of the bot. Authorization is carried out by sending a private message to MatchEd:

/msg MatchEd auth power

If you want MatchEd to start reporting the progress of a game of Counter-Strike, you will need to authenticate as an admin or rcon administrator and tell the bot the rcon password for the Counter-Strike server:

/msg MatchEd rcon_auth fubar

/msg MatchEd rcon_password real-rcon-password

The authenticated user is now able to tell MatchEd to start reporting on the game of Counter-Strike by typing !startcs in the channel.

A quick way of checking to see if everything is working properly is to get MatchEd to say something to the Counter-Strike server. First, type !serversayon in the channel. This causes the bot to announce all server admin messages that are typed in the game. You can get the bot to send a message to the game with the rcon say command:

/msg MatchEd rcon say test

If everything worked successfully, you should see MatchEd respond with the following:

<MatchEd> [SERVER]: "test"

From this point on, any activity in the server will be visible in the IRC channel.

10.5.3 Message Styles

Most aspects of MatchEd can be customized, including its name and the rate that it sends the messages to IRC. This can be useful to prevent the bot from being killed for flooding the server. It is also possible to change the style of the messages that are used to describe the events happening in the game.

To change any of the message styles, you must edit the file. As an example, the default output when an rcon say message is displayed is set as the following:

CSServerSay = [SERVER]: ${sayMsg}

Note the variable ${sayMsg}, which contains the actual message from the game server.

There are some other static variables that can be used to apply some color to the style, such as $RED, $BLUE, $GREEN, and so on. Each time a color is applied, it will affect the rest of the message until it is changed or turned off with the $NORMAL variable. Other formatting, such as $BOLD, $UNDERLINE, and $REVERSE are complementary. Each of these styles can be turned off by repeating the same variable or by using the $NORMAL variable.

To make the rcon say message style stand out a bit more, you can add color and boldness like this:

CSServerSay = $RED[SERVER ADMIN SAYS]$NORMAL: $BOLD${sayMsg}$NORMAL Dynamic configuration

If you a re authorized as an administrator, reload the changes made to any of the game output sections in while the bot is still running. If you type !reload in the channel, the bot will reload its configuration from the file. You can see whether this has worked by telling the bot to send the test message again. The bot should promptly return the following:

<MatchEd> [SERVER ADMIN SAYS]: "test"

The [SERVER ADMIN SAYS] text will be in red and the actual say message, "test", will be shown in bold in the normal text color.

Alex North

    Previous Section  < Day Day Up >  Next Section