Timeline of Ridley AI during 4 x-factor opener ---------------------------------------------- Can follow it at https://milde.no/public/sm/ridley_diagram.png if ya want. A35B Some init stuff at the start. | A377 | A389 | A3DF | A455 | A478 | A354 | B2F3 Accelerates Ridley to a specific coordinate in top left corner | B321 Choose next AI that Ridley should do. | | Would need to jump up to Y=$160 or higher to have a chance of choosing BAB7. Or spin jump to move on to B5C4. | Since we're on the floor, standing still, B6A7 will always be chosen (see full logic below). | B6A7 Pogo startup | | Checks if Ridley Y>$120 (meaning Ridley is closer to the floor) and accelerates to $120 if it is. | If it's not, we go to B6DD. | | Since B2F3 (see above) already put us at Y<$120, we go to B6DD immediately. | B6DD Pogo startup 2 | | Accelerates towards $120 for 32 frames. Since Ridley has an upward momentum at this point, this only serves to | slow the upward momentum down - he will be at Y=$89-ish while still moving slowly upwards after 32f. | | After the deacceleration it does some tail AI & sets Ridley's speed for the pogo (4 different speeds at random), | and then moves on to B70E. | B70E Pogo downwards | 1. Attempts to grab Samus (unless Samus is spinjumping or damage boosting, which we are not). | If Samus is grabbed, it moves on to BB8F and returns. | 2. Moves the tail downwards and checks if it collides with a block. | If it doesn't, it just returns and does the same next frame too. | 3. If Ridley's tail does collides with a block, it sets new "pogo speed" (4 different speeds) and goes on to B7B9. | | At this point in the opener, Ridley's tail is inside the left wall, making the AI go to B7B9 immediately. | If you jump up, you can see the tail has smoke around it, just like when the tail hits the ground in a normal pogo. | B7B9 Pogo upwards | 1. If Samus is high up in the room (Y<$160), it will move on to B321. | 2. It updates Ridley's speed (deaccelerates) and checks if Ridley is moving downwards or not by now. If he is, | we move on back to B70E. | | At this point in the opener, Ridley is still moving upwards (but deaccelerating) when this AI script is hit first, | so this serves to deaccelerate Ridley into a pogo. This takes around 30f. | B70E See above. But this time, the tail is not inside the wall, and the next AI change will happen when the tail | collides with the blocks on the ground. | B7B9 See above. | This time in the opener, you should be higher then Y=$160 in the room (jumping up for the 2nd x-factor), | thus the AI will simply move on to B321. | B321 See above. But I'll extend this comment to explain the full logic. | | This routine first sets up an array of 8 AI scripts, and chooses from that array at random. Which array is used is | decided like this: | | 1. If Samus is spin jumping, the array contains 8x B5C4 (Hover). | 2. If Ridley is dead, the array contains 8x BAB7 (Lunge). | 3. If Ridley has less than 14400 health, the array contains 4x B6A7 (Pogo) and 4x B441 (Swoop). | 4. If Samus is below Y=$160 (ground level or slightly above), the array contains 8x B6A7 (Pogo). | 5. If Samus is NOT spin jumping, grappling or damage boosting, the array contains 6x BAB7 (makes him move upwards) | and 2x B6A7 (Pogo). | 6. If she is, the array contains 4x B441 (Swoop) and 4x B6A7 (Pogo). | | At this point in the opener, all you need to do is to make sure you are high enough. That's all. There's no X | coordinates that works better than others, the charging of the 2nd x-factor does not matter, you don't need to | hit a very specific Y area or angle down, just go high enough and you get the 75% chance of BAB7, which is the | desired AI script for pulling off a 3rd x-factor. | BAB7 Lunge | | Does a lot of decisions based on things like whether Ridley is facing Samus, whether Samus is above Ridley, whether | they are closer than 2 blocks from each other, whether Ridley is dead, whether a power bomb just went off etc. | Since you should be above Ridley at this point | B3EC Sets up a timer (to 0x80) and moves on to B3F8 | B3F8 Decrements the counter, and if it's 0, moves on to B321. So we do the following for a maximum of 0x80 frames: | Accelerates Ridley towards top left corner. Once he hits it, move on to B321. | | This movement is what enables us to get in a 3rd x-factor. | B321 See above. At this point in the opener, we yet again get the 75% chance of BAB7 and 25% chance of B6A7 (re-pogo). If we get BAB7, we can pull off a 4th x-factor. If B6A7 he will pogo and we can't. Chance for getting 3 x-factors: 75% Chance for getting 4 x-factors: 56.25%