forum

Replay parsing

posted
Total Posts
11
Topic Starter
theLiminator
Hi,

I was wondering if anyone could tell me how the osu replay files work. I would really like to be able to parse them in order to build a tool to analyze your replays and trends in your play.

As far as I can tell, it looks like the replays are stored in a binary format. I don't wanna spend a lot of time trying to reverse engineer the binary replays and getting stuck because the replays are encrypted.

Thanks!
smoogipoo
xxdeathx
Whoa, this isn't supposed to be something that people not so far into CS can understand right?
Topic Starter
theLiminator

smoogipooo wrote:

Have a look at https://osu.ppy.sh/wiki/Osr_(file_format)
Thanks! This is exactly what I wanted!

xxdeathx wrote:

Whoa, this isn't supposed to be something that people not so far into CS can understand right?
Yeah, not really.
smoogipoo
There are very few concepts in there that students after their first year of CS won't understand. By 2nd year they'll likely understand it all, however with a little bit of research into ULEB128, possibly bitfields (at least in my course we didn't do these in 1st year), and techniques for reading bytes out of files, you should be able to parse replays fairly easily.

If you don't know how to parse these files yet, learning how to is a great learning exercise.
For those using .NET and don't know where to start, look into BinaryReader.
Howl
If you're into that, you can also take a look to smoogi's osu!replay analyzer ( p/3176521 ) on github here: https://github.com/smoogipooo/osu-Replay-Analyzer (not sure why he hasn't posted it yet lol)
smoogipoo
Just... Don't look at my Replay API ;_; It's a perfect example of how NOT to do it :p
xxdeathx
i'm in my second year of CE and only get small parts of it, not how it all fits together >.<
Topic Starter
theLiminator
Hmm, you've already rolled an api for it. Maybe when i start developing this i'll just use your api haha. Is there a reason you rolled your own implementation of LZMA decoding and encoding?

If I extend the api or w/e, i'll definitely submit some pull requests.

Might have to get decent at C# though, don't really use it at all. Python is my language of choice :P.
smoogipoo
The LZMA implementation is the official LZMA implementation. The only thing that is mine from the LZMA part of it is LZMACoder which is useless as an object and should instead act as a helper class. Oh man, looking back on my code makes me cringe haha. I'm even amazed this still works O.o
I coded this with no knowledge of the wiki article I mentioned, so I was just poking around testing stuff which I didn't think BinaryReader could handle at the time.

I'll attempt to rewrite it quickly right now :)

Edit: Finished. You're going to have to study for yourself what the last few bytes at the end of the file after the frame data represent for the save method to work :).
aznpwnzor
If you still need a parser, pm me.
Please sign in to reply.

New reply