UT2004 Jackbot Query Script
You might have noticed the link over on the side of the page for The Burrow. That’s the Unreal Tournament 2004 game server I have running on samus.ardvaark.net. This evening, I wanted something to distract me, so after playing a few hours of Unreal Tournament with Brian McCullom, I decided to make my IRC bot ping the game server for status information.
Sometimes even I am amazed by the levels to which we geeks will go to amuse ourselves. Most people would probably distract themselves with a good book, but not us geeks! We code!
At first, you might think that the Unreal Technology Page’s Sever Querying page might help you with this. I certainly expected at much. After reading about the string-based protocol “Gamespy protocol” supposedly used, I was delighted to be using ECMAScript to code this script, since it is very good at string processing. Unfortunately, though, the UT2004 engine doesn’t follow that protocol at all. I guess the fact that the page hadn’t been updated since 1998 should have tipped me off.
A little help from Google led me to this wonderful reference on the UnrealEngine2 Sever Query Protocol. It turns out that the new protocol is very binary, for which ECMAScript is not so well suited. In the end, I decided that I would really rather not have any external dependencies, so I wrote it in script anyway.
And here it is. A little hacking could easily weed out the dependencies on the JackBot Object Model and make this a general-purpose script. Oh, and it’s hard-coded to ping my server. I might change that, but for now it is Good Enough. Feel free to muck with it as you will. It is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike License.
Following is some example output. I am Ardvaark, and the bot is named TrunkMonkey.
[00:55] <@Ardvaark> !ut -TrunkMonkey- The Burrow (ut2004://66.92.171.205) -- ping: 223ms -- current map: ons-arcticstronghold -- players: 0/8
Oh, and bit-twiddling in ECMAScript sucks ass, but not as hard as I thought it would.