how to frame-step with ease (just one keystroke!) in Lemmings 2 using DOSBox

Started by ccexplore, July 28, 2010, 12:15:22 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ccexplore

Man am I busy nowadays.  But fortunately I have scrapped together enough time here and there, and now I finally have some time to post some interesting findings interspersed in my past few weeks of chaos.

I'll start with this post, a wonderful technique to frame-step in Lemmings 2 w/o the pain of pressing Spacebar quickly followed by P, and then go from there with a new-ish Lemmings 2 glitch (another thread) and then some unexpected challenge results made possible (yet other threads, with movies attached!).

So, how to make DOSBox do Spacebar+P for you.  I've finally discovered the keymapper in DOSBox, and more importantly, figured out how to use it, and found out a neat way you can configure it so that when you press an otherwise useless key like [ in Lemmings 2, DOSBox will translate that for you into Spacebar followed immediately by P.  Voila, frame-stepping using a single keystroke!

Here's a step-by-step guide to turn your [ key into the frame-step key for L2.  Feel free to substitute [ with whatever other key suits you, as long as it's not a key that L2 already uses (otherwise you lose the use of that key in DOSBox and thus in L2):

1) run DOSBox
2) activate keymapper screen by pressing Ctrl+F1
3) click on the Spacebar key under the "keyboard layout" graphics in the keymapper
4) at the bottom you should see EVENT: key_space and BIND: Key space.  Click "Del" at the right until the BIND: line disappears.
5) now click "Add", then press [ on your keyboard.
6) click "Add" again and then press Spacebar on your keyboard
7) now click on the P key in the "keyboard layout" graphics
8.) click "Del" to remove BIND:ings for key_p
9) click "Add" and then press [ on your keyboard
10) click "Add" again and then press p on your keyboard
11) now click on the [ key in the "keyboard layout" graphics
12) click "Del" to remove the original BIND:ings for the key we're trying to re-assign (the [ key)
13) finally, click "Save" button at the bottom to make the changes permanent (so you don't have to repeat this ritual every time you start DOSBox), and then click "Exit"

Test it out in DOSBox's "DOS prompt" screen by pressing the re-assigned [ key.  You should see it generate a space followed by p in DOSBox.  And if you try it in L2 while paused, you'll see that it does exactly what you expect when you press Spacebar followed by P the hard way--it frame-steps the game by one frame!

Cool! http://www.lemmingsforums.com/Smileys/lemmings/cool.gif" alt="8)" title="Cool" class="smiley" /> Except as it turns out, it's not 100% reliable--once out of like 50 times or so of using it, the game may fail to pause after the frame-step! http://www.lemmingsforums.com/Smileys/lemmings/angry.gif" alt=">:(" title="Angry" class="smiley" /> http://www.lemmingsforums.com/Smileys/lemmings/XD.gif" alt=":XD:" title="XD" class="smiley" /> Needless to say this can be extremely painful since unless you have quick reflexes and respond with the P key, such an encounter of bad luck will probably ruin whatever you were trying to do that needed frame-stepping in the first place.  But it happens infrequently enough that most of the time you'll praise it rather than curse it--precision moves not involving the fan can now be accomplished much more reliably in L2.

Another deficiency with this technique is that keyboard autorepeat doesn't work for the unusually re-assigned key:  that is, press and hold [ doesn't auto-repeat the framestepping.  Instead DOSBox generates one Space keystroke, followed by a stream of only P keystrokes for the auto-repeat.  I'll have to investigate more and see if there's another way to map the keys to get around this deficiency (though I'm not optimistic).  But still, except in cases like frame-stepping through the Medieval dragon, this deficiency shouldn't be too big a deal for the occasional frame-stepping needs.

ccexplore

I just noticed that if you restart DOSBox after saving the keymapper settings, and try out the remapped key for framestepping in DOSBox's "DOS prompt", you would see p followed by space, which looks wrong.  However, it still works for framestepping when in Lemmings 2.  (In fact, I just tried out manually pressing p followed by space, and that could indeed work for framestepping, though of course if you're not fast enough it just unpauses.)

So I guess L2's internal keyboard handling must have a priority scheme whereby if you press the p and space key very closely in time (perhaps within the same frame), it works out such that it will step a single frame no matter which key actually followed which.  It also makes me wonder whether the reliability problem (ie. sometimes it just unpauses rather than frame-steps) is because DOSBox is actually sending out p followed by space all this time I've been using it. http://www.lemmingsforums.com/Smileys/lemmings/shocked.gif" alt=":o" title="Shocked" class="smiley" />

I find that you can restore the "space follow by p" ordering seen in DOSBox DOS prompt if after restarting DOSBox, you remap just the p key again (ie. redo steps 7-10 above).  I'll have to start doing that and see if it helps with the reliability issue.

ccexplore

http://www.lemmingsforums.com/index.php?topic=367.msg8715#msg8715">Quote from: ccexplore on 2010-07-29 16:36:26
I find that you can restore the "space follow by p" ordering seen in DOSBox DOS prompt if after restarting DOSBox, you remap just the p key again (ie. redo steps 7-10 above).  I'll have to start doing that and see if it helps with the reliability issue.

 http://www.lemmingsforums.com/Smileys/lemmings/XD.gif" alt=":XD:" title="XD" class="smiley" /> Unfortunately even if I do that, I still find that once in a while it'll still accidentally unpause. http://www.lemmingsforums.com/Smileys/lemmings/huh.gif" alt="???" title="Huh?" class="smiley" /> I really don't understand why, I even try random things like turning off sound and music (on the off chance that they may somehow interfere or interrupt keyboard processing from time to time), but the accidental unpause still happens.  Maybe a little less often than before but I'm not even really sure about that.  I've tried both giving some time between pressing the framestepping key, and pressing the key repeatedly very quickly.  Accidents still possible in both (although pressing the key quickly does have the advantage of helping you recover from an accident much better, so maybe I'll start doing that).

So I'd say you can probably don't bother with remapping the p key every time you start DOSBox just to get it to space followed by p.  It seems either ordering works and the reliability issue still occurs in both.

I've attached my latest attempt at Sports 1 1-bomber solution, where I got pretty close but still got my 4th killed lemming around 7:23. http://www.lemmingsforums.com/Smileys/lemmings/XD.gif" alt=":XD:" title="XD" class="smiley" /> http://www.lemmingsforums.com/Smileys/lemmings/sad.gif" alt=":(" title="Sad" class="smiley" />  I may need to look at more advanced ways to do framestepping outside of using DOSBox's keymapper.  I know of programming techniques I can try to inject keystrokes directly into DOSBox where maybe I can have more control over the timing of the keystrokes and so forth.  If nothing else, I can probably find a way to make the framestepping work on key auto-repeat so I don't have to press the key repeatedly for ages in something like Sports 1.  (And to be fair, the balls going out of sync is just as much of a factor in making life complicated in Sports 1 as the accidental unpause.)