Post subject: Search for the correct frame to press a button?
Former player
Joined: 3/8/2004
Posts: 1107
As I was thinking about how tedious it is to make TASs, I suddenly came up with an interesting idea for a new feature. Often you'll have some kind of situation where the character is running and there's a door up ahead, and when you get there you have to press up to enter the door, and you have to test several frames to see how early you can press up. You might be in the middle of a jump and you have to find the earliest possible frame when you can let go of A and still land on the other side of the pit. You might have to shoot an enemy and you have to find the earliest frame to shoot so that he'll be vulnerable by the time the shot hits him. This process is especially tedious when for each frame you want to try pressing a button, you have to wait until it goes through another 20 frames in slow motion to see if you succeeded or not. I suppose frame advance makes it a little easier since after testing each frame you can hold down frame advance to make it go faster, but it still takes awhile. I was wondering if one of you experts at programming emulators could figure out how to implement this idea I have to make this process more automatic. Suppose you're running towards a door, and you're holding down the buttons B and right. First you get somewhat close to the door, maybe 2 or so character widths away, and pause the emulator. Then you click on something in the menu called something like "frame search". Then you enter a combination of buttons being pressed that you're going to be switching to soon, which in this case would be B, right, and up. Then you click "search", and starts playing the game automatically at full speed from where you paused it, pressing up immediately. Then once you see whether or not you entered the door, you can press right to go through and test each frame. If you press right once, it'll rewind to the spot where you originally paused it, but this time wait a frame before it starts pressing up. Each time you press right, it'll rewind, start playing at full speed and start pressing up a frame later, and you can also press left if you want to go back to pressing up earlier. You can speed things up even more by making an estimate and pressing right several times to quickly get close to the correct frame, and the press left or right to find it exactly. Once you find the correct frame, you click "exit frame search", and it brings you to the first frame where it pressed up and pauses it.
Post subject: Re: Search for the correct frame to press a button?
Editor, Active player (297)
Joined: 3/8/2004
Posts: 7469
Location: Arzareth
I usually use some kind of variation of binary search. For example, to find the first possible frame to shoot an enemy, the process could be the following: - Save. Shoot an enemy. <result:didn't work> - Reload. Advance 5 frames. Shoot. <result:didn't work> - Reload. Advance 5. Save. Advance 5. Shoot. <result:didn't work> - Reload. Advance 5. Save. Advance 5. Shoot. <result:worked> - Reload. Advance 3. Shoot. <result:worked> - Reload. Advance 2. Shoot. <result:didn't work> - Reload: Advance 3. Save. Shoot. Continue playing. Which gives me the correct position, "18 frames", in less retries than by a frame-by-frame method, with not less precision. The number of "advance" presses can of course be minimized by using more savestate slots.
nesrocks
He/Him
Player (246)
Joined: 5/1/2004
Posts: 4096
Location: Rio, Brazil
When i have to stop doing something at a specific frame and then the result of "worked" or "didnt work" only takes place a long time after, i play the game at 100% or even 200% speed, pause, frame advance, save, unpause. didnt work? pause, load, frame advance, save in different slot, unpause. and so on, it doesnt take long.
Active player (328)
Joined: 2/23/2005
Posts: 786
That's not a bad idea. Frame search could be "Emulate X frames, execute keypress sequence, display result." That would be insanely useful.
adelikat
He/Him
Emulator Coder, Site Developer, Site Owner, Expert player (3574)
Joined: 11/3/2004
Posts: 4754
Location: Tennessee
Interesting, I do the EXACT same method as Bisqwit.
It's hard to look this good. My TAS projects
Emulator Coder, Skilled player (1310)
Joined: 12/21/2004
Posts: 2687
I do something similar, with results saved circularly on 4 slots that are dedicated to it (and 1 slot as backup in case I screw up), to minimize advances as he suggested. Well, first I try it at normal speed a couple of times to narrow the range of possibilities (so in this case I'd guage that it's between about 15 and 30 frames, and only search that range unless I hit the edge of it). But, a lot of times things aren't so simple as this. For instance, if you want to jump as little as possible but you need to shoot an enemy that's in the air, then you have to find the earliest frame in which you can fire a shot that will hit the enemy, and also find the moment to jump and the jump duration that result in that shot hitting the enemy with minimal time spent in the air. Often when there are additional constraints like that and more buttons involved, I don't even know if there's any solution at all. That's where I find most of my rerecords going (into attempts to do things which, after many tries, I decide are probably impossible), except in 2-player runs (where the confusion of controlling 2 players adds about as many rerecords due to screw-up as anything else). I think the frame search feature wouldn't be a bad idea, but it makes me wonder if something more general-purpose could be done that's still less tedious than current methods.
Post subject: Re: Search for the correct frame to press a button?
nesrocks
He/Him
Player (246)
Joined: 5/1/2004
Posts: 4096
Location: Rio, Brazil
Michael Fried wrote:
You might be in the middle of a jump and you have to find the earliest possible frame when you can let go of A and still land on the other side of the pit. You might have to shoot an enemy and you have to find the earliest frame to shoot so that he'll be vulnerable by the time the shot hits him.
I think this was the main issue in his post, right? At those cases it helps to do a lot of jumps with slow speed (no frame advance), and when you feel confident enough you try to understand the situation better, like: "i have to run as fast as possible to the right, go left as soon as possible for as little frames as possible, fall from the ledge, grab the item and then run right again". Understanding that makes it easier to get the final result right.
Michael Fried wrote:
Suppose you're running towards a door, and you're holding down the buttons B and right. First you get somewhat close to the door, maybe 2 or so character widths away, and pause the emulator. Then you click on something in the menu called something like "frame search". Then you enter a combination of buttons being pressed that you're going to be switching to soon, which in this case would be B, right, and up. Then you click "search", and starts playing the game automatically at full speed from where you paused it, pressing up immediately. Then once you see whether or not you entered the door, you can press right to go through and test each frame. If you press right once, it'll rewind to the spot where you originally paused it, but this time wait a frame before it starts pressing up. Each time you press right, it'll rewind, start playing at full speed and start pressing up a frame later, and you can also press left if you want to go back to pressing up earlier. You can speed things up even more by making an estimate and pressing right several times to quickly get close to the correct frame, and the press left or right to find it exactly. Once you find the correct frame, you click "exit frame search", and it brings you to the first frame where it pressed up and pauses it.
I'm not sure if i understood this, but.. that kind of simple search is too easy to do and such a tool would require some work which wouldn't compensate, i think.
Editor, Active player (297)
Joined: 3/8/2004
Posts: 7469
Location: Arzareth
nitsuja wrote:
confusion of controlling 2 players adds about as many rerecords due to screw-up as anything else
For my copy of FCEU, I created a "compose mode" where at every frame, I can toggle which buttons are held down, and if I press nothing, the same buttons will be down that were on previous frame. It makes the 2p-moviemaking significantly easier.
nesrocks
He/Him
Player (246)
Joined: 5/1/2004
Posts: 4096
Location: Rio, Brazil
Nice tool, bisqwit, but how do you know which buttons are pressed and which ones aren't? does it display on screen? The only trouble i have while making 2 player movies is that my hands hurt. I use right hand to press ALL the buttons in the gamepad (player 2) PLUS the arrows in the keyboard (player 1) by positioning the controller by the side of it. Right hand also press pause (ENTER). The left hand is responsible for frame advance, p1 buttons (except arrows), and savestate issues. Before i notice, the controller has slipped far from the keyboard and my right hand is doing some acrobatic movement to reach both at the same time, and i'm so 'entertained' by the action on screen that i only notice it 3 or 4 minutes later after serious damage lol
Emulator Coder, Skilled player (1310)
Joined: 12/21/2004
Posts: 2687
Bisqwit wrote:
nitsuja wrote:
confusion of controlling 2 players adds about as many rerecords due to screw-up as anything else
For my copy of FCEU, I created a "compose mode" where at every frame, I can toggle which buttons are held down, and if I press nothing, the same buttons will be down that were on previous frame. It makes the 2p-moviemaking significantly easier.
I already added this to (my unofficial version of) Snes9x so at every frame I can either toggle which buttons are held, or toggle which buttons are on auto-fire, or press buttons normally, or any combinations of those 3 things. It does make it much easier than otherwise, but the number of options present at any given moment (and the lack of indication of even/odd auto-fire) still makes it confusing, which is what I was talking about.
Player (36)
Joined: 9/11/2004
Posts: 2630
FODA wrote:
Nice tool, bisqwit, but how do you know which buttons are pressed and which ones aren't? does it display on screen?
I'd assume he displayed it in stderr.
Build a man a fire, warm him for a day, Set a man on fire, warm him for the rest of his life.
Editor, Active player (297)
Joined: 3/8/2004
Posts: 7469
Location: Arzareth
OmnipotentEntity wrote:
I'd assume he displayed it in stderr.
Indeed.
Former player
Joined: 3/8/2004
Posts: 1107
I'm not sure if i understood this, but.. that kind of simple search is too easy to do and such a tool would require some work which wouldn't compensate, i think. Suppose it takes 2 hours to make the tool, and each time someone uses it, it saves 10 seconds, and he ends up using it 100 times for each TAS he makes. Then if 50 people each make 5 TASs, you end up with hundreds of hours of profit. Edit:
- Save. Shoot an enemy. <result:didn't work> - Reload. Advance 5 frames. Shoot. <result:didn't work> - Reload. Advance 5. Save. Advance 5. Shoot. <result:didn't work> - Reload. Advance 5. Save. Advance 5. Shoot. <result:worked> - Reload. Advance 3. Shoot. <result:worked> - Reload. Advance 2. Shoot. <result:didn't work> - Reload: Advance 3. Save. Shoot. Continue playing.
Can you estimate how long this process would normally take? I think with the tool I described you could probably get all that done in less than 15 seconds. Less than a second to press the shortcut key that opens the frame search tool, maybe 2-3 seconds to toggle on or off the buttons you want and then click search, and then for each frame you want to test out it would take about 1-2 seconds to see whether or not the shot hits the enemy.
Emulator Coder, Skilled player (1310)
Joined: 12/21/2004
Posts: 2687
I would estimate that in the common/simple case the search takes between 2 and 30 seconds to do manually, more toward the low end of that range for the simplest tasks but it depends on what exactly you're trying to do. For luck manipulation, though, it can take quite a while since then you're usually stuck doing a linear search. (I would also estimate that this tool would take much more than 2 hours to make, and it would be more of a per-emulator feature than a general tool, not that that affects your argument.)
nesrocks
He/Him
Player (246)
Joined: 5/1/2004
Posts: 4096
Location: Rio, Brazil
I would like a programmer to add re-recording to MUPEN64 or fix finalburnalpha instead of doing "fine tuning" tools for already working re-recording emulators.
Former player
Joined: 3/8/2004
Posts: 1107
I would like a programmer to add re-recording to MUPEN64 or fix finalburnalpha instead of doing "fine tuning" tools for already working re-recording emulators. Why not do both? You can use the time you saved by using this tool to work on adding re-recording to other emulators.
Player (206)
Joined: 5/29/2004
Posts: 5712
I can still imagine this tool taking too long to set up for each situation...
put yourself in my rocketpack if that poochie is one outrageous dude
Former player
Joined: 3/8/2004
Posts: 1107
I can still imagine this tool taking too long to set up for each situation... Why would it take too long? I don't see why it would take more than 3 seconds to set up. Half a second to press the shortcut key, 2 seconds to toggle on or off whatever keys you want (possibly even less if all you're gonna be doing is something like pressing the B button to shoot, then you just need to click once to toggle on the B button), and then another half a second to click on search.
nesrocks
He/Him
Player (246)
Joined: 5/1/2004
Posts: 4096
Location: Rio, Brazil
He meant that it would take a long time for a programmer to make. (i think)
Emulator Coder, Skilled player (1310)
Joined: 12/21/2004
Posts: 2687
FODA: That's not how I read it. Michael Fried: I think to really save time you'd want it set up so you can use it almost like frame advance. Like, when you're heading toward a door, you hold 'up' then press a hotkey until you see the door open, at which point you continue recording like normal. I could see something that simple being usable. It would take some thought to make the interface for setting up that process intuitive, though. Should it show some number of frames (how many?) into the future after the button press (or maybe it should emulate normally into the future to show what would happen?) so you can see what the result was, then rewind back to right after the button push the next time you use regular frame advance or unpause?
Former player
Joined: 3/8/2004
Posts: 1107
Like, when you're heading toward a door, you hold 'up' then press a hotkey until you see the door open, at which point you continue recording like normal. I don't think that would work unless I'm not understanding you correctly, because for each frame that you can start holding up, you have to be able to see what's going to happen 10 or so frames later.
Emulator Coder, Skilled player (1310)
Joined: 12/21/2004
Posts: 2687
Michael Fried wrote:
unless I'm not understanding you correctly
By "press a hotkey until" I meant "keep pressing the hotkey until", i.e. you see what's going to happen each time you press it, and each time you press it increases by 1 the number of frames that it tries holding the previously held keys before pressing the new keys and then (in some way that probably needs to be configured beforehand) displaying the result. Just like frame advance, you could probably hold down the hotkey to quickly skip past the frames you don't care about, then slow down to examine each frame more when it gets more promising. Another hotkey should probably be for going back 1 step instead of forward in case of overshooting.
Emulator Coder, Skilled player (1310)
Joined: 12/21/2004
Posts: 2687
I tried implementing this "frame search" feature into VBA, and it works pretty well. I hold the button I want to test, then use ] and [ to scroll forward and backward through the frames of waiting, then when I find the result I want I press L to continue from where the button gets pressed. Saves a lot of tedious reloading. (Haven't quite uploaded it yet, but I thought I'd mention it here in case anyone already has comments/questions about it...)
Player (36)
Joined: 9/11/2004
Posts: 2630
Nitsuja, stop being so awesome. It makes the rest of us look bad. :-) (If you're anywhere near Georgia I need to give you a beer and a sloppy wet kiss)
Build a man a fire, warm him for a day, Set a man on fire, warm him for the rest of his life.
Former player
Joined: 3/8/2004
Posts: 1107
Awesome! Btw, do you have to go into the menu to open up frame search mode, or does it automatically start when you press ]?