Difference between revisions of "Mighty Bomb Jack (NES)/Game Mechanics"

From SDA Knowledge Base

Jump to: navigation, search
m (Items)
 
(93 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
[[Mighty_bomb_jack_(nes)]]
 
[[Mighty_bomb_jack_(nes)]]
 
==General game description==
 
==General game description==
You control Jack in his quest to save the royal family that has been trapped inside a pyramid by the evil Belzebut (yes, I know that the spelling is funny and probably at least 100 million people before you have noticed that too...). The game takes place inside (and in two levels even outside) a pyramid (see external resources for a link to a map over it). Each level is composed of a more regular stage, where you just have to reach the door at the end (there is a little more to it, but that's described under best ending), and at the end is a "palace room". The palace room contains 24 bombs. To clear the level, you need to collect all 24 bombs and then reach the exit. Normally, you have to navigate Jack level by level in this way by going through the corridors of the pyramid and get to the top, where the end of the game is. However, it's possible to warp from palace room to palace room and thus reaching the end faster. As soon as you pick up the first bomb in a palace room, another one will be ignited. If the ignited bomb is picked up as the last (24th) one, you warp to the next palace room (you still have to reach the exit first though).
+
You control Jack in his quest to save the royal family that has been trapped inside a pyramid by the evil Belzebut (yes, that's how it's spelled in the game). The game takes place inside (and in two levels even outside) a pyramid (see external resources for a link to a map of it). The game is divided into 17 "rounds" (levels would be more accurate - probably poor translation). Each round consists of several rooms making up a more or less regular, but sometimes branched, platforming stage (called "corridor" in the game), where you just have to reach the door at the end, and at the end is a "palace room". The palace room contains 24 bombs. To clear the round, you need to collect all 24 bombs and then reach the exit.<br /><br />
  
 +
===Endings===
 +
The last (17th) round is slightly different than the other rounds. Instead of another "palace room" at the end of the round, you're tasked with rescuing the royal family and face Belzebut in the "royal rooms" before escaping the pyramid. There are four different endings. The ending depends on how many of the royal rooms that were solved. To unlock other royal rooms than the King's room, secret items (crystals and S-coins) need to be collected:
 +
* Normal ending - none of the crystals were collected, the game ends after the King's room
 +
* Queen's ending - one of the crystals was collected, Jack continues to the Queen's room after the King's room
 +
* Princess' ending - both crystals were collected, but less than 5 S-coins, Jack continues to the Princess' room after the Queens's room
 +
* "Best ending" - both crystals and 5 or more S-coins were collected, Jack continues to Belzebut's room after the Princess' room
 +
 +
''Note: The better the ending, the more of the pyramid Jack destroys. However, the ending texts are all different (as opposed to more and more text being added to the normal ending text, like in e.g. Solomon's Key). It's still obvious what constitutes the "best" ending since there are no branching requirements for the different endings.''<br /><br />
  
 
==Version differences==
 
==Version differences==
There are several differences between the ntsc-u and ntsc-j versions. The difficulty of this game (without a walkthrough) is absolutely ludicrous. My guess is that someone tried to tone down the difficulty a notch or two before releasing the game in the US (it's still ridiculous though). Anyways, some items have been moved around, some blocks take more jumps to destroy in the Japanese version etc. For the best ending category, this means that it's meaningless to compare the two versions. For the normal ending, you have to make five block breaking jumps more in the j-version. These extra jumps also mean that an extra mighty coin is needed in the j-version. This equals roughly an additional 3 seconds or so (depending on how fast one is to break blocks). On the other hand, there is a chest in level 17 that is visible in the j-version but not in the u-version. That room is roughly 1 second faster on the j-version. So overall, the u-version has a few seconds advantage over the j-version, but one should probably not compare the two versions down to the second.
+
There are several differences between the U- and J-versions. Some items have been moved around, some blocks take more jumps to destroy in the Japanese version, the mummy spawn timers are sometimes different, some room solutions are different etc. The U-version has generally slightly less obscure room solutions, but there are also rooms that are easier to figure out in the J-version.<br /><br />
  
 +
For the best ending category, the differences are so big that it's meaningless to compare speedruns of the two versions. For the normal ending, you have to make five block breaking jumps more in the J-version. These extra jumps also mean that an extra mighty coin is needed. This equals roughly an additional 3 seconds or so (depending on how fast one is to break blocks). On the other hand, there is a chest in round 17 (room 17-2 to be more exact) that is visible in the J-version but not in the U-version. That room is roughly 1 second faster on the J-version. Overall, the U-version has a few seconds advantage over the J-version in the any% category, but one should probably not compare the two versions down to the second.<br /><br />
  
==Items==
+
==Movement mechanics==
The following items are of interest in a speedrun:
+
===x-movement===
* Mighty coins - Found in chests (always in the same location). Jack can hold up to 9 coins at a time. Picking up a tenth coin sends him to the torture chamber (very bad). When using mighty coins, Jack gains different abilities:
+
* $3D1/$3D3 - sub/main Jack's x-position on screen ($3C1/$3C2 - sub/main screen x-position when the level is scrolling)
# coin - Jack turns blue. He can now open locked chests by jumping on them. How long Jack stays in this state depends on whether he was powered up from red Jack or powered down from orange Jack. If coming from red Jack, the blue suit disappears after pressing A 20 times. If coming from orange Jack, it disappears after pressing A 19 times.
+
* $3D0/$3D2 - sub/main x-speed
# coin - Jack turns orange. Same effect as blue and he can now also open chests (both normal and locked) by running into them from the side. Like for blue Jack, how long the effect lasts depends on if Jack was powered up from blue or powered down from green. If powered up, it lasts for 11 A presses. I powered down, it lasts for 10 presses.
+
# coin - Jack turns green. Same effect as orange, S-coins can be collected and all enemies turn into coins for a few seconds. Jack turns pink after pressing A 6 times.
+
If Jack uses a mighty coin while being blue/orange/green, it doesn't matter how many jumps he made previously. The jump count is always reset.
+
* S-coins - Found in chests (always in the same location). There are in total 10 (?) of these coins. In order to get the best ending, you need to collect 5 or more (there is no point in collecting more than 5 though).
+
* Crystal balls - There are two crystal balls in the game. Both are found in special chambers, where you need to break some of the blocks surrounding them. In order to get the best ending, you need to collect both of these.
+
* Sphinx - Some doors are hidden or locked. The only way to open these is to find the corresponding sphinx (sometimes there are more than one sphinx in a room and each one corresponds to one door).
+
* P-ball - All enemies turn into coins for a few seconds. The P-ball is spawned by collecting bombs during the stages and in the palace rooms worth 2000 points. Bombs can give either 100 points or 200 points. The first bomb is always worth 100 points. There is then a "next bomb" in the order. In the palace rooms, the next bomb is the one that's lit. In the stages, it's not always easy to know which bomb is the next in order, but it usually follows the stage layout. Other than giving 200 points, these bombs also give a different sound when picked up. If the threshold of 2000 points is reached during the stage, the next chest you open will contain the P-ball (along with whatever it initially held). If it happens in a palace room, it will spawn in (or near?) the center of the room and start moving around diagonally. The counter is reset every time you reach a new level.
+
* Bottle - Increases the timer. Should be avoided in a speedrun as it wastes time counting down after the end of each level.
+
* E-ball - Extra life. Found in secret locations, but can also be spawned by picking up 40 gold coins (source: Japanese strategy wiki, see [[Additional resources]]). While death abuse can be used in the best ending category, taking the time to collect more extra lives will likely never be of use in a speedrun.
+
  
 +
<br />
  
==Jump mechanics==
+
(1) $3D1 = $3D1 + $3D0<br />
Holding up while pressing the jump button creates a higher jump. For roughly the first half of the screen, it's very similar to a normal jump. The vertical speed of a normal jump then starts to decrease faster than when holding up.<br />
+
(2) $3D3 = $3D3 + $3D2 + [Carry from (1)]<br /><br />
Holding down during a drop increases the acceleration initially. This should be used as often as possible in a speedrun. The max drop speed is however the same as dropping normally.<br />
+
There is a special trick that can be performed at the start of each room. If the jump button is pressed at the right frame, Jack will start by making a jump instead of falling down to the ground. Since this is a 1-frame trick, the use is of course very limited. It's still important to be aware of though, since it's fairly easy to do inadvertently by for example mashing the jump button at the start of a room.
+
  
 +
Since the "sub" x-speed is constant, MBJ will alternate every frame between the speeds 1 pixel/frame and 2 px/f.
 +
 +
===y-movement===
 +
* $3E6/$3E7 - sub/main "main y-speed table index"
 +
* $3D7/$3D9 - sub/main Jack's y-position on screen ($3C3/$3C4 - sub/main screen y-position when the level is scrolling)
 +
* $3D6/$3D8 - sub/main y-speed
 +
<br />
 +
 +
(1) $3E6 = $3E6 + [0xA0 if holding up; 0xF0 when neutral; 0x60 when holding down]<br />
 +
(2) $3E7 = $3E7 + [1 if holding down] + [Carry from (1)]<br />
 +
(3) $3D7 = $3D7 + $3D6<br />
 +
(4) $3D9 = $3D9 + $3D8 + [Carry from (3)]<br /><br />
 +
 +
$3E7 keeps track of where in the jump/fall Jack is, which the game uses to calculate an offset index for a look-up table containing the (main) y-speed. Progressing through the look-up table is what creates the arc-like movement of a jump/fall. When pressing A to jump, $3E7 (and $3E6) is reset to 0 and when it reaches 0x40, Jack is at the apex of the jump. As Jack begins to descend, it continues to increase until it caps at 0x80.<br />
 +
The rate of change of $3D6 also comes from a look-up table that is also determined by the value of $3E7 (and hence also depends on if up/neutral/down is held). The overall y-speed caps at 3.5 px/f.
 +
<br /><br />
 +
 +
=="Hidden" game mechanics and counters (and RNG)==
 +
===Counters (and RNG)===
 +
The game does not appear to have any RNG addresses or algorithms (but a deeper code analysis would be needed to understand seemingly random behavior in the game). Counters instead play a major role in creating randomness and item spawns:
 +
* Bomb counter ($356) - Collecting a bomb increases the bomb counter by one or two. When the value reaches 20, a P-ball (see the [[Mighty_Bomb_Jack_(NES)/Game_Mechanics#Items|item section]]) will spawn in the center of the room (when in a palace room) or the next opened chest will produce one (when in the corridors). The first bomb in a room is always worth 1 bomb point. There is then a "next bomb" in the order, which gives 2 bomb points. In the palace rooms, the next bomb is the one that's lit. In the stages, it's not always easy to know which bomb is the next in order, but it usually follows the stage layout. Other than giving 2 bomb points, these bombs also give a different sound when collected. The bomb counter can be reset in three different ways:
 +
# Complete a palace room
 +
# Collect a P-ball and let its effect wear out before leaving the room (timer in $6B/$6A - 256+64 = 320f)
 +
# Activate green Jack and let its effect wear out before leaving the room (timer in $6B/$6A - 256+64 = 320f)
 +
''Note 1: Any bombs collected while the P-effect or green Jack are active will not add to the bomb counter''<br />
 +
''Note 2: If Jack leaves the room before the timer has finished counting down (#2 and #3), the timer will be reset to 0, but the bomb counter will '''not'''
 +
* A-counter ($00FA) - Increases every time A is pressed (regardless if it results in a jump or not) during gameplay (not during room transitions). It's never reset. This counter determines the enemy types (see the [[Mighty_Bomb_Jack_(NES)/Game_Mechanics#Transformed_enemies|enemy section]]). The number of A-presses is also used to downgrade Jack after having used a mighty coin (see the [[Mighty_Bomb_Jack_(NES)/Game_Mechanics#Items|item section]]).
 +
* Coin counter ($0367) - Collecting enough coins will result in an E-ball spawning (for more details, see the [[Mighty_Bomb_Jack_(NES)/Game_Mechanics#Items|item section]]). Each collected coin (either found in chests or by transforming enemies after collecting a P-ball or upgrading to green Jack) adds one to the coin counter.
 +
 +
===Palace room warping===
 +
When the first bomb is collected in a palace room, the next bomb in the [[Mighty_Bomb_Jack_(NES)/Palace_room_bomb_sequences|sequence of that room]] will be lit. If that lit bomb is collected as the last (24th) in that palace room, Jack will warp to the next palace room, skipping the corridor section.<br />
 +
''Note 1: If Jack dies, he will start at the corridor before the palace room warping started''<br />
 +
''Note 2: This trick has no effect in palace room 16, since that's the last palace room''
 +
 +
===Mid-air jump at the start of a room===
 +
If the jump button is pressed at the first frame of movement in a room, Jack will start by making a jump instead of falling down to the ground. This is a 1-frame trick.
 +
<br /><br />
 +
 +
==Items==
 +
Items found in chests are always in the same location. The following items are of interest in a speedrun:
 +
* [[File:Mighty_coin_mbj.png]] Mighty coins - Found in chests. The coins are described in the manual, but the text contains several errors. Jack can hold up to 9 coins at a time (tracked in $03E2). Picking up a tenth coin sends him to the torture chamber (very bad). When using a mighty coin, the value in $03E1 increases to a set value (and then decreases by 1 every time A is pressed) and Jack gains different abilities:
 +
# coin [[File:Blue_jack_mbj.png]] [Blue ($3E0 = 1)] $03E1 is set to 20 (decimal) and Jack can now open locked chests by jumping on them. Note that you can normally press A 20 times before reverting back to red Jack. However, if powered down from orange Jack, Jack will turn blue when $03E1 equals 19, meaning that he will turn red after pressing A 19 times in this case.
 +
# coin [[File:Orange_jack_mbj.png]] [Orange ($3E0 = 2)] When using a coin as blue Jack, $03E1 is set to 30 (decimal), regardless of the previous value of $03E1. Orange Jack has the same effect as blue and he can now also open chests (both normal and locked) by running into them from the side (or jumping into them from below). Like for blue Jack, how long the effect lasts depends on if Jack was powered up from blue or powered down from green. If powered up, it lasts for 11 A presses. If powered down, it lasts for 10 presses.
 +
# coin [[File:Green_jack_mbj.png]] [Green ($3E0 = 3)] When using a coin as orange Jack, $03E1 is set to 35 (decimal), regardless of the previous value of $03E1. Same effect as orange, but S-coins can now be collected and all enemies turn into coins for a few seconds (same effect as collecting a P-ball). Jack turns back to orange after pressing A 6 times.
 +
When Jack is green, mighty coins can't be used (not even to reset $03E1 to 35).
 +
* [[File:Crystal_mbj.png]] Crystal balls - There are two crystal balls in the game. Both are found in special chambers, where you need to break some of the blocks surrounding them. Picking up one crystal will unlock the queen's room and collecting both will also unlock the princess' room. In order to get the best ending, you need to collect both.
 +
* [[File:Secret_coin_mbj.png]] S-coins - Found in chests. There are in total 10 of these coins (appears to have been verified by code analysis, but reference missing). Collecting 5 of these will open up Belzebut's room at the end (only if both crystal balls have also been collected along the way). There is no point in collecting more than 5 S-coins (other than scoring points). Only green Jack can pick up S-coins (but there is no restriction on what form you need to be in to make it visible).
 +
* [[File:Sphinx_mbj.png]] Sphinx - Opens hidden/locked doors in the room they're found in. Sometimes there are more than one sphinx in a room and each one then corresponds to a specific door.
 +
* [[File:Power_ball_mbj.png]] P-ball - All enemies turn into coins for 320 frames. The P-ball is spawned when the bomb counter (see the section about counters) reaches 20. When the bomb counter reaches 20 during the stage, a jingle sound effect is played and the next opened chest will contain the P-ball (along with whatever it initially held). If it happens in a palace room, it will spawn in (or near?) the center of the room and start moving around diagonally.
 +
* [[File:B-ball.png|22px]] B-ball - Bonus points. Appears in a palace room when the score ($A3/$A2/$A1/$A0) passes a multiple of 5000. The B-ball does not appear in the corridors or as a result of the points awarded from completing a round. In the later rounds, where enemies spawn faster and there will be more objects on the screen, the creation of a B-ball often results in a lag frame (but usually not more).
 +
* [[File:Extra_coin_mbj.png]] E-ball - Extra life ($3E4). Found in secret locations, but can also be triggered by gold coins (tracked in $0367). You need to collect 40 coins or more. The next time the score passes a multiple of 5000 in a palace room, the E-ball will appear (instead of the B-ball).
 +
* [[File:Mighty_drink_mbj.png]] Bottle - Increases the timer ($A4, supported by $229 for changing from hex to dec). Should be avoided in a speedrun as it costs time counting down after the end of each level (6f per "tick").
 +
<br>
  
 
==Enemy behavior and manipulation==
 
==Enemy behavior and manipulation==
There are only six (seven if you count the mummy) different types of enemies in the game. Enemies start out as mummies. The mummies walk back and forth on the platform they spawned on, but eventually drops. When they reach the floor, they transform into one of the six enemy types (these are not the official names, I hope they are understandable though):<br />
+
===Mummies===
0. Bat - Moves around diagonally without considering Jack's position.<br />
+
This section describes mummies in the palace rooms. Mummies in the corridor probably behave similarly, but their spawn locations are determined in a more complicated way (hasn't been investigated in detail).<br /><br />
1. Lobster - Fast moving enemy that homes in on Jack. (in most situations, this is the most dangerous enemy)<br />
+
 
2. Jellyfish - Moves seemingly randomly, but every time Jack hits a wall or the ceiling, the jellyfish will fly to that spot at full speed.<br />
+
<u>RAM-addresses of interest</u><br />
3. Skull - Homes in on Jack horizontally, but cannot control its vertical movement.<br />
+
* $3D3/$3D9 - MBJ's x/y-position
4. Fireball - Homes in on Jack vertically, but cannot control its horizontal movement.<br />
+
* $35E - Mummy spawn timer (room)
5. Bird - Slow moving enemy that homes in on Jack horizontally and vertically. It can't move diagonally.<br />
+
* $6AA - Movement direction, item 0 ($6BA looks similar, but is the way the mummy is facing)
 +
* $6AB/$6B1 - x/y, item 0
 +
* $6BB - Drop timer, item 0
 +
* $94/$92 - Temp variables, x/y-position of possible enemy spawn locations
 +
* $C - Temp variable, sum of the absolute differences in x and y between MBJ's position and the left enemy spawn location (LESL), or written as a formula = Abs(MBJ_x - LESL_x) + Abs(MBJ_y - LESL_y)
 +
* $E - Temp variable, sum of the absolute differences in x and y between MBJ's position and the right enemy spawn location (RESL), or written as a formula = Abs(MBJ_x - RESL_x) + Abs(MBJ_y - RESL_y)
 +
Item addresses are separated by 0x1C, meaning e.g. the first 6 x-addresses are $6AB, $6C7, $6E3, $6FF, $71B and $737.<br /><br />
 +
 
 +
When the room starts, the mummy spawn timer starts ticking down every frame. When it has counted down, a mummy spawns. The timer is reset and the process starts over until there are four enemies. The base value of the timer is room-dependent. The later in the game, the shorter the delay to spawn mummies (with some exceptions - the delay seems to be at a minimum in palace rooms 12 and 13, 0x2F).<br /><br />
 +
 
 +
''Note: when clearing a palace room, the progression in $3CC is updated. $3CC feeds into the timers' start values of the next rooms. By navigating through the pyramid in such a way that palace rooms are skipped, the timers will not be updated. However, once a palace room is cleared, $3CC is updated to its "correct" value again.''<br /><br />
 +
 
 +
There are two possible spawn locations ("left" and "right") in each room. The x-positions are room-dependent and probably related to how the platforms are placed in the individual rooms. The mummy spawns in the location that is the furthest away from MBJ in terms of "coordinate distance" (see description for $E and $C above). Note that these calculations can easily overflow, meaning the result is reversed (the enemy closest to MBJ spawns).<br /><br />
 +
 
 +
Once the mummy has spawned, the general rule is that it starts walking in the direction of MBJ (there are exceptions, see below). It walks back and forth on the platform until the drop timer has counted down. Next time it reaches an edge, it will drop down. If the mummy landed on another platform (and not the floor), the drop timer is reset and will start counting down again. Just like the spawn timer, the drop timers are room-dependent and mummies generally drop down faster as the game progresses.<br /><br />
 +
 
 +
''Note: the movement direction address can be called from a second location in the code and revert the direction (meaning the mummy starts walking away from MBJ instead). The same piece of code can be called again, reverting back to the "normal" movement direction (so walking towards MBJ). This game mechanics has not been fully analyzed. However, player inputs can manipulate this. To study this effect, the following movie and instructions can be used (credits to 'SpaceColonizer'):<br />
 +
https://tasvideos.org/UserFiles/Info/638237798222671732<br />
 +
''Truncate the movie at frame 17814. Mummy 1 goes right as expected.
 +
 
 +
''Add left input up to frame 17830. Mummy 1 now starts going left, which is not the expected direction.
 +
 
 +
''By playing around with the inputs, it's fairly easy to create more movement direction changes of the same kind.
 +
 
 +
''Earlier on in the same room of the same movie, mummy 0 fell through a platform. This has not been investigated in detail either, but it's easy to see how small input changes can make the mummy stay on the platform instead.<br /><br />
 +
 
 +
===Transformed enemies===
 +
The mummies transform into one of six enemy types when dropping to the floor (these are not the official names, but are the ones used in this wiki):<br />
 +
[[File:Bat_mbj.png]] 0. Bat - Moves around diagonally without considering Jack's position.<br />
 +
[[File:Lobster_mbj.png]] 1. Lobster - Fast moving enemy that homes in on Jack. Only moves diagonally. (in most situations, this is the most dangerous enemy)<br />
 +
[[File:Jellyfish_mbj.png]] 2. Jellyfish - Every time it hits an obstacle, it moves in a straight line towards MBJ's position. It seems to have (at least) two speed components. The base speed seems to be determined when bouncing against an obstacle. The further away it was from MBJ, the more base speed it gets. It also changes the speed, but to a lesser extent, between obstacles. It speeds up if MBJ is further away and it slows down as it gets closer to MBJ. The detailed mechanics have not been analyzed.<br />
 +
[[File:Skull_mbj.png]] 3. Skull - Homes in on Jack horizontally, but cannot control its vertical movement. Moves diagonally.<br />
 +
[[File:Fireball_mbj.png]] 4. Fireball - Homes in on Jack vertically, but cannot control its horizontal movement. Moves diagonally.<br />
 +
[[File:Bird_mbj.png]] 5. Bird - Slow moving enemy that homes in on Jack horizontally and vertically. It can't move diagonally.<br />
  
The enemy type is determined three frames before the mummy starts transforming. The game then looks at the value of memory address 00FA and calculates the modulus of 6 of that value (= the remainder when dividing by six). The numbers in front of the different enemy types indicate these values. The value of 00FA is increased by one every time the jump button is pressed (only during actual gameplay, so not during screen transitions etc) and is never reset. This means it's very much possible to manipulate the enemy spawns in certain areas (and it's also crucial to take it into account in a speedrun). Since the value is never reset, it's however also difficult to know its value at any given point in time. The best way to find out the value is to watch the enemy spawns and then start counting the A-presses. This is luckily well suited for the speedrun mindset, with a pre-determined route which allows for a constant number of A-presses between two given points. Needless to say, stretches of gliding in mid-air with rapid A-presses make this harder to control.
+
The enemy type is determined three frames before the mummy starts transforming. The game then takes the A-counter (see the Counter section) and calculates the modulus of 6 of that value (= the remainder when dividing by 6). The numbers in front of the different enemy types indicate these values. It's very much possible to manipulate the enemy spawns in certain areas (and it can also save time speedrun). Since the value is never reset, it's however also difficult to know its value at any given point in time. The best way to find out the value is to watch which enemy that spawns at a certain point and then start counting the A-presses onward. This is luckily well suited for the speedrun mindset, with a pre-determined route which often allows for a constant number of A-presses between two given points. Needless to say, stretches of gliding in mid-air with rapid A-presses make this harder to control.<br /><br />
  
Enemy spawning is only partially understood by me. Most (all?) of the time, spawning locations and initial enemy behavior (for example: start by going left or by going right) depend only on Jack's position. Certain sections of the screen yield different results. It's often fairly complicated however. While this might be difficult to exploit to its full extent, it can readily be used in some areas to get the desired result. My advise is therefore to keep in mind the possibility of manipulating enemy spawns when exploring different route options and then apply findings on a case-by-case basis.
+
''Important note: There is a discontinuity in the enemy type spawns as the A-counter loops. 255 gives a remainder of 3 when divided by 6, while 0 obviously gives a remainder of 0 when divided by 6. This means that two enemy types are jumped over in the cycle. A normal ending run will loop the counter near the end, while a best ending run will loop two or maybe even three times (depending on the category that is played). When routing a speedrun, one should try to avoid this discontinuity to happen during a section of enemy manipulation.''

Latest revision as of 03:43, 16 November 2024

Mighty_bomb_jack_(nes)

General game description

You control Jack in his quest to save the royal family that has been trapped inside a pyramid by the evil Belzebut (yes, that's how it's spelled in the game). The game takes place inside (and in two levels even outside) a pyramid (see external resources for a link to a map of it). The game is divided into 17 "rounds" (levels would be more accurate - probably poor translation). Each round consists of several rooms making up a more or less regular, but sometimes branched, platforming stage (called "corridor" in the game), where you just have to reach the door at the end, and at the end is a "palace room". The palace room contains 24 bombs. To clear the round, you need to collect all 24 bombs and then reach the exit.

Endings

The last (17th) round is slightly different than the other rounds. Instead of another "palace room" at the end of the round, you're tasked with rescuing the royal family and face Belzebut in the "royal rooms" before escaping the pyramid. There are four different endings. The ending depends on how many of the royal rooms that were solved. To unlock other royal rooms than the King's room, secret items (crystals and S-coins) need to be collected:

  • Normal ending - none of the crystals were collected, the game ends after the King's room
  • Queen's ending - one of the crystals was collected, Jack continues to the Queen's room after the King's room
  • Princess' ending - both crystals were collected, but less than 5 S-coins, Jack continues to the Princess' room after the Queens's room
  • "Best ending" - both crystals and 5 or more S-coins were collected, Jack continues to Belzebut's room after the Princess' room

Note: The better the ending, the more of the pyramid Jack destroys. However, the ending texts are all different (as opposed to more and more text being added to the normal ending text, like in e.g. Solomon's Key). It's still obvious what constitutes the "best" ending since there are no branching requirements for the different endings.

Version differences

There are several differences between the U- and J-versions. Some items have been moved around, some blocks take more jumps to destroy in the Japanese version, the mummy spawn timers are sometimes different, some room solutions are different etc. The U-version has generally slightly less obscure room solutions, but there are also rooms that are easier to figure out in the J-version.

For the best ending category, the differences are so big that it's meaningless to compare speedruns of the two versions. For the normal ending, you have to make five block breaking jumps more in the J-version. These extra jumps also mean that an extra mighty coin is needed. This equals roughly an additional 3 seconds or so (depending on how fast one is to break blocks). On the other hand, there is a chest in round 17 (room 17-2 to be more exact) that is visible in the J-version but not in the U-version. That room is roughly 1 second faster on the J-version. Overall, the U-version has a few seconds advantage over the J-version in the any% category, but one should probably not compare the two versions down to the second.

Movement mechanics

x-movement

  • $3D1/$3D3 - sub/main Jack's x-position on screen ($3C1/$3C2 - sub/main screen x-position when the level is scrolling)
  • $3D0/$3D2 - sub/main x-speed


(1) $3D1 = $3D1 + $3D0
(2) $3D3 = $3D3 + $3D2 + [Carry from (1)]

Since the "sub" x-speed is constant, MBJ will alternate every frame between the speeds 1 pixel/frame and 2 px/f.

y-movement

  • $3E6/$3E7 - sub/main "main y-speed table index"
  • $3D7/$3D9 - sub/main Jack's y-position on screen ($3C3/$3C4 - sub/main screen y-position when the level is scrolling)
  • $3D6/$3D8 - sub/main y-speed


(1) $3E6 = $3E6 + [0xA0 if holding up; 0xF0 when neutral; 0x60 when holding down]
(2) $3E7 = $3E7 + [1 if holding down] + [Carry from (1)]
(3) $3D7 = $3D7 + $3D6
(4) $3D9 = $3D9 + $3D8 + [Carry from (3)]

$3E7 keeps track of where in the jump/fall Jack is, which the game uses to calculate an offset index for a look-up table containing the (main) y-speed. Progressing through the look-up table is what creates the arc-like movement of a jump/fall. When pressing A to jump, $3E7 (and $3E6) is reset to 0 and when it reaches 0x40, Jack is at the apex of the jump. As Jack begins to descend, it continues to increase until it caps at 0x80.
The rate of change of $3D6 also comes from a look-up table that is also determined by the value of $3E7 (and hence also depends on if up/neutral/down is held). The overall y-speed caps at 3.5 px/f.

"Hidden" game mechanics and counters (and RNG)

Counters (and RNG)

The game does not appear to have any RNG addresses or algorithms (but a deeper code analysis would be needed to understand seemingly random behavior in the game). Counters instead play a major role in creating randomness and item spawns:

  • Bomb counter ($356) - Collecting a bomb increases the bomb counter by one or two. When the value reaches 20, a P-ball (see the item section) will spawn in the center of the room (when in a palace room) or the next opened chest will produce one (when in the corridors). The first bomb in a room is always worth 1 bomb point. There is then a "next bomb" in the order, which gives 2 bomb points. In the palace rooms, the next bomb is the one that's lit. In the stages, it's not always easy to know which bomb is the next in order, but it usually follows the stage layout. Other than giving 2 bomb points, these bombs also give a different sound when collected. The bomb counter can be reset in three different ways:
  1. Complete a palace room
  2. Collect a P-ball and let its effect wear out before leaving the room (timer in $6B/$6A - 256+64 = 320f)
  3. Activate green Jack and let its effect wear out before leaving the room (timer in $6B/$6A - 256+64 = 320f)

Note 1: Any bombs collected while the P-effect or green Jack are active will not add to the bomb counter
Note 2: If Jack leaves the room before the timer has finished counting down (#2 and #3), the timer will be reset to 0, but the bomb counter will not

  • A-counter ($00FA) - Increases every time A is pressed (regardless if it results in a jump or not) during gameplay (not during room transitions). It's never reset. This counter determines the enemy types (see the enemy section). The number of A-presses is also used to downgrade Jack after having used a mighty coin (see the item section).
  • Coin counter ($0367) - Collecting enough coins will result in an E-ball spawning (for more details, see the item section). Each collected coin (either found in chests or by transforming enemies after collecting a P-ball or upgrading to green Jack) adds one to the coin counter.

Palace room warping

When the first bomb is collected in a palace room, the next bomb in the sequence of that room will be lit. If that lit bomb is collected as the last (24th) in that palace room, Jack will warp to the next palace room, skipping the corridor section.
Note 1: If Jack dies, he will start at the corridor before the palace room warping started
Note 2: This trick has no effect in palace room 16, since that's the last palace room

Mid-air jump at the start of a room

If the jump button is pressed at the first frame of movement in a room, Jack will start by making a jump instead of falling down to the ground. This is a 1-frame trick.

Items

Items found in chests are always in the same location. The following items are of interest in a speedrun:

  • Mighty coin mbj.png Mighty coins - Found in chests. The coins are described in the manual, but the text contains several errors. Jack can hold up to 9 coins at a time (tracked in $03E2). Picking up a tenth coin sends him to the torture chamber (very bad). When using a mighty coin, the value in $03E1 increases to a set value (and then decreases by 1 every time A is pressed) and Jack gains different abilities:
  1. coin Blue jack mbj.png [Blue ($3E0 = 1)] $03E1 is set to 20 (decimal) and Jack can now open locked chests by jumping on them. Note that you can normally press A 20 times before reverting back to red Jack. However, if powered down from orange Jack, Jack will turn blue when $03E1 equals 19, meaning that he will turn red after pressing A 19 times in this case.
  2. coin Orange jack mbj.png [Orange ($3E0 = 2)] When using a coin as blue Jack, $03E1 is set to 30 (decimal), regardless of the previous value of $03E1. Orange Jack has the same effect as blue and he can now also open chests (both normal and locked) by running into them from the side (or jumping into them from below). Like for blue Jack, how long the effect lasts depends on if Jack was powered up from blue or powered down from green. If powered up, it lasts for 11 A presses. If powered down, it lasts for 10 presses.
  3. coin Green jack mbj.png [Green ($3E0 = 3)] When using a coin as orange Jack, $03E1 is set to 35 (decimal), regardless of the previous value of $03E1. Same effect as orange, but S-coins can now be collected and all enemies turn into coins for a few seconds (same effect as collecting a P-ball). Jack turns back to orange after pressing A 6 times.

When Jack is green, mighty coins can't be used (not even to reset $03E1 to 35).

  • Crystal mbj.png Crystal balls - There are two crystal balls in the game. Both are found in special chambers, where you need to break some of the blocks surrounding them. Picking up one crystal will unlock the queen's room and collecting both will also unlock the princess' room. In order to get the best ending, you need to collect both.
  • Secret coin mbj.png S-coins - Found in chests. There are in total 10 of these coins (appears to have been verified by code analysis, but reference missing). Collecting 5 of these will open up Belzebut's room at the end (only if both crystal balls have also been collected along the way). There is no point in collecting more than 5 S-coins (other than scoring points). Only green Jack can pick up S-coins (but there is no restriction on what form you need to be in to make it visible).
  • Sphinx mbj.png Sphinx - Opens hidden/locked doors in the room they're found in. Sometimes there are more than one sphinx in a room and each one then corresponds to a specific door.
  • Power ball mbj.png P-ball - All enemies turn into coins for 320 frames. The P-ball is spawned when the bomb counter (see the section about counters) reaches 20. When the bomb counter reaches 20 during the stage, a jingle sound effect is played and the next opened chest will contain the P-ball (along with whatever it initially held). If it happens in a palace room, it will spawn in (or near?) the center of the room and start moving around diagonally.
  • B-ball.png B-ball - Bonus points. Appears in a palace room when the score ($A3/$A2/$A1/$A0) passes a multiple of 5000. The B-ball does not appear in the corridors or as a result of the points awarded from completing a round. In the later rounds, where enemies spawn faster and there will be more objects on the screen, the creation of a B-ball often results in a lag frame (but usually not more).
  • Extra coin mbj.png E-ball - Extra life ($3E4). Found in secret locations, but can also be triggered by gold coins (tracked in $0367). You need to collect 40 coins or more. The next time the score passes a multiple of 5000 in a palace room, the E-ball will appear (instead of the B-ball).
  • Mighty drink mbj.png Bottle - Increases the timer ($A4, supported by $229 for changing from hex to dec). Should be avoided in a speedrun as it costs time counting down after the end of each level (6f per "tick").


Enemy behavior and manipulation

Mummies

This section describes mummies in the palace rooms. Mummies in the corridor probably behave similarly, but their spawn locations are determined in a more complicated way (hasn't been investigated in detail).

RAM-addresses of interest

  • $3D3/$3D9 - MBJ's x/y-position
  • $35E - Mummy spawn timer (room)
  • $6AA - Movement direction, item 0 ($6BA looks similar, but is the way the mummy is facing)
  • $6AB/$6B1 - x/y, item 0
  • $6BB - Drop timer, item 0
  • $94/$92 - Temp variables, x/y-position of possible enemy spawn locations
  • $C - Temp variable, sum of the absolute differences in x and y between MBJ's position and the left enemy spawn location (LESL), or written as a formula = Abs(MBJ_x - LESL_x) + Abs(MBJ_y - LESL_y)
  • $E - Temp variable, sum of the absolute differences in x and y between MBJ's position and the right enemy spawn location (RESL), or written as a formula = Abs(MBJ_x - RESL_x) + Abs(MBJ_y - RESL_y)

Item addresses are separated by 0x1C, meaning e.g. the first 6 x-addresses are $6AB, $6C7, $6E3, $6FF, $71B and $737.

When the room starts, the mummy spawn timer starts ticking down every frame. When it has counted down, a mummy spawns. The timer is reset and the process starts over until there are four enemies. The base value of the timer is room-dependent. The later in the game, the shorter the delay to spawn mummies (with some exceptions - the delay seems to be at a minimum in palace rooms 12 and 13, 0x2F).

Note: when clearing a palace room, the progression in $3CC is updated. $3CC feeds into the timers' start values of the next rooms. By navigating through the pyramid in such a way that palace rooms are skipped, the timers will not be updated. However, once a palace room is cleared, $3CC is updated to its "correct" value again.

There are two possible spawn locations ("left" and "right") in each room. The x-positions are room-dependent and probably related to how the platforms are placed in the individual rooms. The mummy spawns in the location that is the furthest away from MBJ in terms of "coordinate distance" (see description for $E and $C above). Note that these calculations can easily overflow, meaning the result is reversed (the enemy closest to MBJ spawns).

Once the mummy has spawned, the general rule is that it starts walking in the direction of MBJ (there are exceptions, see below). It walks back and forth on the platform until the drop timer has counted down. Next time it reaches an edge, it will drop down. If the mummy landed on another platform (and not the floor), the drop timer is reset and will start counting down again. Just like the spawn timer, the drop timers are room-dependent and mummies generally drop down faster as the game progresses.

Note: the movement direction address can be called from a second location in the code and revert the direction (meaning the mummy starts walking away from MBJ instead). The same piece of code can be called again, reverting back to the "normal" movement direction (so walking towards MBJ). This game mechanics has not been fully analyzed. However, player inputs can manipulate this. To study this effect, the following movie and instructions can be used (credits to 'SpaceColonizer'):
https://tasvideos.org/UserFiles/Info/638237798222671732
Truncate the movie at frame 17814. Mummy 1 goes right as expected.

Add left input up to frame 17830. Mummy 1 now starts going left, which is not the expected direction.

By playing around with the inputs, it's fairly easy to create more movement direction changes of the same kind.

Earlier on in the same room of the same movie, mummy 0 fell through a platform. This has not been investigated in detail either, but it's easy to see how small input changes can make the mummy stay on the platform instead.

Transformed enemies

The mummies transform into one of six enemy types when dropping to the floor (these are not the official names, but are the ones used in this wiki):
Bat mbj.png 0. Bat - Moves around diagonally without considering Jack's position.
Lobster mbj.png 1. Lobster - Fast moving enemy that homes in on Jack. Only moves diagonally. (in most situations, this is the most dangerous enemy)
Jellyfish mbj.png 2. Jellyfish - Every time it hits an obstacle, it moves in a straight line towards MBJ's position. It seems to have (at least) two speed components. The base speed seems to be determined when bouncing against an obstacle. The further away it was from MBJ, the more base speed it gets. It also changes the speed, but to a lesser extent, between obstacles. It speeds up if MBJ is further away and it slows down as it gets closer to MBJ. The detailed mechanics have not been analyzed.
Skull mbj.png 3. Skull - Homes in on Jack horizontally, but cannot control its vertical movement. Moves diagonally.
Fireball mbj.png 4. Fireball - Homes in on Jack vertically, but cannot control its horizontal movement. Moves diagonally.
Bird mbj.png 5. Bird - Slow moving enemy that homes in on Jack horizontally and vertically. It can't move diagonally.

The enemy type is determined three frames before the mummy starts transforming. The game then takes the A-counter (see the Counter section) and calculates the modulus of 6 of that value (= the remainder when dividing by 6). The numbers in front of the different enemy types indicate these values. It's very much possible to manipulate the enemy spawns in certain areas (and it can also save time speedrun). Since the value is never reset, it's however also difficult to know its value at any given point in time. The best way to find out the value is to watch which enemy that spawns at a certain point and then start counting the A-presses onward. This is luckily well suited for the speedrun mindset, with a pre-determined route which often allows for a constant number of A-presses between two given points. Needless to say, stretches of gliding in mid-air with rapid A-presses make this harder to control.

Important note: There is a discontinuity in the enemy type spawns as the A-counter loops. 255 gives a remainder of 3 when divided by 6, while 0 obviously gives a remainder of 0 when divided by 6. This means that two enemy types are jumped over in the cycle. A normal ending run will loop the counter near the end, while a best ending run will loop two or maybe even three times (depending on the category that is played). When routing a speedrun, one should try to avoid this discontinuity to happen during a section of enemy manipulation.

Personal tools