The Jumping, Gravity, and Punishment of Ninja Gaiden (NES) - Behind the Code
A look at the gravity and velocity design of Ninja Gaiden and the new Game Genie cheat codes we can create from what we've learned.
If you would like to support this channel, here is a link to the Displaced Gamers Patreon page - / displacedgamers
Twitter: / displacedgamers
Facebook: / displacedgamers
Instagram: / displacedgamers
Music by:
/ hariboosx
/ @wolfandraven
Featured Game Genie Codes:
(Take note that I have not tested all of these with a real cartridge)
Pit Screen-wrap: AEEVSLEA
Pit Spit: ENEVSLEE + OEEVNUUE
Death on final bosses takes Ryu to 6-3: ZOSVALAP
Low Gravity: ZOOTKLYU
High Jump (Up, Right, and Left): XYETKSKN + XNXVESKN + XYKVKVKN
Invincibility: ATNTYOOZ
No horizontal knockback: AEXTLPPA
Unlimited Time: SXNYPYSA
Start with 1 Health: PAUVYIAP
Respawn with 1 Health: PENTILAP
Super throwback from Enemies: ZEXTLPPE
Backward jump same as forward: PENTSTAA
Backward jump bonus: ZENTSTAA
Death on final bosses takes Ryu to 1-1: PESVALAP + AESVZLPA
0:00 The Intro
1:55 The Design
12:15 The Cheating
22:23 The New Punishment
23:12 Outro
#BEHINDTHECODE #NES #GAMEGENIE
Пікірлер: 294
I hope you get to 1 million subscribers. Every single video you've done has been well researched & informative.
@psyjax2
3 жыл бұрын
Your channel has a similar attention to obscure detail, albeit in a completely different area :D
@Darxide23
3 жыл бұрын
Share the videos to everyone you know. The algorithm stomped on his channel a couple of months ago and stopped recommending the videos to non-subscribers.
@lustechsource5197
3 жыл бұрын
Agree. He deserves more followers.
I carefully studied how NES jumping/gravity works a number of years back, trying to figure out how to get jumping to feel right in my game. I didn't have the benefit of taking apart the code because I don't know ASM, I reverse engineered it by slowing down an emulator, counting pixel movement for each frame, placing it all in a chart, and then calculating manually what was going on. It was a lot of effort, but I manage create a perfect reconstruction of the jumping from Mega Man. ...which I later threw out the window because I made my sprites taller for artistic reasons, and the values from Mega Man no longer felt right, so I had to find all new values for my gravity and jumping. Anyway, what I wanted to say was: even though I already understood how jumping and gravity works in Ninja Gaiden, it was SO SATISFYING to watch you go over all the details and values.
@DisplacedGamers
3 жыл бұрын
That's quite a story! I am sorry you had to throw it out, but I'll bet it was a good exercise to help find what you felt was right for jumping. Glad you liked the video!
Excellent video. Speaking of the screen wrap, i've had a rare occurence where if Ryu is at the right vertical position as he's falling into a pit and gets hit by an enemy at a pixel-perfect moment, he will also wrap, avoiding said pit death. Your data explains it perfectly.
4:10 - "Ninjas do not make mistakes." 6:44 - Ryu lands on his fucking head when he jumps.
@CarbonRollerCaco
3 жыл бұрын
Bruh, that's motion blur. Those mofos are FAST.
Ninja Gaiden does speedrunning so well. You can go through most stages without stopping. Others you only need to stop once it twice.
@chiarosuburekeni9325
3 жыл бұрын
I love games that allow you to get through levels without breaking momentum
@alfo2804
2 жыл бұрын
@@chiarosuburekeni9325 Yeah, it's so good. I honestly think all action games should be designed so that, if you're good enough, you never have to wait around.
@thewhitefalcon8539
Жыл бұрын
That's actually not so great because it means everyone gets the same time.
@bhavikabachwani5833
Жыл бұрын
@@thewhitefalcon8539 No,the tricks in between the normal horizontal sections can be incredibly precise. I have tried speed running this game and you will never get the same time because of tricks like fast ladder climbs, quick kills on the final bosses, various damage boosts etc.
It's also a well known fact that this game plays better if you wear a cowboy hat.
@GreedyNomadSoul
3 жыл бұрын
And grow a mustache
@demonsty
3 жыл бұрын
arcus
@KID_JEDI_76
3 жыл бұрын
aaaannd clunck!
@EveryDooDarnDiddlyDay
3 жыл бұрын
BZZT!
@DisplacedGamers
3 жыл бұрын
I feel one thing my video was missing was a Good Moo(TM)...
I'm surprised youtube actually recommended something good and informative!
@itdepends604
2 жыл бұрын
Try using 'don't recommend video'
This is definitely one of the more interesting episodes of Behind the Code!
@DisplacedGamers
3 жыл бұрын
Thanks, Joe!
@Lady_Lilith666
3 жыл бұрын
Will you make a new episode about gravity changing? It will be interesting to see
@blackjoebufa
3 жыл бұрын
@@DisplacedGamers can you add a cheat for ability to climp up and down walls like part 2 only thing i hate about part 1
Would LOVE for this to be a long-running series. I love playing around with game genie codes and finding ways to tweak the game mechanics in interesting ways. Double jump alone changes so many games!
@DisplacedGamers
3 жыл бұрын
I try to integrate game manipulation along with code analysis in these videos just so people have more take home points from the video. Ninja Gaiden went overboard... definitely on purpose.
@blackjoebufa
3 жыл бұрын
@@DisplacedGamers find a code how to go up and down like part 2 on walls
Video Ideas: * Sprite Zero Hit in Super Mario Bros * R.O.B the Robot * Duck Hunt * How Scrolling Works In General
I'm a software developer and retro game enthusiast. I grew up playing NES and SNES games. I only found your channel recently, but it's absolutely fantastic. I appreciate the insane amount of work you do with your reverse engineering efforts. Keep up the great work!
This is becoming my favourite series. It's amazing how much is invested in the code for something as simple as a jump. It reminds me of formulas and how all the math components are incorporated just to get the exact measurement. Absolutely mind blowing.
I would have loved to have had a deep dive like this decades ago when I played the game on the NES! The original Ninja Gaiden was the only one of the original 3 I was never able to beat back then. I always ended up dying somewhere on the final bosses and got too frustrated going back to 6-1 to continue on. Great video!
@DisplacedGamers
3 жыл бұрын
Thanks!
That last code is pure evil. . I love this video! .
This is easily the best video about Ninja Gaiden on this entire site. You have a better grasp of the game's mechanics than every person who has reviewed this game... and this isn't even a review. I love when you show off Game Genie codes in these videos to fix certain issues, and I must say, NG definitely needed them! The reduced knockback alone almost brings this game up to par with its NES sequels (well, the level design and boss fights still suck, but there's not much that can be done about that). I am enthusiastic to see videos on The Dark Sword of Chaos and The Ancient Ship of Doom in the near future.
I'm convinced that you can show us the c ways to make all unnecessarily difficult NES games fun. Man, how I wanted to like Blaster Master or Ironsword back in the day. they were just too damn hard!
Great video, many coders, and me included, confuse moon jumps with high jumps, so that's something I will keep in mind and a very good point.
20:05 "I'll spare you how we get here" ... aw, really? I love your code walkthroughs! I've mentioned before that I'm learning assembly and these videos have been pretty helpful for giving real walkthroughs of real code.
I stumbled onto this video while attempting to reverse-engineer Ninja Gaiden's jump mechanics in Game Maker. I definitely wasn't expecting a Game Genie code to start at 6-3 after a final boss death; the impossible dream of a million childhoods. Now I might actually be able to beat this fucking game after 20 years. You guys are the _real_ game genies.
Was Karnov used in the intro as a bad example of physics? Because it's absolutely perfect for that and I laughed. Never played a Data East game in my life that wasn't overtly clunky and awkward to control.
@DisplacedGamers
3 жыл бұрын
I asked a friend of mine, "what do you think about maybe using Karnov for..." and he said "YES."
@penuts17
2 жыл бұрын
Try the fighting game lol
@jnnx
Жыл бұрын
If you think Data East was bad, try Taito
When I was a kid playing this game when it was new, I discovered a way to avoid pit death by tapping start or select, whichever paused the game. You would have to pause and unpause the game repeatedly a ridiculous amount of times, or at a certain frequency, I'm not sure which. As you fall into a pit while doing this you would fall from the top of the screen just as observed here. This was not done with a game genie, it was strictly a glitch of some kind, I am not aware of the popularity of this glitch or whether or not it is known by others. This was discovered out of sheer frustration and trying to avoid the death, kind of like being in denial that I was about to die. Give it a try. Love the video.
@raditts
2 жыл бұрын
This happened to me occasionally as well, but without pausing / unpausing. It seemed to happen only when I got knocked in a pit from enemy damage. I think it might be when you are knocked into a pit while in midair? Someone posted a video of it here: kzread.info/dash/bejne/ZJOKl8momJixd84.html
@LineageStone
2 жыл бұрын
@@raditts ah, thank for the the link and clearing that up for me. This is most likely what happened to me.
@raditts
2 жыл бұрын
@@LineageStone fyi, he also talks about this in the Ninja Gaiden 2 video and what they did to keep it from happening in the sequels
Slash cancel is also necessary to swing your sword in the air without using up any chakra/chi while equipped with the pinwheel power-up. Helps massively when trying to save them for the final boss
Phenomenal video as always. If there's one improvement I can suggest, it would be to exploit the functionality of Mesen to name RAM locations for when you show code in the debugger. It's one of the best aspects of assembly to make it more human-readable, you can name anything and never have to look at many numbers if you don't want to. So instead of saying "86 hex" you can come up with a name and refer to it by that name in your speech as well.
@DisplacedGamers
3 жыл бұрын
I'm with you on this. I think I started to do it just a bit when I was putting together the Dragon's Lair video but removed some of it before editing. I felt the same way you do when I was editing this video as stating the hex values really interrupted the flow since I wasn't doing a line by line walk on any code for NG. I feel like I have enough videos in the series to start streamlining some of the assembly + hex to read more like logic/design or heck - even pseudocode for people unfamiliar with assembly and/or hex. Whatever variables names I use, I want to try to keep them as short as possible (don't we all...) for the sake of space during the video presentation. TL;DR: Thanks, VuurniacSquarewave. I agree.
criminally under-subsribed channel.
I like the code for increased knock back. It makes getting hit more comical.
Me watching this video not understanding a word of this tech jargon and going "this the good shit"
yesss, the movement and controls in NG are some of my fave in any game
@GentlemanOrcus1
3 жыл бұрын
same
This is one of the channels that makes every game fascinating. Well done, it's amazing! Regarding the knockback code, the issue I see with the no horizontal knockback is that it's an insta-kill if you get touched in mid-air.
@DisplacedGamers
3 жыл бұрын
Yep. It even happened to me during testing.
@DisplacedGamers
3 жыл бұрын
Yep. It even happened to me during testing.
Best quote of the entire video. "Ninjas do not make mistakes" We all had to learn that the hard way in Ninja Gaiden . If you made a mistake you got what you got. And it usually sounded like this. tin tong tin tong, ding tin tong tin tong. tong ting tong. It was at that moment that you knew you messed up.
It’s interesting how they made the jump go a farther distance in the PAL version, instead of speeding it up. Would be cool to see it sped up as well, for the ultimate easymode version of the game 😂
I need to try a few of these game genie codes. Especially the extra knockback looks fun! After finishing this game hundreds of times, it will be fun to play it in a different way.
I've noticed if I pause when falling down a pit, sometimes Ryu screen-wraps. This is with the original unmodified cartridge.
@emmettturner9452
3 жыл бұрын
Others have said it happens if you get hit or are at the extreme right edge of the screen.
@ronaldgaffney2221
3 жыл бұрын
Ryu's doesn't have a capped maximum falling speed so he can fall much faster if he falls from a greater height. If his speed is greater than 8, he can screen-wrap from bottom to top in a single frame, meaning the check to see if he's "below" the bottom of the screen returns false.
@emmettturner9452
3 жыл бұрын
@@ronaldgaffney2221 Yes, but does pausing affect this?
I'm kinda curious about how to add a recovery mechanic that many current indie platformers have implemented: The jump-on-knockback mechanic. During a knockback, you can still make a jump mid-air.
@DisplacedGamers
3 жыл бұрын
From what I saw while making observations, there is a bit in the status flags that sets if something is "in-progress" for Ryu. It is used to determine if an action can be taken or not. If this were expanded upon, there could be some bit-combo checks that would work for checking stunned/knockback and allowing a jump. A jump would be limited to just a single jump after hit. You'd have to start checking situations like - hit, then you jump, then you get hit again during your recovery jump... what happens? Allow another jump? How high can you go on screen with this? Etc.
This is really awesome! I like the way you present ROM hacking as understandable and accessible -- it's very inspiring. And as an added bonus some of my favourite games get improved with new Game Genie codes! Although I've beaten NG, I'm looking forward to using the final bosses code to practice the second one more. I wonder if it's possible to do something similar on NG3 -- "fixing" the double damage and new checkpointing system that sends you quite far back after every death would make the game much more fun I think. The Japanese version is fun, and having a middle ground in difficulty of the North American version with codes like these would be a nice next step for easing into the pain that is the NA version of NG3 :). Thank you again, and I'm looking forward to the next video whatever it is!
@DisplacedGamers
3 жыл бұрын
I will probably make some big changes to Ninja Gaiden 3. I don't know the scope of GG codes vs "just make it a ROM patch" yet. I try to put the manipulation of the game in the hands of the viewer/player where I can. Make it something people can do without software if they just have the cart and a GG.
@euanforrester7723
3 жыл бұрын
@@DisplacedGamers Awesome! I'm looking forward to seeing what you come up with (and how you did it!). And yeah, I think GG codes wherever possible work well and are fun to play with.
Excellent. Also reminds me AVGN would have loved to see this episode a few years ago ,haha.
14:14 Achievement Earned: Thinking with 'portals"
I don't know much about game coding, but now I'm trying to get my head around how game genie works
Excellent video, great insights! This is nowadays one of my favorite channels. It's just a matter of time you get million subscribers.
I love this game series and you just breathed new life into them for a 39 year old.
I can't wait for the Ninja Gaiden "Pit Spit" Percent Speedrun category!
Badass that people to this day are still talking about Ryu Hayabusa. He's that nasty. And seeing that screenplay of Karnov was awesome!
I'm binging all your videos. These are wonderfully produced, well thought out and so nostalgic. Please feed me more
Your choice of music is always so excellent. This was another great video! I would love to see another look at Ninja Gaiden, this time at its famous cutscenes, just to see if we can take a deep dive into some of the logic that dictates how they are structured. Maybe it's simpler than I think, but I feel it would be a fun thing to examine.
Dying to any of the final boss's forms gives you a message: "You and your ninjas are dead. GAME OVER." And *then* you get kicked back to stage 1. That was pretty fun to watch, maybe now I'll actually give Ninja Gaiden a try, see if the helpful codes will help me avoid becoming part of the ever-growing "death by those Ninja Gaiden birds" statistic. (...why did I immediately get the mental image of the Duck Hunt dog laughing at the player, replacing the 'death' fanfare specifically if it's a bird that kills you, either by damage or by knocking you into a bottomless pit?)
The No Damage run wasn't accomplished until 2020 (killing the demon head falling off the last boss was an issue as it can't be dodged). But I loved the 1HKO combo code- that would've been brutal as a kid.
@joliver81
3 күн бұрын
Yea, it can be dodged if you use the multi jump-strike method. Jump then tap strike and down at same time, down simply cancels the jump and allows you to strike as many times as you can tap button before hitting ground. 16 strikes for the head then 16 more for body and Boom, a no hit run. I only know of one player to accomplish it.
You missed a very good opportunity to play House of Pain's Jump Around :P
@SuzakuX
3 жыл бұрын
Heh. When I finished watching this, YT ran an ad for that new Crash mobile game featuring "Jump Around."
Backward jump bonus looks betters, like a new skill. Awesome video.
The fact that ninja gaiden has that crazy infinite falling effect just by changing 1 bit is insane. Loved the video
Could you do a breakdown on slash canceling? Also...cape analysis 3:14 - The wall is wearing the cat as a cape, the cat is almost wearing Ryu as a cape, and Ryu is wearing the mountain as a cape. 3:51 - The cat is wearing the bird as a cape. That was a good cape analysis.
Great video, this channel gets better each time you upload new content!
Excellent video as always!
All of these videos are insanely interesting and good.
Very cool. I'd love to see your comparison to the physics in the sequels.
Neat, I never thought to apply decimals transformations to integers like that
What I learned from this video: the expression pit spit exists and I love it.
i subtract 20 after i died in the final bosses and it send me back to 1988
11:47 Where were you back in the day? All I can say, damn son!
I streamed and beat Ninja Gaiden about five years ago and it was easily one of the most frustrating games I'd ever played. The knockback combined with enemy respawn checkmarks makes for a miserable experience at times. (Birds!)
Just seeing those damn birds that respawn endlessly gave me child hood PTSD.
My day just got so much better.
There's something that I understood in this amazing video, that's any Genie Code break the terror feelings that the game has some how input in our minds during decades. 👏👏👏
Amazing video! And thanks for game genie codes, very useful! How about video about tmnt 2 and 3 nes enemy AI?
The thing I most remember about this game is that it plays amazing. So crisp controls. Castlevania jump though... That's punishment and a half. In my opinion the most you need to finish this game is despawning that one hooded guy on the platform in 6th stage. And perhaps you want to die before the last boss if your hp is low so you get to resume before the boss. And try to finish the last boss in one go, because if my memory serves right, you get a hp refill only on the first try.
oh man how do I still remember all of those levels after all this time
Now this is high quality content!
correction: Mario bros was designed such that the air deceleration was applied as an addition to the motion vector that has the opposite direction as what mario is facing instead of what direction mario is moving because they assumed this would be the same, and they could save a few lines of code checking signs and such. This means that you are being accelerated accidentally instead of decelerated when Mario moves in a direction counter to what he is facing. Same thing as the infinite backwards long jump glitch in Mario 64. Its not a feature, its a bug. Its a pleasing bug, but it wasn't something they intended, so thus it is not a designed feature. That said, I appreciate that there are people who take cheating seriously, and aren't just using cheats as an excuse to deride how others want to play games. I cheat in all my single player games, and I'm proud of it. I've made most of the cheats I use.
@Slash0mega
3 жыл бұрын
Your proud to cheat? I understand being proud of your ability to make cheats, but to be proud of the cheating itself? that's odd to me, but you do you. cheating in singleplay hurts no one and can be quite fun.
@notalostnumber8660
3 жыл бұрын
It's cool to cheat if it means experiencing the game in a new one Or perhaps it allows you to even play it On a side note, most GoldenEye 007 speedrunners use a GameShark, but not for cheating, but because it has Region Bypass and allows to boot up the game if the cartridge is faulty most of the time
Had to stop and lmao when ryu hit light speed.😂😂😂
i love your channel im a big nintendo fan and i consume loads of content about nintendo but never would i have thought i would love the science behind the code so much your explanations are pretty clear and simple to understand and i can hear in your voice how much fun u are having urself while making ur videos so i subbed after seeing like 3 videos and am now binging ur content =) lots of love and thanks for the effort and ur videos
14:05 now you're tinkering with Portals.
Would be cool to have a Game Genie code to make Ryu climb walls like in Ninja Gaiden 2!
Exceptionally great video! We incorporated a lot of these changes in our Deadpool NES hack, so its really neat seeing things here! I also added your video to our official NG speedrun discord :) As always, amazing stuff! Keep up the good work!
@DisplacedGamers
3 жыл бұрын
Thanks! I saw some video footage of the Deadpool NES hack while doing some research on NG. Thanks for your work as well!
Another great video. I recently picked up a Game Genie and it was pretty sweet trying these codes out. Big request for a NES Tetris video someday?
@DisplacedGamers
3 жыл бұрын
What sort of things would you like to see for Tetris?
@null_state
3 жыл бұрын
@@DisplacedGamers There are all sorts of game genie codes, some casually mentioned on tetris subreddit, others on CTWC outlets and beyond. I frequently use one to change the Delayed Auto Shift speed, or to disable the animation at the end unless you max out. There was a user who recently coded in modern Tetris hard drop and ghost piece effect (this being beyond codes, and an actual patch). I don't have any one specific request, but it would make for an interesting topic and there is quite a large community growing these days. Thanks!
The respawning and those got damn birds!!!!
The pit death bit is hilarious.
Urban dictionary defines pit spitting as something unmentionable on KZread, but you do you man.
@DisplacedGamers
3 жыл бұрын
Ehh. Didn’t look into it.
Dude this is amazing!! Great episode!! Also wicked background music. Cheers man!
This is an excellent piece of work. Thank you. As a programmer I'm never quite as interested in how to cheat the game as just learning how they made it work back then. That said, I can't help but be impressed by your "pit spit". I think if you run into overflow again you might consider explaining exactly why ADC #$00 adds 1 at this point, specifically the overflow flag. (maybe CLC as well situationally) Given the detail of the explanation of overflow it seems the target audience would include people who don't know assembly. Even among people who know a little programming the ADC instruction's behavior might not be obvious, especially because you explain the ADC #$37 line shortly before, and the lack of an ADD instruction on the 6502.
This content is utterly amazing and it deserves mass liking. What's the memory address we can poke and patch out KZread's checks for number of likes? 😆
that is a very smart way to reduce the jump velocity over time.
Man I used to get wrecked by this game. I stayed up all night long one time to beat this game and figure out every thing. Man I used to skip school to play part 2 on nes. To this day I do no regret it.
Subbed, your channel is very informative and enjoyable to watch
This is excellent stuff! -- Would love to see more! - In particular, I enjoyed the heck out of the fun tweaks that I would have never found with the Mesen emulator myself! :D It would really be fun to see some of your process on how to get your eyes used to swimming through the vast oceans of code!! PS: My inner-8-year old is jumping for joy at these Game Genie codes btw! :D
this is the best video on youtube
Since we have the acceleration due to gravity of the game, we can determine the actual sizes of things. g = 9.8 m/s^2 = 55/256 pixels/(frame)^2 At 60 frames per second, g = 1547 pixels/s^2 So 1 pixel is 6.3 mm Ryu is 32 pixels tall (I think). So he's only about 8 inches tall.
@9adam4
2 жыл бұрын
The other interpretation is that we're seeing things at "ninja speed," that is, the game is slowed down relative to how fast Ryu is moving. Assuming that Ryu is 2 m tall, each pixel would be about 63 mm. Acceleration is 13.4 mm per frame. That means we're seeing 27 frames per second. The game is slowed down by half for us.
I wanted to add that at stage 4-1 if you get knocked back by the gunman into the left side of the screen with the strong knockback you may be able to clip into a loading zone and load into stage 4-2.
12:41 F8 is to check the flag for Ryu falling to his death? So if Ryu falls into a pit that's his "F8" (fate)? I'm not sorry.
Didn't understand a thing, but I liked it
As a game designer who wants to get into platformer design, this is invaluable. Only retro game jump mechanics that are well documented are just Mario, and maybe Sonic. It's very interesting to see how other games did this.
God, I've been trying to wrap head around programming gravity everytime I try to make something in GameMaker for 10 years, I feel so dumb!
For that screen wrap trick. I’ve had this happen without a game genie in stage 6-2. The one with the flying jet ninjas. I fell in the infamous pit below those flying jet pack ninjas and screen wrapped back to that platform. I have no idea how it happened.
Nice callout to kabuki quantum fighter :P
Nice content - more of this type of stuff please. Game physics!
Interesting as hell. Great video sir
now you're thinking with portal jutsu
Fascinating as always thank you for your uploads
Wow ! Good technical data !
"Plus two Ryus in height" Americans and their measurement systems, I tell ya
Also, you can plug two game genie carts together and enter six lines of code... this does work
Superb and fun as always.
"Tip eht fo tuo yats!" - Reptile probably