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 roam around in. Start with the basics: 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. However, normal replays don't work.
Instead, 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 use this is simply to add it as an additional parameter in your map editor's test settings. Add the parameter to the map editor 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, feel free to move around a bit. Jump around some platforms, weave between them, and do whatever you want. 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, it will pop up a dialog box before closing informing you where the replay lump has been saved. This is what you will load into your WAD to make Metal Sonic start moving. 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 a replay created, you need to add it into the level WAD. Open your WAD in a lump editing program and add the file generated by SRB2 in any convenient location, with the name
## is the extended map number of the map. (This will be the same name the file is given when it is created.) For the sake of organization, it is recommended to place this lump directly adjacent to the map itself.
Test your WAD again, making sure to remove the
-metal parameter from your testing settings. With the replay in place, Metal Sonic should begin moving.
For the sake of flexibility, Metal Sonic replays do not start automatically upon map load, and must be triggered via 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, and 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.