Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Input State batch file #212

Open
SpiceWare opened this issue Aug 23, 2017 · 10 comments
Open

Input State batch file #212

SpiceWare opened this issue Aug 23, 2017 · 10 comments
Milestone

Comments

@SpiceWare
Copy link
Contributor

SpiceWare commented Aug 23, 2017

During a discussion about Todd Roger's score in Dragster, it became apparent that a way to play back a sequence of the input state values would be handy. A text file containing something like this:

RESET
10
LEFT
5 FIRE
LEFT
LEFT FIRE
...

would be used like this:

  1. hold RESET for 1 frame (1 is default if no leading number is found)
  2. nothing for 10 frames
  3. hold left for 1 frame
  4. hold fire for 5 frames
  5. hold left and fire for 1 frame
  6. ...
@thrust26 thrust26 added this to the Prio 2 milestone Aug 23, 2017
@sa666666
Copy link
Member

There's already something somewhat similar to this in the code, but it's commented out. I experimented with the ability to do what I called 'event recording'. Basically, when this was turned on, an initial state save was done, and then for every frame, the events generated were also saved. Upon 'replaying' the recording, the state file was reloaded, and the events replayed. In effect, the emulation ran itself, as if someone was inputting the events. But they were synthetic, not from an actual player.

This sounds very much like what is needed here. The only difference is that the events are read from some external file, vs. from an event recording generated by Stella itself. A very cool thing to have, if we ever find time to do it.

@thrust26
Copy link
Member

IMO we should use an universal, editable format e.g. XML

@DirtyHairy
Copy link
Member

This would be pretty useful for testing (haven't forgotten about that) and benchmarking as well. As a format: please not XML --- I always get nervous cramps when trying to write XML without a XSD and full IDE support 😉 What about YAML? It is easy to read, easy to write, and there are parsers aplenty out there.

@thrust26
Copy link
Member

thrust26 commented Aug 24, 2017

An XSD would be no problem. But whatever you prefer, even key/value pairs should work.

@SpiceWare
Copy link
Contributor Author

SpiceWare commented Aug 24, 2017

Maybe a batch file for the debugger would be simpler/quicker to implement. There's already a frame command so would need new commands to set the bits in SWCHA, SWCHB, INPT4, etc and a new command RUN {batfile} to read in the file and act as if the user typed them in a line at a time.

; frame 1
RESET=ON
FRAME
; frame 2
RESET=OFF
LEFT=ON
FRAME
; frames 3-7
LEFT=OFF
FIRE=ON
FRAME 5
; frame 8
FIRE=OFF
...

So the frame would only advance when you issue a FRAME command and values would stay set to whatever you last set them to.

@thrust26
Copy link
Member

What frame command do you mean?

@SpiceWare
Copy link
Contributor Author

type HELP in the debugger's prompt and you'll see a list of commands, frame is one of them. Type frame by itself to advance the emulation a single frame, or type frame # to advance it multiple frames. # is a hex value so frame 10 would advance 16 frames.

@thrust26
Copy link
Member

Ah, I thought you meant the command line.

@SpiceWare
Copy link
Contributor Author

Aha - yeah, I was thinking it would be faster to take advantage of the command parser that's already in place than to create a new parser.

@thrust26
Copy link
Member

I think could be further enhanced, e.g.

  • recording this file during play
  • fast forward to frame n (or for n frames)
  • create savestate
  • load savestate (initial state)
  • ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants