# Tool-assisted speedrun

A tool-assisted speedrun or tool-assisted superplay (TAS; /tæs/) is generally defined as a speedrun or playthrough composed of precise inputs recorded with tools such as video game emulators. Tool-assisted speedruns are generally created with the goal of creating theoretically perfect playthroughs. This may include the fastest possible route to complete a game or showcasing new optimizations to existing world records.
TAS requires research into the theoretical limits of the games and their respective competitive categories. The fastest categories have no restrictions and often involve a level of gameplay impractical or impossible for a human player, and those made according to real-time attack rules serve to research the limits of human players.
The TAS developer has full control over the game's movement, per video frame, to record a sequence of fully precise inputs. Other tools include save states and branches, rewriting recorded inputs, splicing together best sequences, macros, and scripts to automate gameplay actions. These tools grant TAS creators precision and accuracy beyond a human player.

## History

The term was coined during early Doom speedrunning. When Andy "Aurican" Kempling released a modified version of the Doom source code that made it possible to record demos in slow motion and in several sessions, it was possible for the first players to start recording tool-assisted demos. In a few months, in June 1999, Finnish Esko Koskimaa, Swedish Peo Sjöblom, and Israeli Yonatan Donner opened the first site to share these demos, "Tools-Assisted Speedruns".
In 2003, a video of a Japanese player named Morimoto completing the NES game Super Mario Bros. 3 in 11 minutes and performing stunts started floating around the Internet. The video was controversial, because not many people knew about tool-assisted speedruns, especially for the Nintendo Entertainment System. The video was not clearly labeled as such, so many people considered an emulator cheating. It inspired Joel "Bisqwit" Yliluoma to start the NESvideos website for TAS for the NES, and it was renamed TASVideos.
Tool-assisted speedruns have been made for some ROM hacks and for published games. In 2014, the speedrunning application TASBot was developed, capable of direct controller input.

## Method

Creating a tool-assisted speedrun is the process of finding the optimal set of inputs to fulfill a given criterion — usually completing a game as fast as possible. No limits are imposed on the tools used for this search, but the result has to be a set of timed key-presses that, when played back on the actual console, achieves the target criterion. The basic method used to construct such a set of inputs is to record one's input while playing the game on an emulator, all the while saving and loading the emulator's state repeatedly to test out various possibilities and only keep the best result. To make this more precise, the game is slowed down. Initially, it was common to slow down to some low fraction of normal speed. However, due to advances in the field, it is now expected that the game is paused during recording, with emulation advanced one frame at a time to eliminate any mistakes made due to the urgency.
The use of savestates facilitates luck manipulation, which uses player input as entropy to make favorable outcomes. Examples include making the ideal piece drop in Tetris, or getting a rare item drop from a defeated enemy.

### Re-recording emulators

Tool-assisted speedrunning relies on the same series of inputs being played back at different times always giving the same results. The emulation must be deterministic with regard to the saved inputs, and random seeds must not change. Otherwise, a speedrun that was optimal on one playback might not even complete it on a second playback. This desynchronization occurs when the state of the emulated machine at a particular time index no longer corresponds with that which existed at the same point in the movie's production. Desyncs can also be caused by incomplete savestates, which cause the emulated machine to be restored in a state different from that which existed when it was saved. Desyncs can also occur when a user attempts to match inputs from an input file downloaded from TASVideos and fail to match the correct enemy reactions due to bad AI or RNG.

### Verification

Some players have fraudulently recorded speedruns, either by creating montages of other speedrun or altering the playing time, posting them as TAS or RTA. Because tool-assisted speedruns can account for all aspects of the game code, including its inner workings, and press buttons precisely and accurately, they can be used to help verify whether an unassisted speedrun record is legitimate.
One of the best-known cases is Billy Mitchell, whose Donkey Kong and Pac-Man Guinness records were revoked in 2018, because he used the emulator MAME.
In 2018, the world record for Dragster by Todd Rogers was removed from Twin Galaxies and Guinness records after an experiment showed that his 5.51 second time was impossible to achieve even with a TAS.

## Examples

In Super Mario Bros., the current Famicom and NES human-theory world record, created by Maru, stands at 4:57.54 (4:54.265 in RTA timing). In Super Mario Bros. 3, arbitrary code execution along with credits warp allows injecting a hack that simulates a Unix-like console, providing extra features to Mario. The current TAS standing at 216 milliseconds (13 frames) was performed by exploiting a small bug with the Famicom and NES hardware in which the CPU makes many extra "read" requests from one of the controller inputs, registering many more button presses than have occurred; the A button is mashed at a rate of 8 kilohertz (8000 times per second), performing the credits warp glitch. In Super Mario World, arbitrary code execution allows injection of playable versions of Flappy Bird, Pong, Snake, and Super Mario Bros.