Submission #3581: BrotherMojo's Windows Nikujin in 02:53.72

Windows
baseline
Hourglass r81
8686
50
5636
Unknown
にくじん.exe
Submitted by BrotherMojo on 4/26/2012 2:10:02 AM
Submission Comments
Nikujin (にくじん) is a short, tough-as-nails action platformer created by the prolific and bizarre Ikiki. The game stars a ninja who apparently wears nothing but a face mask, infiltrating a fortress of nude ninja and samurai, with the goal of assassinating the official hidden deep within. (If you're worried about the nudity, don't be... it's all cartoony with no depicted genitalia.) This submission attempts to complete the game as quickly as possible, finishing with a total time of 2:53.72, or 1:48 on the in-game clock.

Game objectives

  • Game Version: 1.12
  • Emulator used: hourglass-r81
  • Aims for fastest time
  • Takes damage to save time
  • Manipulates luck

Hourglass settings

The game was recorded on Windows 7 with Multithreading and Wait Sync disabled as well as Directsound Creation. However, playback works just fine with those settings enabled, with the exception of music. (See Additional Comments.)

This is a preliminary encode of the run, so the quality is probably a bit low. Someone better with video editing and such could probably clean it up.
Music was edited into the audio track manually to improve the viewing experience, so don't mind that discrepancy between playback in Hourglass and the youtube video.

Techniques, Tricks and Glitches

Though the game normally requires some difficult and convoluted platforming, a few programming oddities and glitches enable extreme shortcuts, and understanding of the base mechanics allow for further optimization.
High Jump
If you press left, right and jump at the same time, or if while holding one direction you press the opposite direction and jump, you do a high jump. A high jump is identical to a regular jump aside from the fact that it instantly shifts your character up one block at the start of a jump. This technique significantly speeds up sections which have primarily vertical travel, allows for many of the major shortcuts used in the run, and enables glitching into the ceiling. Unfortunately, a high jump sometimes cannot be performed without losing horizontal velocity.
Mid-High Jump
A mid-high jump is much like a high jump, but the boost you get is only half a block. It can be executed by pressing jump while holding both left and right, or by pressing up or down simultaneously with jump. Since it can be activated with no horizontal input, the mid-high jump can always be executed at a run without losing speed.
Sword Speed Manipulation
By attacking, you can influence your horizontal velocity. The effect is less noticeable in the air, but on the ground a sword attack can be used to accelerate very quickly to walking speed, as well as to stop or change directions more quickly. Later in the sword attack animation your character stops again, so to get sustained speed you must either attack repeatedly or cancel your slash with a jump.
Double Slash Trick
During the animation of a sword attack, your character will not cling to walls you come in contact with. If you press attack again after a certain point, your character will follow up that slash with a second slash. This second slash, after a couple of frames, can be interrupted by clinging to a wall. There are two main applications for this: one is to delay when your character can cling to the wall, useful for kicking off of a wall at floor level on the first possible frame. The other is to use the sword slash to influence your horizontal velocity without delaying (too much) when you become able to cling again. Both of these are used extensively in the run.
Rolling and Extended Rolling
Rolling allows you to avoid damage from a long fall, but is also useful in that it instantaneously resets your character to walking speed even more quickly than a grounded sword attack. Like a sword attack, a roll can be cancelled with a jump and will prevent clinging to walls. Additionally, during the beginning of a roll your character cannot attack. Attempting to attack during this time will instead reset your rolling animation (though not the duration of this delay period). It also seems that rolling may be very slightly faster than normal walking; an extended roll can move the character a fraction of a pixel further than a normal roll followed by walking for the remaining time. Exactly how much faster is difficult to gauge, and that tiny amount of extra distance is as often harmful as it is helpful.
Fast Wall-run
You can run up a wall faster (and further) by holding jump as well as pressing up. As is probably obvious, you need to have already been holding jump before you came in contact with the wall, since pressing jump will jump off of the wall.
Instant Wall-kick
You cling to a wall by holding toward it, and then can kick off of that wall by pressing the other direction. You can kick off a wall immediately by holding toward the wall, and then on the frame you will come in contact with the wall, press the opposite direction without letting go of the first. e.g. hold left, then press right while still holding left.
Wall-jump Speed
Though not as fast as the speed you receive from a wall-kick, your horizontal velocity after a wall-jump is slightly higher than your normal walking speed. Walking or rolling will soon reduce your speed to normal, but by jumping on the first frame you touch the ground you can preserve that speed for a bit longer.
Ceiling Cling Slide
When pressing up to cling to the ceiling, you normally lose horizontal velocity very quickly. However, by rapidly pressing the attack button, you can reduce this friction and slide further and faster than you otherwise could.
Ceiling Glitches
The instantaneous upward movement of the high and mid-high jumps can put the character into the ceiling if he is in a passage that is only one block tall. A mid-high jump will only put the character partially inside the ceiling and he will quickly be dislodged, but a high jump will fully embed the character into the block above. Once inside a block, the game will push the character to try to force them out... usually down, but occasionally up or sideways depending on level geometry. Additionally, once inside a block, sword attacks bump the character significantly upward and to the side.
Harmless Spikes
The hitbox of a set of bamboo spikes is somewhat finicky. All sources of damage normally don't take effect until one frame after they touch the player, but depending on position, timing, and some other factors, the game will sometimes allow you to spend two or three frames in a set of spikes before actually damaging you. If you can escape the spikes before then, the spikes will never deal damage to you at all.

Stage-by-stage comments

Stage 1

Here is where I make most significant usage of entering a ceiling. Upon destroying the wooden grate to gain entrance to the fortress, I take advantage of the fact that its opening is only one square tall to high jump into the ceiling. By alternating between high jumps and sword slashes, I can ascend much more quickly than any other method of travel. The rest of the level is straightforward, though it's important to note the existence of an offscreen box to the left of the start, allowing for the initial wall-kick.

Stage 2

This stage features the first usage of the fast wall-run and wall-jump speed preservation. When descending to the button I angle my jump from the second story such that I can jump off of the wall rather than merely dropping down, achieving a wall-jump speed boost there as well as on the way up. Though I'm willing to take damage to save time, I'd like to avoid it when it's unnecessary, so I jump over the shuriken ninja to avoid detection. As an added bonus, being detected less often improves my score.

Stage 3

The normal route through this level requires pressing the blue and red buttons to allow a wall-kick off of the crate to make the later jumps more manageable, but I just take a straightforward route over the top. This stage is also an example of high jumps being uncooperative: When making the jumps toward the end, I have to use only mid-high jumps. High-jumping there would lose speed. A previous playthrough of the stage skipped the high jump to wall-jump I use at the end of the upper platform and in turn was able to high jump for either (but not both) of the final jumps, but it was still slower than jumping off the wall.

Stage 4

An odd bug makes it difficult to jump to the left at the beginning of this stage. At the start of the stage, almost any time you jump your horizontal velocity is immediately set to walking speed to the right. I'm not sure exactly what leads to this. On the third floor, this helps because it makes it unnecessary to roll after running up from the wall. However, on the second floor it makes it very difficult to jump up to the third floor. For this reason I opt to get the boost from headstabbing the sword ninja rather than simply high jumping, even though under normal circumstances high jumping would be much faster. This, as well as the bomb ninja on stages 6-8, are where luck manipulation is most critical. Enemy facing is random, so I manipulate the ninja to face to the right at the start of the level.
This stage also features the only time in the run I take advantage of harmless spikes. With very precise manipulation of the jump down from the fourth floor, I manage to cling to the wall behind the spikes in a position such that the spikes don't harm me, and at a height such that I can wall-jump and cling to the ceiling. This wall-jump saves a bit more than half a second over the normal route.

Stage 5

Mercifully, boss AI in this game seems not to use the RNG, making the luck manipulation much more manageable. Anyway, when you lose control during the boss introduction cutscene, if your character is too far to the right you'll be teleported back to your position at the start of the level. I carefully move as far to the right as allowed so I can reach the boss more quickly once I regain control. The Stage 5 boss becomes vulnerable to a head stab shortly after he does his dual sword attack, so I run behind him to dodge the attack while still leaving myself in position the moment he becomes vulnerable.

Stage 6

I take damage during the high falls in this level so I can wall-kick as soon as early as possible; as mentioned, rolling prevents wall-clinging for the duration of the roll. When alerting the bomb ninja, I use a sword slash to turn around as soon as I've alerted him, a jump to cancel the slash, and a roll to get back up to full speed at the earliest safe moment. Attacking the first shuriken ninja on the third floor allows me to avoid damage without slowing down; otherwise, the necessary jumps would be less conducive to extended rolling.

Stage 7

Most of the tricks in this stage I've already used elsewhere, but right before the end I find another opportunity to glitch into the ceiling. After breaking the grate, a well-timed mid-high jump pushes me far enough into the ceiling that a subsequent sword slash causes me to be shoved out of the left side of the wall, facing right. With this I can double-slash to catch the wall below and wall-jump across to the goal.

Stage 8

By far the most complex stage to TAS, Stage 8 requires basically every trick in the book and then still features some waiting around. At the start of the level, I immediately roll backwards to kick off the wall rather than waiting until I have crossed the upcoming crates. By attacking while jumping, I can hit the two shuriken ninja and deflect their attacks without losing the speed I received from the wall kick. I use rapid presses of the attack button to slide to the end of the ceiling more quickly and save a few frames. When crossing the spike pit after the bomb jump, I couldn't manage to avoid damage from the spikes, so I just hop into the pit, take the hit, then high jump out the other side. At the end of this all, I actually arrive at the final crate slightly too early - it saves me quite a bit of time to wait at the crate for a few frames and let the four staff ninja clump up so I can kill them more quickly.

Stage 9

Easily the hardest stage when playing normally, Stage 9 is a breeze with high jumps. For whatever reason, getting hurt by the spikes at the bottom of this stage won't interrupt you if you're rolling, so just rolling through spikes is a fast way to move to the left at the start. A high-jump onto the front staff ninja allows you to neck stab and boost up to the third platform, and from there, it's basically just high jumps straight up for the rest of the level. My initial instinct was that the intended solution, bomb-jumping off of the ninja, would be a faster way to reach the top... but testing showed that just continuing to high-jump is faster.

Stage 10

More boss-fights. Again, I'm very thankful that the bosses' AI doesn't depend on the RNG. As with the mid-boss fight, the cutscene that first reveals the bosses will teleport you back if you move too far to the right, so I move only as far as allowed. When the first boss appears, I move slightly further to the right to position myself at the boss's preferred distance, making him start his extended staff attack as soon as possible. Once he's committed to the attack, I hop to the left and roll to the right for speed and positioning purposes, deflect his attack, and score the instant kill. I use a similar strategy for the second boss. Though he spends less time "locked in" to an attack, I was able to manipulate him to attack a bit earlier by spending some time facing away from him. The third boss doesn't really have a preferred distance for his charge attack, so I didn't really need to position myself to bait out an attack sooner. Unfortunately, his charge attack will grab you even if you're significantly above him, making it very difficult to set up for a neck stab at the earliest moment. Its horizontal grab range is significantly shorter, so rather than trying to position myself so I'd fall on him at the right time, I instead jumped to the wall and back and made horizontal positioning the main issue. This enabled me to get the stab a few frames earlier.

Background and Additional Credits

I got partway through making a segmented speedrun of Nikujin several years back, but repeatedly having to start over as I discovered superior techniques for earlier levels eventually discouraged me from ever completing it. When Hourglass first came out, the idea of making a TAS crossed my mind, but I wasn't really sure I knew the ins and outs of the game engine well enough to really make something TAS-worthy.
Early this month, I discovered Blaizerazer's segmented speedrun which used a ton of tricks I had never seen previously. Shortly after, I also discovered SeraHarms' abandoned TAS WIP of the full game, as well as Blaizerazer's very impressive training stage TAS. The combination of these factors encouraged me to pick up Hourglass, learn more about the game, and contact Blaizerazer to consult him about the run. It worked out that I was making a full-game TAS while Blaizerazer was working on improving his training stage TAS, so we swapped notes and exchanged information... though I'll admit he clued me in on more techniques than I did for him. In addition to the new techniques he'd been discovering as he worked on his training stage TAS, he also reminded me of the speed benefits of rolling which had somehow slipped my mind.
Blaizerazer's youtube page is here, with his Nikujin segmented speedrun and training stage TAS. For many stages I used basically the same route as in his segmented speedrun. SeraHarms' TAS WIP is here [dead lnk removed], which is fairly sloppy but I do build upon a couple of tricks used in the run... specifically the head stab in stage 4 and the wall-jump at the end of stage 7.

Other comments

For some strange reason, the game allows you to begin input in each level slightly earlier with music on than with music off. Also, for whatever reason, even with sound active in Hourglass and music set to "on" in the game options, the music did not play and the "no music" delay applied. If this problem can be resolved, it will save time as well as make movie playback a bit more enjoyable. Of course, for this same reason, if a later version of Hourglass corrects the music issue this video will almost certainly desync.
Some other aspects of the game engine also remain a mystery, and a better understanding could lead to significant improvements. Understanding the causes of high jump speed loss, for example, could lead to some major improvements. If it was understood why the player receives those mysterious speed boosts in stage 4, it could be possible to prevent the issues associated with them, or to cause them and take advantage of them elsewhere. Additionally, it seems that your sword slash animation takes a variable number of frames, which poses some extra challenges when attempting to time your attacks or optimize a double-slash to save frames. Minimizing animation length at times that it matters could also be a major time-saver. As such, someone more familiar with digging into a game's RAM could likely better understand and manipulate these phenomena to improve on the run.
I'm not really sure what frame would be best for a screenshot. 281 could be good for the "what?" factor, and something like 1627 or 6177 would be pretty visually interesting, but generally the game's simple art means it looks much better in motion than in stills.
Lastly, the rerecord count is a bit inaccurate. I was working with multiple files most of the time, and started over at one point, so the actual rerecord count is probably in the high 7000s or low 8000s.

turska: Judging.

turska: Excellent game choice, excellent first submission. I look forward to more from you.
The issue with Hourglass is unfortunate, but the music can be stitched in to encodes without too much trouble.

natt: Processing. This is going to take a while because of the hourglass midi issues.
Last Edited by adelikat on 9/27/2023 3:29 AM
Page History Latest diff List referrers