Metal Sonic race tutorial
The Metal Sonic race seen in Egg Rock Zone Act 3 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.
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, 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
## 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 the map is loaded. To achieve this quickly, we'll use Trigger Linedef Executor – Level Load to execute the relevant linedef trigger on level load. 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. 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.
- Example WAD: ex_ld440_startmetalsonicrace.wad
- This example WAD can be played in any gametype. It uses
MAP01, replacing Greenflower Zone Act 1.
- This shows a fully functional Metal Sonic replay.