All Projects → nickbabcock → rrrocket

nickbabcock / rrrocket

Licence: MIT license
Rocket League Replay parser to JSON -- CLI app

Programming Languages

rust
11053 projects
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to rrrocket

carball
📈 A Rocket League replay decompiling and analysis library
Stars: ✭ 129 (+258.33%)
Mutual labels:  rocket-league
rlbot-rust
RLBot for Rust
Stars: ✭ 17 (-52.78%)
Mutual labels:  rocket-league
rocket-league-gym
A Gym-like environment for Reinforcement Learning in Rocket League
Stars: ✭ 107 (+197.22%)
Mutual labels:  rocket-league
RocketLeagueReplayParser
No description or website provided.
Stars: ✭ 81 (+125%)
Mutual labels:  rocket-league
rocket-league-replay-analysis
UNMAINTAINED - Creating videos for Analyzing Rocket League Replays (https://gitlab.com/enzanki_ars/rocket-league-replay-analysis)
Stars: ✭ 24 (-33.33%)
Mutual labels:  rocket-league

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
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].