Alyosha
He/Him
Editor, Emulator Coder, Expert player (3821)
Joined: 11/30/2014
Posts: 2829
Location: US
CLChambers00 wrote:
Does Mesen have a TAS Editor and a way to watch Ram Addresses? I will write up what I am looking for later on and we can go from there. Thanks!
It doesn't have a TAS Editor, but it does have savestates and an excellent debugger and memory viewer to keep track of RAM. I recommend giving it a try, it give you what you want right out of the box.
Joined: 7/21/2017
Posts: 54
The input manipulation that I need to do will be frame perfect and will require me to press and hold start any where from the very first frame possible to press start, etc. Without a TAS editor this may be difficult to do. I will play around with it to see how I might be able to utilize it and will post my results here, in the mean time I will write up what I am looking for in the upcoming post.
Chambers_N
Joined: 7/21/2017
Posts: 54
Who Framed Roger Rabbit initializes its memory so it does not matter whether you use a Top Loader or a Front Loader, Everdrive or original cart. Therefore changing the Initial RAM State does not alter results. What I wanted to do is utilize an Emulator with TAS Editor and Ram Watch so that I can TAS out 1000's of input manipulations in order to find the best route for speedrun purposes. What I did for the world record was the following: Press and hold A, reset the console, continue to hold A, I would then press and hold start around the earliest opportunity, I would then continue to hold A and start until I see the 3x Lives screen just before you gain control of the character. Since inputs affect the RNG every single frame I will only get the RNG that I wanted if I initiated pressing start on the exact same frame. These are the addresses for each of the item spawns. 0657 Shoes 064B Rattle 0639 Detonator 0631 Whistle 0645 Baseball 0661 Will Piece #1 065D Will Piece #2 0663 Will Piece #3 065F Will Piece #4 With the input manipulation that I use on original hardware I am able to get the following results, however, since this is done on hardware I can not tell you exactly what frame I am pressing start but I can tell you that it is within the first 20 frames, almost immediately. 0657 (40) 064B (42) 0639 (29) 0631 (21) 0645 (53) 0661 (6) 065D (2) 0663 (16) 065F (13) Some other things that I know... 0016-0019 are where controller inputs are stored (16 = gamepad 0, 17 = gamepad 0 new presses this frame, 18-19 = gamepad 1 similar 0002 seems to be a frame counter 0012-0014 seem to be part of a 24-bit PRNG seed RainWarrior on NESDev has also mentioned the following: "This just runs being called over and over in an infinite loop until an NMI interrupts it and eventually manipulates the stack to get it out of that infinite loop. This is setting up the 24-bit PRNG seed. It maybe runs 40 times per frame. Observation 2: this random seed loop is broken only by the NMI, so this will require precise PPU emulation to get correct. If it's even one cycle different, the PRNG seed could be changed." "Even one cycle difference in the specific timing of the NMI can also alter the seed. That last one in particular is one that emulators might easily behave differently on, especially reset/warmup behaviour of the PPU. It's also possible that on hardware the variability of PPU alignment might mean you only have a 1 in 4 chance of getting a consistent alignment on reset/power-up too, even if you could get that frame-perfect START every time." I am not certain about these last comments by Rainwarrior, but if I can only get my manipulation to work 25% of the time even with perfect inputs, I wonder if any of the other 3 out of 4 results would sync with an emulator? However, I don't know if this is really the case, and if what has been stated about resets and NMI interruption then I would doubt it, since I think the emulator simply is functioning differently in this regard, which is why Bizhawk and FCEUX differ in what frame they initially populate values in the PRNG addresses. Please let me know if you have any other questions, and in the mean time I will play with this other emulator and let you know what I observe.
Chambers_N
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3821)
Joined: 11/30/2014
Posts: 2829
Location: US
BizHawk and FCEUX set the RNG on different frames because FCEUX (erroneously) delays PPU startup by an extra frame. This at least is well understood. NESHawk or Mesen are you're only chances at matching console for behaviour this precise, trying to use FCEUX would be wasting your time. Otherwise yes, this RNG is very sensitive to initial condiitions of the NES. Aside from CPU/PPU alignment, there is also VBlank flag which is a variable. Aside from that, I strongly suspect that there are other variations in power up state as well. Your initial assessment that NES emulation may not be at a state where this can be easily duplicated may be correct. If Mesen doesn't give you the desired result, it is very unlikely that this can be reproduced at this time. It would be pretty easy to create a LUA script that will just randomly press buttons until you get the desired state you want (assuming it is possible) but the resulting input would obviously be useless for real time purposes.
Joined: 7/21/2017
Posts: 54
Mesen or bust it sounds like? No other possible ideas for possible alignment? Would you be willing to write such a Lua Script, I would be very interested to know if such a desired state exists, etc. It could assist in my overall understanding of the game.
Chambers_N
Joined: 7/21/2017
Posts: 54
ok, so the emulator route is totally out, I have exhausted today's nes emulation capability but I another twitch streamer by the name threecreepio hacked the rom so that it gives you the values in the score section upon starting the game so we can try out new variations, found a new route and carved off 1.5 seconds already, will grind it some more but another route may work better
Chambers_N
Arc
Editor, Experienced player (826)
Joined: 3/8/2004
Posts: 534
Location: Arizona
CLChambers00 wrote:
Also, I am offering a $200 bounty for the person who figures out how to get outcomes to match in original hardware and an emulator with TAS such as Bizhawk and FCEUX. If interested please send me a PM, and we can discuss the details.
I don't have the answer to how to sync an emulator with hardware. But I have been slowly working on a TAS of this game for a while. I have made many attempts at perfectly manipulating the eight essential item spawn locations. Eventually I became frustrated by the fact that I always seemed to be off on the memory value of either the Gag Factory will piece (009) or the Victory Road will piece (013). Once I focused my attention on this fact, I soon realized that the values 009 and 013 never occur simultaneously. Every other possible combination comes up frequently, but those two are never together. I considered that it might be an issue with FCEUX, and so I tried Neshawk as well. But 009 and 013 never occurred together in Neshawk either. But it has to be an emulation issue, because the top three times (done on hardware) for this game on speedrun.com all got the will piece spawns at 009 and 013. The solution in my TAS will have to be to spawn the will piece at 007 (lower right cave) instead of 009.
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3821)
Joined: 11/30/2014
Posts: 2829
Location: US
It's definitely possible to get 9 and 13 to appear together. I ran the following script in neshawk:
local HIT_T = true;
local do_once_temp = true;
local i = 0;
local j = 0;
local k = 0;
local l = 0;


while (HIT_T == true) do
	
	if (do_once_temp) then
		savestate.loadslot(1);
		
		do_once_temp = false;
	end

	i = math.random(0,4);

	if (i == 0) then
		joypad.setfrommnemonicstr("|..|.......A|");
	end		
	
	if (i == 1) then
		joypad.setfrommnemonicstr("|..|......B.|");
	end	
		
	if (i == 2) then
		joypad.setfrommnemonicstr("|..|....S...|");
	end		
	
	if (i == 3) then
		joypad.setfrommnemonicstr("|..|........|");
	end		
	
	if (i == 4) then
		joypad.setfrommnemonicstr("|..|......BA|");
	end		
	
	if (emu.framecount() == 800) then

		console.write(memory.readbyte(0x0661));
		console.write('-');
		console.write(memory.readbyte(0x065F));
		console.write('\n');
		
	
		l = l + 1;
		savestate.loadslot(1);
	end	

	emu.frameadvance()
end
The starting frame (where savestate 1 is loated) was 536. This gave me values of 9 and 13 about 1% of the time. The key seems to be to delay when you press start. Originally I ran the script having already pressed start on the first possible frame and I got 0 results after much longer runs. In the above script, there is only a 1 in 5 chance to hit start on any frame. As you can see this script didn't save what the inputs actually were, but hopefully this helps a little.
GJTASer2018
He/Him
Joined: 1/24/2018
Posts: 303
Location: Stafford, NY
Alyosha wrote:
The key seems to be to delay when you press start.
For context, how long a delay in pressing start are we talking about here compared to, say, the game's current publication? It is even going to save time at all to try to get the values to line up the way Arc wants them to?
c-square wrote:
Yes, standard runs are needed and very appreciated here too
Dylon Stejakoski wrote:
Me and the boys starting over our games of choice for the infinityieth time in a row because of just-found optimizations
^ Why I don't have any submissions despite being on the forums for years now...
Arc
Editor, Experienced player (826)
Joined: 3/8/2004
Posts: 534
Location: Arizona
Alyosha wrote:
It's definitely possible to get 9 and 13 to appear together.
Looks like you're right. In FCEUX, the earliest frame that I can press Start is 534. If I press Start on frame 534-539, then 009 and 013 never appear together. But if I wait until frame 540, then 009 and 013 appear together. Thank you.
Arc
Editor, Experienced player (826)
Joined: 3/8/2004
Posts: 534
Location: Arizona
GJTASer2018 wrote:
It is even going to save time at all to try to get the values to line up the way Arc wants them to?
This shows what 007 and 009 actually mean in the game: 009 is definitely preferred. I had found an input combination that yielded the ideal eight memory values with 007 (and had a lot of the TAS done), but now I'm going back to find a combination that yields 009 instead of 007. The full result I'm looking for is: Address - Value 0657 - 040 0639 - 029 0631 - 018 065D - 005 0661 - 009 065F - 013 0663 - 016 0645 - 053 Edit: Changed ideal values. Also I have found this ideal combination already.
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3821)
Joined: 11/30/2014
Posts: 2829
Location: US
http://tasvideos.org/userfiles/info/72385648792277409 Here is a console verified run that will work in dev build or 2.6.3 when it is released. It gets all the items in the right places, but I didn't put much effort into manipulation after that point so it ended up slower then the published run by ~100 frames. So, if anyone wants to use this to get a faster run that can be console verified feel free. EDIT: I found an improvement and submitted a new run.