summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar mszulecki2007-03-19 03:09:08 +0000
committerGravatar mszulecki2007-03-19 03:09:08 +0000
commite6a38f4a8455b7cee3781bb09f4e4aabafcd2710 (patch)
tree163aafe42c4adfde43f2cc5f39b6af069d32e27b
parent9383fd2b3766d36c03ce22afd41845e2f5034c8a (diff)
downloadhl-demofile-spec-e6a38f4a8455b7cee3781bb09f4e4aabafcd2710.tar.gz
hl-demofile-spec-e6a38f4a8455b7cee3781bb09f4e4aabafcd2710.tar.bz2
Add a lot of server message related documentation
git-svn-id: http://svn.sukimashita.com/repos/hldemo/trunk@6 e98d5eb1-5f28-0410-b569-d5a1ad2e6e54
-rw-r--r--doc/hl1-demofile-spec-cstrike.txt144
-rw-r--r--doc/hl1-demofile-spec.txt293
2 files changed, 381 insertions, 56 deletions
diff --git a/doc/hl1-demofile-spec-cstrike.txt b/doc/hl1-demofile-spec-cstrike.txt
new file mode 100644
index 0000000..86ec4d6
--- /dev/null
+++ b/doc/hl1-demofile-spec-cstrike.txt
@@ -0,0 +1,144 @@
+{64} '', // Radio Command?
+
+ uint8 uk_b1;
+ uint8 uk_b2;
+ char* uk_s1;
+ uint8 uk_b3;
+ uint8 uk_b4;
+ uint8 uk_b5;
+ char* uk_s2;
+ char* playername;
+ char* command;
+
+{} 'ScoreInfo',
+
+ uint8 entindex;
+ sint16 frags;
+ sint16 deaths;
+ uint16 uk_s1;
+ uint16 team_index;
+
+{} 'Health',
+
+ uint8 health;
+
+{} 'FlashLight',
+
+ uint8 state; // 1/0 on/off
+ uint8 flash_battery;
+
+{} 'CurWeapon', (67)
+
+ uint8 uk_b1;
+ uint8 uk_b2;
+ uint8 uk_b3;
+
+{} '', (73)
+
+ uint8 uk_b1;
+ uint8 uk_b2;
+
+{} 'SayText', (75)
+
+ uint8 message_length;
+ uint8 slot;
+ uint8 uk_b1; // if slot!=0
+ char* uk_string;
+
+{} '', (76)
+
+ uint8 message_length;
+ uint8 slot;
+ uint8 uk_b1; // if slot!=0
+ char* uk_string;
+
+{} '', (77)
+
+ uint8 message_length;
+ uint8 slot;
+ uint8 uk_b1; // if slot!=0
+ char* uk_string;
+ // Strings containing with # is some sort of command, also "#C1#C2"
+
+{} '', (78)
+
+ uint8 uk_b1;
+ char* weapon;
+ char[8] uk_b2;
+
+{} '', (87)
+
+ uint8 uk_b1;
+ char* team;
+ char[9] uk_b2;
+
+{} 'ShowMenu', (96)
+
+ uint8 message_length;
+ uint8[4] uk_b1;
+ char* uk_string; // #DCT_BuyItem
+
+{} 'SendAudio', (100)
+
+ uint8 message_length;
+ uint8 slot;
+ uint8 uk_b1;
+ char* uk_string; // %!MRAD_LOCKNLOAD
+
+{} 'RoundTime', (101)
+
+ uint16 round_sec;
+
+{} 'Money', (102)
+
+ uint32 money_amount;
+ uint8 uk_b2; // ? Add 0 /Substract 1?
+
+{} 'StatusIcon', (107)
+
+ uint8 message_length;
+ uint8 uk_b1;
+ char* icon;
+
+{} 'StatusText', (107)
+
+ uint8 message_length;
+ uint8 uk_b1;
+ char* uk_string; // message_length points to space after strings end \0 byte??
+ uint8 uk_b2; // ?
+ uint8 uk_b3; // ?
+
+{} 'Radar', (112) // ?
+
+ char[8] uk_b1;
+
+{} 'VGUIMenu', (114) // ?
+
+{} 'WClose', (115)
+
+ uint8 message_length;
+ char* uk_string; // found aimbot stuff in here in some demos
+
+{} '', (118)
+
+ uint8 message_length;
+ char* uk_string;
+
+{128} '', // ?
+
+ char* delta_name;
+
+{143} '', // ?
+
+{217} '', // ?
+
+ // usercmd_t - 440 bytes - skipped !OK!
+
+{249} '', // ? deltadata?
+// ID: 43 - clientdata_t - 1332 >< 1346 bytes (next block unknown) - 1343 ?
+// ID: 03 - entity_state_t - 1430 bytes - skipped !OK!
+// ID: 03 - entity_state_player_t - 1314 bytes - count varies
+// ID: 43 - custom_entity_state_t - 513 bytes
+// ID: 43 - entity_t - 368 bytes - skipped !OK!
+// ID: 23 - weapon_data_t - 546 bytes - count varies
+
diff --git a/doc/hl1-demofile-spec.txt b/doc/hl1-demofile-spec.txt
index 343a5ad..6946fba 100644
--- a/doc/hl1-demofile-spec.txt
+++ b/doc/hl1-demofile-spec.txt
@@ -5,12 +5,11 @@ The Half-Life Demofile format has it's roots in the Quake 1 Demo format and is
basically just an extension to it. Thus it contains only basic descriptors which
rapidly points into raw recorded network data.
-It requires a lot of game engine related logic to be used for parsing such a
+It requires a lot of game engine dependant logic to be used for parsing such a
file in a non-game client application. This explains the lack of any
documentation or examples in the SDK as it would require to heavily open up
game engine sources.
-
General Fileformat Data Hierarchy:
DemoFile {
@@ -31,6 +30,7 @@ DemoFile {
...
}
+The biggest part of the demo file is made up by the macro for game data.
Demofile Header
--------------------------------------------------------------------------------
@@ -166,7 +166,7 @@ struct DemoMacro_GameData
...
}
-A server message follows the game data information and is parsed dynamically.
+A server message follows directly after the gamedata and is parsed dynamically.
struct DemoServerMessage
{
@@ -174,63 +174,251 @@ struct DemoServerMessage
...
}
-List of Server Message IDs:
+List of Server Messages and their structure:
+
+{0} 'bad',
+
+// Should never be encountered, otherwise stream is corrupt.
-{0} 'bad',
{1} 'nop',
{2} 'disconnect',
-{3} 'event',
+{3} 'event',
+
+ uint8 num_events;
+ // ... excessive bit parsing
+
{4} 'version',
+
+ uint32 version;
+
{5} 'setview',
{6} 'sound',
-{7} 'time',
-{8} 'print',
-{9} 'stufftext',
-{10} 'setangle',
+{7} 'time',
+
+ float32 time;
+
+{8} 'print',
+
+ char* text;
+
+{9} 'stufftext',
+
+ char* text;
+
+{10} 'setangle',
+
+ char[5] uk_b;
+
{11} 'serverinfo',
-{12} 'lightstyle',
+
+ uint32 serverversion;
+ uint32 servercount;
+ uint32 server_crc;
+ char[16] client_dll_crc;
+ uint8 maxclients;
+ uint8 playernum;
+ uint8 uk_b5;
+ char* gamedir;
+ if(serverversion >= 45) {
+ char* remotehost;
+ }
+ char* map1;
+ char* map2;
+ uint8 extraflag;
+ if(extraflag > 0) {
+ uint8 extralength;
+ char* extradata;
+ char[16] lastdata;
+ }
+
+{12} 'lightstyle',
+
+ uint8 style_index; // 0 - 63
+ char* lightinfo;
+
{13} 'updateuserinfo',
+
+ uint8 slot;
+ uint32 userid;
+ char* userinfo;
+ char[16] uk_data;
+
{14} 'deltadescription',
-{15} '',
+
+ char* text;
+ uint16 uk_i1;
+
+// if text = 'entity_t' then
+// skip constant data chunks due to no delta compression
+// and read until "00 27" is found as MSGID 39, reseek and continue reading blocks
+
+{15} 'clientdata',
+
+ uint8 slot;
+ uint32 userid;
+ char* userinfo;
+
{16} 'stopsound',
-{17} '',
-{18} '',
-{19} '',
-{20} '',
-{21} '',
-{22} '',
-{23} 'temp_entity',
+
+ uint16 uk_s1;
+
+{17} 'createstringtables',
+{18} 'updatestringtable',
+{19} 'entitymessage',
+{20} 'spawnstatic',
+{21} 'spawnbinary',
+{22} 'spawnbaseline',
+{23} 'temp_entity',
+
+ uint8 entity_event_type;
+
+ // Rest is the actual event, see common.h in HLSDK
+
{24} 'setpause',
+
+ uint8 state;
+
{25} '',
{26} '',
{27} '',
{28} '',
{29} 'spawnstaticsound',
+
+ uint16[3] org;
+ uint16 sound_num;
+ uint8 vol;
+ uint8 atten;
+ uint16 uk_s1;
+ uint8 uk_b2;
+ uint8 uk_b3;
+
{30} 'intermission',
{31} '',
{32} 'cdtrack',
+
+ uint32 fromtrack;
+ uint32 totrack;
+
{33} '',
{34} '',
{35} 'weaponanim',
+
+ uint8 sequence_number;
+ uint8 weaponmodel_bodygroup;
+
{36} '',
{37} 'roomtype',
+
+ sint16 room_type;
+
{38} 'addangle',
+
+ float32[4] angles;
+
{39} 'newusermsg',
+
+ uint8 usermsg_id;
+ uint8 default_msg_length;
+ char* usermsg_description;
+ uint8 uk_b2;
+
{40} '',
{41} '',
{42} '',
{43} '',
{44} '',
{45} 'classinfo',
+
+ uint8 subpacket;
+
{46} '',
{47} '',
{48} '',
{49} '',
{50} 'hltv',
+
+ uint8 stateflag;
+
+ // HLTV_ACTIVE 0
+ // tells client that he's an spectator and will get director commands
+ // HLTV_STATUS 1
+ // send status infos about proxy
+ // HLTV_LISTEN 2
+ // tell client to listen to a multicast stream
+
{51} 'director',
+
+ uint8 command_length;
+ uint8 command_event;
+
+ if(command_event) {
+
+ "command_event":
+ // DRC_CMD_NONE 0 // NULL director command
+ // DRC_CMD_START 1 // start director mode
+ // DRC_CMD_EVENT 2 // informs about director command
+ // DRC_CMD_MODE 3 // switches camera modes
+ // DRC_CMD_CAMERA 4 // sets camera registers
+ // DRC_CMD_TIMESCALE 5 // sets time scale
+ // DRC_CMD_MESSAGE 6 // send HUD centerprint
+
+ uint8 effect;
+ uint8[4] col1_rgba;
+ float32 x;
+ float32 y;
+ // ushort 8.8 fadein time
+ float32 fadein_time;
+ // ushort 8.8 fadeout time
+ float32 fadeout_time;
+ // ushort 8.8 hold time
+ float32 hold_time;
+ // optional ushort 8.8 fxtime (time the highlight lags behing the leading text in effect 2)
+ float32 fx_time;
+ // string text message (128 chars max sz string)
+ *char text;
+
+ // DRC_CMD_SOUND 7 // plays a particular sound
+ // DRC_CMD_STATUS 8 // status info about broadcast
+
+ uint32 hltv_slots;
+ uint32 hltv_spectators;
+ uint16 hltv_proxies;
+
+ // DRC_CMD_BANNER 9 // banner file name for HLTV gui
+ // DRC_CMD_FADE 10 // send screen fade command
+ // DRC_CMD_SHAKE 11 // send screen shake command
+ // DRC_CMD_STUFFTEXT 12 // like the normal svc_stufftext but as director command
+ // DRC_CMD_LAST 12
+
+ }
+ else
+ {
+
+ uint16 entity_index_prim; // index number of primary entity
+ uint16 entity_index_sec; // index number of secondary entity
+ uint32 event_flag; // eventflags (priority and flags)
+
+ "event_flag":
+ // DRC_FLAG_PRIO_MASK 0x0F // priorities between 0 and 15 (15 most important)
+ // DRC_FLAG_SIDE (1<<4) //
+ // DRC_FLAG_DRAMATIC (1<<5) // is a dramatic scene
+ // DRC_FLAG_SLOWMOTION (1<<6) // would look good in SloMo
+ // DRC_FLAG_FACEPLAYER (1<<7) // player is doning something (reload/defuse bomb etc)
+ // DRC_FLAG_INTRO (1<<8) // is a introduction scene
+ // DRC_FLAG_FINAL (1<<9) // is a final scene
+ // DRC_FLAG_NO_RANDOM (1<<10) // don't randomize event data
+
+ uint8[command_length-8] uk_data;
+
+ }
+
{52} '',
{53} '',
{54} 'sendextrainfo',
+
+ char* text;
+ uint8 uk_b;
+
{55} '',
{56} '',
{57} '',
@@ -240,43 +428,11 @@ List of Server Message IDs:
{61} '',
{62} '',
{63} '',
-{64} '',
-{65} '',
-{66} '',
-{67} '',
-{68} '',
-{69} '',
-{70} '',
-{71} '',
-{72} '',
-{73} '',
-{74} '',
-{75} '',
-{76} '',
-{77} '',
-{78} '',
-{79} '',
-{80} '',
-{81} '',
-{82} '',
-{83} '',
-{84} '',
-{85} '',
-{86} '',
-{87} '',
-{88} '',
-{89} '',
-{90} '',
-{91} '',
-{92} '',
-{93} '',
-{94} '',
-{95} '',
-{96} '',
-{97} '',
-{98} '',
-{99} '',
-{100} ''
+--------------------------------------------------------------------------------
+{64-256}
+These server messages are dynamically indexed using message {39}'s usermsg_id
+See hl1-demofile-spec-cstrike.txt
+--------------------------------------------------------------------------------
# 2 / Unknown
@@ -297,3 +453,28 @@ next one.
# 6 / Unknown
+ uint32 uk_i1;
+ uint32 uk_i2;
+ float32 uk_f;
+ char[72] data;
+
+# 7 / Unknown
+
+ uint32 uk_i1;
+ uint32 uk_i2;
+
+# 8 / Play Sound
+
+ uint32 uk_i1;
+ uint32 sound_name_length;
+ char* sound_name;
+ float32 uk_f1;
+ float32 uk_f2;
+ uint32 uk_i2;
+ uint32 uk_i3;
+
+# 9 / Unknown
+
+ sint32 chunklength;
+ char* data;
+