Speedrun Playback + Record Tool vA

0
0
Published 2023-06-12


TO LOAD THIS CART in immediate mode, type load #playback_a

VVhat's new ?
(01-17-22)
✅ New BTN() can now be called with no arguments, returns numeric of all buttons, thanks to @SmellyFishstiks.
✅ Beefed up the documentation and usage instructions.

This program will let you record and playback keystrokes, including saving your code with those compressed keystrokes in very small code indeed.

First off, the record and playback routine is 436-characters total, so this entire method is pretty small at that. Add about 46-characters for each of the functions record() and play() and you're home free !

Further I did not make this game. It is JELPI, written by @zep, a demo game which is included when you purchase Pico-8.

What I have written are two primary functions. One to record keystrokes as you play the game and transfer them to the clipboard as new source code - and the other is to simply play them back as you have listed.

This replaces the btn() function with my own. Include the 3-functions that + typing at the top of your code: _b0=btn and you are perfectly done. Nothing whatsoever else is needed. See the code below on usage:

When you choose RECORD, you can play the game as normal with no changes to your sourcecode. Every keystroke is recorded through a new version of BTN() as you can see. To stop recording at any time by press all 4-arrow keys at the same time, this will also stop the cart and return back to the editor. Then you can choose a line of your source code and press CTRL+V to paste the new button set you just used to play your game. It might appear like this:

Then select PLAYBACK after the btnpb= definition and run your cart again. You will see all of your keystrokes played back exactly as you did them with exact timing and everything. When the end of your keystrokes is reached, game input returns to normal and you can continue playing your game right where it was left off.

There is slight compression in here in that it counts the number of cycles you repeat a keystroke or series of keystrokes. So it doesn't just record 30-numbers for 30-frames of data, that would make the data too big. In fact to play this entire demo game of JELPI above from beginning to end took only 265-numbers or true 687-characters of space.

There are more details and instructions in the cart listed above, examine them for additional assistance.

And that's it ! Choose RECORD first and play the game as well as you can. When done recording press all 4-arrow keys together. Return to your code and Press CTRL+V to paste the new btnpb (button playback) string. Then select the PLAYBACK function instead of record, run the code, and sit back and watch it.

If you want to, paste your own Pico-8 cart playing back your own movements for the game, to show everyone else how well you can play it.

If greater compression over raw numbers is desired, (6-bit characters for instance), I can certainly write that for you and increase the btn() function in size slightly with higher compression in the data table.

Thanks to @Cadaeib65 for getting my brain spinning on this.

Hope This Helps !