From SRB2 Wiki
Jump to: navigation, search
For the WAD file lump called MAINCFG, see SOC#Script execution.

The MainCfg block is a special SOC block that allows the user to modify a variety of global game settings, such as the timers of various power-ups and other timed effects, the name of the gamedata and save files, the location of the Special Stages and the first Single Player stage, and other miscellaneous settings. It is commonly used in level packs and other addons that extensively modify the game.

The MainCfg block should not be confused with the MAINCFG lump. Although both share the same name and are related to SOCs, they are not otherwise connected. MAINCFG is a reserved lump name in SRB2 – if a WAD file contains a lump with that name, SRB2 will recognize it as a SOC lump and load its contents upon loading the WAD file. Because of this, SOC code that should be executed immediately is often placed in the MAINCFG lump – including the MainCfg block.

Because it contains globally relevant information, the MainCfg block is usually placed at the top of a SOC lump or file. This causes it to be loaded before all other SOC blocks. This is especially relevant due to the ResetData parameter, which can cause previously loaded SOC data to be erased. But even if the ResetData parameter is not set, it is advised to place the MainCfg block first for better organization.


The header of the MainCfg block simply consists of a single line that reads MainCfg. Unlike most other SOC blocks, it contains no slot number, since the data it modifies is global and exists only once.


The following is a list of all parameters that can be set in the MainCfg block. Not all of these have to be specified; if a parameter is left out, it will revert to its default value.

Level settings

These parameters are commonly used in level packs to determine which maps are used in them.

  • SpStage_Start defines where the Single Player rotation starts. This is used for telling the game which map to warp to when starting a new game. The Single Player maps do not have to be clustered together like the Special Stages, because the individual level headers determine which map is loaded next. This parameter merely tells the game where the first level is. Defaults to 1 if the parameter is omitted.
  • SStage_Start sets the map number of the first Special Stage. All other Special Stages must be clustered together in the immediately following map slots. For example, if SStage_Start = 50, then the first Special Stage should be in MAP50, the second in MAP51, and the seventh in MAP56. Defaults to 50 if the parameter is omitted.
  • UseNiGHTSSS determines if NiGHTS Special Stages (true) or old Special Stages (false) are used. Defaults to true if the parameter is omitted.


These parameters affect relatively minor traits in-game, though may be handy for some modifications.

  • RedTeam sets the skin color of players on the red team in Team Match and Capture the Flag games in the format SKINCOLOR_X, where X is the name of color, e.g. SKINCOLOR_RED. See List of skin colors for a full list of available colors.
  • BlueTeam sets the skin color of players on the blue team in Team Match and Capture the Flag games in the format SKINCOLOR_X, where X is the name of color, e.g. SKINCOLOR_RED.
  • RedRing sets the color of the red ring thrown in Match and other combative gametypes in the format SKINCOLOR_X, where X is the name of color, e.g. SKINCOLOR_RED.
  • BlueRing sets the skin color of the rings thrown by players on the blue team in Team Match and Capture the Flag games in the format SKINCOLOR_X, where X is the name of color, e.g. SKINCOLOR_RED.
  • DisableSpeedAdjust determines whether to change the player's animations according to the player's velocity, for example when Sonic's walking animation speeds up as he walks faster, (false) or not (true). Defaults to false if the parameter is omitted. Note that this will affect all characters in the game. To set this for specific characters, use the SF_NOSPEEDADJUST skin flag.
  • Use1UpSound determines whether to play the sound effect sfx_oneup (true) or the music track mus_xtlife (false) when collecting extra lives. Defaults to false if the parameter is omitted.
  • MaxXtraLife determines the maximum number of extra lives that can be earned from collecting rings. Extra lives are awarded for each 100 rings that the player collects, until the maximum is reached. Defaults to 2 if the parameter is omitted, which means that no more extra lives are awarded for collecting 300 rings and above.


These parameters affect the title screen as well as the intro and credits cutscenes.

  • IntroToPlay determines the number of the cutscene to play as the intro, completely replacing the existing intro cutscene SRB2 uses. For example, if IntroToPlay = 2 is set, then the game will search for a cutscene block with a header of Cutscene 2 to be played as the intro.
  • LoopTitle determines whether to loop the title screen music (true) or play it just once (false). Defaults to false if the parameter is omitted. If looping is enabled and the title screen music has a loop point, the music will loop according to the loop point.
  • TitleScrollSpeed sets the speed at which to scroll the title screen rightwards. 1 speed is equal to 1/16 of a pixel per tic. To get a speed of 4 pixels per tic, multiply the desired number of pixels per tic by 16. This integer does not support negative values. In order to make the title screen scroll the opposite direction, multiply the width of the title screen by 16 and subtract your desired speed - this will make the title screen appear to be scrolling the other direction when it is actually just travelling ridiculously fast.
  • CreditsCutScene determines the number of the cutscene to use at the credits.

Title screen demos

These parameters affect the demos that are played back at the title screen.

  • NumDemos sets the number of demos that are played back in the title screen. The demo lumps to be played should have the lump names DEMO_xxx, with xxx starting at 001 and continuing up until the value of this parameter. The default value is 3.
  • DemoDelayTime sets the amount of time that the game will stay on the title screen between playing back demos. The default value is 15*TICRATE (15 seconds).
  • DemoIdleTime sets the additional amount of time that the game will stay on the title screen if the DemoDelayTime was depleted while the console was open or the user was in a menu. Once the console or menu is closed, the game will additionally deplete the DemoIdleTime before playing back a demo. The default value is 3*TICRATE (3 seconds).

Data handling

  • GameData defines which data file is used to save game progress, such as unlocked secrets. Modifications with custom unlockables need to set this parameter. For example, if GameData = s_mymod.dat is set, then the file used to save data is s_mymod.dat in the SRB2 directory. The file extension must be .dat.
  • ResetData resets the sprite, state or Object type tables upon loading the file. This means that the effect of any previously loaded SOC files will be nullified. The value determines which tables to reset: Add 1 to reset the sprite table, 2 to reset the state table, and 4 to reset the Object type table. The values can be combined. No state or Object type definitions should be placed above this line in the lump, as they will be erased as well.


These parameters control how long the effects of certain power-ups and other timers last. They are measured in tics, of which 35 equal one second. Multiply the values with the constant TICRATE (35) to convert them to seconds. SOC files made simply to modify these parameters are generally frowned upon, and forbidden on the SRB2 Message Board.

  • InvulnTics sets how long the Invincibility power-up lasts. The default value is 20*TICRATE (20 seconds).
  • SneakerTics sets how long the Super Sneakers power-up lasts. The default value is 20*TICRATE (20 seconds).
  • FlashingTics sets how long a player flashes and is invincible right after taking damage. The default value is 3*TICRATE (3 seconds).
  • TailsFlyTics sets how long Tails can fly before getting tired. The default value is 8*TICRATE (8 seconds).
  • UnderwaterTics sets how long the player can stay underwater before drowning. Note that this value includes the drowning countdown, not just the period before it. To retain the full countdown, this value should be at least 6 seconds. The default value is 30*TICRATE (30 seconds).
  • SpacetimeTics sets how long the player survives in a space countdown before dying. Note that the timer can actually be expanded beyond just the countdown, so that there is a period before the countdown starts, like in water. The default value is 11*TICRATE + (TICRATE/2) (11.5 seconds).
  • ExtraLifeTics sets how long the extra life music plays. Note that this value is completely separate from the length of the actual extra life tune. If this value is shorter than the length of the tune, the tune will be cut off. If it is longer, the remaining time will be filled with silence. If a custom extra life tune is used, this parameter should be adjusted to match the length of the custom tune. The default value is 4*TICRATE (4 seconds).
  • GameOverTics sets how long the game stays at a Game Over screen before switching to the continue screen or the title screen. This affects only Single Player mode, where the game eventually switches to another screen. In other applicable modes, such as Coop and Competition, the Game Over screen will be displayed indefinitely until the other players complete the level. The default value is 15*TICRATE (15 seconds).


  • ExecCfg sets the file name of a console script to be executed when the WAD is loaded.
  • CustomVersion replaces the "v2.1.x" version string in the bottom-left corner of the game menus with a customized version string. This parameter supports custom colors.


SpStage_Start = A1
SStage_Start = B1
UseNiGHTSSS = true
GameData = s_mymod.dat
ResetData = 7
TailsFlyTics = 10*TICRATE
CustomVersion = v1.1
  Sonic Object Configuration [view]
General ClearMainCfg
Objects ObjectStateSoundFreeslot
Unlockable content EmblemExtraEmblemUnlockableConditionSet
Miscellaneous WipesCharacterLevelCutscene / SceneHudItem
Related links ActionsConstantsObject creation tutorial