Pokota
He/Him
Joined: 2/5/2014
Posts: 779
Oh, right. Death warp. So THE PLAN then is 1) Wing Boots 2) Sky Fountain 3) Tower Fountain 4) Joker Key 5) Death Warp 6) Ruby Ring 7) 4500 Golds from slaying at most 6.25 Wyverns 8) Misted Lands Ahoy
Adventures in Lua When did I get a vest?
Invariel
He/Him
Editor, Site Developer, Player (171)
Joined: 8/11/2011
Posts: 539
Location: Toronto, Ontario
Actually, it's a bit closer to: 1) Make the jumpy thing face left on entering the death screen in Eolis. Lord Tom takes his first hit on frame 1900, with it facing right on entering the screen. I can get a small improvement by having it face and jump left, because it will hit me sooner. 2) Die 3) Golds, initial buys, etc. 4) Mattock 5) Wing Boots (2800 Golds) 6) Sky Fountain 7) 2x Wing Boots from bees 8) Joker Key 9) Tower Fountain 10) Death Warp 11) Long Sword 12) Kill two mages to buy Key Q 13) Joker Fountain, Ruby Ring 14) 4500 Golds --without gaining a level-- from slaying at most 6.25 Wyverns 15) Misted Lands Ahoy 16) Picking up the difference in Golds from riflemen and mages. Also, I came across a disassembly of the game here: http://www.the-interweb.com/serendipity/index.php?/archives/30-Faxanadu-Disassembly.html and it suggests that this is the random number generator:
ROM:CA6E GetRandomNumber:
ROM:CA6E                 LDX     byte_DA
ROM:CA70                 LDA     $8000,X
ROM:CA73                 EOR     PressedKey_1    ; Key pressed by the player
ROM:CA73                                         ; Bit 0: Right
ROM:CA73                                         ; Bit 1: Left
ROM:CA73                                         ; Bit 2: Down
ROM:CA73                                         ; Bit 3: Up
ROM:CA73                                         ; Bit 4: Start
ROM:CA73                                         ; Bit 5: Select
ROM:CA73                                         ; Bit 6: B
ROM:CA73                                         ; Bit 7: A
ROM:CA75                 INC     byte_DA
ROM:CA77                 RTS
ROM:CA77 ; End of function GetRandomNumber
I /believe/ that it means:
X <- 0xDA
0xDA's value + value in 0x8000 = memory address's value to load into accumulator
Acc XOR PressedKey_1
Inc byte_DA
but I am no expert in assembler.
I am still the wizard that did it. "On my business card, I am a corporate president. In my mind, I am a game developer. But in my heart, I am a gamer." -- Satoru Iwata <scrimpy> at least I now know where every map, energy and save room in this game is
Player (36)
Joined: 9/11/2004
Posts: 2630
Invariel wrote:
Also, I came across a disassembly of the game here: http://www.the-interweb.com/serendipity/index.php?/archives/30-Faxanadu-Disassembly.html and it suggests that this is the random number generator:
ROM:CA6E GetRandomNumber:
ROM:CA6E                 LDX     byte_DA
ROM:CA70                 LDA     $8000,X
ROM:CA73                 EOR     PressedKey_1    ; Key pressed by the player
ROM:CA73                                         ; Bit 0: Right
ROM:CA73                                         ; Bit 1: Left
ROM:CA73                                         ; Bit 2: Down
ROM:CA73                                         ; Bit 3: Up
ROM:CA73                                         ; Bit 4: Start
ROM:CA73                                         ; Bit 5: Select
ROM:CA73                                         ; Bit 6: B
ROM:CA73                                         ; Bit 7: A
ROM:CA75                 INC     byte_DA
ROM:CA77                 RTS
ROM:CA77 ; End of function GetRandomNumber
I /believe/ that it means:
X <- 0xDA
0xDA's value + value in 0x8000 = memory address's value to load into accumulator
Acc XOR PressedKey_1
Inc byte_DA
but I am no expert in assembler.
byte_DA isn't necessarily guaranteed to have the value 0xDA. Which you seem to have realized partway through. Interestingly, this code seems to operate by taking the game's object code (which starts at $8000), and xor'ing it with the controller input, which means that the RNG should be entirely and supremely predictable and repeat every 256 calls. Your disassembly seems to be correct other than what I pointed out up there, here's how I would have written it (ignoring effects on flags):
X = byte_DA;
A = *(0x8000 + X);
A ^= PressedKey_1;
++byte_DA;
I haven't done much with NES assembly, so I found it very surprising that this function just left the return value right in the accumulator and returned. I was expecting it to use the stack. However, I'm not certain that this is the correct get random function. It seems to have extremely bad randomness characteristics, especially when you find out that $8000 is mostly 0 bytes.
00, 00, 00, 00, 00, 00, 00, 00, 08, 18, 18, 10, 10, 00, 30, 00, 00, 00, 28, 28,
28, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 08, 18, 10, 00,
00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 60,
60, 20, 40, 00, 00, 00, 00, 7E, 00, 00, 00, 00, 00, 00, 00, 00, 00, 30, 30, 00,
00, 00, 00, 00, 00, 00, 00, 00, 7C, C6, C6, C6, C6, C6, 7C, 00, 18, 38, 18, 18,
18, 18, 3C, 00, 7C, C6, 0E, 3C, 70, E0, FE, 00, 7E, 0C, 18, 3C, 06, C6, 7C, 00,
1C, 3C, 6C, CC, CC, FE, 0C, 00, FE, C0, FC, 0E, 06, C6, 7C, 00, 3C, 60, C0, FC,
C6, C6, 7C, 00, FE, C6, 0C, 18, 30, 30, 30, 00, 7C, C6, C6, 7C, C6, C6, 7C, 00,
7C, C6, C6, 7E, 06, C6, 7C, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
00, 00, 00, 00, 00, 00, 00, 00, 7C, C6, 86, 3C, 30, 00, 30, 00
Build a man a fire, warm him for a day, Set a man on fire, warm him for the rest of his life.
Invariel
He/Him
Editor, Site Developer, Player (171)
Joined: 8/11/2011
Posts: 539
Location: Toronto, Ontario
From what I gather from the disassembler, byte_DA is the address 0xDA, not the value 0xDA. I can't think of much in Faxanadu that is actually random: enemy facing (their positions are all set), when certain enemies jump or fly, and when projectiles are spawned. Even the 'random' items are predictable. And recall that those 256 values are all XOR'd with whatever the player is pressing right now (which will likely never be Start or Select, making bytes 4 and 5 interesting...) so the randomness is based on the gamestate. Edit: Minor success! I forced the jumping dwarf to face left instead of right and am dead at frame 2061 instead of 2080! I do have to figure out which of the eight buttons made that happen, but it's a start. Edit: It was A. Edit: Rough WIP: http://tasvideos.org/userfiles/info/23288780221476689 I've smoothed it a bit since, and continued forward. Next stop: Hail to the King, Baby. Edit: Leaving Eolis: http://tasvideos.org/userfiles/info/23309253951749362 Link to video
I am still the wizard that did it. "On my business card, I am a corporate president. In my mind, I am a game developer. But in my heart, I am a gamer." -- Satoru Iwata <scrimpy> at least I now know where every map, energy and save room in this game is
Post subject: Faxanadu - WIP
Invariel
He/Him
Editor, Site Developer, Player (171)
Joined: 8/11/2011
Posts: 539
Location: Toronto, Ontario
I've started work on improving Lord Tom's wonderful Faxanadu submission. WIP is at http://tasvideos.org/userfiles/info/23288780221476689 I've added a bit of polish to what is there, and am now heading to see the King. Planned improvements:
    Acquire the Long Sword Faster farming to 4500 Golds for Key K
Unexpected improvements:
    Made the first enemy face left, getting me killed 19 frames sooner
I would love to optimize the route, but I am pretty sure that Lord Tom's route is optimal, barring finding some wrong warps, or getting nicely embedded into walls.
I am still the wizard that did it. "On my business card, I am a corporate president. In my mind, I am a game developer. But in my heart, I am a gamer." -- Satoru Iwata <scrimpy> at least I now know where every map, energy and save room in this game is
Invariel
He/Him
Editor, Site Developer, Player (171)
Joined: 8/11/2011
Posts: 539
Location: Toronto, Ontario
WIP III 129 frames ahead, 236 Golds behind. Encode: Link to video
I am still the wizard that did it. "On my business card, I am a corporate president. In my mind, I am a game developer. But in my heart, I am a gamer." -- Satoru Iwata <scrimpy> at least I now know where every map, energy and save room in this game is
Pokota
He/Him
Joined: 2/5/2014
Posts: 779
Why did the walking speed reset halfway through Apolune? I thought it was maintained between screen transitions.
Adventures in Lua When did I get a vest?
Invariel
He/Him
Editor, Site Developer, Player (171)
Joined: 8/11/2011
Posts: 539
Location: Toronto, Ontario
That would be because I missed holding R for one frame during the screen transition. Great catch, thank you, and redoing (minorly) the rooms after have me 47 frames faster than the encoded WIP.
I am still the wizard that did it. "On my business card, I am a corporate president. In my mind, I am a game developer. But in my heart, I am a gamer." -- Satoru Iwata <scrimpy> at least I now know where every map, energy and save room in this game is
XkyRauh
He/Him
Joined: 6/9/2005
Posts: 171
Location: Southern California
I'm sure you know of this already, but if you spend the King's initial 1500 gold to the last cent, and talk to him again with 0 golds, he will give you 1500 new ones. Would this be faster than farming golds from monsters?
Invariel
He/Him
Editor, Site Developer, Player (171)
Joined: 8/11/2011
Posts: 539
Location: Toronto, Ontario
I really don't think so.
ItemPrice
Hand Dagger400
Red Potion160
Elixir320
Deluge400
Key J100
The backpack problem is NP Hard, but this is a small backpack and can be solved as follows: 3x Red Potion + 1x Elixir + 1x Hand Dagger (or Deluge) + 2x Key J. In my current run, I walk past the key shop door at frame 3490, I get back to the item shop at frame 7344, and finish buying six items at frame 10832, with the game accepting input again at frame 10859. If I returned to the King, that would take another 3854 frames, then I would have to buy one item from each shop. Golds are received and spent at a rate of 10/frame, and I need to buy 500 Golds worth of items. I buy the Elixir as follows:
FrameComment
7478Start ialogue
7690What would you like? (1)
7812Buy menu entered
7826Elixir selected and urchased
7963Dialogue closed
This comes to 348 frames of dialogue, 105 frames of waiting for the dialogue box, and 32 frames of spending Golds, or 453 guaranteed wait frames and cost/10 spending frames per purchase. Buying two additional items totalling 500 Golds is then 906 wait frames + 50 spending frames, 956 frames. Without calculating the time to get into and out of the shops, I would be leaving the key shop at 10859 (input accepted leaving key shop) + 3854 (travel time to and from the King) + 956 (buying) puts me at frame 15669 without having left Eolis. For reference, Lord Tom enters the Mattock dungeon on frame 15675 with 906 Golds in hand. The ultimate question, then, is this: does it take 4810 frames + travel time within the shops to kill the nine mages that would give 1035 Golds? I highly doubt it. I hope this sufficiently answers your question.
I am still the wizard that did it. "On my business card, I am a corporate president. In my mind, I am a game developer. But in my heart, I am a gamer." -- Satoru Iwata <scrimpy> at least I now know where every map, energy and save room in this game is
Pokota
He/Him
Joined: 2/5/2014
Posts: 779
Invariel wrote:
I buy the Elixir as follows:
FrameComment
7478Start dialogue
7690What would you like? (1)
7812Buy menu entered
7826Elixir selected and purchased
7963Dialogue closed
Psst, there's no [th] tag. Also the table tags seem to like their personal space.
Adventures in Lua When did I get a vest?
Invariel
He/Him
Editor, Site Developer, Player (171)
Joined: 8/11/2011
Posts: 539
Location: Toronto, Ontario
I just thought of something that will make me have to revisit XkyRauh's suggestion with the King. (And yes, I was aware of the 'go back to the King' thing. Did it as a kid.) Pokota: I had actually fixed the th issue from the first table, forgot it in the second. Edit: If I talked to the King a second time, it would cost a lot of time, but give me a 1000 Golds head start. The math in the previous post suggests that the shopkeeper takes 453 + Golds/10 frames to transact with me, so each transaction has to be measured in frames against the Golds difference. Having 1000 additional Golds also suggests that I can skip the initial death warp and instead buy meat twice (100 Golds) for a possible frame savings. This leaves me with 900 Golds after the required purchases of a Hand Dagger (or Deluge) and the third Key J. If it were just a matter of Golds, my eyes would be wide open with the path that is presenting itself right now. By equipping the bottom Key J from inventory before doing any purchasing, my inventory looks like: RP, RP, RP, J After coming back from the King a second time, I could then buy such that my inventory looks like: RP, RP, RP, J, J, RP, RP, RP "Wait, three additional Red Potions? This is a TAS, you're never going to use them!" You're right, voice in my head. But I can sell them. In Forepaw, RPs cost 400, which means I can sell them for 200 apiece. So, at the cost of 453+20 frames times six, 2838 frames, I can get 1200 Golds. Added to my leaving town amount of 420, selling 1200 Golds of gear puts me at 1620, plus an additional RP along the route is 1820 Golds, meaning I need to collect 980 Golds on the way to Forepaw. Which is dead simple. If all I needed was Golds, this would be a dead obvious choice. Unfortunately, I also need experience, and there isn't any way to get 1000 experience for Aspirant by collecting 980 Golds. It means that I must kill enemies along the route, which makes the selling route slower in principle, without even counting frames. Also, Wyverns grant only 90 experience, which suggests that farming them at the top of the Mattock tower also isn't an ideal way to get to 1000.
I am still the wizard that did it. "On my business card, I am a corporate president. In my mind, I am a game developer. But in my heart, I am a gamer." -- Satoru Iwata <scrimpy> at least I now know where every map, energy and save room in this game is
XkyRauh
He/Him
Joined: 6/9/2005
Posts: 171
Location: Southern California
Thank you for the extremely detailed answer! :) While I'm sorry the question made you revisit the idea a few times, I'm glad the issue seems to have been settled conclusively. I'm looking forward to your run!
Invariel
He/Him
Editor, Site Developer, Player (171)
Joined: 8/11/2011
Posts: 539
Location: Toronto, Ontario
It's no problem at all. The question of, "Can visiting the King be faster?" has come up a couple of times in this thread, and instead of just being told, "No," I feel happy to be able to provide a reasoned answer. And it did make me wonder if it was worth using the extra Golds to make more. But... apparently not. It would be enough to buy the Long Sword earlier than I intend, but it will be less time-consuming to just get the second pair of Wing Boots. (I wonder if I should just get four pairs there and skip the entire rest of the game... Would make things boring though.)
I am still the wizard that did it. "On my business card, I am a corporate president. In my mind, I am a game developer. But in my heart, I am a gamer." -- Satoru Iwata <scrimpy> at least I now know where every map, energy and save room in this game is
Invariel
He/Him
Editor, Site Developer, Player (171)
Joined: 8/11/2011
Posts: 539
Location: Toronto, Ontario
WIP IV, all the way to Forepaw. Link to video
I am still the wizard that did it. "On my business card, I am a corporate president. In my mind, I am a game developer. But in my heart, I am a gamer." -- Satoru Iwata <scrimpy> at least I now know where every map, energy and save room in this game is
Player (36)
Joined: 9/11/2004
Posts: 2630
Handling the Myconid at 5:15 or so looks a bit awkward, why the stutter step to pause? I noticed that you nearly bumped into the second step, so I assume the reason was you needed to wait a short amount of time so you could both clear the step and the enemy. But it didn't look like you just cleared the enemy, though I know that hitboxes in this game can be a bit... ridiculous.
Build a man a fire, warm him for a day, Set a man on fire, warm him for the rest of his life.
Invariel
He/Him
Editor, Site Developer, Player (171)
Joined: 8/11/2011
Posts: 539
Location: Toronto, Ontario
Without that stutter step, in 100% of trials (with this timing -- when I was slower it was easy and the following didn't happen), the Myconid turns around halfway through my jump and hits me. Hard. Without the stutter, it turns around on every attempt to clear it, and if I jump one frame later, I jump into it and get hit backwards, and that's just worse. As for the middle step, you can't clear it at top speed, you're forced to land on it. I can upload my .bk2 if you want to play around with it, the stuttering happens at frame 19047.
I am still the wizard that did it. "On my business card, I am a corporate president. In my mind, I am a game developer. But in my heart, I am a gamer." -- Satoru Iwata <scrimpy> at least I now know where every map, energy and save room in this game is
Invariel
He/Him
Editor, Site Developer, Player (171)
Joined: 8/11/2011
Posts: 539
Location: Toronto, Ontario
I went and fixed my laddering at 3:33 (if you watch closely, he jerks back to the right when grabbing the second ladder) -- one frame. Which must have hit a frame rule or something because that singular motion has saved me 15 frames into Forepaw. And, OmnipotentEntity, it removed my need to stagger-step in front of the Myconid.
I am still the wizard that did it. "On my business card, I am a corporate president. In my mind, I am a game developer. But in my heart, I am a gamer." -- Satoru Iwata <scrimpy> at least I now know where every map, energy and save room in this game is
Invariel
He/Him
Editor, Site Developer, Player (171)
Joined: 8/11/2011
Posts: 539
Location: Toronto, Ontario
A new WIP. Started over because it was becoming increasingly obvious that I needed more Golds from earlier in the game, upgraded from BizHawk 1.9.1 to 1.11.0 and switched cores from QuickNES to NesHawk. Link to video
I am still the wizard that did it. "On my business card, I am a corporate president. In my mind, I am a game developer. But in my heart, I am a gamer." -- Satoru Iwata <scrimpy> at least I now know where every map, energy and save room in this game is
Invariel
He/Him
Editor, Site Developer, Player (171)
Joined: 8/11/2011
Posts: 539
Location: Toronto, Ontario
After a lot of time being frustrated with my progress, and then starting over with a new route plan (I tried using a bunch of magic along the route with the intention of collecting the Glove, which would increase the Dagger's damage from 5 to 7 and let me kill the white mage enemies in four hits instead of six. Unfortunately, that didn't pan out because saving one swing across eleven enemies didn't make up for the two additional screen transitions required to collect it), I'm now basically following Lord Tom's room routing. However, I've managed to save 117 frames by the end of the first dungeon/tower! Progress! http://tasvideos.org/userfiles/info/34354022453190386 Link to video
I am still the wizard that did it. "On my business card, I am a corporate president. In my mind, I am a game developer. But in my heart, I am a gamer." -- Satoru Iwata <scrimpy> at least I now know where every map, energy and save room in this game is
Invariel
He/Him
Editor, Site Developer, Player (171)
Joined: 8/11/2011
Posts: 539
Location: Toronto, Ontario
I am still the wizard that did it. "On my business card, I am a corporate president. In my mind, I am a game developer. But in my heart, I am a gamer." -- Satoru Iwata <scrimpy> at least I now know where every map, energy and save room in this game is
Invariel
He/Him
Editor, Site Developer, Player (171)
Joined: 8/11/2011
Posts: 539
Location: Toronto, Ontario
TWELVE SECONDS SAVED!
I am still the wizard that did it. "On my business card, I am a corporate president. In my mind, I am a game developer. But in my heart, I am a gamer." -- Satoru Iwata <scrimpy> at least I now know where every map, energy and save room in this game is
Lord_Tom
He/Him
Expert player (3144)
Joined: 5/25/2007
Posts: 399
Location: New England
Congrats! I wasn't expecting such a big savings. What'd you do?