PK Hunter architecture

Asheron’s Call is a MMORPG by Turbine Games. Originally released in 1999 and published by microsoft, in 2003, the franchise was bought entirely back by Turbine. A 3-rd party utility application, Decal, was created by players with some programming savvy, which allowed other programming end users to create plug-ins that integrate with the AC client. This allowed for the automation of tedious in game tasks, tracking of statistics, drawing of extra things on the screen, and any other number of things which Turbine would not, or could not add themselves. (for a list of the large number of plug-ins, see sites like Decal Dev or AC Heaven)

I have written 3 plug-ins for Asheron’s Call using decal; one which tracks monsters you kill and “trophy” items you recieve, and submits it to a website (Trophy Hunter), another which acts as a shopping cart when interacting with players who are running special “Trade Bot” plug-ins to act as vendors (Bargain Hunter), and one which tracks Player vs Player kills (PK Hunter). This article covers some design and implementation details that third plug-in, PKHunter.


One feature that exists in almost any form of multiplayer game is some facet of “player vs. player” gameplay, or “PvP”, where players directly attack each other. Commonly, it is also known as “player killing”, or “PK”. In most games this aspect is optional, meaning that players cannot attack other players unless that player has flagged themselves somehow, by completing a special quest, or checking a checkbox somewhere in the game’s interface. However, most of these games also have specific servers where player vs player is always on, so that players have no choice. In Asheron’s Call, this server is called “Darktide”, abbreviated simply as DT. Because players who are “PK” appear as red dots in a player’s radar, the players are commonly called “red”, as well as servers of the PvP only type being called “red” servers.

Unlike many games with PvP, Asheron’s Call has no in game rating or ranking system of player killing activities. Because I had already written one plug-in which tracked player vs monster (PvM) activities, i decided to expand that out to another plug-in that tracked PK activity and would attempt to assign some kind of ratings to players.

How it works

Security details omitted πŸ™‚

Figure 1: client side details

The plug-in uses various facilities within Decal to watch the network stream going from the client to the server. When it sees special “Player Killed” message go by, it looks at the UID (unique identifier) for each person involved. If both of these UID’s resolve to player characters, the plug-in adds that time and those two user UID’s to a list. Every few minutes (or by pressing button in the UI) and when the player logs out of the game, the plug-in submits that information to the PKHunter website.

Figure 2: PKHunter UI

The client plug-in also has a few other functionalities, including a list that shows the players own kills and deaths, as well as other player vs player kills that they witnessed. “Witnessed” is used lightly here, as a player may not have actually watched a player kill another, he might have just been near enough for the AC server to send the “Player killed” packet to that player. The AC client itself may filter that out, so the player might never be informed of the event. To see some details about the AC protocol, as reverse engineered by players, see Example these (out of date) protocol docs. You might want to right click and “save as” that baby, as it’s around 675k!

Figure 3: server side details

The “server side” of PKHunter includes 3 pieces; a website, a service which processes submissions, and a database which stores player information.

The website does more than just serve up pages to users outside of the game like a regular website. It also has several scripts which are used by the plug-in to validate users, submit results, and retrieve player info to display in game. The website is written in entirely in PHP. Some of the PHP scripts are used by cron jobs to regularly generate static html that is used for the front page and some other high traffic pages to avoid them going to the database for no reason. The PHP scripts that handle submissions do the bare minimum of work, doing some very basic security checks, and then dump the rest of the submission into the database and immediately return to the client. This attempts to minimize any delay within the AC client itself.

The service is a java application which runs 24/7 on the database server. The service processes the raw submissions from the client at its leisure, parsing the xml, validating them, and culling any duplicates that were submitted by other players. The service takes each submission in turn, looking up each player involved, computes the rating change based on each player’s current rating, and then updates each player.

The database is a simple MySQL database, with only a few important tables: One holds submissions, one holds processed and validated kills, and a third holds player details and statistics. A few other tables are used for bookkeeping, site statistics, service stats, but aren’t interesting enough to be discussed here πŸ™‚

Technologies used

Client side:

  • “Decal” plug-in: c++

Server Side:

  • Web site: PHP
  • Service: Java
  • Database: MySQL
  • OS: Currently Mandrake (now Mandriva?) Linux. Because the rest of the technologies used are cross platform, I can set up the server on almost any operating system, though.

Some statistics

Original Release: PKHunter 10/20/2002
Number of Releases: in just under 3 years, only 5 updates, the last of which was 11/24/2002.
Number of “Characters” in the Database: 186,152. This does not imply “users” of the plug-in, only people who have been witnessed as a killer or victim.
Number of “Plug-in Users”: 73,519. This is player characters who have submitted results.
“Unique” Users:15,203. This is the closest to actual “users” that i can get with the information i track. I don’t track anything specific enough to identify people having multiple accounts or anything like that.
Users submitting results in last year:4100
Number of kills tracked:3,334,216
Number of kills in the last year:1,108,350
Website hits per month:235,485
Website bandwidth per month:1.61 GB
Website hits YTD: 1,539,861
Website bandwidth YTD: 9.74 GB
Electricity consumed by servers: 1.21 GW. kidding. thats from back to the figure. But probably a lot!


The current system only tracks killer and victim, but a lot of people have complained that the person who gets the “killshot” is not necessarily the “killer” that has looting rights.

What i’d like to do is add extra stuff, so that the system can find the corpse created when a player dies, get details from that (text on the corpse indicates who was the actual “killer”), and have the system track both “real” killer, and also have an entry for the “killshot” player. This would allow some more statistics like kills:killshots, to see if people are real PK’s or just are ganking people at the end :).
I’d also like to switch back over to an actual “ladder” style rating system instead of using the “modified” glicko system i’m using now.

Posted in Uncategorized Tagged with: ,
One comment on “PK Hunter architecture
  1. James from WE says:

    Hey John, were missing you and your plugins in AC these days. πŸ™
    (sorry to post this here wasnt sure if you check the gmail anymore)
    I was wondering if you still planning on updating PKhunter?

    If not I was wondering if youd be willing to allow me to update the source. Using your webserver or one I get doesn’t matter to me. Course credit would be given to you πŸ˜€

    Contact me if so, thanks – James

Leave a Reply

Your email address will not be published. Required fields are marked *


XBox GamerCard

Recent Flickr