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

TAS studio split and join sections of the script #110

Draft
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

Eddio0141
Copy link

@Eddio0141 Eddio0141 commented Nov 17, 2024

How to mark a script split

  • save line
  • reset line
    • For the sake of smoother editing, once either clients reach this point and reset, it would store the non-shared RNG state to be used on split
    • You must add a bxt-rs-split <name> for this operation
  • Adding a comment on the script bxt-rs-split <name>
    • Difference with save and this is this, this wouldn't load a save if you do bxt_tas_studio_replay and the script replays from before the comment split marker

How does this work

  • If you edit after marker save1, the simulator will start running from the save1 point, as long as the save is valid
  • If you edit before the marker save1, the markers will be invalidated and the simulator must regenerate the saves again

What happens with bridged hltas

  • Nothing, you will always see the full script in this

Shared RNG

If using a comment split marker, shared RNG is updated to not cause desyncs from shared RNG mismatching after split load

TAS editor stuff

  • Some visual indication on split marker to be added
    • Maybe separate indicators for a comment marker, and the others
  • Command to let you hover over and split / join, which would split / join that selected framebulk via the comment split marker
    • I think this is necessary. It would allow for doing this process visually without messing with alias stuff, as well as doing it in the bridged hltas easily via comment split markers and such

Split bookmark

  • A command that lets you choose a segment to edit: bxt_tas_studio_bookmark <name>
    • Name coming from a unique name from the split markers, otherwise it is invalid
  • It will replay the TAS on the main client until it reaches the split, which then it will open the editor
  • This will limit what you can edit to be in the split segment
  • Marking another split marker in this mode will literally split the editable region
  • You can see the frames after the current segment with bxt_tas_studio_bookmark_unhide <frame_count>, repeating using the command will keep unhiding that amount of frames, you can't edit the frames shown here, but you can see it update from the editor + simulator
  • Undo choosing segment by passing an empty argument to bxt_tas_studio_bookmark

@YaLTeR
Copy link
Owner

YaLTeR commented Nov 18, 2024

I guess there needs to be some command to split while inside the editor.

bxt_tas_studio_hide would split the script, if you hide up to the line with the split marker

I already forgot if hide does anything other than visually hide, but what exactly happens when you do this and why is it tied to hide? I guess then the editor starts showing only the post-split part?

I kind of imagine splitting to be transparent in the editor, like you put a split marker and it just renders there, then if you edit after the split marker it replays the post-split part, whereas if you edit before, it replays and invalidates the whole thing. Hiding up to the split marker can be just a quality of life command, but why should hiding itself do something?

@Eddio0141
Copy link
Author

I already forgot if hide does anything other than visually hide, but what exactly happens when you do this and why is it tied to hide? I guess then the editor starts showing only the post-split part?

I'm mostly thinking about this idea with very big scripts. It would be too messy to work on the end of that big script in the first place with too many lines showing together in the first place, so I thought of combining both.
Current idea is that, in the editor, if you hide past the split comment (or some save load), it would automatically use that point of the script to load a save, which would speed up the simulator and replay

That idea to make it more explicit seems good though. Hiding in this case wouldn't need changes and overall the splitting still functions the same way.

@Eddio0141
Copy link
Author

Also more additional things.
It might be worth introducing some bookmark command, which would let you edit a segment, starting from some split (bookmark) and only making framebulks visible up till the next split.
If you were to use TAS studio to edit earlier sections of the script later, it would be very hard or impossible to do on a big script, and cherry picking a segment would be important.
Though this is for later, maybe in another pr.

@YaLTeR
Copy link
Owner

YaLTeR commented Nov 18, 2024

Hmm, yeah, but also you may want some part of the script to show up to make sure you lined it up properly

@Eddio0141
Copy link
Author

One idea I have is to show an additional set amount of frames from after the bookmark segment ends, maybe something like 250 frames by default and let you customise as you need if you want to peek more into the script, since there could be something like a cutscene you want to wait, or the default is too little because of the low frametime, etc

@YaLTeR
Copy link
Owner

YaLTeR commented Nov 18, 2024

Fwiw I had the same conundrum with seeing too much into the past of the script and decided to only have manual hide because you can't really tell what's a good value for all scripts

@Eddio0141
Copy link
Author

Eddio0141 commented Nov 18, 2024

In that case, it could be a command to unhide past the current segment as needed
Something like bxt_tas_studio_bookmark_unhide 1000 to see 1000 frames after
Avoids showing too much script from choosing segment in the first place, and you could just bind it to repeat
I don't think manual hovering works well in this scenario

Comment on lines +392 to +395
// TODO: is this fine? not sure how else to get MainThreadMarker for game directory
unsafe {
SplitInfo::validate_all_by_saves(&mut splits, MainThreadMarker::new());
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this fine?

src/modules/tas_studio/editor/db.rs Show resolved Hide resolved
pub ready: bool,
// TODO: timing on grabbing rng values
// TODO: how do i get shared rng from engine?
// TODO: i most likely need to add this information being sent from a sim client, how can this be done in a clean way
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I check SplitInfo for ready state inside apply_accurate_frame, I need shared and non-shared RNG so splits can use those information
Is it fine to just give those information in AccurateFrame struct? I don't know the alternate way to grab those information from whatever is sending AccurateFrame

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

Successfully merging this pull request may close these issues.

3 participants