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.19, this is 19
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.19, 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.


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 will alternate between playing each successive demo in order and returning to the title screen; i.e. the game plays back the first demo, returns to the title screen, then plays back the second demo, returns to the title screen, then plays back the third demo, and so on. After the last demo has been played, the game's intro is replayed after the title screen.

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 as all three characters:

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 the game sometimes reports them as de-synchronising (despite the fact they appear to work as expected).

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. If any levels in a custom modification use the same map slots as the levels above (thereby replacing the levels), it is recommended to either provide title screen demos for the new levels, or otherwise disable title screen demos for the modification by setting NumDemos to 0. This is so that the game does not attempt to play SRB2's own title screen demos in the levels now taking up the above map slots.

Metal Sonic replays