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

Negative time delta in first couple of frames for Mania Replays #39

Closed
sinanates17 opened this issue Apr 29, 2023 · 3 comments
Closed

Comments

@sinanates17
Copy link

sinanates17 commented Apr 29, 2023

After executing the following code:

from osrparse import Replay
replay = Replay.from_path("strong.osr")
with open("replay.txt", "w") as f:
    for frame in replay.replay_data:
        f.write(str(frame) + "\n")

The first few lines of replay.txt are as follows. It also appears that Key 9 is considered to have been pressed during those first 2 frames while no keys were actually pressed at the very beginning of this play before any notes came down.

ReplayEventMania(time_delta=0, keys=<KeyMania.K9: 256>)
ReplayEventMania(time_delta=12158, keys=<KeyMania.K9: 256>)
ReplayEventMania(time_delta=-12158, keys=<KeyMania: 0>)
ReplayEventMania(time_delta=0, keys=<KeyMania: 0>)
ReplayEventMania(time_delta=12, keys=<KeyMania: 0>)
ReplayEventMania(time_delta=17, keys=<KeyMania: 0>)
ReplayEventMania(time_delta=13, keys=<KeyMania: 0>)
ReplayEventMania(time_delta=20, keys=<KeyMania: 0>)
ReplayEventMania(time_delta=18, keys=<KeyMania: 0>)

In addition, it seems that very occasionally, there is a time_delta that is exceedingly large. Lines 68-71 in replay.txt is as follows:

ReplayEventMania(time_delta=18, keys=<KeyMania: 0>)
ReplayEventMania(time_delta=11193, keys=<KeyMania: 0>)
ReplayEventMania(time_delta=0, keys=<KeyMania: 0>)
ReplayEventMania(time_delta=6, keys=<KeyMania: 0>)

I'm unsure if there's a meaning behind the negative time_deltas. I'm trying to loop through all the frames in a replay and assign a timestamp to each frame using the time_deltas. Due to these negatives, I'm not exactly sure which frame corresponds to the first actual frame of the replay.

Here is the exact replay I used in this code: https://cdn.discordapp.com/attachments/571707842235727902/1101982751344828436/strong.osr

And here is the replay.txt file I generated:
replay.txt

This is a replay for the following beatmap: https://osu.ppy.sh/beatmapsets/1657903#mania/3384013

The occurrence of negative frame deltas in the first few ReplayEvents seemed to be pretty consistent across different replays and different maps. I wasn't able to replicate the random, large time_delta in the middle of the replay, however.

@tybug
Copy link
Collaborator

tybug commented Apr 29, 2023

There's two distinct comments here. The easier one to comment on is the negative and/or large time_deltas. This is not a bug, as these frames are present as-is in the lzma data. Negative time frames do have special meaning, and depending on your use case you can treat them in different ways. Lazer skips negative time frames. circlecore incorporates negative frames in a different way, which may even be more correct than lazer. I can't offer advice beyond that.

The second comment is about the first two frames of the replay having an odd keys value. This is due to osrs containing two frames at the beginning with an x value of 265, which is interpreted by mania as K9. Lazer removes these frames. I would argue we should do the same - these frames are (relatively) harmless for std, but cause issues for minigames, which e.g. interpret the x value as keys (mania).

Doing so is a breaking change and requires a major version bump.

@sinanates17
Copy link
Author

I see, thank you for clarifying everything. I seem to have found my way around proper timestamps as well!

@tybug
Copy link
Collaborator

tybug commented May 10, 2023

We now remove these two frames in v7.0.0.

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

No branches or pull requests

2 participants