Metal Sonic race tutorial

From SRB2 Wiki
Jump to navigation Jump to search
This article or section is outdated and has not been fully updated to reflect the current version of SRB2.

Please help the Wiki by correcting or removing any misinformation, as well as adding any new information to the page.

The Metal Sonic race seen in Black Core Zone Act 1 is an interesting way to add a time limit to a level. It gives players a natural benchmark of how quickly they're going through a stage. This tutorial shows the basic setup of a Metal Sonic race.

Introduction

Before Metal Sonic can be set up, he needs a map to move around in. For this tutorial, we will use a basic level with a thok barrier, a few platforms to jump around, a red sector (you'll see why) and a Player 1 Start. Place a Metal Sonic race start somewhere in your level too, preferably where the player can see him (although this is not mandatory). This will be the entry point to the race.

Recording the replay

You may have noticed that Metal Sonic isn't moving yet. This is because he has no pre-defined actions. All of his movement input is read from a replay lump contained in the WAD or PK3 file that you need to record yourself. However, normal replays aren't accepted – they need to be in a special format.

To record the replay, start the game with the -metal command line parameter. Loading the game with this parameter will start recording of a Metal Sonic replay. The simplest way to do this is to simply add it as an additional parameter in your map editor's test settings. Add the parameter to the test settings and run the game. If done correctly, you will spawn at the Metal Sonic race start instead of the Player 1 Start.

Now that you're in Metal Sonic recording mode, you can move around and record your replay. Note that any rings placed in the level will disappear while recording a Metal Sonic replay, and death will result in a forced termination of the recording.

When you quit the game, the replay is saved in your SRB2 directory. A dialog box will pop up, telling you the name of the file. This file is what you will load into your WAD or PK3 file to make Metal Sonic move. Note that any previous replay lumps for the same map number will be overwritten without asking, so be sure to make copies of any replays you wish to keep.

Loading the replay

Now that you have created a replay, you need to add it into the level WAD or PK3. Open your WAD or PK3 file in a lump editing program and add the replay file generated by SRB2 in any convenient location, with the name MAP##MS, where ## is the extended map number of the map. (This is the same name the file will be given when it is created, without the file extension.) For the sake of organization, it is recommended to place this lump directly adjacent to the map itself.

Test your level again, making sure to remove the -metal parameter from your test settings. You will notice that Metal Sonic still doesn't move.

For the sake of flexibility, Metal Sonic replays do not start automatically upon map load, and must be triggered via a linedef executor. This can be used to create a race that only spans part of the map, for instance, or to use Metal Sonic as a scripted event of sorts instead of as a race.

For now, though, we want Metal Sonic to start moving as soon as someone steps on a sector with Sector type 80, Trigger Linedef Executor (Floor Touch). To achieve this, we'll use Trigger Linedef Executor – Once to execute the relevant linedef trigger by stepping on the red square. Set up a linedef executor sector outside of the map with this trigger, and set one of the adjacent linedefs to Linedef Executor – Start Metal Sonic Race. This linedef executor does not need a tag, and takes no arguments. Save and test your map again. Step on the red square. Metal Sonic should load the replay and start moving around.

If you place some spikes in Metal Sonic's path, he will run straight through them, destroying them in the process. If the spikes were placed before recording the replay, they will have no collision, allowing you to run straight through. If the replay is then played in the map, Metal Sonic will still break the spikes.

A similar event happens upon collision with an enemy, in which case Metal Sonic will instantly destroy it.

Sample

Example file: ex_ld440_startmetalsonicrace.wad (MAP01) 
  • This shows a fully functional Metal Sonic replay.
How to use
  • You may load this file into your favorite map editor, such as Zone Builder. Select MAP01 as the map to load.
  • You may also load this file in the game:
    1. Save ex_ld440_startmetalsonicrace.wad into the addons folder of your SRB2 directory.
    2. Start SRB2, go to the Addons menu, and then select ex_ld440_startmetalsonicrace.wad.
    3. Start the game in Single Player mode.
    4. Press the Console button (~), and type in the command MAP MAP01 to access the example map.
  • When you load this file in the game, it replaces Greenflower Zone Act 1.