joncampbell123 / dosbox-x

DOSBox-X fork of the DOSBox project
GNU General Public License v2.0
2.8k stars 383 forks source link

TAS recording feature #849

Open QuakerRUS opened 6 years ago

QuakerRUS commented 6 years ago

It will be great if you will add feature for recording tool-assisted speedruns (like rerecording and speed control / slow motion), because there is no emulators with this feature working properly with dos/windows games. JPC-RR (DOS) and Hourglass (Windows) development abandoned and this emulators have very limited functionality.

joncampbell123 commented 6 years ago

DOSBox-X does have CTRL+Pause to pause emulation. When paused, spacebar can single-step frame by frame.

If I were to add only speed up/slowdown as an option, would that be a good first step?

QuakerRUS commented 6 years ago

Thanks for your interest to this request! I am afraid to make a mistake because I never recorded TAS by myself, and I asked TASVideos.org community to help answer this question. :)

vadosnaprimer commented 6 years ago

Sorry for the criticism towards the whole dosbox environment that I gave in the forum thread, but for the sake of productivity, I can give a few advices about TAS features.

The 2 most fundamental things for TASing are movie recording (input replay file) and fully deterministic savestates. Ability to dump lossless video and audio is also required, but I know dosbox can do that already. Ability to look at the memory of the emulated system is also very important, because a tas won't be optimal without this information. And yes, frame advance.

Savestates and input replays are merged together conceptually. Determinism means that every time you replay a certain input sequence, the system should get in the same identical state in its entirety. Not just the values of all the RAM cells, but all states of all CPUs involved, etc. Full serialization of the device. If the state is non-deterministic, then after it's been loaded in different conditions that affect it, it will cause a movie desync. Average rate of state reloads for a tas is several saveloads for every frame of the movie. A 10-minute movie may have 10k state reloads. Every such reload is required to put the machine into the same exact state.

Movies are a part of it in a sense that every savestate contains a movie that leads to it. You load a state in read-only mode and only the state itself gets restored. You load it in read+write mode, and your current movie is replaced with whatever input sequence is embedded in the savestate. That way, you can record a second of input, save a state X, record some more, save a state Y, then load X, record a different input sequence and save that as state Z. Then you load Y and Z in turns and they restore all the input that led to them respectively. So whatever state you resume recording from determines what input ends up in your final movie.

More info on rerecording: http://tasvideos.org/LawsOfTAS.html

Tip: The most modern approach to movies and savestates is using a zip-like container and throwing all the blobs in there. That way both can be endlessly expanded with future additions without having to change the format. And movies are best done in a text form. Attachment is a savestate that lsnes emulator uses. lsnes.lsmv.zip

joncampbell123 commented 6 years ago

Good to know. DOSBox-X may not fit that criteria for a while yet, but this is worth keeping here for reference.

sikthehedgehog commented 6 years ago

Forgot: does DOSBox-X have frame advance? (I think not, but doesn't hurt to ask) That seems like the easiest feature to implement now and could probably help for more than just TAS (e.g. people who want to analyze what a game or demo is doing in a particular scene, or who want to take a screenshot of a particular keyframe, etc.).

EDIT: nevermind, just noticed it's mentioned earlier in the thread (´・ω・` )

joncampbell123 commented 6 years ago

If examining the game frame-by-frame is desired, don't forget DOSBox-X inherits the video capture function from DOSBox SVN as well.

sasko2k commented 3 years ago

Sure hope this gets done eventually, it would be an awesome feature since all other alternatives kinda suck and are all abandoned.