Code Monkey home page Code Monkey logo

rrrocket's Introduction

rrrocket

ci

rrrocket parses a Rocket League replay file and outputs JSON.

Underneath rrrocket is the general rocket league parsing library: boxcars

Installation

Download the appropriate bundle from the releases page:

  • For Windows, you'll want the one labeled windows-msvc
  • For Linux, you'll want the one labeled linux-musl
  • For macOS, you'll want the only one labeled apple

Usage

Parses Rocket League replay files and outputs JSON with decoded information

USAGE:
    rrrocket [FLAGS] [input]...

FLAGS:
    -n, --network-parse    parses the network data of a replay instead of skipping it
    -c, --crc-check        forces a crc check for corruption even when replay was successfully parsed
        --dry-run          parses but does not write JSON output
    -h, --help             Prints help information
    -j, --json-lines       output multiple files to stdout via json lines
    -m, --multiple         parse multiple replays in provided directories. Defaults to writing to a sibling JSON file,
                           but can output to stdout with --json-lines
    -p, --pretty           output replay as pretty-printed JSON
    -V, --version          Prints version information

ARGS:
    <input>...    Rocket League replay files

Output

A sample output of the JSON from rrrocket:

{
  "header_size": 4768,
  "header_crc": 337843175,
  "major_version": 868,
  "minor_version": 12,
  "game_type": "TAGame.Replay_Soccar_TA",
  "properties": {
    "TeamSize": 3,
    "Team0Score": 5,
    "Team1Score": 2,
    "Goals": [
      {
        "PlayerName": "Cakeboss",
        "PlayerTeam": 1,
        "frame": 441
      },
      // all the goals
    ]
    // and many more properties
  }

If network parsed is enabled then an attribute (snipped) looks something like:

{
  "actor_id": 6,
  "stream_id": 51,
  "attribute": {
    "RigidBody": {
      "sleeping": true,
      "location": {
        "bias": 16384,
        "dx": 16384,
        "dy": 16384,
        "dz": 25658
      },
      "x": 1,
      "y": 1,
      "z": 1,
      "linear_velocity": null,
      "angular_velocity": null
    }
  }
}

Queries with jq

Since rrrocket outputs json, jq is a natural query tool. Here are some questions that rrrocket and jq can answer together.

Want to find out which non 3v3 games had a score difference greater than 2?

rrrocket --json-lines --multiple ~/projects/boxcars/assets/replays/good/ \
  | jq -c 'if (.replay.properties.TeamSize != 3 and
      (((.replay.properties.Team0Score // 0) - (.replay.properties.Team1Score // 0) | length) > 2)) then .file else empty end'

Top combined score?

rrrocket --json-lines --multiple ~/projects/boxcars/assets/replays/good/ \
  | jq -c  '{(.file): (.replay.properties.Team0Score // 0 + .replay.properties.Team1Score // 0)}' \
  | sort -n -k2 -t ':'

Games with certain attributes?

rrrocket --json-lines --multiple ~/projects/boxcars/assets/replays/good/ \
  | jq -c 'if (.replay.objects | contains(["Archetypes.Ball.Ball_Breakout"])) then .file else empty end'

boxcapy

boxcapy is a python script that ingests given JSON files that have been created by rrrocket (and only needs header information). The command below is the one I use to generate the JSON files:

find . -type f -iname "*.replay" | xargs ~/rrrocket -m 

To have your graphs saved into your directory follow the below instructions:

  • Since the graphs are in the style of XKCD, one has to install the Humor Sans font before continuing (eg. apt install fonts-humor-sans)
  • Install pipenv
  • Install dependencies pipenv && pipenv install
  • Run on generated JSON files: pipenv run boxcapy/rocket-plot.py *.json --headless

rrrocket's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar nickbabcock avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

rrrocket's Issues

Incomplete Replay Data Question

Hello! Thank you so much for your parser, it has saved me a ton of time and effort. I have a question for you with regards to some replays that I have which appear to have incomplete data in them. Here's some stats from a set of around 1200 replay files I obtained online:

Total Replays: 1200
With PlayerStats: 1032
Complete PlayerStats: 715

'With PlayerStats' means that replay['properties'] contains a 'PlayerStats' array containing an overview of that player's name, team, performance in the match, etc. 'Complete PlayerStats' means that the PlayerStats array size is actually equal to the number of players in the game after looking at all the network frames. In this example, nearly 30% of the replays with a PlayerStats array do not actually contain information about all the players, for example the PlayerStats array may be of size 3 for a 2v2 game.

My questions are the following:

  • Do you know why the PlayerStats value may be missing from some replays?
  • Do you know why if it's there, it may be incomplete?
  • If a replay doesn't have a complete PlayerStats value, should we "trust" the rest of the replay to contain accurate information?

Thank you again for the software

Freeplay Replays cannot be parsed properly.

I have a replay file from freeplay that should contain car and ball frames, but rrrocket with flag -n only produces an empty array frames when I know it is not empty. Everything else seems to be parsed perfectly fine, and there is no log/error given to me about the network frames.

How can I retrieve these frames?

Unable To Get Ball Location After A Goal Is Scored

Hi, I am trying to get the balls location data (x, y, z) from a replay using the .json file that rrrocket generates. Using python I can successfully extract the data for the location of the ball, until a goal is scored.

It appears that a new ball is created under a different actor_id every time a goal is scored. I have not been able to find any positional data relating to these new actor_ids and it seems that they don't appear in many frames. I tried to use rattletrap and encountered the same problem so I am at a loss. Any advice you can give would be appreciated.

actor_ids:
- 'Ball_TA_0' (1786 Frames)
- 'Ball_TA_2' (45 Frames)
- 'Ball_TA_4' (82 Frames)
- 'Ball_TA_6' (46 Frames)

Thanks, Maverick.

Question on Bias.

How does Bias impact the XYZ coordinates. I am getting some crazy XYZs like:

 "location": {
                      "bias": 262144,
                      "size": {
                        "limit": 21,
                        "value": 17
                      },
                      "x": -204800,
                      "y": 256000,
                      "z": 1701

thanks

Unable to parse replays

60DFE52E4E6DA4E2B8ACDBA79D6E55E9.replay
Could not parse replay Attribute error: Unexpected size for string: 1342177280 Unexpected size for string: 1342177280

7086546B4E9C97D9279BDE8281CA3E7D.replay
Could not parse replay Attribute error: Unexpected size for string: 870515036 Unexpected size for string: 870515036

72AE1E0740E7C060BAA3BB8A9AEDFD71.replay
Could not parse replay Actor id: 10 of object id: 232 (GameInfo_Soccar.GameInfo.GameInfo_Soccar:GameReplicationInfoArchetype) but stream id: 18 (Engine.Actor:Rotation) was not implemented. Possible missing implementations for stream id 18 object 21 (Engine.Actor) has property 19 (Engine.Actor:Rotation)

FC4279EE4C20ECEA417655BE8EFD3C78.replay
Could not parse replay Actor id: 13 of object id: 292 (GameInfo_Soccar.GameInfo.GameInfo_Soccar:GameReplicationInfoArchetype) but stream id: 4 (Engine.Actor:bNetOwner) was not implemented. Possible missing implementations for stream id 4 object 21 (Engine.Actor) has property 5 (Engine.Actor:bNetOwner)

All of these happen when I try to do a network parse. I have attached them as a zip for further investigation. Thank you!

replays.zip

Feature Request: "Data Science" Output

I am computer science professor / ai researcher, and a few colleagues / students have recently started looking to rocket league for data sets for machine learning. The output of rocket league replay parsers is quite confusing at first glance, and some considerable effort went into deciphering what various values means, etc.

What we are looking for is a JSON output that gives the following information:

  • The names / teams of all the players
  • The final game stats (goals, shots, assists, etc)
  • The rigid body properties at each frame (position, rotation, velocity, etc)
  • The car boost properties at each frame (is it boosting, current boost level, etc)
  • The above data stored as a dictionary, indexed by player name rather than confusing actor ids which change upon respawns

The actual replay format makes this slightly annoying to extract, requiring me to go through and calculate the mapping from actorid to player names, find updated actors, and fill in frame data for which no updated actor data is found. If there was a way to output the data above directly from the program with a new flag, I think a lot of people would use it for this purpose. I do not know rust well enough to attempt this myself, and I have had some limited success with CPPRP in accomplishing this.

If you feel that this is a feature you may want to implement, I would be happy to provide a sample output JSON file with the type of data we are typically interested in for machine learning purposes.

Parser breaking Rocket League update

Hey, it looks like there was a parser breaking update for Rocket League. I get this error for pretty much all the recent replays. Can you take a look at it pls? Thanks!

I've used this random replay: https://ballchasing.com/replay/436d667b-116f-44d9-b548-f8079484fc80

rrrocket.exe -n test1.replay
An error occurred: Unable to parse replay test1.replay: Error decoding frame: attribute unknown or not implemented: actor id / actor object id / attribute id: 47 / 283 / 24. found attribute TAGame.CarComponent_Dodge_TA:DodgeImpulse (unknown to boxcars) on Archetypes.CarComponents.CarComponent_Dodge in network cache data. This is likely due to a rocket league update or an atypical replay. File a bug report! Context: on frame: 134, last updated actor: (actor stream id / object id / name: 47 / 283 / Archetypes.CarComponents.CarComponent_Dodge, attribute stream id / object id / name: 22 / 271 / TAGame.CarComponent_TA:ReplicatedActive, attribute: Byte(3))

Error parsing latest replay files from Unranked Play

Getting the error below when parsing a replay file that was in Unranked and contained bots today. Did not have this issue before when I was playing with bots in private matches.
I am running on Ubuntu 22.04.3 LTS, using the program rrrocket-0.9.9-x86_64-unknown-linux-musl.
When parsed without the -n, the json successfully parses into the attached .json file
181D63AC470CE9DAED6BCDAFC950D7CD.json

If you would like the .replay file I used to parse, please let me know how I can send it to you. I have 2 files with this issue

./rrrocket -c -p -n ./181D63AC470CE9DAED6BCDAFC950D7CD.replay > ./181D63AC470CE9DAED6BCDAFC950D7CD.json
An error occurred: Unable to parse replay ./181D63AC470CE9DAED6BCDAFC950D7CD.replay

Caused by:
    0: Error decoding frame: attribute unknown or not implemented: actor id / actor object id / attribute id: 1 / 112 / 28. found attribute TAGame.GameEvent_TA:bIsBotMatch (unknown to boxcars) on Archetypes.GameEvent.GameEvent_Soccar in network cache data. This is likely due to a rocket league update or an atypical replay. File a bug report! Context: on frame: 0, last updated actor: (actor stream id / object id / name: 1 / 112 / Archetypes.GameEvent.GameEvent_Soccar, attribute stream id / object id / name: 27 / 76 / TAGame.GameEvent_TA:BotSkill, attribute: Int(940201477))
    1: Error decoding frame: attribute unknown or not implemented: actor id / actor object id / attribute id: 1 / 112 / 28. found attribute TAGame.GameEvent_TA:bIsBotMatch (unknown to boxcars) on Archetypes.GameEvent.GameEvent_Soccar in network cache data. This is likely due to a rocket league update or an atypical replay. File a bug report! Context: on frame: 0, last updated actor: (actor stream id / object id / name: 1 / 112 / Archetypes.GameEvent.GameEvent_Soccar, attribute stream id / object id / name: 27 / 76 / TAGame.GameEvent_TA:BotSkill, attribute: Int(940201477))
    2: attribute unknown or not implemented: actor id / actor object id / attribute id: 1 / 112 / 28

[STEAMID] Wrong steam ID

Hello,

i recently found something wrong with properties, the steam id is not the same as the real one.

Example here :
image

And the real one :
image

Thank you.

PS : It seem that i have to add +2 to the id to get the real one, tested with two players

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.