Experienced Forum User, Published Author, Player
(138)
Joined: 1/18/2016
Posts: 17
And at some point (in my *cough* copious free time) I need to figure out how to make myself a TASBot so I can get the TAS to run on console -- there are definite timing differences (which made turning the TAS into a realtime run quite, uh, interesting).
Experienced Forum User, Published Author, Player
(138)
Joined: 1/18/2016
Posts: 17
FWIW, it sounds like it was definitely a power-off reset: https://www.youtube.com/watch?v=g5Hq2eASg74&t=29m19s
I don't see how $03FB could get $02 in normal play anyway, since even on a soft reset, you'd have to have gone through the area 1 boss first.
It could well be a cosmic ray-type event, but I have a vague recollection of seeing this glitch happen once or twice while playing it as a kid -- though to be fair, that could just be a false memory from watching the AGDQ run.
Experienced Forum User, Published Author, Player
(138)
Joined: 1/18/2016
Posts: 17
I haven't looked at Blaster Master before, but this glitch got me curious, so a few observations from looking at the code in case they give anyone any ideas. Note that these are all from the English ROM (the only version I have handy), so if the glitch turns out to be JP-only then none of this may be of much use...
- The only stores to $03FB are the one Dacicus quoted which is done on boss kill, and a few that store literal 0 or 255 (and the 255 clearly can't be the case because the rest of the bosses showed up properly). The store after the area 1 boss kill in that run can't have set the wrong bit, because then the boss would immediately respawn when the room was reloaded after the boss death.
- The only indexed stores that could reach $03FB are the stores to the PPU RAM write buffer at $0300. I played up to area 2 to check, but the buffer high water mark was $0340, and a cursory review of the code suggests it's pretty good at flushing the buffer before it overflows, so it seems unlikely to me that a buffer overflow is the cause. (Also, in order to have disabled only the second boss, the store value would have to have been $02 or $03, which seems unlikely for an arbitrary PPU data store; and if the buffer overflowed all the way up to $03FB then it would stomp on lots of other stuff in the $03xx range, which would probably cause more problems than just a missing boss.) On the other hand, Personman's example of a case when both a boss and its item were missing could indicate a buffer overflow that wrongly set bits in both $03FB and $03FC, so I dunno.
- The boss-defeated store to $03FB has this stack trace (again, addresses are from the English ROM - bank 4 is mapped to $8000 here):
For $A07B to reach the store to $03FB, the following have to be true:
- $0053 = 0
- The low bit of $0010 is clear
- $03FD >= 127
It does look like this routine is called for other purposes as well, so conceivably there could be a case where all those preconditions are (incorrectly) met, which would trigger the glitch.
Here's the relevant part of that routine:
A07B: A5 53 lda $53
A07D: F0 10 beq $A08F
A07F: AD FD 03 lda $03FD
A082: F0 7B beq $A0FF
A084: CE FD 03 dec $03FD
A087: D0 76 bne $A0FF
A089: 20 18 A1 jsr $A118
A08C: 4C FC A0 jmp $A0FC
A08F: A5 10 lda $10
A091: 4A lsr a
A092: B0 19 bcs $A0AD
A094: AD FD 03 lda $03FD
A097: D0 0A bne $A0A3
A099: A9 0A lda #$0A
A09B: 20 16 C2 jsr $C216
A09E: A9 0B lda #$0B
A0A0: 20 16 C2 jsr $C216
A0A3: EE FD 03 inc $03FD
A0A6: AD FD 03 lda $03FD
A0A9: C9 80 cmp #$80
A0AB: B0 53 bcs $A100
(...)
A100: 20 0E C1 jsr $C10E // Only reachable from branch at $A0AB
A103: 20 72 A0 jsr $A072 // Get bit for current area (encapsulates "lda $14" etc.)
A106: 0D FB 03 ora $03FB // Set boss-killed flag for current area
A109: 8D FB 03 sta $03FB // Store updated flag byte
A10C: A9 5A lda #$5A
A10E: 85 46 sta $46
A110: A9 00 lda #$00
A112: 20 1A C1 jsr $C11A
A115: 68 pla
A116: 68 pla
A117: 60 rts
Experienced Forum User, Published Author, Player
(138)
Joined: 1/18/2016
Posts: 17
Encounter avoidance is easy as long as you know where the RNG is, which in turn is just a matter of counting steps (and not bonking -- though bonking in dungeons is fine as long as you do it a multiple of 8 times, to get the frame counter back in sync for overworld and town RNG). This is the same reason things like Metal Slime farming near Dhama work. The catch is that to know where the RNG is after a battle, you also need to know what the battle RNG seed is, and there's no way to change that outside of actually taking a turn in battle -- so a single input mistake will throw everything off, and you can't even reset to get back to where you were before. That said, attempting to run doesn't change the battle seed, so as long as you have a way to set up the battle seed ahead of time, it might be possible to make use of seed lock in an RTA, if that's what you're asking.
If you mean "could this TAS be console-verified", I'm pretty sure it could, but it would almost certainly need tuning because DW3 is only loosely interrupt-locked and it desyncs easily (especially with message boxes).
Experienced Forum User, Published Author, Player
(138)
Joined: 1/18/2016
Posts: 17
Okay, I've got subtitles written, but it looks like I can't update the submission anymore -- can anyone help with that?
[Edit] Here's the updated movie: http://tasvideos.org/userfiles/info/28706285680998942
[Edit 2] The submission is updated. Thanks, Samsara!
Experienced Forum User, Published Author, Player
(138)
Joined: 1/18/2016
Posts: 17
If you mean pirohiko's Dream Ruby TAS, I think this is it: http://www.nicovideo.jp/watch/sm3134444
It uses Fighter crits and takes advantage of how the RNG counter advances every frame in DQ3 while a menu is open (as opposed to DW3, in which it doesn't so your battle RNG manipulation options are much more limited).
Experienced Forum User, Published Author, Player
(138)
Joined: 1/18/2016
Posts: 17
I could look into doing this (and I agree it would help viewers not familiar with the game), but I'm not too familiar with video processing tools; is there a particular format I should use?
Experienced Forum User, Published Author, Player
(138)
Joined: 1/18/2016
Posts: 17
Aqfaq wrote:
This run has a multi-level-up sequence that takes 8½ minutes. That must be the record, right? How many levels were advanced at once?
67 in all (1/1/1/1 to 17/18/18/18).
TheAxeMan wrote:
Is the RNG similar in DQ2? I keep thinking I'll look more deeply into that game again sometime but I probably never will.
Yes, DQ2 uses the same base RNG algorithm but without the extra counter, so if you put it into seed lock, every RNG call returns the same value. Starting a new game (on any file) with name TUT, speed Fast gives you seed lock with $5FEA; you can get all the way up to Lianport with no encounters, but you can't skip the forced Gremlin encounter to get the ship and the Gremlin AI goes into an infinite loop, so I'm not sure how much use it would be. It can be amusing, though, to watch every NPC in every town move in the same direction. :)
Experienced Forum User, Published Author, Player
(138)
Joined: 1/18/2016
Posts: 17
dave_dfwm wrote:
Naming a slot ypp somehow gave you a bewildered metal babble with a level 1 pilgrim ready to crit??!?! That's pretty spectacular.
It's not quite that simple -- sex, speed, and save file order also matter for getting the encounter (see my reply to Catastrophe aove), and the crit additionally requires the specific battle RNG seed used in the run.
Great thinking saving with Luisa instead of the King.
Credit where credit is due -- I picked that up from watching Highspirits running DW3 on Twitch.
[end edit]
1. Is there any way you could have gotten the Killer Bee fight faster?
Nope; this is the flip side of the RNG glitch (see the (*) note in small text toward the end of section 2). There's no way to reach the Killer Bee encounter area by the time an encounter occurs, and once you skip the encounter you have to take around 150 steps before the next one occurs. I tried using encounters to adjust the RNG, but (1) there's only one counter value which gives a Killer Bee encounter at night, and in that encounter the bee doesn't use its numb attack; and (2) in order to get back to daytime you need to enter and run from at least 4 encounters, which takes longer than just walking out the 127 steps + 2 waits needed after leaving Kanave.
2. Once you were at the end of the boss rush, how did you get 5 herbs in a row to get 240+ damage on Zoma?
A solid week of number crunching. :) You can look at my routing scratchpad (see links at the end of the description and search in the file for "[Appendix: Boss rush]") to see what I went through, but basically I started with getting 4 high Herb hits in Zoma turn 2 (though I ended up needing only 3) and worked backwards turn by turn to find a sequence that connected to the RNG state at the floor entrance.
Fun Fact: I wish I had an emulator recording of this, but I once got Zoma to "stand guard" during the first round of the fight instead of Breath + Snowstorm. If this can be replicated, it'd be very useful.
Hmm, I think the only way that can happen is if you out-turn Zoma and use the Sphere of Light before he acts. Pre-sphere Zoma uses a fixed action sequence so the first turn will always be breath + Snowblast, and if for some reason any enemy fails to choose an action, it will default to attack (possibly attacking nothing) rather than defend. I haven't traced the logic to see what happens to the action IDs when you Sphere him, but I tried once and got flaming breath, which is not in his action list so I assume defend is a possibility as well. Unfortunately we can't make use of that here, since a character's agility has to be at least 65 to out-turn Zoma and agility isn't anywhere near that at level 20.
Experienced Forum User, Published Author, Player
(138)
Joined: 1/18/2016
Posts: 17
Catastrophe wrote:
Oh wow! That's great information! I'm supposed to be looking at the SFC version, but now I'm tempted to be distracted. A setup for an easy (and rare) overworld lone metal babble would be pretty awesome.
Not to further tempt you into distraction :) but if you want to mess with it, here's the program I used to find the Metal Babble seed: http://pastebin.com/0nKL9bSU
It's set up for Rimuldar, but it should work for any encounter set if you drop in the proper data. (In case you don't already know, encounter data is at $8ADB in bank 0 in groups of 15 bytes: byte 0 has the encounter rate index in bits 7-5, the encounter chance table index in bits 4-2, and the preemptive/back attack modifier in bits 1-0, and the remaining 14 bytes are base enemy IDs for each encounter. You can break at 0/$835A and look at register A to see the encounter set index for any particular area.)
Your bag has 255 item ids starting at 7E3725 and the quantities start immediately after. (Yes, an odd memory address! The DQ SFC games have lots of those.) But for some reason when reordering the bag it starts reading from one byte earlier. And if the item you're moving has an item ID that matches 7E3724 then a dupe will occur when 7E3724 is mistakenly "sorted into" your bag. This will zero out 7E3724, with whatever side effects that brings, and prevent another dupe until it changes.
Interesting! I haven't messed with the SFC DQs at all, but the off-by-one bug sounds like it matches the code quality of DW3 (heh). I'm taking a look at FC DQ3 at the moment, but I'll keep it in mind if I have time later.
Totally irrelevant bit of trivia, from the DW3 enemy-to-enemy breath attack routine:
4/$8DCD: jsr $B2A3 ;Party/enemy target check
;...
4/$8DD5: lda $51 ;Oops, should have been ldx!
4/$8DD7: lda $0558,x ;Get action ID to look up damage range
That code doesn't result in random damage ranges only because $B2A3 happens to do ldx $51 itself. (And to make things even better, the following code gets the base and range values backwards, which is why King Hydra's breath does 10-39 damage to Ortega but 30-39 damage to your party.) Yeah, this is why compilers are good for you...
Experienced Forum User, Published Author, Player
(138)
Joined: 1/18/2016
Posts: 17
Catastrophe wrote:
That was entertaining! I like the floor crumbling scene after you beat Zoma and the encounterless Najima the best. Something's just not right there. :)
I actually panicked for a moment at that floor crumbling, because I thought the seed lock had thrown it into an infinite loop like with battles (it's actually just clearing the same tile multiple times). It would have been less than pleasant to discover after a solid week of number crunching that I couldn't use the route because it froze on the final cutscene...
Catastrophe wrote:
I wonder if your method of rigging the RNG would help in a speed run? Or does the battle RNG persist in SRAM even when you delete all 3 save files? Would removing the battery at least give every new game a consistent starting point?
The battle RNG persists; it's never modified except after entering commands in battle. It's not even cleared when the program detects uninitialized SRAM (only $6000-$693D is cleared, which I think is actually an off-by-$100 bug because $693D is in the middle of save slot 3), but I guess if you know what happens to SRAM when you put a new battery in, you could make use of that. Since the battle RNG seed has only 4 bits, it's also feasible to just make a list of all 16 possible results from a known state and then work out what you need to do to get the RNG back to where you want it.
Whether all that would be an overall benefit in real time, I don't know. I imagine it might be an overall boost if you found a Metal Slime battle sequence that leaves the battle RNG seed unchanged, so you can run the same battle over and over.
Catastrophe wrote:
Does the name on file 2 "E?" immediately put the RNG in the sequential state, or does it only do that because of the prior events that have happened?
It's name+sex+speed (all 3 parameters matter), and it'll work as long as file 3 is empty and is in the third slot. The slot number is important, because the RNG state at main menu time is the checksum of the file in the third slot, which may not be file #3: when you load a game, the program swaps save file slots so the game you loaded is in the first slot (I assume to simplify Luisa logic, so it doesn't need to take the current save file into account when looking up character stats).
A quick way to check whether the slots are in the right order is to erase all files, then create a game in file 1 as A/Male/8; if the hero's initial HP is 15, the files are in the right order, otherwise (17 HP) files 2 and 3 are switched. To unswitch them, you can do this:
Create a new game in file 3 (name/sex/speed can be anything).
Create a new game in file 2.
Erase file 3.
Erase file 2.
Erase file 1.
Then if you retry the file 1 hero, you should see 15 HP.
Catastrophe wrote:
Also have you ever looked at any of the SFC games?
Nope, I haven't taken a look at those yet. I'd be a little surprised if they kept the same RNG algorithm across a platform change, but I guess you never know.