We finally got into Castlevania! I wanted to have this out by Halloween but didn't quite make it. However! I ate some candy while the upload processed.
I find this bug to hilarious. You really would think it would have something to do with RNG or counter hitting which it kinda does but the fact it's completely unintended is kinda great. Basically, it's ends up being a Bloody Cross.
As a kid, I called the Nintendo Helpline about this very phenomenon. I heard the guy paging through a book and realized they don't know everything, they just have a book of tips. He didn't know the answer. Thanks for the info!
This is awesome! Hoping to see a Behind the Code on the funky scroll glitch shenanigans that runners do now. Edit: As a speedrunner of this game I've always been curious why the bat crit would one-shot because you're on a stair, the only reason I ever heard in our community was "it just does". This now makes sense since the timer would be 16~ frames instead of 4~. Cool insight!
I started with the funky scroll glitch research. I have some information on it, but the critical hit with the whip was a more timely pursuit for producing a video. I may do the scroll glitch next. We'll see.
@@malkneil Since you don't get knocked off stairs when you get hit, I suspect it jumps straight to the stunned timer, instead of the shorter pause before knockback.
@@DisplacedGamers We have some very good knowledgeable people in the CV speedrunning Discord who have broken it down pretty well already. I'm sure they can help if you ever need it!
Basically, the whip freezes in attack position and does 4 frames more damage than Simon would normally do. Your channel is fantastic, I always can't wait for a new episode! I might even learn assembly for some of these old systems :)
Just remember that the NES uses a different ASM code than intel-like processors. The instruction sets and... I think registers (it's been a while) are different. The last time I did this, I was messing around with Zelda 2. I wrote it so that every actor to appear on screen turned into a fairy. Which was fun. Bad guy comes on, is fairy. Locked door? Fairy. Temple boss? Fairy. Statue to place the gemstone to finish the temple? Fairy... and it was at that point that I realized, I f*cked up.
Honestly this is a bug that I could see being expanded into a feature. Everything you need for a good game element is there: Risk-reward (You're trading your health for a *chance* to do massive damage if your timing is perfect), challenge... new players will get it randomly and it'll be really hype, experienced players will actively reach for it to get kills faster. It should stay!
yeah, what about the idea that the whip gets to wrap around the enemy and deal more damage as it gets pulled back off. I think its neat. I never knew about this bug
It's funny, I've actually watched first playthroughs where the player got one on dracula, but didn't realize it. So they were just left confused why his health went down so quick. Blink and you miss it. :)
I would be very interested in the damage logic where Simon gets hit and knocked back. As a certain someone pointed out oh so many years ago, it often seems like even if you're facing away from a pit, it's like the game always knocks you back toward a pit. Would be interesting to know how the game decides which way Simon gets knocked back when damaged.
That's easy, it is based on the direction Simon is facing when he suffers the knockback result. If Simon is facing left, he is knocked back to the right, and if he is facing right he is knocked back left. Speed runners use this knowledge to bypass the dungeon section of Level 1. When the bat spawns they leap and turn Simon to leap to the right but he is now facing to the left of the screen, so when the bat hits him he gets a boost to the right and lands on the normally out of reach blocks on the right side past the door.
@@fgetce We do jump to the right, but we do so in a way that Simon is hit on the left side of his sprite. That way it'll still do the knockback to the right.
@@DatingTV I reviewed the game, since it has been more than 10 years since I played it and it seems there is an importance from which direction the collision comes from and a little based on what direction Simon is facing when the collision occurs. It's weird because I had a different memory of the collisions when I played.
Great video. My son said, "So, no Game Genie code? Rats." He loves them and saves your GG codes from each video. Thanks for the explanation. I look forward to every Displaced Gamers video.
Ooh man! I am sorry I didn't give a Game Genie code this time. It is a tradition with these videos, but I didn't have one to make this time. I guess I could have extended the freeze timer to increase damage.
@@ThePreciseClimber Really! That's neat. I recently got my hands on a PC-engine and it's a great game but quite tough. I'll have to try out that trick.
Mostly commenting for engagement. Keep up the good work! When I was 12 I tried really hard to get into the SNES/NES hacking scene but never could find a community where I could learn from. Twenty years later I'm finally learning a bit about how these games worked from an inside perspective
I'd love to see you tackle Ironsword: Wizards and Warriors II collision detection. I was under the impression it's one of the first games to attempt per body part collision, but did so poorly. If you've ever played the game it seems like enemies either do no damage at all or one shot you, and your sword is unusable due to its short collision range. I love this channel btw, it's such a niche topic but just the sort of content I love.
Has anyone written anything about the "per body part" collision aspect? Perhaps an interview from the past? Did you figure out the game had implemented this while playing?
@@DisplacedGamers I can't find any official documentation, I just remember reading about it on the Internet a long time ago. The manual hints that helmet upgrades specifically help protect your head. I also found a post on gamefaqs that mentions the body zones thing but I think my comments are getting deleted when I include the url. Honestly it could just be confusion over a lack of s after being hit or something like that.
Great video as always! Really neat stuff. There's always a point in these videos where I feel lost and I'm worried I just am not going to understand what's going on, and then later on it all clicks and just makes sense. You're a great teacher!
Thank you! Scripting it is one of the toughest parts. Translating the code discoveries into a narration that makes sense is important to me, and I am glad to hear that it is worth it!
I love these videos so much. The way you break down the way the code of the game works not only show a great deal of effort on your part but also the ingenuity of the programmers of the time
I love the breakdown man, because these videos also double as a kind of introduction to the kind of issues and bugs that crop up in complex systems, but complex systems us 30+ year olds are familiar with from a young age (NES games)
"Simon states are in agreement once again" - This is a bug I've seen way too often that is introduced by having multiple states instead of just one. If there are multiples states, you must keep them correctly in sync at all times and there is quite often a situation where it is overlooked that these states can go out of sync for a certain combination of actions. This happens even more often if there are no states at all, just a series of flags, as keeping multiple flags in sync is even harder and requires even more code. State machine logic is very simple as long as you only have one state, so ideally you cramp everything into a single state, even if that means you need a lot more states. E.g. instead of state 1 being either A, B, C, or D and state 2 being either nothing, E or F (but only valid in state B) or G or H (but only valid in state D), you can also just have a single state with possible values A, B, BE, BF, C, D, DG, DH. That way if you switch from, let's say, BE to A, you not only switch B to A but you also automatically always clear E when doing that, no extra code required and no need to remember to clear state 2 when it is in state E or F and state 1 switches away from B. Keep in mind that states are inexpensive, they don't require memory or processing power just because they exist, so it makes no difference if you have 4, 16 or 128 different states. States are just numbers and only expensive when there is a mapping table or code that may have to map/handle all existing states. Yet by assigning state numbers in a clever way, many states can be as easy to handle as little ones. E.g. If you map A to 0, B to 4, C to 8, and D to 12, you can assign BE to 5 and BF to 6. By masking off the last 2 bits, you still only have 4 states to map in a table or handle in code that way, just as if A, B, C, and D were separate states again but you still keep the benefit of autoclearing E, F, G, and H without any extra code whenever you set the state.
Your channel is such a well-edited and produced look into so many interesting quirks in the code of famous games. I cannot overstate my appreciation for the work you do.
The Japanese cartridge version's Easy mode doesn't contain the knockback state which does some weird things with mechanics, like not allowing Simon to die while crouching. You can technically beat the game on every boss while dead, it's just a bit hard without some elaborate setups. www.twitch.tv/videos/541994542?filter=highlights&sort=time But yeah, death is programmed to require the standing state by game logic. There's also some fun things you can do with death checks on the DOS and C64 ports - i.e. saving and continuing or transitioning screens while "hit" skips checks as well. Though unfortunately NES is coded in such a way that achieving something similar isn't possible.
I did this when I finally beat the game a few years back. I had no idea I did it until I reviewed the video I was uploading. It’s cool to know the full details behind this. Thanks!!!
I thought this was going to be some video about how some enemies in _Castlevania_ seemingly take more or less damage from attacks than others. I was ready to call shenanigans and explain that more enemies just have more or less health than 16. But, nope. This is legitimately an oversight in the game. Thank you for explaining it.
So I'll be honest, I'm new getting into gamedev and your videos have been excellent all around, just learning how games did things they did have been inspirational and just profoundly interesting to me. This video has a somewhat small aspect that kinda blew me away because I was seriously misunderstanding how State Machines worked. Every time I've ever tried looking up information regarding FSM, it's always saying things like "Keep states simple, keep them separate" and at least in my interpretation usually keep them mutually exclusive. With that in mind I had no clue at all how exactly you would replicate a lot of games that seemingly _would_ use FSM for the sake of clarity, game design, and even just ease of development. Then I realized something in this video and it's so simple but it never even crossed my mind: Just use multiple FSMs on the same game object. I know, weird video to notice that on, but seeing "Simon Action" and then "Simon Attack" made me realize how limited my view of this stuff was lol. Of _course_ you should probably have another FSM for handling states that are supposed to be usable during other states, like being able to attack while in the air, or on the ground, for example. Anyway, I just felt strongly about it because it feels like I've been trying to wrap my head around FSM forever now and this helped me break through and understand how I can implement it better now lol
So pretty much for 4 frames (stun) Simon's whip becomes holy water (does damage every frame) that is insanely broken if you can consistently pull it off
I love your videos so much, and I honestly have no idea what it is specifically about them. They are a master class in video game documentation. I have been here since the beginning it seems, and the quality and effort that goes into your videos is constantly improving and I love it. I would like to make a request for something that isn't your normal wheelhouse, but would still be such a fun ride.. BtC for roller coaster tycoon. Famous for being written in assembly and incredibly efficient, I would love to learn more about the how and the technical expertise that must have been involved. It's a bit of a departure from your normal formula, but I can't find anything like it on RUclips.
I got a fun topic for you if you're interested. Mega Man 2. There's a glitch in boss rooms where if you lay down a lot of Item 1's or bubbles then touch the gate (sometimes while taking damage), you'll activate the door, transporting you to the next screen. Commonly called the "Boss Gate glitch"
As someone who has dabbled in some more-than-casual, less-than-speedrun, head-to-head racing of this game (among others), it's so much fun to see even further under the hood. Basically, I know the "how," but it's great to see the "why".
Would love to see a 'methodology' video. I know you've touched on it in a few of your videos, but one titled such and that focuses on it would be great.
Heck yeah! I'd been wanting to know why this happened for a long while now! Seeing how they work really make me think about how to approach programming games like these in assembly. There's so many interesting behind the scenes stuff I want to know more about in these old games, like the vertical scrolling sections in Megaman 5 where the floor doesn't move while the background does.
The visual part of that is easy, it's done with the MMC3 scanline counter IRQ. When the screen rendering hits the specified scanline, the interrupt occurs and the code can set an X and Y screen position fixated on the ground for the rest of the frame to be drawn.
@@Bofner And many other things yes, like the ship in the water. MMC3 was one of the most popular mappers, games that came earlier than IRQ generating mappers had to resort to the console's built-in method of syncing with the frame rendering, which is much more costly and can only be done once per frame, called the "Sprite 0 flag". When rendering reaches the first opaque pixel of the first hardware sprite overlapping with an opaque pixel of the background a readable flag is set by the PPU. By polling this flag again and again until it is set, you can wait for a certain point to be reached in the frame, but you are wasting all your CPU just spinning on the poll until it is set. You can try to squeeze in some code that you know for sure will be able to fit before you need to start polling and take action, but it's more wasteful either way and a proper IRQ. Also, once the flag is set, it is only cleared when the next frame begins to draw, so this can only be used once (ideally for a status bar on the top of the screen).
@@vuurniacsquarewave5091 Wow, that really does sound limiting. I've never had that much experience witht he NES from a programming standpoint, but I've done work with the Sega Master System, which can't be exanded in the way the NES can, but has a lot more features out of the box (like handling interrupts) so whenever I see interresting screen effects on the NES, I tend to compare it to what the SMS can and can't do
@@Bofner The SMS seems really great when it comes to color, but kind of bad when it comes to sprites. But then again, it uses VRAM by design, whereas the NES has the option for the cartridge to provide the graphics on either ROM or RAM. Both can be exploited really nice, and just to give a great graphical example, I think Aladdin on SMS does a lot of amazing graphics tricks by making buildings look fake-3D (must be done with tile swapping in VRAM ) to parallax scrolling and still manages to have great spritework.
Interesting. If I understand this correctly, the game stops the whip from dealing damage if the whip animation didn't complete, and it does this by delaying the damage with a timer and freezing this timer if you get damaged; but if you get damaged on the exact moment that the timer is ended, then it will freeze in that exact instant and deal damage to that location repeatedly until the whipping animation is completed.
A fun thing to show would had been a hitbox while the bug occures. Since in knockback he faces backwared and the hitbox extands to both sides. Very nice explenation and islustraiten. Thank you sir. Also the cross crit would be very easy to explain as it just keeps track of the last enemie hit to not hit again as far I am aware of. So it becomes clear what happen when two sprites overlap and do not die while the cross overlaps them too.
This is great, just a few hours ago I was dealing with a bug that shares a surprising amount of similarities to this one. Had yielded a unexpected feature simply from not clearing a variable when it should have been cleared, lol A cool accident, but it was still a bug.
Great video! Goes into great detail on one of the biggest types of bugs in games from my experience. Very hard to debug these inconsistent state issues :( I'd say at least half of my bugs relate to something being in the wrong state for some reason and then having to figure out why.
It's pretty fortunate that patching and alternate updated versions weren't very feasible in the past. We have a vast showcase of coding quirks and flat-out bugs to enjoy and/or learn from. I feel that I learn far more from mistakes or poor practices, my own or otherwise.
They definitely exploit it! The Dracula battles in particular are quite fun to see. It takes some great skill to perform a double cross/boomerang throw while backward jumping & whipping with a crit.
Please don’t fix it.. LOL. I’d love to see you dissect the bat crit and why the stairs do even more damage than standard crit. Very much enjoyed your video.
I believe it's because the stairs don't knock Simon back; they freeze his current position in place for 16 additional frames, including his whip graphic if he happens to be whipping. So if the frame 17 interruption activates on the stairs, the crit that occurs will remain active for those additional frames too.
please do a video on the other castlevania bug you showed us And do a series on all bugs/exploits in all castlevania games please You explained it so well, you really know how to explain these things. Amazing. I wonder if management or the development team simply did not beleive the testers finding or if they were unsure on how to fix it at the time? I suspect the former. Also probably the tester did not understand why or exactly when the bug occured. I am subscribed and though the video was not interesting until retroRGB pointed it out! How wrong my assumption was. I will never doubt you again! The critical hit, lol I thought it was how the code handles the final hit on an enemy, which in retrospect does not make sense since that is not really interesting to make a video about
Great detailed breakdown, but why would we want to "fix" the critical hit?? This is one of those "it's not a bug, it's a feature" situations. It takes a lot of skill and practice to time that critical hit just right, and when it finally happens it's extremely satisfying.
This is mind-blowing, I don't recall ever landing a critical hit on Dracula but I do remember destroying the Bone Pillars in one hit while being hit myself, I just never realized what it was. Also, doesn't the whip do damage on its first frames when Simon is holding it behind its back? I think it does in other Castlevania games.
So does this happen on all versions of Castlevania? (PRG0, PRG1 and Vs .) Also I hope the nasty Grim Reaper hallway bug from the PRG0 version is explained next.
Funny how a bug creates a really interesting (if overpowered) mechanic. You can do a bunch of extra damage, but it requires getting hurt _and_ perfect timing, so it's risky.
This is going to sound kinda random, but have you looked at much Castlevania II code? I was playing it (because Halloween) and one part that always confused me was the behavior of the bouncing slimes. Namely, how they would sometimes pass through floors or ceilings. I assume it has something do do with the vertical vs horizontal scrolling in the area, and how collision was handled, but definitely was an odd thing to see as a 7 year-old.
Some of the blocks are areas where Simon will fall through if he attempts to walk across them. I think the slimes therefore pass through those same blocks while going either up or down.
@@DisplacedGamers Well, you have me doubting myself now, but I'm pretty sure this isn't where the false blocks are. I think happens when the slimes are at the edge of the screen while it scrolls. But now I have to go load it back up and make sure I'm not just crazy.
This is so cool! Can you do a 'behind-behind-the-code'? I mean how do you write these scripts? I know Messen(sp?) is involved, but how do you script breakpoints & such? My apologies if you've already made a vid like that
This channel is for sure one of the best on this godforsaken platform. Shmootube seems so devoted to promoting annoying and redundant minecraft and fortnite videos from some overhyped goof rather than truly interesting and high quality videos like this one. I'm sure you know by now the numbers don't really mean shit cuz your channel is dope , my dude.
The CV critical attack mechanism feels a lot like when Undertale tells you a certain someone is the weakest enemy with each attack only consuming 1 hp.
Can you look at collision detection in Simon's Quest and figure out how the "drop through the floor" glitch works? I'd love to watch a video about that.
I am a bit confused about the fix shown in the video. At 0:15, the Player is hit by a fireball and takes four bars of damage as shown at 0:25. But at 10:59, the Player is hit by a fireball and takes no damage as shown at 11:15. Is the fix causing the Player to take less damage during these double collusions?
I froze the player's health value in RAM for a large portion of the video. Player damage will definitely be inconsistent as it wasn't my focus and I needed to continue to test various things without the concern of Simon dying.
Any chance you could share the Lua scripts you use for the readouts in these videos? The progress bar in this one is really cool, it would be super helpful to be able to try out my own data readouts using yours and a springboard.
What if the timer were changed to increment by zero? Could Simon be put into a state where he's always attacking even when technically in different states?
We finally got into Castlevania! I wanted to have this out by Halloween but didn't quite make it. However! I ate some candy while the upload processed.
I count’s as a Halloween upload. 😊
As long as it was the best candy ever, candy corn.
I find this bug to hilarious. You really would think it would have something to do with RNG or counter hitting which it kinda does but the fact it's completely unintended is kinda great. Basically, it's ends up being a Bloody Cross.
How does the Giant Bat quick kill work? Please do a video about that if it's worth it!
You know what, it was still spooky, because code scares me, so that works.
As a kid, I called the Nintendo Helpline about this very phenomenon. I heard the guy paging through a book and realized they don't know everything, they just have a book of tips. He didn't know the answer. Thanks for the info!
i mean they were customer service reps not software engineers. cut them some slack lol
"So, how about fixing it?"
Doctor Evil: HOW 'BOUT NO!!!
This is awesome! Hoping to see a Behind the Code on the funky scroll glitch shenanigans that runners do now.
Edit: As a speedrunner of this game I've always been curious why the bat crit would one-shot because you're on a stair, the only reason I ever heard in our community was "it just does". This now makes sense since the timer would be 16~ frames instead of 4~. Cool insight!
I started with the funky scroll glitch research. I have some information on it, but the critical hit with the whip was a more timely pursuit for producing a video. I may do the scroll glitch next. We'll see.
Why is the timer 16 frames on the stairs instead of 4?
@@malkneil Since you don't get knocked off stairs when you get hit, I suspect it jumps straight to the stunned timer, instead of the shorter pause before knockback.
@@NrgSpoon yeah my number might be off, but this is it
@@DisplacedGamers We have some very good knowledgeable people in the CV speedrunning Discord who have broken it down pretty well already. I'm sure they can help if you ever need it!
Basically, the whip freezes in attack position and does 4 frames more damage than Simon would normally do. Your channel is fantastic, I always can't wait for a new episode! I might even learn assembly for some of these old systems :)
Go for it! And thanks!
Just remember that the NES uses a different ASM code than intel-like processors. The instruction sets and... I think registers (it's been a while) are different. The last time I did this, I was messing around with Zelda 2. I wrote it so that every actor to appear on screen turned into a fairy. Which was fun. Bad guy comes on, is fairy. Locked door? Fairy. Temple boss? Fairy. Statue to place the gemstone to finish the temple? Fairy... and it was at that point that I realized, I f*cked up.
*5
The NES uses a 6502 clone, which is very easy to learn and use. You shouldn't have much trouble at all.
Honestly this is a bug that I could see being expanded into a feature. Everything you need for a good game element is there: Risk-reward (You're trading your health for a *chance* to do massive damage if your timing is perfect), challenge... new players will get it randomly and it'll be really hype, experienced players will actively reach for it to get kills faster. It should stay!
yeah, what about the idea that the whip gets to wrap around the enemy and deal more damage as it gets pulled back off. I think its neat. I never knew about this bug
It's funny, I've actually watched first playthroughs where the player got one on dracula, but didn't realize it. So they were just left confused why his health went down so quick. Blink and you miss it. :)
A sort of Newton's Third Law of Motion for damage. Maybe have it work for the enemy as well.
10:06 Fixing it? I'd say it's a great example of "It's not a bug, it's a feature!"
I would be very interested in the damage logic where Simon gets hit and knocked back. As a certain someone pointed out oh so many years ago, it often seems like even if you're facing away from a pit, it's like the game always knocks you back toward a pit. Would be interesting to know how the game decides which way Simon gets knocked back when damaged.
That's easy, it is based on the direction Simon is facing when he suffers the knockback result. If Simon is facing left, he is knocked back to the right, and if he is facing right he is knocked back left. Speed runners use this knowledge to bypass the dungeon section of Level 1. When the bat spawns they leap and turn Simon to leap to the right but he is now facing to the left of the screen, so when the bat hits him he gets a boost to the right and lands on the normally out of reach blocks on the right side past the door.
@@fgetce We do jump to the right, but we do so in a way that Simon is hit on the left side of his sprite. That way it'll still do the knockback to the right.
@@DatingTV I reviewed the game, since it has been more than 10 years since I played it and it seems there is an importance from which direction the collision comes from and a little based on what direction Simon is facing when the collision occurs. It's weird because I had a different memory of the collisions when I played.
That's a nerd reference
Great video. My son said, "So, no Game Genie code? Rats." He loves them and saves your GG codes from each video.
Thanks for the explanation. I look forward to every Displaced Gamers video.
Ooh man! I am sorry I didn't give a Game Genie code this time. It is a tradition with these videos, but I didn't have one to make this time. I guess I could have extended the freeze timer to increase damage.
Wait, there's a critical hit mechanic!?
Edit: Nope, just a very cool bug. Great video!
On the other hand, Rondo of Blood does have an "extended whip" mechanic. Pressing forward twice quickly while using the whip attack.
@@ThePreciseClimber Really! That's neat. I recently got my hands on a PC-engine and it's a great game but quite tough. I'll have to try out that trick.
Love it. I especially love the monitoring scripts you build to translate code into plain english for the viewer to illustrate your points.
Mostly commenting for engagement. Keep up the good work!
When I was 12 I tried really hard to get into the SNES/NES hacking scene but never could find a community where I could learn from. Twenty years later I'm finally learning a bit about how these games worked from an inside perspective
I'd love to see you tackle Ironsword: Wizards and Warriors II collision detection. I was under the impression it's one of the first games to attempt per body part collision, but did so poorly. If you've ever played the game it seems like enemies either do no damage at all or one shot you, and your sword is unusable due to its short collision range.
I love this channel btw, it's such a niche topic but just the sort of content I love.
Has anyone written anything about the "per body part" collision aspect? Perhaps an interview from the past? Did you figure out the game had implemented this while playing?
@@DisplacedGamers I can't find any official documentation, I just remember reading about it on the Internet a long time ago. The manual hints that helmet upgrades specifically help protect your head. I also found a post on gamefaqs that mentions the body zones thing but I think my comments are getting deleted when I include the url. Honestly it could just be confusion over a lack of s after being hit or something like that.
Great video as always! Really neat stuff. There's always a point in these videos where I feel lost and I'm worried I just am not going to understand what's going on, and then later on it all clicks and just makes sense. You're a great teacher!
Thank you! Scripting it is one of the toughest parts. Translating the code discoveries into a narration that makes sense is important to me, and I am glad to hear that it is worth it!
All these videos are so interesting and produced so well.... Thanks for doing this
These videos are always so detailed and good. Fantastic!
DG: "Let's fix it!"
The Castlevania Speedrunning community: "How about no?"
Glad you finally reached Castlevania. I knew I wouldn't be disappointed. Can't wait to see what other secrets you'll find in the code next video.
Thanks for the great breakdown. Love seeing the secrets of the whip
always enjoy your videos my dude!
I love these videos so much.
The way you break down the way the code of the game works not only show a great deal of effort on your part but also the ingenuity of the programmers of the time
I love the breakdown man, because these videos also double as a kind of introduction to the kind of issues and bugs that crop up in complex systems, but complex systems us 30+ year olds are familiar with from a young age (NES games)
Great video! I actually didn't know about frame 17 collision, and I've been taking part in this game's speedrun for years.
"Simon states are in agreement once again" - This is a bug I've seen way too often that is introduced by having multiple states instead of just one. If there are multiples states, you must keep them correctly in sync at all times and there is quite often a situation where it is overlooked that these states can go out of sync for a certain combination of actions. This happens even more often if there are no states at all, just a series of flags, as keeping multiple flags in sync is even harder and requires even more code. State machine logic is very simple as long as you only have one state, so ideally you cramp everything into a single state, even if that means you need a lot more states. E.g. instead of state 1 being either A, B, C, or D and state 2 being either nothing, E or F (but only valid in state B) or G or H (but only valid in state D), you can also just have a single state with possible values A, B, BE, BF, C, D, DG, DH. That way if you switch from, let's say, BE to A, you not only switch B to A but you also automatically always clear E when doing that, no extra code required and no need to remember to clear state 2 when it is in state E or F and state 1 switches away from B. Keep in mind that states are inexpensive, they don't require memory or processing power just because they exist, so it makes no difference if you have 4, 16 or 128 different states. States are just numbers and only expensive when there is a mapping table or code that may have to map/handle all existing states. Yet by assigning state numbers in a clever way, many states can be as easy to handle as little ones. E.g. If you map A to 0, B to 4, C to 8, and D to 12, you can assign BE to 5 and BF to 6. By masking off the last 2 bits, you still only have 4 states to map in a table or handle in code that way, just as if A, B, C, and D were separate states again but you still keep the benefit of autoclearing E, F, G, and H without any extra code whenever you set the state.
I always wondered how speed runners would sometimes one shot kill the bosses in this game, now I know why. Great video, thank you!
They were using game genie or some other hack.
@@Dylan_thebrand_slayer_Mulveiny claiming that speedrunners are using game genie is the dumbest thing I've ever heard.
I love seeing whats going on in the background . Keep doing this type of videos .
Love these videos! Always neat to see under the hood of the games we played as kids
Your channel is such a well-edited and produced look into so many interesting quirks in the code of famous games. I cannot overstate my appreciation for the work you do.
Such a great game. Thanks for digging in!
The Japanese cartridge version's Easy mode doesn't contain the knockback state which does some weird things with mechanics, like not allowing Simon to die while crouching. You can technically beat the game on every boss while dead, it's just a bit hard without some elaborate setups.
www.twitch.tv/videos/541994542?filter=highlights&sort=time
But yeah, death is programmed to require the standing state by game logic. There's also some fun things you can do with death checks on the DOS and C64 ports - i.e. saving and continuing or transitioning screens while "hit" skips checks as well. Though unfortunately NES is coded in such a way that achieving something similar isn't possible.
There is some interesting history in the FDS to cart Rev 0 to cart Rev 1 to Famicom cart re-release, for sure. Lots of good stuff.
Oooh. I’ve seen speedrunners do quick kills before but no idea how. Thanks for that explanation!
Every time there's a new one if these it puts a smile on my face, more people should sub to your patreon
I did this when I finally beat the game a few years back. I had no idea I did it until I reviewed the video I was uploading. It’s cool to know the full details behind this. Thanks!!!
I thought this was going to be some video about how some enemies in _Castlevania_ seemingly take more or less damage from attacks than others. I was ready to call shenanigans and explain that more enemies just have more or less health than 16. But, nope. This is legitimately an oversight in the game. Thank you for explaining it.
This content is what RUclips is all about. 🙌🏆
Whoa super cool my question got answered. I didn't expect critical hits to work like that!
Castlevania is one of my favorite series. Glad to see a behind the code for it!
So I'll be honest, I'm new getting into gamedev and your videos have been excellent all around, just learning how games did things they did have been inspirational and just profoundly interesting to me.
This video has a somewhat small aspect that kinda blew me away because I was seriously misunderstanding how State Machines worked.
Every time I've ever tried looking up information regarding FSM, it's always saying things like "Keep states simple, keep them separate" and at least in my interpretation usually keep them mutually exclusive. With that in mind I had no clue at all how exactly you would replicate a lot of games that seemingly _would_ use FSM for the sake of clarity, game design, and even just ease of development.
Then I realized something in this video and it's so simple but it never even crossed my mind:
Just use multiple FSMs on the same game object. I know, weird video to notice that on, but seeing "Simon Action" and then "Simon Attack" made me realize how limited my view of this stuff was lol. Of _course_ you should probably have another FSM for handling states that are supposed to be usable during other states, like being able to attack while in the air, or on the ground, for example.
Anyway, I just felt strongly about it because it feels like I've been trying to wrap my head around FSM forever now and this helped me break through and understand how I can implement it better now lol
So pretty much for 4 frames (stun) Simon's whip becomes holy water (does damage every frame) that is insanely broken if you can consistently pull it off
I love your videos so much, and I honestly have no idea what it is specifically about them. They are a master class in video game documentation. I have been here since the beginning it seems, and the quality and effort that goes into your videos is constantly improving and I love it.
I would like to make a request for something that isn't your normal wheelhouse, but would still be such a fun ride.. BtC for roller coaster tycoon. Famous for being written in assembly and incredibly efficient, I would love to learn more about the how and the technical expertise that must have been involved. It's a bit of a departure from your normal formula, but I can't find anything like it on RUclips.
amazing work as always. you somehow manage to make Assembly Code interesting which is a feat in and of itself.
I got a fun topic for you if you're interested. Mega Man 2. There's a glitch in boss rooms where if you lay down a lot of Item 1's or bubbles then touch the gate (sometimes while taking damage), you'll activate the door, transporting you to the next screen. Commonly called the "Boss Gate glitch"
As someone who has dabbled in some more-than-casual, less-than-speedrun, head-to-head racing of this game (among others), it's so much fun to see even further under the hood. Basically, I know the "how," but it's great to see the "why".
Thank you for covering this topic! I've been looking for an explanation video on this for a while now.
I love the depth you go into, this is gonna be great as always. (Grabs a handful of candy corn and mug of coffee)
Would love to see a 'methodology' video. I know you've touched on it in a few of your videos, but one titled such and that focuses on it would be great.
e.g. how you write some of the scripts in fceux/mesen
Heck yeah! I'd been wanting to know why this happened for a long while now! Seeing how they work really make me think about how to approach programming games like these in assembly. There's so many interesting behind the scenes stuff I want to know more about in these old games, like the vertical scrolling sections in Megaman 5 where the floor doesn't move while the background does.
The visual part of that is easy, it's done with the MMC3 scanline counter IRQ. When the screen rendering hits the specified scanline, the interrupt occurs and the code can set an X and Y screen position fixated on the ground for the rest of the frame to be drawn.
@@vuurniacsquarewave5091 Ahhhh, is that the same way that the status bar in Super Mario Bros 3 is drawn then?
@@Bofner And many other things yes, like the ship in the water. MMC3 was one of the most popular mappers, games that came earlier than IRQ generating mappers had to resort to the console's built-in method of syncing with the frame rendering, which is much more costly and can only be done once per frame, called the "Sprite 0 flag". When rendering reaches the first opaque pixel of the first hardware sprite overlapping with an opaque pixel of the background a readable flag is set by the PPU. By polling this flag again and again until it is set, you can wait for a certain point to be reached in the frame, but you are wasting all your CPU just spinning on the poll until it is set. You can try to squeeze in some code that you know for sure will be able to fit before you need to start polling and take action, but it's more wasteful either way and a proper IRQ. Also, once the flag is set, it is only cleared when the next frame begins to draw, so this can only be used once (ideally for a status bar on the top of the screen).
@@vuurniacsquarewave5091 Wow, that really does sound limiting. I've never had that much experience witht he NES from a programming standpoint, but I've done work with the Sega Master System, which can't be exanded in the way the NES can, but has a lot more features out of the box (like handling interrupts) so whenever I see interresting screen effects on the NES, I tend to compare it to what the SMS can and can't do
@@Bofner The SMS seems really great when it comes to color, but kind of bad when it comes to sprites. But then again, it uses VRAM by design, whereas the NES has the option for the cartridge to provide the graphics on either ROM or RAM. Both can be exploited really nice, and just to give a great graphical example, I think Aladdin on SMS does a lot of amazing graphics tricks by making buildings look fake-3D (must be done with tile swapping in VRAM ) to parallax scrolling and still manages to have great spritework.
I never knew about that bug, very nicely done as always.
Awesome work, as always. Educationa and fun!
Cool explanation! I always liked the health bars in ClassicVania games.
Player IIIIIIIIIIIIIIII
Enemy IIIIIIIIIIIIIIII
Interesting. If I understand this correctly, the game stops the whip from dealing damage if the whip animation didn't complete, and it does this by delaying the damage with a timer and freezing this timer if you get damaged; but if you get damaged on the exact moment that the timer is ended, then it will freeze in that exact instant and deal damage to that location repeatedly until the whipping animation is completed.
I HAVE NEVER SEEN THAT CRITICAL HIT IN MY LIFE..................................... HOW COME?
A fun thing to show would had been a hitbox while the bug occures. Since in knockback he faces backwared and the hitbox extands to both sides. Very nice explenation and islustraiten. Thank you sir. Also the cross crit would be very easy to explain as it just keeps track of the last enemie hit to not hit again as far I am aware of. So it becomes clear what happen when two sprites overlap and do not die while the cross overlaps them too.
Now that's a CRITICAL hit for a critical situation you're putting yourself into.
I've done this a few times on Dracula. It's so op when it happens though. Nice to see the math behind it.
I guess they only updated game state when relevant to not hammer CPU too often.
Hell yeah! I was asking for this :)
Great video as always! Always look forward to these videos :)
This is great, just a few hours ago I was dealing with a bug that shares a surprising amount of similarities to this one.
Had yielded a unexpected feature simply from not clearing a variable when it should have been cleared, lol
A cool accident, but it was still a bug.
Thanks for another great video, Chris!
Great video!
So if you used some game genie codes to lengthen the freeze timer you could increase the damage of the critical hit, that's cool.
I enjoy that the moment I saw the red box at 1:10 I went 'oh, I know how this happens now' and was right LMAO
Great video! Goes into great detail on one of the biggest types of bugs in games from my experience. Very hard to debug these inconsistent state issues :(
I'd say at least half of my bugs relate to something being in the wrong state for some reason and then having to figure out why.
It's pretty fortunate that patching and alternate updated versions weren't very feasible in the past. We have a vast showcase of coding quirks and flat-out bugs to enjoy and/or learn from. I feel that I learn far more from mistakes or poor practices, my own or otherwise.
This could be a very interesting risk/reward system
This should be interesting to the speed runners.
They definitely exploit it! The Dracula battles in particular are quite fun to see. It takes some great skill to perform a double cross/boomerang throw while backward jumping & whipping with a crit.
Please don’t fix it.. LOL. I’d love to see you dissect the bat crit and why the stairs do even more damage than standard crit. Very much enjoyed your video.
I believe it's because the stairs don't knock Simon back; they freeze his current position in place for 16 additional frames, including his whip graphic if he happens to be whipping. So if the frame 17 interruption activates on the stairs, the crit that occurs will remain active for those additional frames too.
@@jay_cee583 Thanks dude. That makes sense. So it’s a 16 frame counter instead of 4. -RetroDismas (forgot to change profiles..LOL)
@@AllenPlyler omg retrodismas haha good to see you here
please do a video on the other castlevania bug you showed us
And do a series on all bugs/exploits in all castlevania games please
You explained it so well, you really know how to explain these things. Amazing. I wonder if management or the development team simply did not beleive the testers finding or if they were unsure on how to fix it at the time? I suspect the former. Also probably the tester did not understand why or exactly when the bug occured.
I am subscribed and though the video was not interesting until retroRGB pointed it out!
How wrong my assumption was. I will never doubt you again!
The critical hit, lol
I thought it was how the code handles the final hit on an enemy, which in retrospect does not make sense since that is not really interesting to make a video about
Very helpful explanation!
A great follow up would be the mummies and the cross glitch.
Good trick! I waited for some kind of "critical logic for enemies" (like onimusha) but, it was a bug instead (I know was too much for 80's capcom).
That teaser at the end!
Great detailed breakdown, but why would we want to "fix" the critical hit?? This is one of those "it's not a bug, it's a feature" situations. It takes a lot of skill and practice to time that critical hit just right, and when it finally happens it's extremely satisfying.
Well, the generic response for why we would want to fix it is "for science!"
amazing videos , very instructive, thanks!
Believe it or not, but I've never seen a critical hit in any of my playthroughs. This is why this video was doubly entertaining for me.
This is mind-blowing, I don't recall ever landing a critical hit on Dracula but I do remember destroying the Bone Pillars in one hit while being hit myself, I just never realized what it was. Also, doesn't the whip do damage on its first frames when Simon is holding it behind its back? I think it does in other Castlevania games.
"It does not clear the data until new one is loaded to overwrite it".
Right then was when I had a vague idea where this is going.
So does this happen on all versions of Castlevania? (PRG0, PRG1 and Vs .) Also I hope the nasty Grim Reaper hallway bug from the PRG0 version is explained next.
Funny how a bug creates a really interesting (if overpowered) mechanic. You can do a bunch of extra damage, but it requires getting hurt _and_ perfect timing, so it's risky.
"With that, let's jump straight to Dracula."
_Castlevania speedrunners everywhere are super-jealous_
would you release the lua scripts you make for these videos?
I didn't even know this glitch existed, so that's neat
As a kid I always wondered why sometimes when Simon got hit it seemed to do a lot of damage. Now I know why!
This is going to sound kinda random, but have you looked at much Castlevania II code? I was playing it (because Halloween) and one part that always confused me was the behavior of the bouncing slimes. Namely, how they would sometimes pass through floors or ceilings. I assume it has something do do with the vertical vs horizontal scrolling in the area, and how collision was handled, but definitely was an odd thing to see as a 7 year-old.
Some of the blocks are areas where Simon will fall through if he attempts to walk across them. I think the slimes therefore pass through those same blocks while going either up or down.
@@DisplacedGamers Well, you have me doubting myself now, but I'm pretty sure this isn't where the false blocks are. I think happens when the slimes are at the edge of the screen while it scrolls. But now I have to go load it back up and make sure I'm not just crazy.
Until I saw this video pop up just now, I didn’t even know there was such a thing as critical hits with the whip in CastleVania.
Subweapons too!
This is so cool! Can you do a 'behind-behind-the-code'? I mean how do you write these scripts? I know Messen(sp?) is involved, but how do you script breakpoints & such? My apologies if you've already made a vid like that
This channel is for sure one of the best on this godforsaken platform.
Shmootube seems so devoted to promoting annoying and redundant minecraft and fortnite videos from some overhyped goof rather than truly interesting and high quality videos like this one.
I'm sure you know by now the numbers don't really mean shit cuz your channel is dope , my dude.
The CV critical attack mechanism feels a lot like when Undertale tells you a certain someone is the weakest enemy with each attack only consuming 1 hp.
Can you look at collision detection in Simon's Quest and figure out how the "drop through the floor" glitch works? I'd love to watch a video about that.
I am a bit confused about the fix shown in the video. At 0:15, the Player is hit by a fireball and takes four bars of damage as shown at 0:25. But at 10:59, the Player is hit by a fireball and takes no damage as shown at 11:15. Is the fix causing the Player to take less damage during these double collusions?
I froze the player's health value in RAM for a large portion of the video. Player damage will definitely be inconsistent as it wasn't my focus and I needed to continue to test various things without the concern of Simon dying.
@@DisplacedGamers Ah, gotcha. That definitely covers my worries.
Wow that is interesting. Never knew a crit was in that game.
Any chance you could share the Lua scripts you use for the readouts in these videos? The progress bar in this one is really cool, it would be super helpful to be able to try out my own data readouts using yours and a springboard.
Simon be abusing trading hits LONG before the FGC was a thing:
"It is not my -fist- whip, but your own sins that will kill you."
What RUclips is all about is the random facts about games for sure.
Never noticed in dracula but it has happened to me with the bone pillars and axelord
I never understood how critical hits worked before, but after watching this video I'm proud to say i understand it even less now. 😂
If speedrunners could do this consistently it'd revolutionize Castlevania 1 speedruns
I would be most interested in getting my hands on your MESEN annotation/comment files. Any chance you might make those available?
What if the timer were changed to increment by zero? Could Simon be put into a state where he's always attacking even when technically in different states?
Very nice