tfausak / rattletrap

:car: Parse and generate Rocket League replays.
https://hackage.haskell.org/package/rattletrap
MIT License
147 stars 21 forks source link

ERROR: MissingObjectName #254

Closed Darxeal closed 2 years ago

Darxeal commented 2 years ago

Hello, I'm having the following issue:

$ ./rattletrap.exe -i input.replay -o output.json
ERROR: MissingObjectName 2147483807
-- Context: Replay, content, Content, frames, element (2396), Frame, replications, element (311), Replication, value, ReplicationValue, Spawned
-- You are using Rattletrap version 11.2.4
-- Config {compact = False, fast = False, help = False, input = Just "input.replay", mode = Nothing, output = Just "output.json", schema = False, skipCrc = False, version = False}
-- Please report this problem at https://github.com/tfausak/rattletrap/issues/new

The replay is rather unusual, but it works fine in game. Unfortunately I can't currently post the replay file publicly, but if you need it for debugging, please DM me on discord Darxeal#1784

tfausak commented 2 years ago

Sorry, I can't really do anything without the replay file. You should be able to upload it here if you zip it up first. If there are secrets in the replay that you don't want to share, then I can get it from you on Discord. But usually I add failing replays to the test suite to make sure that they stay fixed.

Darxeal commented 2 years ago

Yes, there are secrets that I currently cannot release to the public. It should be ok to add it to the test suite after 1-2 months.

tfausak commented 2 years ago

I received the replay file. I am able to play it from end to end in the official Rocket League client. Rattletrap 11.2.4 fails to parse it with exactly the same error described above. The object ID it's trying to look up (2147483807) is huge! Most of the other object IDs are like 300 or so. In fact, that ID is just 160 more than the largest 32-bit integer. So it seems likely that Rattletrap is parsing the object ID (or, more likely, something before it) incorrectly.

Curiously rrrocket 0.9.3 can parse this replay file. rrrocket's JSON output is smaller than Ratteltrap's, and the resulting compact output is still 110 MB!

The problematic frame (2396) starts at 82.74584.

tfausak commented 2 years ago

I now think this is a problem with getting Rattletrap's CompressedWord type:

https://github.com/tfausak/rattletrap/blob/0ae9fa54a4a453a78dd912c27ffa4e841f754368/src/lib/Rattletrap/Type/CompressedWord.hs#L67

Printing out the actor IDs just before the error, they're counting up one by one: 1020, 1021, 1022. Then it jumps to 2047, which is the limit. It's likely that it was supposed to read 1023 but read an extra bit after that to hit 2047 instead.

0b01111111100 1020
0b01111111101 1021
0b01111111110 1022
0b01111111111 1023 -- should have been this
0b10000000000 1024
...
0b11111111111 2047 -- but was this instead

The corresponding function from rrrocket (read_bits_max_computed) is found through boxcars in bitter: https://github.com/nickbabcock/bitter/blob/33a5f64e5693b41801b5bb1bcd50bbb515cb605e/src/lib.rs#L862

tfausak commented 2 years ago

This is related to https://github.com/nickbabcock/boxcars/pull/84, which fortunately includes a smaller public replay that exhibits the same problem.

tfausak commented 2 years ago

Can you try with version 11.2.5? https://github.com/tfausak/rattletrap/releases/tag/11.2.5

Darxeal commented 2 years ago

Looks like it works! Thank you for looking into this ❤️