Difference between revisions of "Mighty Bomb Jack (NES)/Game Mechanics"
From SDA Knowledge Base
m (→Items) |
|||
(81 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, | + | 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 | + | 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 /> | ||
− | == | + | ==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 | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | * | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
+ | <br /> | ||
− | = | + | (1) $3D1 = $3D1 + $3D0<br /> |
− | + | (2) $3D3 = $3D3 + $3D2 + [Carry from (1)]<br /><br /> | |
− | + | ||
− | + | ||
+ | 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== | ||
− | + | ===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 - | + | <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 | + | 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 /> |
− | + | ||
− | + | ''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
Contents
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:
- 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
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 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 [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 [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 [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 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.
- 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 - 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.
- 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 - 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).
- 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).
- 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):
0. Bat - Moves around diagonally without considering Jack's position.
1. Lobster - Fast moving enemy that homes in on Jack. Only moves diagonally. (in most situations, this is the most dangerous enemy)
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.
3. Skull - Homes in on Jack horizontally, but cannot control its vertical movement. Moves diagonally.
4. Fireball - Homes in on Jack vertically, but cannot control its horizontal movement. Moves diagonally.
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.