EverestAPI / CelesteTAS-EverestInterop

Everest interop for DevilSquirrel's CelesteTAS
https://github.com/EuniverseCat/CelesteTAS
MIT License
67 stars 28 forks source link

Add direct compatability with TAS Recorder #43

Closed psyGamer closed 1 year ago

psyGamer commented 1 year ago

TASRecorder is a mod I made, which allows you to create frame-perfect recording of TASes. This add compatability with StartRecording and StopRecording commands. You can also directly record an entire TAS from Studio. (File -> Record TAS) Savestates, breakpoints and fast-forwarding are ignored while recording.

Please let me know before releasing the version with this PR, because I'd like to release TAS Recorder at the same time.

I needed to make some changes to the .csproj files, so that everything compiles on Non-Windows platforms. I don't think this should cause issues with the CI or manually compiling on Windows.

DemoJameson commented 1 year ago

awesome

jsut experienced it

  1. can you popup a friendly tooltip and stop tas when starting recording but tasrecorder is not installed or ffmpeg is not inistalled
  2. when I record the whole tas through the studio menu, if I pause in the middle and then continue, the recording will stop before the tas playback ends
  3. when using StartRecording command without specify frames, it immediately stops recording, creating an unplayable mp4 file
psyGamer commented 1 year ago
  1. What exactly you do mean by tooltip? Something like the toast when a console load fails? Also should there be both the studio popup and the toast or just one?
  2. There are two options:
    1. Simply disable pause while recording
    2. Pause the recording I could implement either although 1 would be easier.
  3. That didnt happen while testing but maybe I broke something since then
DemoJameson commented 1 year ago

1 Yes, it's the usual toast when a command fails, just show it in game only 2 Both options are fine.

psyGamer commented 1 year ago

I tried it with the tagged and lastest build on a Windows VM and StartRecording worked normally there, so idk whats going on. One thing thats still not working quite right are breakpoints inside or after a recording block. Currently the fast-forwarding gets canceled, however the first few frames aren't recorded. I don't really know why my attempts didn't work but it would be great if you could implement this correctly.

DemoJameson commented 1 year ago
  1. The StartRecording command works fine when starting the game, but it doesn't work as long as StartRecording frames has been used
psyGamer commented 1 year ago

Thanks. However when testing this in a Windows VM with a fresh Celeste install it worked perfectly fine. Could you try the latest master build? I feel like FFmpeg isn't installed correctly or outdated. The ffmpeg_install command currently only works while the mod is zipped. If you have it as a folder, you either need FFmpeg installed system/user-wide, or after running ffmpeg_install, drop the DLLs from Mods/Cache/unmanaged-libs/lib-win-x64/TASRecorder into bin/lib-win-x64

psyGamer commented 1 year ago

Also i just tried your patch, however with the following TAS, the first about 29 frames get skipped in both breakpoint cases:

console load 1
 300
StartRecording
 100,J
***
 100
StopRecording
 100
#***
 100
DemoJameson commented 1 year ago

yeah, i haven't look into it but i found still has 1 frame get skipped even without breakpoint image

psyGamer commented 1 year ago

The fact that the first frame is skipped is know, however currently not important enought to be fixed, since it complicates things a lot and almost nobody would actually notice it:

Frame 1: orig_Tick: Update() - Recording gets started Render() - Not captured, because this is still in orig

Frame 2: hook_Tick: Update() Render() - First captured frame

DemoJameson commented 1 year ago

The number of frames being skipped doesn't seem to be fixed I have no good idea maybe stop fast-forwarding a few dozen frames earlier?

psyGamer commented 1 year ago

Well, what needs to happen is once the StartRecording command is hit, only call update everything once per Engine.Update call. What I feel like is current happening is, that the fast-forward updates everything multiple times per Engine.Update call until the next Engine.Update call, at which point it only updates everything once. However the check which I add should techincally cover that case, but it doesn't.

DemoJameson commented 1 year ago

@psyGamer can you check whether if the frames skipp issue is fixed

psyGamer commented 1 year ago

Yeah no more frames are skipped. It feelsa bit like hacky solution, but as long as it works, it works.

psyGamer commented 1 year ago

One thing I noticed was that since the start and stop times are static, multiple recording blocks aren't properly handled while fast forwarding, since only the last block gets recognized. Also since the start and stop times are known, should I implement the target time for regular blocks as well?

DemoJameson commented 1 year ago

guest I can make it support multiple blocks what do you mean 'regular blocks`

psyGamer commented 1 year ago

By regular blocks I mean start/stop blocks without a frame count directly specified

DemoJameson commented 1 year ago

If you don't have anything to change, I'm going to merge it and release a new version

psyGamer commented 1 year ago

Missclicked... I'd like to get everything ready for the realease and then I'll let you know. This shouldn't take too long.

psyGamer commented 1 year ago

Alright, everything seems to work. You can release the version and I'll follow with TAS Recorder

psyGamer commented 1 year ago

@DemoJameson actually, I just noticed two things:

  1. The optional dependency should be 1.0.1 since thats the version where IsFFmpegInstalled() was added
  2. The commands docs should probably also mention StartRecording and StopRecording

Not really urgent, because nobody should even have 1.0.0 installed and the docs can be updated later. However I noticed that you reverted the release. Is there anything still missing/not working besides the above mention things?

DemoJameson commented 1 year ago

@psyGamer can you push another pr for adding the commands docs and upgrade the tas recorder version

psyGamer commented 1 year ago

Sure

DemoJameson commented 1 year ago

@psyGamer you didn't upgrade the version in the TASRecorder-v1.0.1.zip file https://github.com/psyGamer/TASRecorder/releases/tag/1.0.1