.rec file 1005: Difference between revisions

From NPC for VCMP 0.4 Servers
Jump to navigation Jump to search
 
(22 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Introduction==
The new structure of rec files can hold the name of the player whose actions are recorded. It can also hold chats send by player, cmds, priv msg send by him. Also rec files hold pickup picked by player (id stored), checkpoints, objects touched and shot. Also client script data send by player's client script can be captured and replayed.
Additionaly, once the player is put in recording, by death of him the recording does not interrupt. Rather the class selected by him after death to spawn will be recorded. So that npc when on replay, will die and spawn with the class the player selected.
==New Structure of Rec Files==
==New Structure of Rec Files==
{| class="wikitable" style="margin:auto align:left"
{| class="wikitable" style="margin:auto align:left"
Line 71: Line 74:
|-
|-
|19||disconnection data
|19||disconnection data
|-
|20||class choose data
|-
|-
|}
|}
</div>
</div>
<div style="float: left; width: 33%;">
<div style="float: left; width: 33%;">
===spawn data (3 bytes)===
===spawn data (4 bytes)===
{| class="wikitable" style="margin:auto align:left"
{| class="wikitable" style="margin:auto align:left"
! Offset* || Value ||Type
! Offset* || Value ||Type
Line 83: Line 88:
|1-2||skin|| unsigned short
|1-2||skin|| unsigned short
|-
|-
|3||classID||unsigned char
|}
|}
===death data (26 bytes)===
===death data (26 bytes)===
Line 103: Line 109:
|2-3||model||unsigned short
|2-3||model||unsigned short
|-
|-
|4||seat| unsigned char
|4||seat||unsigned char
|}
</div>
<div style="float: left; width: 33%;">
===vehicle entered data(5 bytes)===
same as vehicle enter request
===passenger data(7 bytes)===
{| class="wikitable" style="margin:auto align:left"
! Offset* || Value ||Type
|-
|0-1||vehicle id||unsigned short
|-
|2-3||model||unsigned short
|-
|4||health||unsigned char
|-
|5||armour||unsigned char
|-
|6||seat||unsigned char
|}
===checkpoint enter/exit data(14 bytes)===
{| class="wikitable" style="margin:auto align:left"
! Offset* || Value ||Type
|-
|0-1||checkpoint id||unsigned short
|-
|2-5||pos x||float
|-
|6-9||pos x||float
|-
|10-13||pos x||float
|-
|}
|}
===class choose data(2 bytes)===
{| class="wikitable" style="margin:auto align:left"
! Offset* || Value ||Type
|-
|0||relative index(0,1 or 255)||unsigned char
|-
|1||class ID||unsigned char
|}
</div>
<div style="clear: both;"></div>
<div style="float: left; width: 33%;">


===player command data data(2+len bytes)===
{| class="wikitable" style="margin:auto align:left"
! Offset* || Value ||Type
|-
|0-1||len of msg||unsigned short
|-
|2-(2+len)||msg||char*
|-
|}
===player chat data===
same as player command data
===client script data===
same as player command data, except instead of char*, it is unsigned char*
</div>
<div style="float: left; width: 33%;">
===player pm data(26+len bytes)===
{| class="wikitable" style="margin:auto align:left"
! Offset* || Value ||Type
|-
|0-23||target player name||char*
|-
|24-25||len of priv msg||unsigned short
|-
|26-(26+len)||priv msg||char*
|-
|}
===object shot (5 bytes)===
{| class="wikitable" style="margin:auto align:left"
! Offset* || Value ||Type
|-
|0-1||object id||unsigned short
|-
|2-3||model||unsigned short
|-
|4||weapon||unsigned char
|-
|}
</div>
<div style="float: left; width: 33%;">
===object touch data (4 bytes)===
{| class="wikitable" style="margin:auto align:left"
! Offset* || Value ||Type
|-
|0-1||object id||unsigned short
|-
|2-3||model||unsigned short
|-
|}
===disconnection data (0 bytes)===
===onfoot-data===
The structure of onfoot-data is not changed. onfoot-aim has same offsets as onfoot-data. driver-data is same as Vehicle data. These (On-foot data and vehicle data) can be found here: [[.rec_file#Data blocks (v4)|.rec_file]]
===driver-data===
This is not changed from Vehicle data of earlier versions. See [[.rec_file#Vehicle data|.rec_file]]
</div>
</div>
<div style="clear: both;"></div>
==Example==
Here is an example of .rec file opened in Hex editor: [[:File:Rec example.png|click here]]

Latest revision as of 07:16, 29 February 2024

Introduction

The new structure of rec files can hold the name of the player whose actions are recorded. It can also hold chats send by player, cmds, priv msg send by him. Also rec files hold pickup picked by player (id stored), checkpoints, objects touched and shot. Also client script data send by player's client script can be captured and replayed. Additionaly, once the player is put in recording, by death of him the recording does not interrupt. Rather the class selected by him after death to spawn will be recorded. So that npc when on replay, will die and spawn with the class the player selected.

New Structure of Rec Files

Offset Name type
0-3 Version Unsigned Integer
4-7 Recording Type Unsigned Integer
8-11 Flags Unsigned Integer
12-35^ Name if (Flags&1) == 1 char*, 24 bytes.
36-40 (or 12-16) General Datablock See General Datablock section
41- _ (or 17- _) One of SpawnData, CommandData, PickupData, PrivMsgData, CheckpointData, ObjectTouchData, ObjectShotData, DeathData,VechicleEnterData See appropriate sections
... ...

General Datablock

Offset* Name type
0-4 Time Unsigned Integer
5 Packet Type 1 for Spawn Data, 2 for Death Data,.. See table Packet Types

Packet Types

Value of Packet Type Corresponds to has trail data
1 Spawn Data
2 Death Data
3 Vehicle Exit Data
4 Vehicle Enter Request
5 Vehicle Entered Data
6 on-foot update data
7 on-foot update aim
8 driver update
9 passenger update
10 player command data yes
11 player chat data yes
12 player pm data yes
13 clientscript data yes
14 pickup picked data
15 checkpoint entered
16 checkpoint exited
17 object touch
18 object shot data
19 disconnection data
20 class choose data

spawn data (4 bytes)

Offset* Value Type
0 team unsigned char
1-2 skin unsigned short
3 classID unsigned char

death data (26 bytes)

Offset* Value Type
0-23 killer name char*
24 reason unsigned char
25 bodypart unsigned char

vehicle exit (0 bytes)

vehicle enter request (5 bytes)

Offset* Value Type
0-1 vehicle id unsigned short
2-3 model unsigned short
4 seat unsigned char

vehicle entered data(5 bytes)

same as vehicle enter request

passenger data(7 bytes)

Offset* Value Type
0-1 vehicle id unsigned short
2-3 model unsigned short
4 health unsigned char
5 armour unsigned char
6 seat unsigned char

checkpoint enter/exit data(14 bytes)

Offset* Value Type
0-1 checkpoint id unsigned short
2-5 pos x float
6-9 pos x float
10-13 pos x float

class choose data(2 bytes)

Offset* Value Type
0 relative index(0,1 or 255) unsigned char
1 class ID unsigned char

player command data data(2+len bytes)

Offset* Value Type
0-1 len of msg unsigned short
2-(2+len) msg char*

player chat data

same as player command data

client script data

same as player command data, except instead of char*, it is unsigned char*

player pm data(26+len bytes)

Offset* Value Type
0-23 target player name char*
24-25 len of priv msg unsigned short
26-(26+len) priv msg char*

object shot (5 bytes)

Offset* Value Type
0-1 object id unsigned short
2-3 model unsigned short
4 weapon unsigned char

object touch data (4 bytes)

Offset* Value Type
0-1 object id unsigned short
2-3 model unsigned short

disconnection data (0 bytes)

onfoot-data

The structure of onfoot-data is not changed. onfoot-aim has same offsets as onfoot-data. driver-data is same as Vehicle data. These (On-foot data and vehicle data) can be found here: .rec_file

driver-data

This is not changed from Vehicle data of earlier versions. See .rec_file

Example

Here is an example of .rec file opened in Hex editor: click here