This file is mirrored from the libtw2 documentation and is dual-licensed under MIT or APACHE.
The DDNet teehistorian format is the format which DDNet uses to save all input to a server in order to be able to reproduce it faithfully. A teehistorian file is fundamentally a stream of messages that describe input to the server and a little data for sanity checks.
The format is designed in a way to make it easily compressible using standard compression algorithms in order to make it suitable for long-term storage, which Teeworlds demos are not due to their large size. It is easy to write out in a stream (you just append data at the end) but for reading, one has to read the whole file end-to-end because the format does not support seeking.
This document describes version 1 and 2 of the teehistorian file format.
The only difference between them is the existence of the
A teehistorian file is fundamentally a header followed by a stream of messages.
The header starts with the teehistorian UUID (699db17b-8efb-34ff-b1d8-da6f60c15dd1, version 3 UUID derived from the Teeworlds namespace e05ddaaa-c4e6-4cfb-b642-5d48e80c0029 and the name “firstname.lastname@example.org”), encoded as a big endian binary encoded UUID (16 bytes). It is followed by a null-terminated string that contains a JSON object containing at least the following keys:
version: This is the version number of the teehistorian format. It must be
"2"for this document.
Each message starts with a Teeworlds variable-width integer, which is the message ID.
The following extra messages are known right now:
The following data types are used:
the UUIDs are version 3 UUIDs, with the teeworlds namespace e05ddaaa-c4e6-4cfb-b642-5d48e80c0029 a tick is implicit in these messages when a player with lower cid is recorded using any of PLAYER_DIFF, PLAYER_NEW, PLAYER_OLD e.g. PLAYER_DIFF cid=0 … PLAYER_NEW cid=5 … PLAYER_OLD cid=3 has an implicit tick between the cid=5 and the cid=3 message another correction: the header is the teehistorian uuid followed by a zero-terminated string containing json in a self-explanatory format