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

Seeking support #47

Closed
in0finite opened this issue Feb 23, 2024 · 4 comments · Fixed by #49
Closed

Seeking support #47

in0finite opened this issue Feb 23, 2024 · 4 comments · Fixed by #49
Labels
resolution/fixed type/feature New feature or request

Comments

@in0finite
Copy link

There should be seeking support in the library.

It seems that demos already have enough data for this to be possible, eg. snapshots on every 60 sec, round-start ticks, etc...

Backward seeking through time should also be possible.

For best usability, I think library should have an API like this:

DemoParser.SaveToSnapshot(Snapshot s);
DemoParser.RestoreFromSnapshot(Snapshot s);

class Snapshot
{
    List<Entity> entities;
    List<StringTable> stringTables;
    int tick;
    long streamPosition;
    CDemoFileHeader header;

    ...
}
@saul saul added the type/feature New feature or request label Feb 23, 2024
@saul
Copy link
Owner

saul commented Feb 23, 2024

This is definitely do-able, I have some changes on a branch that I need to test that implement seeking to arbitrary ticks.

@saul
Copy link
Owner

saul commented Feb 23, 2024

WIP PR here: #49

@saul
Copy link
Owner

saul commented Feb 24, 2024

The PR should now be in a state for you to test.

I've tested it locally jumping 77 seconds every 77 seconds, and jumping back 16 seconds every 33 seconds. It seems to read the demo fine.

You just need to call SeekToTickAsync before or after MoveNextAsync (i.e., don't try to seek when you're in the middle of e.g. a game event callback).

Can you try it out and let me know how you get on?

@saul
Copy link
Owner

saul commented Feb 29, 2024

This is now available as v0.12.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution/fixed type/feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants