- Genre: platform
- Manipulates luck
- Doesn't take damage
- Aims for fastest time
Legend of Kage is a story based in old Japan.
The beautiful princess Kiri has been kidnapped by evil ninjas.
Many samurai warriors were sent to rescue her. None ever returned.
The player is Kage, a young ninja who goes to rescue the princess Kiri.
It is a 128-frame improvement to the
previous submission that was cancelled. The improvement consists of better accuracy in the 1-3 stage (first mountain jumping), which gave about 40 frames of improvement, and consequently, better luck in 1-5 (first aftermath) because of earlier available 128-frame granularity. Additionally, 2 frames were mysteriously gained in 2-3, but the same two frames were mysteriously lost in 3-2, so the net gain is 128 frames.
Speedrunwise, this game is all about luck manipulation.
Like any good ninja game, it hides many secrets inside, and I set out
to discover every one of them that is important in making a TAS.
Here's my dictionary:
- Hokage means yōbō means magic monk. I use the term hokage because it's what pops to my head when I think of that particular enemy, thanks to Naruto.
- Shinobis are the blue and red ninja guys. (And occassionally black.)
Game objectives
- In forest levels: Kill four hokages.
- In moat levels: Kill ten shinobis.
- In mountain jumping: Reach the top.
- In the fortress: Rescue Kiri-hime.
- In the aftermath: Kill the enemy (the butterfly must be killed first, because it makes the enemy invulnerable)
- Overall: Rescue Kiri three times from the fortress and once from the last boss.
Strategy
- All forest levels: Make hokages appear as soon as possible, kill them as soon as possible. Screen must be scrolling to the left when the last hokage is killed.
- All moats: Kill the last shinobi at earliest possible frame. Screen must be scrolling to the left when the last enemy is killed.
- All mountains: Jump as precisely as possible. This is difficult, because Kage's jumps are very imprecise. A lot worse than those of Samus.
- All fortresses: Untie Kiri at the first possible frame.
- All aftermaths: Make butterfly disappear as soon as possible (fall to ground). Hit the enemy (Yōbōs, Yukinosuke kiri, and finally Yōshirō Yukigusa) as soon as they appear. Screen must be scrolling to the left when enemy is killed.
- Level 1-1 (summer, forest): Gain the superhuman power as soon as possible, because it enables running faster. (2 pix/frame normally, 3 pix/frame at superhuman speed.)
- Level 3-4 (winter, aftermath): Send the last shuriken as early as possible, and maximize its travel time. Manipulate the luck so that further actions after the shuriken is sent are not needed.
- Never miss an important enemy spawning.
- Don't scroll the enemy out of screen.
- Ensure that there aren't too many enemies on screen that would prevent the new enemy from appearing.
In forest levels, how to enable hokages to appear
- All hokages: They can only appear when the screen scrolling position is odd (not even) and no enemies exist on screen.
- First hokage: The enemy kill counter must become evenly divisible with 4 while the current screen number is < $11.
- Second hokage: Same, except that screen must be < $0E.
- Third hokage: Same, except that screen must be < $0A.
- Fourth hokage: Same, except that screen must be < $04.
This only enables the hokage to appear. It is still subject to the framenumber and mask mechanism, explained below.
How to make the crystal ball (that gives superhuman powers) appear
- Every 12th enemy that appears, carries a crystal ball. However, this counter is reset occassionally:
- When the screen scrolls to the left, and an odd screen number is encountered, the counter is reset to 0.
- When the screen scrolls to the right, and an even screen number is encountered, the counter is reset to 0.
- Every time a hokage is trying to appear, the counter is incremented . The counter may be incremented by a few units at once, if the hokage doesn't manage to make a permanent appearance immediately. Its fire also increments the counter. Effectively, the counter is incremented by a random value depending on hokage's actions.
The two first facts are undesirable, but I abused this third fact to make the two necessary crystal balls appear as soon as possible.
What decides when enemies appear
- Enemies appear only at certain intervals. There's a ‹mask› variable and a ‹frame counter›. A bit-wise AND of them must yield 0 for enemies to appear.
- For a hokage to appear, no other enemies must be on screen, and the screen scrolling position must be odd (not even). (And the hokage must be enabled as explained above.)
- There are three enemy slots. If all are full, no enemy is created and the opportunity is lost. Dead enemies also occupy a slot until the corpse disappears.
- When a stage begins, the ‹mask› is set to $7E (forest stages) or $3F (other stages).
- When you kill many shinobis at one location, even more shinobis begin to pour in at faster rate.
- When 4 enemies have been killed, the ‹mask› is set to $3F. (Enemy is born every 64 frames.)
- When 8 enemies have been killed, the ‹mask› is set to $1F. (Enemy is born every 32 frames.)
- When hokage is enabled to be seen, the ‹mask› is set to $1F.
- When you move enough, the enemies lose the track of you:
- When the screen scrolls to the left, and an odd screen number is encountered, the ‹mask› is reset to $7F. (Enemy is born every 128 frames.)
- When the screen scrolls to the right, and an even screen number is encountered, the ‹mask› is reset to $7F.
- At the moat stage, the ‹mask› remains at $3F at all times.
- Enemies do not appear when the music is something other than the normal plight music or the eerie scroll+praying music.
Because enemies don't always spawn where I'd want them to, I have to lead an enemy that has been spawned earlier to the point where I can kill it to make the hokage appear. This causes the apparently useless left-right motion at some points. For this, I always chose a red shinobi because they can follow Kage faster than the blue shinobis.
This no longer applies. I noticed that there's enough time even if I don't do the above thing. However, because of the frame counter granularity (a bitmask instead of counter), nothing is gained or lost by this exchange.
How to manipulate luck
- This game uses the CPU clock as its random source. It is extremely volatile, and reacts to almost any changes in input, even though the input is not fed into the randomness formula. Details at GameResources/NES/TheLegendOfKage#RNG.
How did I approach the problem
- I disassembled the game. I deciphered all important bits of it.
- I used a custom-made luck-manipulation robot, BisqBot,
extensively throughout this movie for some parts in this movie.
I didn't need the bot so much on the second run; I had already learned what is crucial and what is not. In any case, the bot did a total of 881208 rerecords in the passage of these two movies.
Artistic choices
- In the first two fortresses, I chose to kill as many enemies as I could by luck-manipulating them to run into my shurikens. In the third, I manipulated away all enemies that I could.
- I killed all the butterflies before the became visible. This wasn't necessary (it would have been perhaps better to show their colour changes at least once), but it was atypical playing so thus moderately suitable in a TAS.
- In the moat levels, I tried to use different strategies each time.
- In the forest levels, when I wasn't interested in killing enemies (in order to preserve the kill counter at a certain value), I tried to make them not appear, or I clashed the knife against their sword for fun.
Miscellania
- The thunder has no strategic meaning in the game.
- Contrary to common belief, the fire of the hokage is not actually an OHKO device for Kage. If it only hits for 1 frame, Kage suffers a normal hit. The danger comes from the fact that the fire does not disappear from hit; if it still hits for the second frame, it kills Kage.
- This game never lags.