Difference between revisions of "Replay file format"

From Stunts Wiki
Line 2: Line 2:
  
 
==Overview==
 
==Overview==
Replays are saved by Stunts as binary files of extension '.rpl'. They contain the necessary information to recreate the actions by the player on one track, with one car and to identify the opponent. Replays are always saved from the start of the race. It's not possible to have a replay starting any later. All moves made by the player are saved up to a maximum of ten minutes at maximum quality (20 frames per second). It is not yet tested whether it's possible to save a longer time while using a lower quality (say, 20 minutes at 10 frames per second).
+
Replays are saved by Stunts as binary files of extension ''.rpl''. They contain the necessary information to recreate the actions by the player on one track, with one car and to identify the opponent. Replays are always saved from the start of the race. It's not possible to have a replay starting any later. All moves made by the player are saved up to a maximum of ten minutes at maximum quality (20 frames per second). It is not yet tested whether it's possible to save a longer time while using a lower quality (say, 20 minutes at 10 frames per second).
  
 
Actions by the opponent (if any) are not saved. Stunts will reproduce the opponent's AI during the execution of the replay instead.
 
Actions by the opponent (if any) are not saved. Stunts will reproduce the opponent's AI during the execution of the replay instead.
Line 25: Line 25:
 
==Body==
 
==Body==
 
* (1802 bytes) Exact copy of original track file
 
* (1802 bytes) Exact copy of original track file
* ('n' bytes, where 'n' is the 'number of ticks' given above) Keys pressed during replay
+
* (''n'' bytes, where ''n'' is the ''number of ticks'' given above) Keys pressed during replay
  
 
[[Category:Modding]]
 
[[Category:Modding]]
 
[[Category:Internals]]
 
[[Category:Internals]]

Revision as of 04:42, 13 March 2019

Replay File Format refers to the format of binary '.rpl' files used by Stunts

Overview

Replays are saved by Stunts as binary files of extension .rpl. They contain the necessary information to recreate the actions by the player on one track, with one car and to identify the opponent. Replays are always saved from the start of the race. It's not possible to have a replay starting any later. All moves made by the player are saved up to a maximum of ten minutes at maximum quality (20 frames per second). It is not yet tested whether it's possible to save a longer time while using a lower quality (say, 20 minutes at 10 frames per second).

Actions by the opponent (if any) are not saved. Stunts will reproduce the opponent's AI during the execution of the replay instead.

Because the whole track and terrain are saved within a replay file, it is possible to reproduce it without having the track file. It's also straightforward to extract the track from the replay file.

Two replay formats exists. The "old format", used by Stunts v1.0 (Broderbund) and the "new format", used by all others. They only differ in two additional bytes added to the latter.

Header

  • (4 bytes) Car ID of player's car
  • (1 byte) Car colour code of player's car
  • (1 byte) Transmission or player's car (0 = manual, 1 = automatic)
  • (1 byte) Opponent ID
  • (4 byte) Car ID of opponent's car
  • (1 byte) Car colour code of opponent's car
  • (1 byte) Tranmission of opponent's car (0 = manual, 1 = automatic)
  • (9 bytes) Name of the track file used to record, right padded with null bytes
  • (1 byte) Play frequency (tics per second) <<-- Not present in v1.0
  • (1 byte) Ignored, always zero <<-- Not present in v1.0
  • (1 word) Number of ticks in replay

Body

  • (1802 bytes) Exact copy of original track file
  • (n bytes, where n is the number of ticks given above) Keys pressed during replay