Dragon Warrior III Speedrun RNG Manipulation Notes =================================================== Things I referenced: Vaxherd's TAS: http://tasvideos.org/4992S.html (A lot/most of this is based on his notes) Vaxherd's RNG notes: http://pastebin.com/raw/WKQ9A21a ==================================================== Important memory addresses: - 001C: Normal RNG seed (Two bytes) - Every time a savefile is saved, the checksum gets stored here - 00A4: RNG "Counter" (Increments each time a number is generated) - Reset to 0 upon reset - 6A68: Discard Counter (the one that splits things sixteen ways) - To manipulate to a static value, load a "5FEA" save and get into a battle, Fight first round, and reset. - If the battle is in the cave under the first tower, it gives me a value of 7... Overworld seemed inconsistent? Did I try in different zones? ============================================ How to never have to set the message speed for the metal slime grind - Save slots are not kept in order in SRAM - When you save, that file is swapped to position 1 - The file in position 3 determines the seed if you don't select a message speed To figure out which savefile is in which slot: (I use files one and three as examples because you want file 3 in the third SRAM position for my script outputs) - Have a savefile in Dhama or have a Wing (just for consistency/simplicity). I'll refer to this as File 1. - Select any message speed on File 3, load File 1 and run out of town until you get into a fight; note the encounter formation and which tile it happened on. - Reset the console. Select any message speed on file 1 and reset the console again. - Load the file again, repeating the movement you did before until you get into a fight. - Same encounter on the same step? File 1 is first; File 3 is last. - Otherwise, File 1 is first and File 3 is second. On seeding from an empty cart ============================= First of all, read the "How to never have to set the message speed" section above. My current plan: File 1) The file you actually play on File 2) Manipulation file that gets the random number generator to get "stuck in a hole", used to AVOID encounters File 3) Manipulation file for a metal slime fight If the route requires it, other message speeds on either files 2 or 3 could also be used for bombcrag/metal babble manipulations. How to set up these files: 1) Know which files are in which SRAM slots, and delete them all in an order that will leave file 3 last. 2) Reset the console. Create one of the following files in slot 2: Name: am Sex: F Speed: 6 Checksum: $AFF5 Name: E? Sex: F Speed: 5 Checksum: $5FEA 3) Reset the console. Create the following file in slot 3: Name: vb Sex: M Speed: 5 Checksum: $2E34 4) Reset the console. Select a message speed on file 2 to put slot 3 back into the third position (to make metal slime manips free) The process is simple; it's just important that you make file 3 first NOTE: When using the above metal slime seed ($2E34) you need to stand still for at least one frame after dismissing Dhama Dude's text before leaving Dhama! - If you only stay still for one frame, the fight will happen after three steps in the forest/mountains. - If you stay still until the hero's animation ticks once (or twice), the fight will happen on the FIRST step, which is faster and better. - If you dismiss the text box by holding down and leave too quickly you will not get the fight at all. Random number generator ======================= Quoting Vaxherd: The random number generator algorithm is: for (16 iterations) { seed = LFSR(seed, 1) } counter += 1; return (byte)(seed + counter); where LFSR(seed, input) = (seed << 1) ^ ((seed>>15 ^ input) ? $1021 : 0) "This gives an RNG sequence length of LCM(65534,256) = 8,388,352 values." So if you generate eight million values, the pattern starts repeating. HOWEVER, there are two values that are in their own little loop The "Battle RNG" value, when used, tells the game to throw away that many (plus one) numbers before taking one - This means the "Counter" will increment by "Battle RNG" + 2 Notice there are three "global variables": The seed, the counter, and the "Battle RNG". Notice the output is NOT the new seed - The output is the seed plus the counter. Random Factoids ========================== Herbs damage Zoma in this range: [0,192)U[229,255] - They didn't account for herbs; these numbers are pulled from an out-of-bounds array index - Herbs cannot deal damage in the range [192,228] Luck increases resistance to status spells (and Vivify) - Basically, it multiplies the base effectivity by 50%-150% Bombcrags ========= "am" file that gives broken generator - MS 1: - Pause when all four characters are on a mountain - Pause when under last mountain - Pause one step before the tile where you turn right - MS 7: - Pause under last mountain - PRECISE: When you land, Hero's sword should be forward; wait until he pulls it back TWICE (one two three four) and then move. If you screw it up you get Grizzlies. Manipulate to Kanave using $AFF5 seed: - Start a new game - Sell Copper Sword, buy three wings, assemble party - Save (Lusia) and reset. - Head toward Thief Key - Start up game with the $AFF5 seed, and wing to Aliahan - Walk all the way left and up two steps and wait for a bit to dodge the freeze-battle - When the HUD pops up, press left. - When it pops up again, wait another half-second and start walking - Walk to the hidden cave entrance, and then go toward the Thief Key - You'll hit an encounter near the end. Just parry/run from it. - Get key, jump off the tower, hopefully don't freeze... - Wing to Aliahan, heal up, and save the game - Head toward Kanave... - Start up game with the $AFF5 seed, and wing to Aliahan - Dodge the freeze-battle as before and go to Reeve - Grab the Magic Ball and wing to Reeve - Start heading toward Kanave. - When you find an encounter on the second floor of the Cave of Entisement, you do NOT want to run away on turn two or you'll find another encounter really soon. - When you find an encounter on the third floor, just Deal With It. - Hopefully you don't die...