UT 2004 game query documentation?

Discussions about everything else
User avatar
UT Sniper (SJA94)
Masterful
Posts: 727
Joined: Thu Jun 24, 2010 10:35 pm
Personal rank: noob programmer
Location: England

UT 2004 game query documentation?

Post by UT Sniper (SJA94) »

Does anyone have a link that's not dead for the game query protocol for Unreal Tournament 2004?(like /players/ ect)

I get some responses from some servers and other I get nothing on the +1 to +10 query ports using UDP, it's kind of driving me nuts not being able to find anything useful :evil:


-- Edit --

Port + 1 stuff

Code: Select all

//128 = €
//   -> //charcode numbers // info
// A -> 128 0 0 0 // = map name and gametype
// B -> 128 0 0 1 // = servermode, admin, admin email, spec details mutators
// C -> 128 0 0 2 // looks like player names
// D -> 128 0 0 3 // looks like  B and C


// mapname and gametype
const buf = Buffer.from('\128\0\0\0', 'utf8');

// server mode, admin details, spec details and mutators
const buf = Buffer.from('\128\0\0\1', 'utf8');

// player details
const buf = Buffer.from('\128\0\0\2', 'utf8');

// B and c combined
const buf = Buffer.from('\128\0\0\1', 'utf8');

console.log(buf);

send buffer to server port + 1
User avatar
UT Sniper (SJA94)
Masterful
Posts: 727
Joined: Thu Jun 24, 2010 10:35 pm
Personal rank: noob programmer
Location: England

Re: UT 2004 game query documentation?

Post by UT Sniper (SJA94) »

Found something on wayback machine: https://web.archive.org/web/20090730022 ... yspec.html
User avatar
UTPe
Masterful
Posts: 532
Joined: Sun Jul 12, 2009 7:10 pm
Personal rank: Dude
Location: Trieste, Italy

Re: UT 2004 game query documentation?

Post by UTPe »

a question: do ut99 and ut2004 use the same server query protocol ?
Personal map database: http://www.ut99maps.net

"These are the days that we will return to one day in the future only in memories." (The Midnight)
User avatar
UT Sniper (SJA94)
Masterful
Posts: 727
Joined: Thu Jun 24, 2010 10:35 pm
Personal rank: noob programmer
Location: England

Re: UT 2004 game query documentation?

Post by UT Sniper (SJA94) »

A few servers use gamespy query protocol on port + 10, but most use the format used in that link above which is completely different, that's where I was running into problems with my query bot for ut2004 servers.

UT99 queries are like this:
\players\
\info\
\status\

UT2004 queries are like this:
0x80 0x00 0x00 0x00 = server name, mapname, and gametype name response.
0x80 0x00 0x00 0x01 = detailed server information including mutators, email name, max players, and others.
0x80 0x00 0x00 0x02 = Player details
0x80 0x00 0x00 0x03 = Is detailed server information and player details together.
User avatar
UT Sniper (SJA94)
Masterful
Posts: 727
Joined: Thu Jun 24, 2010 10:35 pm
Personal rank: noob programmer
Location: England

Re: UT 2004 game query documentation?

Post by UT Sniper (SJA94) »

It's worth noting that the colour data is a little different then it is shown in that documentation:

Colour data is always 4 bytes, and always starts with Hex 1B

Code: Select all

--  r   g    b
1B 00 00 00 = black
1B FF 00 00 = red
1B 00 FF 00 = green
1B 00 00 FF = blue
User avatar
Darkelarious
Skilled
Posts: 170
Joined: Sat Feb 08, 2014 12:02 pm
Personal rank: 333networks admin
Location: Phobos Moon

Re: UT 2004 game query documentation?

Post by Darkelarious »

I hope to get involved with this soon too. I'd like to think of myself as an expert on ut99/gamespy by now (give our experience with 333networks) and hope to extend this with the knowledge of ut2004 too.
UTPe wrote: Tue Jun 23, 2020 10:06 am a question: do ut99 and ut2004 use the same server query protocol ?
No, UT99 uses the \key\value format with UDP data whereas UT2004 uses byte code and (please confirm this) TCP connections.

I have a number of documents with additional information available on http://share.333networks.com/share/dev/ut2004
--Darkelarious
Image
Masterserver | Discord Channel
Oh, and we still are ready to receive donations. The url works, right? It doesn't seem to be doing anything...
User avatar
UTPe
Masterful
Posts: 532
Joined: Sun Jul 12, 2009 7:10 pm
Personal rank: Dude
Location: Trieste, Italy

Re: UT 2004 game query documentation?

Post by UTPe »

thanks both for the reply.
Personal map database: http://www.ut99maps.net

"These are the days that we will return to one day in the future only in memories." (The Midnight)
User avatar
UT Sniper (SJA94)
Masterful
Posts: 727
Joined: Thu Jun 24, 2010 10:35 pm
Personal rank: noob programmer
Location: England

Re: UT 2004 game query documentation?

Post by UT Sniper (SJA94) »

Darkelarious wrote: Mon Jun 29, 2020 3:28 pm I hope to get involved with this soon too. I'd like to think of myself as an expert on ut99/gamespy by now (give our experience with 333networks) and hope to extend this with the knowledge of ut2004 too.
I'm rewriting my ut2004 query module commenting everything I'm doing regarding the packets so it should be easy to understand what's going on/what to expect with the packets.


Examples:

Code: Select all

//byte 1 is the game id, for UT2004 is hex 0x80 or binary 128
//byte 2 and 3 are always 0
//byte 4 is the one you change for different responses, either 0, 1, 2, or 3.

        const packets = [
            [128, 0, 0, 0], //server info 1 packet
            [128, 0, 0, 1], //detailed info 1 packet
            [128, 0, 0, 2], //player info 1 - 2 packets
            [128, 0, 0, 3] //packet 2 and 3 | 2 - 3 packets
        ];

Code: Select all

parseServerInfo(data, ip, port){

        data = JSON.stringify(data);
        data = JSON.parse(data).data;


        const serverInfo = {
            "ip": ip
        };

        if(port != undefined){
            serverInfo.port = port - 1;
        }
        

        //remove first byte(game id 0x80 / 128)
        data.splice(0,1);

        //remove response code (always 0 for server info)
        data.splice(0, 1);

        //remove server id (never used) always 4 bytes long
        data.splice(0, 4);

        //remove server ip (never used) always 4 bytes long
        data.splice(0, 4);

        //get game query port, always 4 bytes last 2 being 0, and first two being back to front

        const portHex = data[1].toString(16) + data[0].toString(16);

        serverInfo.port =  parseInt(portHex, 16);

        //remove server port bytes
        data.splice(0,4);

        //remove port for status query (never used) always 4 bytes
        data.splice(0,4);

        ...

    }
    


----Edit----
After redoing my ut2004 query module, its nearly 200 lines less with loads of comments :)
User avatar
UT Sniper (SJA94)
Masterful
Posts: 727
Joined: Thu Jun 24, 2010 10:35 pm
Personal rank: noob programmer
Location: England

Re: UT 2004 game query documentation?

Post by UT Sniper (SJA94) »

I'm on the second version of the UT2k4 query bot, first one was more testing than a working bot anyway, only thing I need to do now is the admin commands and server list.

Demo display server display:
Image


It's worth noting I'll remove UT2k4 query from the other bot I made as it doesn't work with UT2004 servers that don't support gamespy protocal.



--EDIT--

Image