Skip to content

Demo Seeking, Attempt 3 - #148

Open
Patiga wants to merge 5 commits into
heinrich5991:masterfrom
Patiga:seek-demo3
Open

Demo Seeking, Attempt 3#148
Patiga wants to merge 5 commits into
heinrich5991:masterfrom
Patiga:seek-demo3

Conversation

@Patiga

@Patiga Patiga commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Here I just went with the existing readers and added the required functionality.
I like the relatively small changes, and think this is the best solution for now, and also mergable.

In the interpreted reader interface I needed to expose if a tick chunk is marked as a keyframe. This is a breaking change sadly.
The only immediate change I would recommend alongside this one is to rename the ddnet module to something else, as it is generic over the protocol.

@Patiga Patiga mentioned this pull request Jul 8, 2026

@heinrich5991 heinrich5991 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Looks very well-thought out. Thanks for the PR.

It'd be best if this wasn't a binary, but a test that was automatically run on changes, but I don't have a repository of demos right now and wouldn't know where to store them without bloating this git repository, so whatever. The binary is a good building block for such a test.

Comment thread demo/src/reader.rs
Comment on lines +128 to 131
if matches!(marker, TickMarker::Delta(_)) && keyframe {
warn.warn(Warning::DeltaTickKeyframe);
keyframe = false;
}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

What was the motivation for adding this fail-safe? Have you observed this happening in real demos?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

My motivation is that keyframe == true implies/suggests that we can jump to this chunk in a demo later on and just start reading from there. A delta tick does not fulfil this promise, so simply setting keyframe = false in that case seemed like a sane action.
Until now, I have not checked any demos for this behavior. I now checked a few (~5) demos and this doesn't seem to be a thing. Would you rather have this be an error or be handled differently?

Comment thread demo/src/reader.rs
Comment thread tools/src/bin/demo_check_seeking.rs Outdated
Comment thread tools/src/bin/demo_check_seeking.rs
Comment thread tools/src/bin/demo_check_seeking.rs Outdated
@Patiga

Patiga commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator Author

For now I only exposed next_chunk_type on the high level reader. It could also be added to the lower abstraction reader, however that one has kind of a different idea what the chunk types are.

@Patiga

Patiga commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator Author

ah, gotta rebase on master

@Patiga
Patiga force-pushed the seek-demo3 branch 4 times, most recently from 849ffcf to 4a593ba Compare August 8, 2026 12:12
@Patiga

Patiga commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator Author

Fixed three inconsistencies:

  • rename ChunkType::NetMessage to ChunkType::Message
  • all the seek functions only use io::Error now
  • bug in keyframe seeking where it wouldn't seek back to the initial position

@Patiga

Patiga commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator Author

imo this can be merged now, would also appreciate a crates.io bump.
I've already integrated this change into twsnap and twgpu with demo seeking, and it appears to work nice at the highest level.

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.

2 participants