User:Monster Iestyn/Demo

From SRB2 Wiki
Jump to: navigation, search
Test.png This article or section is incomplete. It doesn't have all of the necessary core information on this topic. Please help the SRB2 Wiki by finishing this article.

Demos, also known as replays, are a type of file format that store recordings of a player's input and position data for a particular level, which can be played back by the game. These are mainly created and used by the Record Attack and NiGHTS Mode game modes. Notably, the Metal Sonic race in Egg Rock Zone Act 3 also relies on a special replay in order for Metal Sonic to move about and jump in the level.

Demo format

Every demo for SRB2 starts with the following information:

Position Length (bytes) Description
0x00 12 A header of twelve bytes shared by all SRB2 demos: the hexadecimal number F0, followed by the string "SRB2Replay" encoded in ASCII, followed by the hexadecimal number 0F.
0x0C 1 A constant representing the version of SRB2 the demo was recorded for; for v2.1, this is 201
0x0D 1 A constant representing the sub-version of SRB2 the demo was recorded for; for v2.1.17, this is 17
0x0E 2 The demo format version number; this may be updated by later versions of SRB2 if changes are made to the format. As of v2.1.17, this is currently 9.
0x10 16 The demo's checksum.
0x20 4 An ASCII-encoded string representing the type of replay the demo is:
  • "PLAY" - Player replay
  • "METL" - A Metal Sonic replay

Following this, the format of demos varies depending on the type of replay or the part of the game the demo was recorded for, which will not be written in detail here.

Recording/Playback

Command line parameters

  • -record
  • -playdemo
  • -timedemo
  • -maxdemo

Console commands/variables

Record Attack/NiGHTS Mode

Main article: Record Attack

Console commands/variables

Title screen demos

Demos can also be played back at the title screen. This feature can be turned on or off using the rollingdemos console variable. Some time after the music has finished playing, SRB2 automatically starts playing back a demo; after it has finished playing, the game returns to the title screen. If there are multiple title screen demos, the game then plays back the second demo, returns to the title screen, plays the third demo and so on. As of the current release of SRB2, the title screen cycles through a set of three of these in turn, demonstrating gameplay of SRB2 itself:

Demo name Description
DEMO_001 A replay of Sonic playing through Greenflower Zone Act 1 (MAP01).
DEMO_002 A replay of Tails playing through Greenflower Zone Act 2 (MAP02).
DEMO_003 A replay of Knuckles playing through Techno Hill Zone Act 1 (MAP04).

However, all three of these use an outdated demo format (version 8), and are prone to de-synchronising.

Custom demos can be played back at the title screen in place of SRB2's own demos, if needed. See MainCfg > Title screen demos for more information.

Metal Sonic replays