I made an AI to tas Nintendo Nighmare in 17 minutes and 37 seconds although AI is probably giving too much credit to this code.
Take for example a generic room. Suppose it has some obstacles to walk around in order to reach a door. My current way that I would tackle this is to write some sequence of conditionals that partition the room into manageable regions. Then in each region I say to walk towards some position. That is the extent of this logic. It is *automated* (and therefore a bot), but it is not really doing any actual *thinking*. Therefore I do not consider it a bot.
In this run I would say there are seven major areas that we go through. This is just a broad categorization I have mentally, and others might disagree with me. These seven segments are as follows:
1. Intro level as Mario
2. Death Egg as Mario
3. Intro level as Link
4. Death Egg as Link
5. Gyorg Tower
6. Volcano Temple
7. Sand Temple
Technically within the code there are six segments as the intro level is the same code for Link and Mario. Mechanically they are the same, aside from Link having the ability to acquire items.
The primary goal of the speedrun is to defeat the final boss which is located in the Sand Temple. In order to defeat the boss, two items are required. These items are the hookshot and the hammer. The hookshot is located within the Gyorg tower which we immediately exit upon obtaining. The hammer is located in the volcano temple, and we also leave that dungeon immediately upon getting the hammer. The Death Egg dungeon is entered in order to obtain the Jet Shield, which is an upgrade that allows the player to hover infinitely over any distance. While this item is theoretically skippable, the hover ability allows the bot to essentially skip the majority of obstacles.
The primary technique used in this run is the CAD (control-alt-delete) exploit. To elaborate, on Windows pressing the CAD keyboard combination brings up a secondary desktop security window. Through errors in the underlying game engine that are not fully understood, large swaths of game code are not executed while in this menu and similar UAC menus. As it matters for this speedrun, this causes collision and walking movement disabled while leaving gravity enabled. This allows the player to fall under the floor at any time, and because jumping midair is a normal feature, this is utilized to jump under walls. Once Jet Shield is obtained, the need to jump back in bounds is eliminated as all doors have infinite height in both directions. Because the issue of opening and closing windows security menus via automation is neither deterministic timing-wise nor possible without some form of *Windows* exploit (aka a Windows security flaw), CAD is simulated via a call to event_perform() to generate calls to the begin step event (which according to people far smarter than me is the only event executing every frame CAD is active).
Another large skip is backup/star farming during the first Death Egg segment. That particular collectible is not quite functional and can be collected any number of times. Doing this allows one to skip the first three worlds and go straight to the Death Egg level. This probably didn’t need much clarification but I hope it helps.
I am hoping by starting this conversation some further skips might be discovered or perhaps better optimized routing might be created. I am currently shooting for sub 15, but sub 10 or even sub 5 would be amazing.
The video:
https://m.youtube.com/watch?v=4-_6hI8RjHw&t=7s
Note that I did not film the video or publish, so while nothing has been mentioned to me there is always the possibility that the recorder didn’t keep their hands off (apparently they were frustrated by the bot’s inefficiency). This happened last time and created a minor discrepancy between my time and their time. No such discrepancies exist (that I know of), but if any are determined I will be sure to make note of it here.
Here is the code:
https://pastebin.com/rdRk46X6
I put it in a function-like format for readability. The bot is hardcoded within the game’s source code which is then compiled with Game Maker 8.0.