Submission #6112: keylie's Linux SteamWorld Dig 2 in 18:11.87

(Link to video)
Linux
baseline
libTAS 1.3.1
65512
60
13439
Unknown
steamworld_dig_2_en_1_1_15062.sh
! Version info: 

libTAS version: 1.3.1

! Annotation info: 

{{Game: SteamWorld Dig 2, Release 1 (v1.1) Build 6.1.1.1 DRM-free version (taken from GOG at https://www.gog.com/game/steamworld_dig_2 ), 64-bit binary. The game needs the libraries libopenal1 and libsdl2-2.0-0 to run.

OS: Ubuntu 18.04 amd64 with Linux kernel 4.13.0-36-generic, libTAS v1.3.1. Game executable is "/path/to/game/game/Dig2".

There is an issue in this game regarding sync and loading times. The game fowards levels loading to another thread while keeping drawing on screen. This results in uncontrolled loading times when running in libTAS. The solution I choose, which to me appears as the less arbitrary, is that loadings should take the least amount of time possible. As a result, each time there is a loading, I pause the game to wait for the loading to finish. I wrote a bit of code to pause at the right frames, to save time in the process of TASing (showed below). It can be used to help playing back the movie, but it is not mandatory to make the movie sync. Also, the added code is inserted inside linTAS (the GUI program) and not in libTAS (library loaded by the game) to make sure that the game execution is not altered at all.

To add in file "src/linTAS/GameLoop.cpp" in line 196 before "emit startFrameBoundary();":

 int pause_frames[] = {2    , 54   , 55   , 97   , 2486 , 6923 , 8056 , 8155 ,
                       9678 , 9849 , 10246, 11962, 13862, 13905, 14004, 15140,
                       18159, 19906, 20443, 21120, 23082, 23214, 23408, 25131,
                       27134, 27758, 31284, 31934, 32267, 32476, 32524, 32721,
                       33252, 33664, 33955, 34862, 35035, 37263, 37511, 40307,
                       40481, 41658, 41906, 42397, 42601, 42644, 42758, 44155,
                       46713, 48308, 48482, 50639, 50941, 52472, 52776, 52819,
                       53007, 53289, 61053, 64201};
 for (int pp = 0; pp < (sizeof(pause_frames)/sizeof(pause_frames[0])); pp++)
     if (pause_frames[pp] == (context->framecount-1))
         sleep(1);

For encoding purpose, the resolution of the game window can be changed inside file "~/.local/share/SteamWorld Dig 2/settings.xml", under parameter "Screen.WindowSize". It does not affect sync as long as the game has a 16:9 resolution ratio.

Commentaries are also provided as a srt subtitle file inside the movie archive (rename with tar.gz extension and decompress it to access this file).
}}
			
Submitted by keylie on 9/26/2018 6:09:01 PM
Submission Comments
SteamWorld Dig 2 is a metroidvania game released in 2017, where the main mechanics is exploring an underground mine by digging and collecting resources. As opposed its predecessor, the levels are not procedurally generated, except for resources location. The present TAS finished the game as fast as possible by skipping upgrades and manipulate the level layout.
The above video contains commentaries as subtitles.

Game objectives

  • Emulator used: libTAS 1.3.1
  • Takes damage to save time
  • Uses death to save time
  • Heavy luck manipulation
  • Genre: Platform, Action, Adventure

Tricks

Double Jump

Like many modern platformers, this game implements "coyote time", i.e. when we walk off a platformer ledge, we can still jump for a few frames (6 frames in this game). However, it is also working when we leave the ground by jumping, so we can jump again for a few frames. The second jump velocity is not added to the first one, so we only gain a small additional height. In the context of a TAS, we are not limited to one extra jump. Moreover, we can alternate between a jump input from the keyboard and from a game controller. In the end, because the coyote time lasts 6 frames, we can jump for 7 consecutive frames to get the maximum height. This is the cause of the weird jump sound that you can hear on the video.
The most important use of this trick is the skipping of upper Temple of Guidance at the beginning of the run. We can escape this section and skip the first boss by using a double jump. The problem is that because we didn't enter El Machino town normally, Transport Tubes are not working. A solution is to enter another area (here Yarrow), which will unlock the option to self-destruct. It brings us back to town, so we can use Transport Tubes from here.

Hook Jump

The hook is a very powerful item in this game, and it combined very well with double jump. We can throw the hook horizontally to gain a high velocity. If we then release the hook and double jump at soon as we touch the ground, the double jump will gain the extra property that every jump input will have its vertical velocity added to the current one. So if we jump for 7 consecutive frames, we will have a 7-fold vertical velocity. This property holds as long as our horizontal velocity is high enough. In particular, we can chain multiple hook jumps. If we slowdown too much, the huge vertical velocity will be reset.

Jet Boost

This trick requires the hook, the jackhammer and its Slipstream Jet upgrade. When breaking a block with this upgrade, it pulls you forward. However, if you do this while having a high velocity from the hook, the obtained horizontal velocity will be massive (more than twice the hook velocity) for one frame, then the ground friction will cancel it. By jumping at that frame, we can keep the velocity in the air. Unfortunately, the jackhammer upgrade is obtained very late in the run (it is quite expansive).

Rosie phase skips

The last boss fight against Rosie is decomposed into 5 phases, each one can be ended when you throw back a rocket at her. Luckily, it is possible to skip most phase using the Aramid Armor upgrade. This upgrade deflects a projectile back, and has a cooldown of 30 seconds. By deflecting one of the little homing rockets and make it explode inside Rosie's hitbox, it will deactivate her shield, so you can end the phase early. It is not possible to do it on fourth phase because Rosie does not throw any little rocket. It should save a bit less than 2 minutes in the entire fight.

Routing

Routing is very important in this game genre, so here is the different aspects of the used route:

Necessary steps

The intended route of the game is to collect some upgrades, then destroy the first Device (Device of Doom) in the middle of the Temple of the Destroyer. Then the game tells us to reach Vectron at the bottom of Archaea. After completing Vectron, we obtain the Jetpack, which allow us to destroy three more Devices at the bottom of each area. Then we go to the final boss at the Oasis by taking a secret passage because the Transport Tube is deactivated.
The first timesaver is that we don't need the Jetpack to access the Devices. This cuts off a lot of time because we don't need to access and complete Vectron. This is an intended sequence break by the developers, as there is a Steam achievement for completing the game without accessing Vectron.
The second timesaver is that we don't need to destroy the first Device. Destroying the other three will unlock the door to the final boss. However, the cutscene won't trigger when you destoy the last Device, so the Transport Tube to the Oasis will still be available, for extra time saved! This is good news because the first Device is protected by a boss and a long area.
The last timersaver was mentioned earlier: we can skip the first boss and enter Yarrow from the beginning.

Items and Upgrades

We are collecting a certain amount of items and upgrades, either because they are needed, or because they save time in the run:
  • Speed boots: you cannot advance the game without them.
  • Lamp: we must buy it to unlock upgrades and to enter Archaea from the town.
  • Two bag upgrades: the first one is really cheap and can be bought together with the lamp. The second one saves time for the farming section at the bottom of the Temple of the Destroyer.
  • One pickaxe upgrade: it allows us to dig blocks in one hit at the top of Archaea. The second one would also save time but is more expensive.
  • Four armor upgrades: the third upgrade unlocks Vidar Boots, which makes us invulnerable to lava and acid for a short time. The fourth one unlocks Aramid Armor which is needed for the final boss. Vidar Boots is not much useful, but we must unlock it anyway so we use it when needed.
  • One water upgrade: without a third water bar, we would be short on water after the second Yarrow barrier, and we would have to dig 4 blocks with the pickaxe to access a Transport Tube and refill water. This would take way too much time.
  • Pressure Bomb: this is a mandatory item to open the two barriers of Yarrow.
  • One pressure bomb upgrade: every upgrade of the bomb increases its range by one tile, and we need one extra tile range for the second Yarrow barrier.
  • Jackhammer: technically, this item is not required, but it allows us to dig very fast
  • Two jackhammer upgrades: these upgrades are really expansive, but the first one makes us dig faster in the Temple of the Destroyer, and the second one unlocks Slipstream Jet which saves massive time on Yarrow.
  • Hook: mandatory to access the Devices (because we don't take the jetpack), and saves a lot of time anyway

Main route

We first collect the needed items: the pressure bomb from the top of Archaea, then the jackhammer which can be accessed from top Yarrow, and then the hook. After that, we have the choice on the order of the Devices to destroy. We start with the Device in the Temple of Guidance, because there is almost no digging involved, and a bit of money. Then we continue with the Device in the Temple of the Destroyer. There is a bit of digging, but we collect enough money to buy the first jackhammer upgrade. The last section has many ores, so we can collect enough money to buy the second jackhammer upgrade for Yarrow Device.

Area comments

West Desert

There is a $50 gem at the beginning, but it takes too long to take. We manipulate the breaking blocks so that they break early.

Temple of Guidance

We grab the Sprint Hydraulics, then enter the hidden passage to the lower temple, using a double jump. Ore location is determined at the first entry in an area, so we used the pickaxe here to advance the RNG and get the ore location we want for the next area.

Yarrow

We first unlock the Transport Tube here for later, and then self-destruct to return to the town and activate Transport Tubes. When we self-destruct, we loose at least half of our collected ores, so we can only keep one. The best one to keep is a Blood Rock from the snail, which is worth $23. We must also collect another ore so that we can keep the Blood Rock. After the self-destruct, we go back to Yarrow and take the bottom path to Archaea to unlock the Tube next to the jackhammer location. On our way, we need to collect as much money as possible, so I carefully chose the RNG seed by tweaking the initial system time to get 3 ores on our way without making a detour. We also kill the other snail for the experience and the Blood Rock. The XP route is very precise because levels add a bonus to the ore selling, so we must kill some enemies and sell ores as late as possible to get the maximum money.

Archaea

We just unlock the Tube and go to the town

El Machino

People are grouped for the cutscene when you enter the town normally, but you can still talk to them. We sell the ores and but the lamp, a pickaxe upgrade and a bag upgrade.

Archaea

We dig to the Pressure Bomb cave, taking advantage of all the holes in the layout.

Archaea - Burster's Station

After getting the pressure bomb, it is much faster to leave the cave from the entrance. We also kill an enemy for the XP.

Archaea

We self-destruct to access the town Tube and go to the first Archaea Tube we unlocked. We dig to the Jackhammer's cave.

Archaea - Mason's Station

There is a short skip in the second section: by destroying the block under the rock with a bomb, we have enough time to take the same path as the rock and not getting crushed. There is a $20 ore over the podium, but it would take too much time (and water) to take it.

Archaea

We killed one enemy to manipulate a water drop, it is faster than refilling at the water pond.

Oasis - Rosie's Storage

We take the ores here, and the cog on the way.

Temple of Guidance

We can use the hook together with the jackhammer to drill faster

Temple of Guidance - Chamber of Wheels

We have barely enough water to break the cog box. We use the pickaxe to manipulate the orbs in the next area.

Temple of Guidance - Chamber of Arrows

We need the orbs for the money, and we manipulate their trajectory so that we can catch them early. Getting between the two lines of arrows was difficult to do from that position.

Temple of Guidance - Device of Devastation

We would have saved time by having a water bar to throw a pressure bomb.

Archaea

We take a detour to grab a $30 ore, and head to the Temple of the Destroyer. We advance the RNG to get favorable ore placement in the Temple.

El Machino

We barely have enough money to buy the first jackhammer upgrade, which is very useful for the first section of the Temple of the Destroyer.

Temple of the Destroyer

Trying to get the "optimal" ore placement in the whole Temple is an impossible task, at least without a special method like reverse-engineering the ore placement code or writing a bot. Thus I chose the best among about 50 different locations for the first part of the Temple. So there is definitively possible improvement in this whole area. We needed enough money to buy the Vidar Boots and one bag upgrade before the Lava River. Then we have a farming section where we need $775 for the jackhammer, water and bomb upgrades.

Yarrow - Leaky Lodge

The still need money for the last armor upgrade, so we grab the two gems in this area. At the end, we use the fall damage to dig one block

Yarrow

We were lucky to find a $50 gem on the way. When the blocks are getting tougher, we manipulate water drops from the enemies to keep our gauge filled.

Yarrow - Aeronaut's Station

We use the pressure bomb with the increased range to skip this cave.

Oasis

With the armor upgrade bought and the Aramid Armor, we are ready for the final boss fight. We used the Aramid Armor as described above to shorten the boss phases.
Suggested screenshot: 28498

feos: I'm on the Linux spree! Judging...
feos: This was tough, but I consider this movie legitimate.
Both myself and fsvgm777 were able to get this to sync, even on the unmodified stable release of libTAS. The difference is just in how much time is needed for pauses so the thread that loads the level could properly finish. On high end machines this takes a few milliseconds, on my VM running on a very weak machine it was taking several dozen seconds. If loading takes less that 1/60th of a second, this may potentially be synced without pauses.
I don't believe that this movie explicitly abuses time pauses though (I need to note that libTAS pauses are not the same thing as pauses in emulation of the hardware: libTAS forces the game to pause by intercepting the game's interaction with the operation system API). There are no in-game tricks that pausing affects or enables. They are used only to make sure the level loading thread finished within a single frame.
This, in turn, is required fundamentally, because there yet is no way for libTAS to control such secondary threads: without this technique the game might not be TASable. And since level loading takes different time depending on the host computer specs, waiting arbitrary amount of frames in-game would introduce arbitrary sub-optimality, that may even fail to help if the host machine is just too weak. This is proven by the fact that the author used 1 second waits, while I had to increase the wait period to 50 seconds: with 10 seconds it wasn't finishing loading. So if the author waited the time that's enough for them, for others it might not be enough. And we can't be blindly accounting for all possible cases just by standing still in the level, because this damages the superplay value, and also because it may be impossible to account for literally all scenarios.
So since libTAS pause times can be easily adjusted when replaying, even without rebuilding the tool and using only manual pauses, this movie uses the most optimal waiting period - 0 in-game time. The main reason to allow it here is because it does not affect any TASable gameplay. If this movie is redone using a tool that can control secondary threads, everything should sync, aside from probably RNG changes. So they key point is that TAS input is valid in this movie, therefore it can be published.
Accepting to Moons, because the feedback was great.
fsvgm777: Processing.
Last Edited by adelikat on 10/27/2023 10:05 PM
Page History Latest diff List referrers