103 lines
2.4 KiB
Plaintext
103 lines
2.4 KiB
Plaintext
Heartbeat server protocol
|
|
|
|
Main heartbeat server:
|
|
play.iceballga.me port 27790
|
|
(port is for UDP *and* TCP)
|
|
|
|
Iceball clients should connect to:
|
|
play.iceballga.me port 27795
|
|
[ NOT IMPLEMENTED ]
|
|
|
|
Iceball only supports IPv4 UDP ports at the time of writing, sorry.
|
|
|
|
Feel free to host your own heartbeat server, though!
|
|
|
|
Note, S = heartbeat server, C = heartbeat client (AKA iceball server).
|
|
|
|
The heartbeat server will terminate your session after 120 seconds of inactivity.
|
|
|
|
ALL PROTOCOLS ARE LITTLE ENDIAN WHERE APPROPRIATE, GUYS!
|
|
|
|
Iceball servers interface the heartbeat server using this UDP protocol...
|
|
|
|
"1CEB" hbversion.u16 ibversion.u32 port.u16 players_current.u16 players_max.u16 name.z[30] mode.z[10] map.z[30]
|
|
I->H
|
|
Announce a server.
|
|
|
|
Note, remember to send a burst of 5 of these
|
|
with a second in between each packet,
|
|
and do this every 40 seconds
|
|
|
|
(that is, a gap of 36 seconds between the last of a burst
|
|
and the first of the next).
|
|
|
|
Note, the strings are terminated with a NUL (char 0)
|
|
unless they hit their string limit,
|
|
in which case there is no NUL. BE WARY OF THIS.
|
|
|
|
"MSOK" cookie[]
|
|
H->I
|
|
|
|
Your packet was accepted.
|
|
|
|
If your server gets this message, send a "HSHK" with the same cookie you received.
|
|
|
|
cookie can be any length.
|
|
|
|
"HSHK" cookie[]
|
|
I->H
|
|
|
|
Handshake.
|
|
|
|
Only once the heartbeat server receives this will your server be listed.
|
|
|
|
"BADV" hbversion.u16 ibversion.u32
|
|
H->I
|
|
|
|
Your version of Iceball and/or the heartbeat protocol are too old and/or new.
|
|
Here's the version we expect.
|
|
|
|
If your server gets this message, give up.
|
|
|
|
Alternatively, if you support the given heartbeat version, try falling back to it.
|
|
|
|
"BADF"
|
|
H->I
|
|
|
|
The packet you sent was complete horseshit and you should feel bad for writing such bad code.
|
|
|
|
If your server gets this message, crash in shame, because your code is seriously broken.
|
|
Or alternatively just don't send any more data to the server.
|
|
|
|
But crashing with an error is a much better idea.
|
|
|
|
OK, so that's the UDP side of the master server.
|
|
|
|
The TCP side is a minimal HTTP server at the same port with these interfaces:
|
|
|
|
/:
|
|
/index.html:
|
|
An HTML page following a template.
|
|
/style.css:
|
|
A stylesheet you can provide.
|
|
/master.json:
|
|
The raw serverlist info in JSON format.
|
|
Here's the expected format!
|
|
|
|
{
|
|
"version": int,
|
|
"servers": [
|
|
{
|
|
"address": str,
|
|
"port": int,
|
|
"players_current": int,
|
|
"players_max": int,
|
|
"name": str,
|
|
"mode": str,
|
|
"map": str,
|
|
"version": str
|
|
}
|
|
]
|
|
}
|
|
|