Mari0 is Super Mario Bros. but with portals. It turns out the placed warp pipes weren't enough, so Mario grabs his portal gun and creates his own path through the levels.
Game objectives
- Aims to complete the game as fast as possible
- Pauses the game to save time
- Uses gravity to go fast
- Thanks gravity
Doing a normal SMB run of this game was long overdue, but optimization in this game turns out to be more difficult than expected. There was a previous (unsubmitted) attempt clearing the game in 01:11.92 or 4315 frames. This movie saves another 280 frames on top of that.
Route
The route is pretty simple: Enter the 1-2 pipes before they have fully loaded. This brings you to the minus world -1. Quit and continue the game from there, bringing you to 8-4 to finish the game.
Game mechanics
Portals
Portals can only be placed if there are two solid tiles next to each other. Once you shoot a portal, there is a 12 or 13 frame delay until you can shoot the next one.
Physics
Your running speed is capped at 9 tiles per second (the game runs at 60 FPS). The vertical falling speed is capped at 100 tiles per second. Using portals you can exchange X and Y speeds giving you up to 100 tiles per second horizontal speed (for reference, 1-1 is about 200 tiles long).
Optimizing this game
The most important part is preserving momentum. Getting high speeds but crashing into walls is pretty much always slower than lower speeds but smooth maneuvering (8-4 example). This is why optimizing this game can be difficult and, most importantly, unintuitive. A great challenge for a TASer.
1-1
Obviously, using the pipe or any normal route would be too slow. So the basic strategy is to use a vertical portal loop to then shoot yourself out at high horizontal speed. This went through many iterations due to the amount of pipes at the beginning, limiting the horizontal speed to avoid bumping against them. The first attempt (
video) intentionally slowed down to make the jump over the pipes. It gives you a speed of around 30, but it was no good considering the maximum speed of 100.
A way to get maximum horizontal speed would be to somehow get past the initial pipes while preserving high Yspeeds. Since maximum Xspeed is quite slow, doing it normally wastes too much time.
So the solution we found was converting jump Yspeed (~17) to Xspeed, preserving this Xspeed while doing the portal loop (which is very difficult with the 12-13 frame delay of portal shooting), and then jumping over the pipes with a single jump. This barely makes it over the pipes, and then barely makes it in time before the level timer turns to 386 giving you fireworks (~2 frames).
1-2
The goal in this level is to get into the warp zone pipes without them being fully loaded, meaning the camera is not allowed to scroll all the way to the right.
The first problem, again, is gaining Xspeed to get to the end of the room. Spawning in the air and dropping down immediately is helpful in gaining speed. Going through the level at a high Xspeed is the biggest challenge. We tried getting both a high X and Yspeed and clipping through the ceiling. But it turns out that gaining Yspeed with a very high Xspeed is basically impossible.
That route was quickly obsoleted by a simpler strategy of going through the level normally at a slightly higher Xspeed. The koopa limits the speed since we have to let him fall through a portal so he doesn't get the way. We didn't find any faster strategies, so this is what we ended up with.
The second problem was to somehow quickly clip into the warp zone room without the camera moving too far to the right.
It was time to blindy try out a lot of things.
It's kind of expected that high Yspeeds tend to make you clip into the ground. This way we can get into the ground in front of the pipe before the warp zone. Getting into the warp zone room this way is very slow due to the distance.
However, being able to clip into the ground opens up the possibility of simply clipping through the ceiling above the warp zone. Except clipping is not possible on one-block ceilings. In other words, you can only clip if you have a "ground" to land on underneath the blocks. This means you
can clip into the ceiling to the left of the warp zone room. The problem is the sophisticated setup. It was the route in the
previous movie mentioned above. Getting enough downwards Yspeed (and proper positioning) while having at least some Xspeed takes a lot of portals and a lot of time.
At the top of the exit pipe, a tile is missing. You can get a mushroom and squeeze into the missing tile, decreasing the distance you need to move compared to the clip under the pipe. But redoing 1-1 to get a mushroom and then clipping is a few frames faster than the method in the previous movie, but comes with problems of being big in 8-4, possibly losing more frames than it saves (getting hit already wastes too many frames).
This movie ended up with the stategy of tricking the camera to scroll towards the beginning of the level and then use portals to get into the warp zone room offscreen. We are just barely able to place a portal on the rightmost wall without the warp zone activating. We need to move quite a distance back because the camera catches up at a speed of 100, which is quite fast.
The final solution is making the piranha plant spawn as soon as possible, and then use the camera scroll trick to get into the pipe.
-1
Entering the warp zone before it is activated brings you to the minus world. Suspending the game from here and continuing from the menu will put you into 8-4 (through an intended easter egg!). The most interesting part here is that the menuing input is all done on a single frame:
esc down return kp_enter up space
Pressing keys in this order will pause the game, put the cursor on the Suspend option, activate the option, put the cursor on the Continue option, and activate the option... all on the same frame.
8-4
The first room is very straightforward.
The second room went through several iterations, an example shown above [dead link removed]. The biggest problem here was how fast the piranha plant spawns once it's onscreen. The previous movie makes a loop to despawn the plant and have enough speed to make it the second time. This movie skips making a complete loop by slowing down enough to make the jump. It ends up looking very simple, but being slow enough to actually land on the pipe instead of flying over is easier said than done.
The third room is interesting. The delay before being able to shoot another portal is 12 or 13 frames. The actual value is 0.2 seconds: a floating point value. The game subtracts the frame durations from the delay variable, and 12 frames of 1/60th of a second can result in the subtractions passing 0, or not passing 0. It's simply floating point errors. However, sometimes it's necessary to place another portal in only 12 frames, so a 1 frame pause was used to make the game use a different frame duration value to subtract.
The fourth room, a water room. The initial idea was doing another portal loop to speed through the room. But the gravity is so low that it actually takes a while to speed up. The room has a small size where speeding up too high actually loses time. For example, speeding up to 15 speed makes the room slower than speeding up to 20. All good, makes sense. But it's not worth it to speed up to, say, 40 when you're already at 30. It simply doesn't save enough frames at the end.
The sweet spot is somewhere at 24 speed.
But of course, swimming along the ceiling and using portals to quickly get through the room is just way faster.
The fifth and final room uses a quick setup to end input as soon as possible. The hammers of the Hammer Bro and the fire of Bowser are based on a global RNG, but it can be manipulated in other rooms with the portal particles.
Masterjun
Mari0 is a cool game to optimize! I like the resulting movie.
lexikiq
Thanks Mari0 for introducing me to TASing :) Was a lot of fun to work through the puzzles of every room (then getting my times optimized by Masterjun)
dwangoAC
I kicked off the process of seeing if it was possible to get libTAS working with this game as part of getting it at GDQ but I admit that lexikiq and Masterjun took the ball and ran with it after that. I probably only have a few frames of input left at the very beginning of the run but I'm honored to be listed as a co-author. Thanks to everyone else who helped make this possible, including the devs on both the libTAS and the Mari0 side!
Suggested screenshot
feos: Replaced with a movie that has reproducible instructions. Input is the same.
feos: Replacing with a faster movie. It looks better now, and the feedback is good. Overall I admit that watching it frame by frame is way more entertaining than in real-time. Still overall enjoyable, accepting to Moons.