Demo
Demo files contain a header starting with a constant magic followed by information about the engine, the player and the current session. The main contents are stored in an array of messages.
- Overview
- C
- C++
- C#
- JS
- TS
- Go
- Rust
- Zig
Name | Type | Size in bytes | Size in bits | Value |
---|---|---|---|---|
DemoFileStamp | string | 8 | 64 | HL2DEMO\0 |
DemoProtocol | int | 4 | 32 | - |
NetworkProtocol | int | 4 | 32 | - |
ServerName | string | 260 | 2080 | - |
ClientName | string | 260 | 2080 | - |
MapName | string | 260 | 2080 | - |
GameDirectory | string | 260 | 2080 | - |
PlaybackTime | float | 4 | 32 | - |
PlaybackTicks | int | 4 | 32 | - |
PlaybackFrames | int | 4 | 32 | - |
SignOnLength | int | 4 | 32 | - |
DemoMessages | Message[] | - | - | - |
typedef struct {
char demo_file_stamp[8];
int demo_protocol;
int network_protocol;
char server_name[260];
char client_name[260];
char map_name[260];
char game_directory[260];
float playback_time;
int playback_ticks;
int playback_frames;
int sign_on_length;
message_t** demo_messages;
} demo_t;
struct demo_t {
std::string demo_file_stamp;
int32_t demo_protocol;
int32_t network_protocol;
std::string server_name;
std::string client_name;
std::string map_name;
std::string game_directory;
float32_t playback_time;
int32_t playback_ticks;
int32_t playback_frames;
int32_t sign_on_length;
std::vector<message_t> demo_messages;
};
class Demo {
public string DemoFileStamp { get; set; }
public int DemoProtocol { get; set; }
public int NetworkProtocol { get; set; }
public string ServerName { get; set; }
public string ClientName { get; set; }
public string MapName { get; set; }
public string GameDirectory { get; set; }
public float PlaybackTime { get; set; }
public int PlaybackTicks { get; set; }
public int PlaybackFrames { get; set; }
public int SignOnLength { get; set; }
public List<Message> DemoMessages { get; set; }
}
class Demo {
/** @type {string} */
demoFileStamp;
/** @type {number} */
demoProtocol;
/** @type {number} */
networkProtocol;
/** @type {string} */
serverName;
/** @type {string} */
clientName;
/** @type {string} */
mapName;
/** @type {string} */
gameDirectory;
/** @type {number} */
playbackTime;
/** @type {number} */
playbackTicks;
/** @type {number} */
playbackFrames;
/** @type {number} */
signOnLength;
/** @type {Message[]} */
demoMessages;
}
export class Demo {
public demoFileStamp?: string;
public demoProtocol?: number;
public networkProtocol?: number;
public serverName?: string;
public clientName?: string;
public mapName?: string;
public gameDirectory?: string;
public playbackTime?: number;
public playbackTicks?: number;
public playbackFrames?: number;
public signOnLength?: number;
public demoMessages?: Message[];
}
type Demo struct {
DemoFileStamp string
DemoProtocol int32
NetworkProtocol int32
ServerName string
ClientName string
MapName string
GameDirectory string
PlaybackTime float32
PlaybackTicks int32
PlaybackFrames int32
SignOnLength int32
DemoMessages []Message
}
pub struct Demo {
pub demo_file_stamp: String,
pub demo_protocol: i32,
pub network_protocol: i32,
pub server_name: String,
pub client_name: String,
pub map_name: String,
pub game_directory: String,
pub playback_time: f32,
pub playback_ticks: i32,
pub playback_frames: i32,
pub sign_on_length: i32,
pub demo_messages: Vec<Message>,
}
const Demo = struct {
demo_file_stamp: []u8,
demo_protocol: i32,
network_protocol: i32,
server_name: []u8,
client_name: []u8,
map_name: []u8,
game_directory: []u8,
playback_time: f32,
playback_ticks: i32,
playback_frames: i32,
sign_on_length: i32,
demo_messages: []Message,
};