.rec file: Difference between revisions

From NPC for VCMP 0.4 Servers
Jump to navigation Jump to search
No edit summary
No edit summary
Line 54: Line 54:
| 36-39|| float || player's speed z co-ordinate
| 36-39|| float || player's speed z co-ordinate
|-  
|-  
| 37 || bool || IsAiming
| 40 || bool || IsAiming
|-
|-
| 38-41|| float || player's aim direction x co-ordinate
| 41-44|| float || player's aim direction x co-ordinate
|-
|-
| 42-45|| float || player's aim direction y co-ordinate
| 45-48|| float || player's aim direction y co-ordinate
|-
|-
| 46-49|| float || player's aim direction z co-ordinate
| 49-52|| float || player's aim direction z co-ordinate
|-
|-
| 50-53|| float || player's aim position x co-ordinate
| 53-56|| float || player's aim position x co-ordinate
|-
|-
| 54- 57|| float || player's aim position y co-ordinate
| 57-60|| float || player's aim position y co-ordinate
|-
|-
| 58 -61|| float || player's aim position z co-ordinate
| 61-64|| float || player's aim position z co-ordinate
|-
|-
| 62 (new) || bool || IsReloading
| 65 (new) || bool || IsReloading
|-
|-
| 63-64 (new) || unsigned short || ammo
| 66-67 (new) || unsigned short || ammo
 
|}
|}
[*]Offset is relative to the datablock
<h3 style="font-weight: normal;"> Vehicle data </h3>
<h3 style="font-weight: normal;"> Vehicle data </h3>
----
----

Revision as of 19:14, 20 November 2022

.rec files

The rec files are the files recorded by the VCMP server using the plugin-npc04relxx. Normally, the files are created by recording a player's action. They then can be used by the npc scripts for playback so that the npcs reproduce exactly the same actions. Only rec files in the npscripts/recordings directory can be accessed by the npc scripts, while the rec files created normally lie in a folder also named 'recordings' in the server directory.

General Structure

The .rec file format consists of a header, followed by a non-separated sequence of data blocks. Every data block completely describes the player state at a specific moment, and so the NPC's actions are stored fluently. The data is stored as bytes in little endian order. Single data values can be 1, 2 or 4 bytes long, and so either are bytes, shorts, integers or floats in IEEE-754 format. ).

HEADER[8]DATABLOCK[76]DATABLOCK[76]... ( for on foot recordings, datablock size is 76 in v.1.3 )

File Header

The .rec file header got the same structure for both vehicle and on-foot recordings. It is 8 bytes long, where the first 4 bytes are an integer. It is 1000 for recordings created by the first version (April 2022) of the program, whereas in release v1.4 it is 1001. The other 4 bytes represent an integer which is 1 for on foot recordings and 2 for vehicle recordings.

Offset* type meaning
0-3 integer File identifier, always e9 03 00 00
4-7 integer 1 for onfoot recordings, 2 for vehicle recordings

[*]Offset is relative to the beginning of the file.

Data blocks

On-foot data


Offset* type meaning
0-3 unsigned integer time in ms when to apply this block's data
4-7 unsigned integer the players keys
8-11 float player's position x co-ordinate
12-15 float player's position y co-ordinate
16-19 float player's position z co-ordinate
20-23 float player's Angle
24 unsigned char Health
25 unsigned char Armour
26 unsigned char Weapon
27 bool IsCrouching
28-31 float player's speed x co-ordinate
32-35 float player's speed y co-ordinate
36-39 float player's speed z co-ordinate
40 bool IsAiming
41-44 float player's aim direction x co-ordinate
45-48 float player's aim direction y co-ordinate
49-52 float player's aim direction z co-ordinate
53-56 float player's aim position x co-ordinate
57-60 float player's aim position y co-ordinate
61-64 float player's aim position z co-ordinate
65 (new) bool IsReloading
66-67 (new) unsigned short ammo

[*]Offset is relative to the datablock

Vehicle data