Replay file format

From Stunts Wiki
Revision as of 04:57, 13 March 2019 by Cas (talk | contribs)

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

Car IDs are the four characters (usually alphanumeric) that identify a car's files. For the game's original cars, these are as follows:

  • COUN : 25th Aniversary Lamborghini Countach
  • FGTO : Ferrari GTO
  • JAGU : Jaguar XJR9 IMSA
  • LANC : Lancia Delta HF Integrale 16V
  • LM02 : Lamborghini LM-002
  • P962 : Porsche 962
  • PC04 : Porsche Carrera 4
  • PMIN : Porsche March Indy
  • VETT : Corvette ZR1
  • ANSX : Acura NSX
  • AUDI : Audi Quattro Sport

When playing solo, the opponent's car ID is set to a character 255 followed by three null bytes.

Colour codes depend on the car. Each car has a number of paintjobs, which is always 7 for the original game cars. The paintjob to be used is identified with a number from zero to one less than the number of paintjobs. For any of the original cars, a number greater than 6 here will be assumed 0. Custom cars may have more than 7 paintjobs. What happens with higher numbers in that case is untested. A curiousity is that the Porsche 962 and the 25th Aniversary Lamborghini Countach are the only two original cars with the exact same set of paintjobs. When playing solo, the opponent's car colour is set to zero.

Opponent ID goes from 0 to 6. A null here means no opponent. For values 1 to 6, the default opponents are the following:

  • 1 : Squealin' Bernie Rubber
  • 2 : Herr Otto Partz
  • 3 : Smokin' Joe Stallin
  • 4 : Cherry Chassis
  • 5 : Helen Wheels
  • 6 : Skid Vicious

Using any larger number causes Stunts to try to locate a file that's not found, suggesting it is possible to create new opponents.

Play frequency is normally 20 tics per second, but Stunts will drop this to 10 if the CPU is to slow and can't keep up. Although Stunts doesn't seem to use any other frequency, modifying this value to anything else does work. A normal replay at 20 tics per second that gets this byte modified will appear to run at a different pace. Crazy speeds are possible this way. For v1.0, only 20 tics per second can be handled.

Body

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