Post subject: Mega Man
NitroGenesis
He/Him
Editor, Experienced Forum User, Experienced player (532)
Joined: 12/24/2009
Posts: 1873
This is a game made by Hi-Tech Expressions. It is a platforming game. There are 3 robot masters and a short Wily stage. I'm gonna try it.
YoungJ1997lol wrote:
Normally i would say Yes, but thennI thought "its not the same hack" so ill stick with meh.
Editor, Experienced Forum User
Joined: 3/10/2010
Posts: 898
Location: Sweden
Be sure to pick the least bad graphics quality.
Editor, Experienced Forum User, Skilled player (1328)
Joined: 3/31/2010
Posts: 2066
Sure sounds interesting enough.
Emulator Coder, Experienced Forum User
Joined: 3/9/2004
Posts: 4588
Location: In his lab studying psychology to find new ways to torture TASers and forumers
Don't forget the game has a speed control, to best TAS it, you want to make the game fly. Also, being a bit clever and employing the DOS copy command, you could skip the first 3 levels... Edit by DarkKobold: Further discussion of the DOS copy command legitimacy should go here: http://tasvideos.org/forum/viewtopic.php?t=9455
Warning: Opinions expressed by Nach or others in this post do not necessarily reflect the views, opinions, or position of Nach himself on the matter(s) being discussed therein.
Experienced Forum User, Player (219)
Joined: 10/17/2005
Posts: 399
I don't think this game makes for an interesting tas anyway. I mean come on, it's just so horrible.
<adelikat> I've been quoted with worse
Editor, Experienced Forum User, Skilled player (1328)
Joined: 3/31/2010
Posts: 2066
Bablo wrote:
I don't think this game makes for an interesting tas anyway. I mean come on, it's just so horrible.
This may make it all the more interesting. Games with a horribly borken physics engine come to mind.
NitroGenesis
He/Him
Editor, Experienced Forum User, Experienced player (532)
Joined: 12/24/2009
Posts: 1873
oh jeez, i wanted to talk about mega man, not cheating and rules
YoungJ1997lol wrote:
Normally i would say Yes, but thennI thought "its not the same hack" so ill stick with meh.
Editor, Experienced Forum User, Player (53)
Joined: 6/22/2005
Posts: 1011
scrimpeh wrote:
This may make it all the more interesting. Games with a horribly borken physics engine come to mind.
You're assuming that Hi-Tech the same mistakes as Capcom. I'm not sure about that, but feel free to prove me wrong. Also, let Nach make his version of the TAS if he wants to. We could make a "Nach-approved cheating" category for this game. ;)
Current Projects: TAS: Wizards & Warriors III.
Post subject: Volt Man skip
Sand
He/Him
Experienced Forum User, Player (108)
Joined: 6/26/2018
Posts: 113
A major skip is possible in Volt Man's stage. There is a row of death tiles immediately below the start position. Contact with a death tile sets Mega Man's health to zero, but the game doesn't actually notice he's dead until the next frame; during that frame you can pause and use an E Tank to restore Mega Man's health. Four E Tanks suffice to pass completely through the barrier. This skips almost the whole stage: after landing, the boss chamber is just a short walk to the right. According to my rough estimate based on DarkKobold's TAS and LiteralGrill's RTA WR, farming four E Tanks in Sonic Man's stage—even though you need to die three times and continue for each one—is faster than playing through Volt Man's stage once.
Post subject: Re: Volt Man skip
Sand
He/Him
Experienced Forum User, Player (108)
Joined: 6/26/2018
Posts: 113
It turns out that the skip in Volt Man's stage needs only one E Tank, not four. If you take damage such that you stagger backwards against the solid wall, the death barrier only damages once. No E Tank farming is required in Sonic Man's stage—the single E Tank in that stage requires only a slight detour. Incidentally, from the top of this pole, you can walk to the left and get out of bounds. The same trick is possible in Dyna Man's stage. Here, it skips a comparatively short portion of the stage. It also avoids the trigger that initiates lava eruptions and acid droppers in the following section. The necessary E Tank can be acquired in Volt Man's stage, from behind a destructible wall.
Active player, Experienced Forum User (368)
Joined: 9/25/2011
Posts: 652
Great find, Sand! Thanks for posting it. If you've ever considered doing a TAS, this would be a good one to start on. ;)
Editor, Experienced Forum User, Player (53)
Joined: 6/22/2005
Posts: 1011
Nice work! Have you tested if farming E-tanks in Sonic is faster or slower than getting the one in Volt for the Dyna skip?
Current Projects: TAS: Wizards & Warriors III.
Sand
He/Him
Experienced Forum User, Player (108)
Joined: 6/26/2018
Posts: 113
Dacicus wrote:
Have you tested if farming E-tanks in Sonic is faster or slower than getting the one in Volt for the Dyna skip?
I did a test and I don't think the Dyna Man skip is worth it. I was able to farm a single E Tank in Sonic Man's stage (including dying three times with Esc-F10-P) in about 659 frames. The skip in Dyna Man's stage saves only about 425 frames (or less, depending on how long it takes to line up the Sentry Bee in order to take damage). In an earlier comment I said that you can use an E Tank from Volt Man's stage to do the Dyna Man skip, but obviously you won't have that E Tank if you skip Volt Man's entire stage. Volt Man's E Tank is deep in the stage. I didn't test it, but I'm sure it's slower to get that one. I don't know of any E Tanks other than the one in Sonic Man's stage and the one in Volt Man's stage. My estimate for getting an E Tank in Sonic Man's stage includes a minor time save relative to the current TAS: in the first room, if your last shot on the second destructible wall hits near the top of the wall, the explosion will be high enough to walk under.
Post subject: Stifling Sentry Bees
Sand
He/Him
Experienced Forum User, Player (108)
Joined: 6/26/2018
Posts: 113
A small glitch, noting for completeness: In Dyna Man's stage, at the beginning, wait for 16 frames, then run right at full speed. The Sentry Bee will fly overhead without dropping its nails—and no more Sentry Bees will spawn for the remainder of the opening section. I'm not sure if this helps or not. To be worth it, the 16 frames spent waiting would have to be less than then number of frames spent evading bees later in the section. And by this point you would have the Volt Shield, which protects you from the nails, so the only concern would be contact with the bees themselves. I don't know what causes the glitch. I tried for a little while, but wasn't able to reproduce it in later sections that have Sentry Bees. The trick isn't very hard in real time, either. Hold down the J key before the level starts to buffer a full-height jump. Start running to the right as soon as you land.
Post subject: Re: Stifling Sentry Bees
Sand
He/Him
Experienced Forum User, Player (108)
Joined: 6/26/2018
Posts: 113
Sand wrote:
The Sentry Bee will fly overhead without dropping its nails—and no more Sentry Bees will spawn for the remainder of the opening section.
I figured out why this happens. Imagine that the stage is divided into vertical zones, each 8 tiles wide (128 pixels wide). The bee drops its bundle of nails as soon as it enters the zone that Mega Man is currently in. (Which means that the drop can be right on top of Mega Man's head, or up to 8 tiles away, or anywhere in between, depending on Mega Man's position in the zone.) If Mega Man, moving right, crosses from zone A to zone B in the same frame as the bee, moving left, crosses from zone B to zone A, then there is no frame in which they are both in the same zone, and nails never drop. The relevant code is at offset 0x1947 in dyna.bin:
0000:1947  268b07      mov ax, word es:[bx]     ; bx points to Mega Man's x position
0000:194a  2580ff      and ax, 0xff80           ; round down to a multiple of 128
0000:194d  8b1c        mov bx, word [si]        ; si points to the bundle's x position
0000:194f  83e380      and bx, 0xff80           ; round down to a multiple of 128
0000:1952  3bc3        cmp ax, bx               ; same zone?
0000:1954  7508        jne 0x195e               ; branch if not same zone
0000:1956  ff441a      inc word [si + 0x1a]       ; set bundle's y velocity to 1 (indicates it's now falling)
0000:1959  c744180000  mov word [si + 0x18], 0    ; set bundle's x velocity to 0
0000:195e
Or in pseudocode:
if (megaman.x / 128 == bundle.x / 128) {
        bundle.y_vel++;
        bundle.x_vel = 0;
}
Knowing this, I was able to prevent the drop in the second section where bees appear, too. The way respawning works is, there's really only one bee: there are five sprite slots for the bee, bundle, and four nails. (The bundle and one of the nails share a slot.) The next bee can spawn only when all five slots become empty (despawn). The bee itself despawns when it goes far enough offscreen, but the bundle only despawns when it hits the ground. Because the bundle never drops, it never hits the ground, and the next bee can never spawn. (Actually, if you wait long enough—several minutes—the bundle's x position will wrap around 16 bits, arrive once more in Mega Man's zone, finally drop, and restart the spawning cycle. I only noticed this because it happened in the background while I was writing this post.)
Sand
He/Him
Experienced Forum User, Player (108)
Joined: 6/26/2018
Posts: 113
First draft of a TAS incorporating the skip in Volt Man's stage and other improvements: Link to video But you may prefer this version that has been slowed down to a watchable speed (more on this below): Link to video More info and JRSR file: https://archive.org/details/megamanpc-tas-1_49_352 The file is 7663 frames or 01:49.34, which is about 24% faster than [2247] DOS Mega Man by DarkKobold in 02:23.55. The biggest single time save is skipping Volt Man's stage. Further gains are from general clean movement: pre-jumping down pits and avoiding hugging walls. Other specific improvements are:
  • Putting C: on HDD rather than HDA and skipping all the startup options, as recommended at Wiki: EmulatorResources/JPC, makes the boot faster.
  • You need to delay slightly to avoid getting hit by the dog; there's enough time to kill one dog while still saving a few frames overall.
  • The second wall in Sonic Man's stage can't be harmed while the first wall is exploding. (This applies to all such explosions: only one can exist at a time, so anything that might explode is invulnerable until an existing explosion is gone.) While waiting for the explosion to finish, we lure the Batvire to the left to open up some headroom. Jumping and shooting the second wall near the top causes the explosion to spawn up high, so that Man Man can walk under it.
  • Holding up in the vertical fan shaft reaches maximum vertical speed slightly faster.
  • One damage boost is enough to get past the Sewer Rat—it requires slowing down so the wall blasters can hit you first.
  • It pays to be out of the water as much as possible. Under water, Mega Man moves at 6 pixels/frame; above it, 8 pixels/frame. Jumping from a lower to a higher platform incurs a slight delay for camera recentering. You can sometimes avoid the recentering delay by jumping immediately after landing.
  • Jumping from the top of a ladder mitigates the camera recentering that occurs in the dark Batvire cave and elsewhere.
  • Taking the right ladder, rather than the left, is a faster way to exit the Batvire cave.
  • The Volt Shield makes Mega Man immune to many of the hazards in Dyna Man's stage: Sentry Bee nails, lava bubbles, and acid drops. Keeping it equipped throughout the stage means we almost never have to slow down.
  • It's possible to touch the backwards conveyor belts for only one frame between jumps. You need to press the jump button before Mega Man is visually on the ground. If you do it right, Mega Man will stay in the jumping animation and not enter the running animation.
  • Damage boosting through the hazards in Dyna Man's assembly line is faster than waiting: even while stunned, Mega Man moves at 6 pixels/frame because of the conveyor belt, compared to 8 pixels/frame when running normally.
  • The pause/weapon menu is free if it only appears for one frame. To switch to the Sonic Wave, for example: press S, press Esc, frame advance; release S, release Esc, frame advance.
  • Earlier first shots in a damageless Wily fight.
Known deficiencies and potential improvements:
  • The intervals between the stages (when the game is loading resources from disk) are slightly slower than in [2247] DOS Mega Man by DarkKobold in 02:23.55. My best guess is that this has something to do with putting C: on HDD rather than HDA. If so, then it would be better to go back to HDA: the time saved between stages would more than make up for a slightly slower boot.
  • Didn't jump out of the first ladder in Sonic Man's stage.
  • It would be better to get up to speed before equipping the Volt Shield in Dyna Man's stage.
  • In the first Dyna Man fight, I tested both Volt Shield and the buster, and the buster was faster. But in the refight, I found a fast way to do it with the Volt Shield that may also work in the first fight. The circumstances are not exactly the same, because in the refight your goal is not only to defeat the robot master but also to get to the right side of the screen as fast as possible.
2247thisdiff
boot9159−32
configuration menu32−1
title screen127129+2
intro stage386382−4
stage select146154+8
Sonic Man stage20401928−112
Sonic Man111102−9
stage select352367+15
Volt Man stage2125186−1939
Volt Man109100−9
stage select305314+9
Dyna Man stage19881783−205
Dyna Man7757−20
Wily title cards363374+11
Wily stage17341686−48
Wily10440−64
total100617663−2398
About the game's speed It's unfortunate that the game's speed is CPU-limited up to the display refresh rate. It means that the video plays back at a speed that is too fast to appreciate what is going on. What can be done about this?
  • [2247] DOS Mega Man by DarkKobold in 02:23.55 links to a separate video that is slowed down to 30 fps. It's a lot nicer to watch—the only problem is that the sound effects are longer in duration and lower-pitched than they should be.
  • Cranking JPC-RR's CPU frequency divider up to its maximum value of 256 doesn't help. It's not slow enough to make a frame take more than a refresh, so the gameplay speed is unchanged, while loading stages, etc. is slower.
  • The F1 and F2 keys are in-game speed controls. F2 decreases the game speed by inserting busy-waits into every iteration of the main game loop. Using F2, you can make the game run 2×, 3×, 4×, 5×, ... slower. It complicates timing because one iteration of the game loop now takes more than one JPC-RR "frame." The slowdown only affects the gameplay loop, not things like loading stages.
Above, I tried a compromise, which is a separate slowed-down "soundhack" video, named after the camhacks in e.g. [3584] Genesis Sonic the Hedgehog 2 by Zurggriff & Aglar in 17:40.08. The sound effects in Mega Man use the PC speaker and the programmable interval timer, which is clocked independently of the main CPU. The soundhack is a small modification to the game executable that increases the pitch and decreases the duration of all sound effects, so that they sound mostly correct when the video is slowed down. It's not perfect, because some of the high frequencies are lost, but it's much better than just slowing down all the audio. I chose to slow down the video by a factor of 5, to about 14.02 fps. I chose this speed, even though it feels a little too slow to me, because it's close to the speed you get when running in DOSBox with cycles=500, which is what speedrun.com RTA runs use. I measured the speed by counting blinks. Mega Man's blink cycle is 64 frames. I timed 10 blink cycles in DOSBox to take approximately 45.65 seconds, or 14.02 fps, which conveniently is almost exactly 1/5 of the natural framerate of a JPC-RR dump.
Editor, Experienced Forum User, Player (53)
Joined: 6/22/2005
Posts: 1011
Looks good. Was it faster to jump over the weapon tank after the second Dyna Man fight than to pick it up, or why did you do that?
Current Projects: TAS: Wizards & Warriors III.
Active player, Experienced Forum User (368)
Joined: 9/25/2011
Posts: 652
Great run, Sand! Congrats on your first TAS. I'm looking forward to voting "Yes". :)
Sand
He/Him
Experienced Forum User, Player (108)
Joined: 6/26/2018
Posts: 113
Dacicus wrote:
Was it faster to jump over the weapon tank after the second Dyna Man fight than to pick it up, or why did you do that?
Yes, it's faster to jump over (or at least equally fast). I discarded most of my notes, but for descents like that I tested 1-frame jumps at various offsets, 2-frame jumps, etc. The rule of thumb is you want to jump as high as possible, because that gives you more time to accelerate downward before reaching the drop; and jump as early as possible without clipping the corner. In some corridors with a low ceiling it's better to jump as high as possible and bounce off the ceiling. A good jump versus a not-so-good jump only translates into a difference of maybe 8 pixels or less of y position. As Mega Man's maximum falling speed is 15 pixels/frame, a better jump may not always result in him actually hitting the ground sooner. I only optimized for y position and velocity at some fixed frame number on the descent. I wrote a little Lua script to automate optimizing these jumps, but it caused a deadlock in JPC-RR due to an apparent race condition. (I didn't investigate it thoroughly.) I was able to work around it by commenting out a line in JPC-RR that restores the display after loading a savestate, but that becomes annoying when working interactively, and it was too cumbersome to switch back and forth between the two versions. So I just optimized all the jumps manually. Maybe in a future revision.
Active player, Experienced Forum User (368)
Joined: 9/25/2011
Posts: 652
Sand wrote:
I wrote a little Lua script to automate optimizing these jumps, but it caused a deadlock in JPC-RR due to an apparent race condition. (I didn't investigate it thoroughly.) I was able to work around it by commenting out a line in JPC-RR that restores the display after loading a savestate, but that becomes annoying when working interactively, and it was too cumbersome to switch back and forth between the two versions. So I just optimized all the jumps manually. Maybe in a future revision.
Hi Sand, Could you point me to the line you commented out? I would love to get this solved, as it is very annoying whenever a script I'm running stops everything, ruining what I'm trying to do.
Patashu
He/Him
Experienced Forum User
Joined: 10/2/2005
Posts: 3901
c-square wrote:
Sand wrote:
I wrote a little Lua script to automate optimizing these jumps, but it caused a deadlock in JPC-RR due to an apparent race condition. (I didn't investigate it thoroughly.) I was able to work around it by commenting out a line in JPC-RR that restores the display after loading a savestate, but that becomes annoying when working interactively, and it was too cumbersome to switch back and forth between the two versions. So I just optimized all the jumps manually. Maybe in a future revision.
Hi Sand, Could you point me to the line you commented out? I would love to get this solved, as it is very annoying whenever a script I'm running stops everything, ruining what I'm trying to do.
Sand posted more about it here: http://tasvideos.org/forum/viewtopic.php?t=20377
My Chiptune music, made in Famitracker: http://soundcloud.com/patashu My twitch. I stream mostly shmups & rhythm games http://twitch.tv/patashu My youtube, again shmups and rhythm games and misc stuff: http://youtube.com/user/patashu
Post subject: Second-draft TAS (77 frames saved)
Sand
He/Him
Experienced Forum User, Player (108)
Joined: 6/26/2018
Posts: 113
This is the second draft of my Mega Man TAS. Its time is 1:48.226 or 7586 frames, 77 frames faster than the first draft. I was planning to submit this version, but at the last minute I discovered a technique that can let you start moving 1 frame earlier at the beginning of some stages. I'm planning to rework the TAS to include the improvement; in the meantime consider this a WIP. This is the slowed-down "soundhack" encode. For the full-speed version, input files, scripts, etc., see https://archive.org/details/megamanpc-tas-1_48_226. Link to video My main motivation for doing a second draft was to machine-optimize certain tricky or tedious movements, such as jumps around corners, using a Lua script (more on this below). In addition, I found a few other minor time saves:
  • Kill the dog head-on in the intro stage. This requires you to pause for 1 frame in order to avoid colliding with the dog, but that's faster than having to turn around. The dog is unlike most (all?) other enemies in that it can only take damage once per frame, which means you have to space out your shots so that they land on different frames, which leaves less time to shoot all 8 necessary shots before the dog hits you.
  • Avoid vertical camera recentering delays caused by jumping from a lower to a higher platform. When Mega Man lands on a higher platform, he becomes frozen in place for a few frames while the camera scrolls vertically to recenter on him. (There are a few special cases in the underwater section of Sonic Man's stage where you can avoid the vertical recentering, but only if you touch the higher platform for just 1 frame.) The recentering delay doesn't occur when jumping from high to low or to an equal height. This means that if a sequence of platforms goes high–low–high, it's better to jump over the middle platform, rather than down and back up, even if you never stop running. You can see the benefit by comparing the lava section of Dyna Man's stage in this draft and the first draft.
  • Avoid horizontal camera recentering delays when exiting boss arenas. After each of the boss refights in the Wily stage, there is a delay while the camera recenters on Mega Man. The camera moves at 8 pixels per frame, which is equal to Mega Man's running speed. Therefore, contrary to intuition, there's no advantage to being closer to the exit door when the boss dies (as long as you are on the same half of the screen)—you have a shorter distance to run but the camera has a longer distance to scroll, and they cancel out. The exception to this is the camera's first frame of movement: if Mega Man's x position is not a multiple of 8, the camera's first movement will be less than 8, in order to align itself with Mega Man's position—costing 1 additional frame. You can avoid the extra frame by shuffling your feet to get the proper alignment before the camera starts moving. The best position to be in, after killing the boss, is aligned to a multiple of 8 pixels, moving towards the exit door at maximum speed—the specific x coordinate doesn't matter, as long as you are aligned and on the correct half of the screen. This technique only applies to the refights; the camera doesn't move after beating the bosses the first time.
  • In the room with wall blasters in Sonic Man's stage, shoot the wall blaster and allow its explosion to damage you. This is slightly faster than waiting for the wall blaster to shoot a bullet at you.
  • Against Dyna Man, use the Mega Buster until close enough to use the Force Field. The Buster does 2 HP of damage and the Force Field does 6, but you can't use the Force Field until you are close. The boss has 32 HP, so shooting him 4 times with the Buster saves 2 uses of the Force Field (2 frames). Using the Buster only matters in the first Dyna Man fight, because the only goal is to kill the boss as quickly as possible. In the refight, the goal is to kill the boss and cross the screen, so the Buster doesn't give an advantage because you are limited by Mega Man's running speed anyway.
  • Use the Nuclear Detonator in the Sonic Man refight. The Nuclear Detonator is a slow, awkward weapon: it doesn't shoot very far and there is a delay of 16 frames before you can detonate it. It is Sonic Man's weakness, doing 16 HP of damage (out of 32), but I had discounted the possibility of using it because shooting the Nuclear Detonator twice is slower than just spamming the Buster. That is, until until I saw this video by Psychedelic Eyeball, which showed me that you can hit Sonic Man twice with the same shot.
  • Take advantage of RNG manipulation. I reverse-engineered the AI of certain enemies including bosses. Volt Man's and Dyna Man's jumps are random: Volt Man's (xy) velocity is random in ({4, 6}, {14, 16}); similarly Dyna Man's is random in ({4, 5, 6, 7}, {7, 9, 11, 13}). Against Volt Man, only the y velocity is important: you want a short jump because he becomes vulnerable only after he lands (saves 2 frames). Against Dyna Man, both components matter: you want him to jump toward you at maximum speed so that you can use the Force Field sooner, and not to jump so high that he's out of reach. The Raptorbot that I kill in Volt Man's stage and the Sentry Bee I kill in Dyna Man's stage are sacrifices to get favorable RNG against the bosses.
Regarding entertainment, I tried to make as many 1-ups drop as possible (1/64 chance) without losing time. I managed to get 9 1-ups to drop, out of 35 kills. I also attempted to humanize the run a bit by avoiding 1-frame shots (press and release Space on the same frame) except where needed.
#2247first draftdiffsecond draftdiff
boot9159−32590
configuration menu32−120
title screen127129+21290
intro stage386382−4376−6
stage select SVD146154+81540
Sonic Man stage20401928−1121902−26
Sonic Man111102−9100−2
stage select _VD352367+15368+1
Volt Man stage2125186−19391860
Volt Man109100−998−2
stage select __D305314+93140
Dyna Man stage19881783−2051768−15
Dyna Man7757−2052−5
Wily title cards363374+113740
Wily stage17341686−481666−20
Wily10440−6438−2
total100617663−23987586−77
The optimization Lua script deserves special mention. A lot of the smooth movement in this TAS—just barely avoiding a bonk while going around corners—is due to computer optimization. The script takes as input a search space over sequences of keypresses, tests each one of them (repeatedly reloading an initial savestate), and outputs the one that gives the best result according to some metric function. Say, for example, you need to climb a ladder after running right through a corridor. You want to jump before grabbing the ladder because jumping is faster than climbing, except near the top of the jump where climbing is faster. If there's a low ceiling, you don't want to jump too early, or you'll bonk your head, but jumping too late wastes time. You may also need to stop moving right at some point, or you'll go past the ladder before reaching the full height of your jump. Here's a real example from the TAS:
-- Optimize jump and batcave exit ladder
-- Start at frame 2161, x=131.12
optimize(pattern(pad(12,
	overlay(
		concat(rep(0, 3, frame()), atom(KEY_J)), -- jump
		concat(rep(4, 6, frame()), atom(KEY_RIGHT)), -- stop moving right
		concat(rep(6, 10, frame()), atom(KEY_UP)) -- grab
	)
)), metric_going_up)
What this means is, try waiting between 0 and 3 frames before jumping (KEY_J). Try waiting 4 to 6 frames before releasing Right, and try waiting between 6 and 10 frames before pressing Up. (These bounds were found through manual experimentation.) Overlay these three input sequences so they happen concurrently. Pad all the inputs to a length of 12. Return the sequence that does the best according to the metric_going_up function, which is
function metric_going_up()
	return {-megaman_y(), -camera_y(), -megaman_dy()}
end
In this example, the script will test all 4×3×5=60 possibilities before outputting
-- best schedule is	{{}, {36}, {}, {}, {}, {}, {205, 200}}
-- best score is	{-563, -512, 0}
Which means: jump (keycode 36) on frame 2, and press Right (205) and Up (200) on frame 7; the best y position you can get after 12 frames is 563. I used this optimize script in 46 places. Some of the instances went through thousands and inputs and took a few hours to run, which accounts for the large number of rerecords. I found out about the horizontal camera recentering alignment issue when the script output some surprising sequences; the script figured out that you need to get your x alignment right. The script needs a patch to JPC-RR, or else it quickly deadlocks the whole process. A side effect of the patch is that you no longer get an instant screen refresh after loading a savestate, which is annoying but you get used to it 😄 In addition to the optimization script, I used a HUD script that shows HP and hitboxes, with additional information off to the side. The game draws the most recent frame while already having computed the next frame, so seeing the hitbox overlay is a little like seeing 1 frame into the future. The HUD script shows the RNG sequence, which is how I knew when a 1-up was approaching. The potential enhancement I mentioned at the beginning: Say a stage appears visually onscreen at frame X. So you try frames X and X−1 and find that the game actually starts accepting input at frame X−1. I had already done this in every stage. But it turns out that in some stages, you can actually start moving at frame X−2, if you place the input later in the frame and not right at the beginning. So at frame X−2 you might insert some padding inputs at the start of the frame before the input you want: Up Up Up Up Up Up Up Up Up Up Right, and sometimes this works.
Post subject: Re: Second-draft TAS (77 frames saved)
Active player, Experienced Forum User (368)
Joined: 9/25/2011
Posts: 652
Wow! Well done. I'm really impressed with all the work you've put into this, and how you're squeezing every last frame from it. Your lua-fu is especially strong, and puts mine to shame. I think I'm going to copy some of your code for runs in the future. ;)
Sand wrote:
So at frame X−2 you might insert some padding inputs at the start of the frame before the input you want: Up Up Up Up Up Up Up Up Up Up Right, and sometimes this works.
At the normal CPU divider, frames are roughly 14 ms long. However, inputs often register at many intervals during those 14 ms. I had to do the same thing with the cd-man TAS, often padding input with space bar to try and position my directional input exactly where I wanted it. TASScript allows you to precisely define your input down to the sub-millisecond, avoiding the need for padding inputs. However, since you only need to do this at the start of a few stages, it may not be worth switching emulator versions just for that. On the other hand, if you want to avoid having to redo the entire TAS all over again, it may well be worth giving it a try. Another thing to keep in mind is that the directional arrows take twice as long to register in JPC-rr than other keys. There may be some tiny savings by using the number pad or other key input instead of the arrow keys. Still eagerly awaiting the submission!
Post subject: Third-draft TAS (5 frames saved)
Sand
He/Him
Experienced Forum User, Player (108)
Joined: 6/26/2018
Posts: 113
The third draft of the Mega Man TAS. This one applies the sub-frame input technique mentioned in Post #477849 to save 5 frames overall. The total time is 1:48:154 or 7581 frames. Now I'm out of ideas, so I'm planning to submit this one. This is the slowed-down "soundhack" encode. Click through and enable captions! The full-speed version, input files, scripts, etc. are also available through the link. Link to video The sub-frame input technique can save up to 1 frame during stage select or at the beginning of stages. Relative to the second draft, it saves 1 frame in each of these places:
  • stage select before Sonic Man's stage
  • beginning of Sonic Man's stage
  • stage select before Volt Man's stage
  • stage select before Dyna Man's stage
  • beginning of Dyna Man's stage
The same technique gives you control over Mega Man 1 frame sooner at the beginning of Volt Man's stage, too—but it doesn't save time because you must wait to be hit by the spark anyway. I had already used the technique at the beginning of Wily's stage in the second draft, so it doesn't save additional time here. (The Wily title cards finished one frame faster, so it was a wash.) Sonic Man's stage is more sensitive to RNG than any of the others, so starting the stage a frame earlier required reworking most of it. I still manage to get three 1-ups, but they are in different places. The other stages are pretty much copy-paste jobs from the second draft, with only minor changes. The extra frame enabled me to get an additional two 1-ups in Dyna Man's stage, and I threw in a quick demonstration of the zero-gravity tiles at the end of Wily's stage.
#2247first draftdiffsecond draftdiffthird draftdiff
boot9159−32590590
configuration menu32−12020
title screen127129+212901290
intro stage386382−4376−63760
stage select SVD146154+81540153−1
Sonic Man stage20401928−1121902−261901−1
Sonic Man111102−9100−21000
stage select _VD352367+15368+1367−1
Volt Man stage2125186−193918601860
Volt Man109100−998−2980
stage select __D305314+93140313−1
Dyna Man stage19881783−2051768−151767−1
Dyna Man7757−2052−5520
Wily title cards363374+113740373−1
Wily stage17341686−481666−201667+1
Wily10440−6438−2380
total100617663−23987586−777581−5
Editor, Experienced Forum User, Player (53)
Joined: 6/22/2005
Posts: 1011
Why did you pause at approximately 5:00? Was it related to the vertical camera recentering delays? Or RNG manipulation?
Current Projects: TAS: Wizards & Warriors III.