The Ninja is an arcade style shoot-em-up game on the Sega Master System. This run completes the US version of the game as fast as possible.

Project History

The project was started in 2012 on a very early version of BizHawk, pre BKM, pre BK2. The extension for the movie file was .TAS and was a single plaintext file with a small header for sync settings followed by an input roll, instead of a zipped set of files. TAStudio, amazingly, was included with the version of BizHawk that I was using, and I looked at this tool in awe, it was exactly the interface I wanted to use to create the run but unfortunately it was not very functional at the time. Additionally, I did not know how to properly use traditional rerecording tools at the time so the run was constructed by editing the .TAS file in Notepad with the inputs I thought I needed and playing back the result from the start every time, checking for style, desyncs, and deaths.
I never finished the game using this technique, probably due to the ever increasing time needed to check my work as the run got longer, and as such the project was put on hold until 2015 when TAStudio was much more mature. My first run that finished the game was based on Jok-R's run and the faster Level 1 WIP with a final time of 5:38.65, although because of significant optimizations across all areas of the run almost none of the inputs from those submissions remain today.
Speed was not my initial goal for the project, so 100% hit ratio was a common occurrence with some stylish enemy kills in the run that I had to take out in favor of lower hit ratio.

Version Choice

Differences between the US and Japanese releases of the game are outlined below:
  • Level 1 starts 79 frames sooner on the US version due to lack of the Sega Mark-III boot screen
  • The Japanese version adds an extra level between Level 1 and the rock autoscroller, adding roughly 1300 frames of movement and an extra score screen to the run
  • The Japanese version adds Easter Eggs in most levels, the triggers are always loaded increasing the likelihood of lag on the Japanese version
  • Boss fights are roughly 10 frames quicker per level on the Japanese version, I believe it’s because they move faster than their US version counterparts and thus appear on screen and become vulnerable to damage sooner
  • After the cliff level, the Scroll screen can be skipped 168 frames sooner on the Japanese version
  • Some Green Scroll placements are different on the Japanese version, this causes Level 8 to be 66 frames faster in the Japanese run due to less backtracking and Level 9 to be 53 frames faster in the Japanese run due to the Scroll being placed lower on the cliff
I completed a test run with the Japanese version and the result was slower by 965 frames, mostly due to the extra level. Most of the levels without different Green Scroll placement synced with the inputs lifted straight from the US run, but I needed to redo a few for the reasons outlined above. If the extra level didn't exist, and provided the US hit ratios could be matched, the Japanese version would have been over 5 seconds faster than the US version for this run.
I decided to use the US version in the end because this run is aiming for the fastest completion time and the Japanese version does not suit that goal. A run that defeats all bosses and possibly activates all in level Easter Eggs would be better suited to the Japanese version.

Techniques

Preventing Enemy Spawns

The game limits the number of enemies loaded to 7, it is faster in every measurable way (lag, hit ratio, and movement) to avoid the first 7 enemies that spawn at the start of the level, and eventually outrun them. This prevents enemies further along in the level from spawning. The levels become essentially pacifist up until the boss fights where possible.

Shot Spam

At the end of every level is a score screen that takes a variable amount of time depending on your enemy hit ratio achieved throughout that level. Each percentage point of hit ratio adds 200 points to a bonus that takes 1 frame per 200 points to count down with no method to skip or speed up the countdown. So the fastest strategy is to fire as many shots as possible that do not hit enemies to reduce your hit ratio. Note that 0% hit ratio gives a massive bonus of 10,000,000 and would take almost 14 minutes to count down, so 1% hit ratio is optimal.
There are many techniques used throughout the run to cram in extra shots, the most effective of which involves moving to the top of the screen or the bottom of a wall or obstacle in a lagless area allowing 60 shots per second using a repeating 1-2-1-2-1-2 pattern. This situation is very rare to come across outside of autoscrollers and is mostly seen in levels 2 and 7.
Another technique more commonly seen involves using the L + R + U + 1 trick shot that spawns to the right of the player and moves upwards without causing any time loss due to sideways movement. This trajectory allows the shot to hit an obstacle, commonly a tree or rock, that causes it to despawn sooner than if it were to travel all the way to the top of the screen allowing the next shot to be fired sooner. Level 6 is the most notable use of this technique shown at the start of the level to add in extra shots that narrowly miss an enemy, and again at the end of the level to fire many extra shots that hit the trees. A downside to this technique is that holding L + R + U is more likely to cause lag than simply holding U, this was taken into careful consideration when optimizing shot spam. Unfortunately if you're not already braced against a wall or obstacle on your left, there are no trick shots that spawn to the left of the player without losing time to sideways movement, otherwise this technique could be used in many more situations throughout the run.
When optimizing a level I firstly block out minimalistic inputs for optimal movement and boss fight, then work backwards from the fight to implement shot spam, bruteforcing every possible shot input on every frame and checking for the highest possible shot density while avoiding extra enemy kills, and desyncs due to added lag frames. I considered automating this process but was already well over halfway through the run before I thought of the idea to do so, so I decided to just push on and finish the run normally. If anyone is interested in attempting to beat this run I would highly recommend investing the time into automating the shot spam process, it will save you many tens of hours, and your wrist and elbow.
Lag Reduction was very important throughout the run as this game becomes extremely laggy when many objects are on screen at once. I initially relied on TAStudio's ability to display lag frames as red and non-lag frames as green in the input roll. BizHawk's Automatic lag detection is generally fairly reliable for this game, but unfortunately there were both false positives and false negatives so I ended up writing a Lua script that measures the player's change in position to detect lag frames. Lag frames cause dx and dy for that frame to be 0 instead of somewhere between 1 and 3 depending on the level, and whether the player has the Blue Scroll. This more accurate lag detection brought my time down by several seconds and allowed me to improve on my initial approach of optimizing the inputs for a completely green input roll in TAStudio.

The Red Scroll

There has been talk within the TAS community for this game about skipping the Red Scroll, I opted instead to collect it in Level 2. There are a couple of arguments for skipping this pickup, firstly collecting the Red Scroll causes the music to change to the same track throughout the run instead of unique tracks for each level. Secondly is the fact that shots without the Red Scroll despawn once they hit an enemy, instead of piercing through the enemy and allowing multiple enemy kills with the same shot, which is not needed for a TAS player according to people who argue to skip the Scroll.
I generally agree with their arguments and would have preferred to skip the Red Scroll in my run. I can however, make the case for piercing shots being useful in a TAS. During Level 8, right after I backtrack to the Green Scroll after spawning the boss, I am greeted by a cluster of enemies from the start of the level. Keeping these enemies on screen causes significant lag so it's necessary to kill three of them. The problem I faced, is that firing multiple shots to kill them causes significant lag, and waiting until the last possible frame also caused more lag than necessary. The optimal solution in the end was to abuse the piercing shot mechanic to kill 3 enemies with 1 shot and then despawn the shot with a projectile that was conveniently located between the three enemies I needed to hit and the extra enemies I did not want to hit for ratio reasons.

IL Times

The movement column measures the number of frames between the first input of the level and the first non-lag frame at the start of the score screen, except for Level 13 which is measured to the final input of the movie, the last shot to kill the final boss.
LevelMovement (Frames)Hit Ratio
1119311%
220021%
3100913%
4106613%
521152%
614327%
719901%
818487%
98041%
1012231%
13101010%

IL Comments

Level 1

I redid this level many times, progressively removing enemy kills to lower the hit ratio, and cutting out unneeded movement towards the left side of the screen. I kill only 1 unnecessary enemy to force the enemy containing the Blue Scroll to spawn. Collecting the Blue Scroll in this level is many frames faster than waiting until a later level. The hit ratio is still pretty high at 11% but with the required enemy kills there's nothing I could do about that.

Level 2 (autoscroller)

Lots of playaround with trick shots here and there. I achieve 1% hit ratio with plenty of time to spare.

Level 3

There are 2 pesky lag frames near the big cluster of enemies at the start that I spent thousands of rerecords trying to eliminate but couldn't in the end. The hit ratio is relatively high compared to the other levels at 13% but with so much lag and nowhere convenient to spam shots on the way up to the boss there's nothing that can be done about it.

Level 4

Somewhat counter intuitively, it's actually faster to stop moving up for a few frames at the top of the Green Scroll trigger while shooting the statue than the alternative of moving further left and backtracking right while always moving up.

Level 5 (autoscroller)

Since it’s impossible to move to the edge of this level for 60 shots per second I do not believe 1% hit ratio to be possible in this level. I could fit in a few more shots but this would lower the quality of the playaround overall for no chance at saving any more frames on hit ratio, so I decided to spare your ears and eyes and focus on enjoyable playaround for this level, while still achieving the optimal 2% hit ratio in the process. I abuse a glitch to despawn enemy projectiles by crossing over a specific log barrier.

Level 6

L + R + U + 1 shots are used a lot throughout this level, firstly at the start to narrowly miss the enemy in the center of the screen, then again at the end to squeeze in many shots that hit the trees without losing time to extra unnecessary sideways movement.

Level 7 (autoscroller)

There’s limited playaround potential in this level as it’s very easy to cause lag by not killing every enemy that spawns. As a side effect of so many required kills, many shots are needed to reach 1% hit ratio so I had very little time to spare. I use a few L + R + 1 trick shots to keep projectiles locked in place and kill some enemies while shot spamming.

Level 8

My initial route through this level collected the Green Scroll first before backtracking to spawn and fight the boss. I later found that it was possible to shoot the boss through the wall from much closer to the Green Scroll's spawn location. So spawning the boss, then backtracking to the Green Scroll location and hitting the boss through the wall shortly after ended up being significantly faster than my initial route. This level was particularly desync prone when changing earlier inputs.

Level 9

This level was very simple to optimize. I move to the right of the screen as early as possible to get in position to spawn the final Green Scroll. I avoid moving right while many enemies are on screen to reduce lag. At the end of the level I added in some shot spam and comfortably achieve 1% hit ratio without causing any extra lag. I toyed with the idea of adding in as many shots as possible to this level as the animation for shooting while moving on the cliff is quite amusing, but I decided in the end to be minimalistic with the shot spam.

Level 10

Since a hit ratio of 0% has a near 14 minute countdown, I needed to kill an enemy in this level to achieve 1% hit ratio. Unfortunately doing so cost me a frame of movement, as it delayed the frame that I was able to make the final disappearing input by 1.

Level 13

Since the score screen occurs after the final input in the run, it is not counted towards the run time as per standard TAS timing. So I had the option of achieving 100% hit ratio on this level with no time penalty. Instead I decided to shot spam for a few reasons. Firstly, a lower score is generally more difficult to achieve in this game, it's a fairly good indicator of a fast, high quality run. Secondly, since I had been shot spamming throughout the rest of the levels I wanted to keep things consistent. Thirdly, spawning extra enemies by killing enemies earlier in the level caused more lag than outrunning them and spamming shots. And lastly, a shorter bonus screen makes the ending appear sooner, with the final score being displayed on the “Game Over” screen for those who want to see it.

Samsara: No one will see me judging.
Samsara: People saw me judging :c
While I don't completely agree with the version choice, as it doesn't provide the "complete" game by leaving out a level, the run is still more than solid enough for publication. I'm accepting this to Moons, though a future improvement (and any other runs) should be using the (J) version so that extra level is included.
feos: Grabbing this as well, to test the newly added overscan feature.


TASVideoAgent
They/Them
Moderator
Joined: 8/3/2004
Posts: 15626
Location: 127.0.0.1
This topic is for the purpose of discussing #5199: Isotarge's SMS The Ninja in 05:16.54
Synahel
She/Her
Former player
Joined: 1/19/2011
Posts: 260
Location: France
Very nice! It looks so smooth, good job on optimizing the hit ratio for each stage, very nice watch
GloriousLiar
He/Him
Player (168)
Joined: 4/20/2016
Posts: 63
Location: Texas
The amount of effort put into this short run is astounding. Yes vote.
I am a sad avian
Jungon
He/Him
Player (51)
Joined: 4/2/2009
Posts: 376
Location: Porto Alegre - Brazil
Are you sure those hordes of enemies are not lagging anything? Anyway, I voted Yes on this one and the older version too, can't complain if it's going faster, and it's nice to see the triple direction glitch in the movie =)
*Jungon*/*Johnnyz* smilie weirdo =P ^^ o.o @__@ +D
Post subject: Movie published
TASVideoAgent
They/Them
Moderator
Joined: 8/3/2004
Posts: 15626
Location: 127.0.0.1
This movie has been published. The posts before this message apply to the submission, and posts after this message apply to the published movie. ---- [3203] SMS The Ninja by Isotarge in 05:16.54
Editor, Experienced player (570)
Joined: 11/8/2010
Posts: 4038
Very nice run. I'm glad Jok-R's run was helpful to you in making this one. He and I were going to work on improving his movie but nothing came of it. Is the bonus point payout for a 0% hit rate an underflow bug? It's hard to imagine they would make the player sit there for 14 minutes as it counts down.