Because I have done plenty of research for this game for TASing, I am happy to answer any questions you have about game mechanics. If I don't know the answer, I will research it. The questions here may help in any future tutorials or guides, and possibly even to future strategies.
Research Todo List: How the guards' and camera's line of sight works, and when it is enabled. More info on the non-prisoner flag of digit 10, bit 5. More info on the unknown prisoner of digit 21 bit 3. Why the password screen is not loaded sometimes when chosen after dying. Why the snake sprite is messed up initially when loading a password that is rank 3. Why double input happens. Why the random pause happens.
I looked through the password guide and saw that I had a few things to add. Here is the list of things I made:
Error: In Digit 2, swap the bit positions of Tank and Bulltank. Bulltank should be bit 5, Tank should be bit 4.
Resolving the XXXXXXXXXXXXX:
Digit 6 bit 1 is the fake Dr. Pettrovich on floor 2 of building 2. I call this prisoner Prttrovich because of the typo in the dialogue. This prisoner counts for the total of ranking up.
Digit 10 bit 5 is a non-prisoner flag. It gets cleared when rations are obtained, so it could be a dummied out Rations+16 that can be set in password but gets cleared because it is not used, although it is saved in the password if it is set at the time. I will do some research on this in the future.
Digit 21 bit 4 is the poisoned status. However, the flag gets cleared immediately after entering the password. The poisoned status is saved in the password when dying while poisoned.
Digit 21 bit 3 is an unknown prisoner that counts for the total of ranking up. I have no idea where the prisoner is or if it is possible to rescue normally, but I will do some research on this in the future.
Addition: If you enter a quantity of ammo or rations that is more than the rank can hold, the amounts are allowed, but obtaining more will set the quantity to the maximum that the rank can hold.
Prisoner count for ranking: All 3 Coward Duck prisoners count as a single prisoner; all 3 must be rescued in order to count in the total. However, this "prisoner" will not cause a rank up probably because of special logic for the triple prisoners and because rank 4 is expected to be obtained at this point. Ellen counts as a normal prisoner. Dr. Pettrovich counts as a normal prisoner only after Ellen is rescued.
Rank locations should be added to the list of starting points 1 star rank -- at the beginning of the game, at the start of the jungle 2 star rank -- inside building 1 just inside the front entrance 3 star rank -- in the east elevator of building 1 at the floor 1 position 4 star rank -- outside as if just exiting building 1 by the back door
To answer "Are there any passwords that the game rejects that I have not listed in Section 6?": You listed everything that the game rejects. This can be confirmed by this password that has everything: WZZZZ ZZZZZ ZOOOZ UYRZZ ZZZZZ
But a more useful password is this, which has everything except the final 2 bosses and the transmitter: 5ZZZZ ZZZZZ ZOOOZ UYRZZ ZZRZZ
Edit: I finally figured out the memory address for the Supercomputer's HP and added that to the lua script, which was uploaded to the guides. It uses one a few scratchpad addresses for the current room instead of the normal boss HP variable. Another address is used, which is the flag for rescuing Dr. Pettrovich, to determine whether Supercomputer can be damaged. The lua script will show 'INF' if Supercomputer cannot be defeated.
This means that if any prisoners are shot, which resets all the prisoners, then Supercomputer cannot be defeated. Also because Supercomputer's HP goes down by 1 for 8 consecutive frames instead of all at once, do not explosion cancel otherwise the explosive will not do full damage.
Also, do not menu after the supercomputer is defeated until after the countdown message, otherwise the supercomputer will not actually be defeated as shown in this really old video of mine:
Also, I found the memory address for the maze zone, 0x07C9. It is 0 when first entering or if after going the wrong way, 1 after the first left, 2 after the second left, and 128 after the following up. I added to the lua script the next direction to go in the maze to avoid getting lost.
The Japanese version's any% is 3683 frames faster (61.28 sec). The text is 4555 frames faster, but 874 frames slower in 46 menus, and 2 frames faster in the intro. Also, I believe that rescuing Backup instead of Twin Shot Prisoner is faster in the Japanese version, but I need to test it because of damage considerations.
The Japanese version's deathless is 3651 frames faster (60.75 sec). The text is 4658 frames faster, but 1007 frames slower in 53 menus, and 2 frames faster in the intro.
Here is a breakdown of the timing differences, with the amount of frames saved in the Japanese version, except menus which are slower: -19 Menu(weapon/equip) 0 Transceiver 0 Deathwarp 0 Item Get 2 Intro (could use -13.06 instead of -13.1 instead) 68 Moving Truck (2 of these in any%, 1 in deathless) 74 B1F3 Ammo Rooms Prisoner (64 text, 10 smaller box) 200 B1F3 SW Prisoner 74 B1F3 NW Prisoner 168 B1F3 E Prisoner 100 B1F1 NE Prisoner 180 B1F1 SE Prisoner 93 Captured Truck (73 both texts, 20 from 2 small text boxes) 1312 Grey Fox 52 Shotgunner 74 B1F2 SE Prisoner 160 B1F2 S Prisoner 120 Machine Gun Kid 74 B1F2 W Prisoner 74 B1R SW Prisoner 156 B1R SE Prisoner aka "Twin Shot Prisoner" 104 B2R Prisoner 305 B2F1 Prisoner aka "Backup" (268 text, 37 faster room layout) 0 B2F2 Fake Dr. Pettrovich (text box is an item get) 100 B2F2 SE Prisoner 244 B2F2 E Prisoner 20 Calling Jennifer (done twice if getting compass) 124 Coward Duck 74 Coward Duck L Prisoner 74 Coward Duck R Prisoner 160 Coward Duck M Prisoner "Jennifer's Brother" 296 B3B Prisoner 916 Big Boss 228 Ellen 328 Dr. Pettrovich (After Ellen is rescued) 96 Fire Trooper 74 B5 S Prisoner 74 B5 N Prisoner 57 "I'm getting sleepy!" 41 "I feel asleep!" 41 "OK, your turn!" 38 "OK! in we go!"
Here is time cost for the time wasting messages: "I'm getting sleepy!!" -- U 93 (1.55 sec) -- J 36 (0.60 sec) "I feel asleep!!" -- U 73 (1.21 sec) -- J 32 (0.53 sec) "ok, your turn!!" -- U 73 (1.21 sec) -- J 32 (0.53 sec) "ok!! in we go!!" -- U 70 (1.16 sec) -- J 32 (0.53 sec) delay for each slow capture -- 190 frames (3.16 sec) for both ration duplication inside a truck ONLY -- 142 frames (2.36 sec) for both. If this is done elsewhere it will be more because of the difference of screen transition. I will add that later.
A couple of my research notes that I posted on Discord:
I decided to investigate the gas rooms on the any% route more throughly.
On entry to the gas room in building 1 floor 3 from both doors, and both gas rooms in building 3, there is a 4 in 32 chance (12.5%) of risk of damage because of the 4 frame rule of doors, but there is a 2 frame window of bringing up the menu before taking damage, so with button mashing there is a very good chance of avoiding that damage.
On exit from both doors in building 1 floor 3 from both doors and the second gas room in building 3, there is a 9/32 chance (28.125%) of taking damage, again because of the door frame rule. So it is leaving the gas rooms that has the most risk of taking damage.
On exit of the first gas room of building 3 (and it is faster to change to card 5 in the gas room because of screen transition time) the risk of damage is less depending on how close snake is to the edge of the screen. The minimum chance is 1 in 32 (3.125%) going up by 1 for every position away from the edge.
I completed research into why guards shoot. There are two factors involved, Initial Bullet and Repeat Fire.
Initial Bullet: There are 2 factors that contribute to a guard shooting for the first time, which I predicted: cards and universal timer. Addresss 0x0075 stores what cards have been obtained, with each card setting its own bit when obtained. Card 8 is the high bit. So obtaining cards 1-5 is 00011111. To determine if a guard is going to shoot, (256 - value of 0x0075) AND universal timer must equal 0. Note that the result of the subtraction ignores the carry flag on the subtraction, so 256 is 0. Here is the code for the math: SEC <-- sets the carry flag LDA #$00 <-- set accumulator to 0, and with the carry flag also set makes this effectively 256 SBC $75 <-- subtract the value in 0x0075 from the accumulator, using the carry flag for borrow AND $12 <-- logical and with the universal timer and the accumulator (which does not use the carry flag) BNE $DF6C <-- if the result in accumulator is non-zero (not shooting) then branch elsewhere
There are a couple interesting things about this. If no cards have been obtained, the guards will always shoot. This is why the initial jungle is very dangerous. Also because of the math, after obtaining card 1 the guards will only decide to shoot on even number universal timer on a range from 0 up to the even number before the number that 0x075 represents. Here is a table of how guards decide to shoot: cards u-t* % chance of shoot none all 100 1 0-0 0.39 1-2 0-2 0.78 1-3 0-6 1.56 1-4 0-14 3.125 1-5 0-30 6.25 1-6 0-62 12.5 1-7 0-126 25 1-8 0-254 50 *note that the universal timer range is even numbers only
The chance of Initial bullet rises exponentially as the higher cards are obtained. I had noticed that after getting card 6 that guards were more likely, which makes sense now that I understand how this works. Also because card 4 can be obtained at the start, there are more possibilites than above, but the difference is not that much. When a guard decides to shoot, it sets a flag which I call "Shooty Mood", which I explain below.
A guard will decide to do the Initial Bullet check in two cases: At the start of the alert status, and when the guard's timer counts down to 0. This timer is set when a guard chooses a direction to move, and the timer is used as a distance to travel. This is how the guards chase after Snake, and so this can be manipulated. Out of alert status, the timer dictates how a guard rotates.
Repeat Fire requires that the guard has first done Initial Bullet by checking if its "Shooty Mood" flag is set. In this mode, the guard will shoot whenever the universal timer is at 64 or 192 if the guard's bullet is not active, that is they can only shoot one bullet at a time. Because this causes guards to fire very frequently and become dangerous, I previously made the comment that the guard is in a shooty mood when it happens in a run.
Thank you for compiling all of this information. Also checked out your Any% tutorial.
I recently made a "stealth run" video of Metal Gear - where the goal was to complete the game with as little alerts as possible.
I haven't managed to complete it legitimately yet - but I stitched together a video with 5 Alerts and 0 Stuns to give an idea of what this might look like:
Just had a few questions:
- Is it possible to complete the game with less than 5 alerts? The bottom camera in Building 1, Floor 2 is one alert I would like to avoid. This would mean the only alerts left are in the jungle and at the entrance to the final building.
- Is there a safer strategy for making it through the first gas room without a mask? Most of my runs die here. I think I can get a little further by opening and closing the menu repeatedly, but I kinda want to make the run enjoyable to watch.
I'm looking into a no damage playthrough and was wondering if you could do a quick breakdown on the pausing to avoid damage in gas rooms? I'm looking for the easiest set up to go no damage. Speed dosn't matter to me. thank you
also the electric floor room at the end do you think that there is a human viable way past without damage
There is a universal timer (it counts up by 1 from 0 to 255 each frame, then overflows back to 0) that controls most aspects of the game, including the two kinds of damage floors. The first is gas areas, where Snake takes damage when the timer is a multiple of 32, the other is electric floor and deep water where damage is at the multiple of 16. The timer runs even when the game is paused, in a menu, and during screen transitions, so those can be used to avoid damage.
Even with the gas mask avoiding damage is very difficult. This is because the gas mask cannot be equipped when entering the room. Therefore there is at least a 1/32 chance of taking damage on entry, but perhaps up to 3/32 depending on mashing speed to enter the menu. On exit the chance is higher because of the door, which will only open on a multiple of 4 of the timer. This increases the chance to minimum 1/8 chance because the door forces the next multiple of 4.
As for the pause glitch, it requires damage to know where the timer is to initiate the pause timing. Lag frames, which always happen with menus and screen transitions, do not increment the counter.
Also I realized I forgot to Guy1's post above. I started researching, but got distracted and forgot about it. I will have to remember to work on that again.
thanbk you this is exacly what I needed to know. One more question. Does anything else use that timer? Is there anything else we can use to know the position besides taking damage?
Nearly everything does, that's why I call it a universal timer. But because not everything uses a multiple of 16 or 32 it can be hard to find a way to know where it is. I can't think of a reliable way to know what it is for either the gas room on building 1 floor 3.
I did further testing on avoiding damage in the gas rooms. I tested the one on building 1, floor 3 because this is most relevant to speedruns, but it seems that this should apply to any gas room door. On entry there is a 1 in 8 chance of the bad pattern where there is only 2 frames to avoid damage by mashing to go into the menu. On exit, if you are against the wall that has the door, it is a 9 is 32 chance of taking damage. The reason is that the door's frame rule that makes it open every 4 frames makes Snake wait but will take damage, plus there is walking from the door to the screen's exit point. Each position away from the wall adds 1 to the chance.