Skip to main content

Rocket League replay parsing and analysis.

Project description

Sprocket-carball

Sprocket-carball is an open-source project that combines multiple tools for decompiling Rocket League replays and then analysing them. It is a fork of SaltieRL's carball project, which appears to no longer be maintained.

Install

Install from pip:

pip install sprocket_carball

Examples / Usage

One of the main data structures used in carball is the pandas.DataFrame, to learn more, see its wiki page.

Decompile and analyze a replay:

import carball

analysis_manager = carball.analyze_replay_file('9EB5E5814D73F55B51A1BD9664D4CBF3.replay', 
                                      output_path='9EB5E5814D73F55B51A1BD9664D4CBF3.json', 
                                      overwrite=True)
proto_game = analysis_manager.get_protobuf_data()

# you can see more example of using the analysis manager below

Just decompile a replay to a JSON object:

import carball

_json = carball.decompile_replay('9EB5E5814D73F55B51A1BD9664D4CBF3.replay', 
                                output_path='9EB5E5814D73F55B51A1BD9664D4CBF3.json', 
                                overwrite=True)

Analyze a JSON game object:

import carball
import gzip
from carball.json_parser.game import Game
from carball.analysis.analysis_manager import AnalysisManager

# _json is a JSON game object (from decompile_replay)
game = Game()
game.initialize(loaded_json=_json)

analysis_manager = AnalysisManager(game)
analysis_manager.create_analysis()
    
# return the proto object in python
proto_object = analysis_manager.get_protobuf_data()

# return the proto object as a json object
json_oject = analysis_manager.get_json_data()

# return the pandas data frame in python
dataframe = analysis_manager.get_data_frame()

You may want to save carball analysis results for later use:

# write proto out to a file
# read api/*.proto for info on the object properties
with open('output.pts', 'wb') as fo:
    analysis_manager.write_proto_out_to_file(fo)
    
# write pandas dataframe out as a gzipped numpy array
with gzip.open('output.gzip', 'wb') as fo:
    analysis_manager.write_pandas_out_to_file(fo)

Read the saved analysis files:

import gzip
from carball.analysis.utils.pandas_manager import PandasManager
from carball.analysis.utils.proto_manager import ProtobufManager

# read proto from file
with open('output.pts', 'rb') as f:
    proto_object = ProtobufManager.read_proto_out_from_file(f)

# read pandas dataframe from gzipped numpy array file
with gzip.open('output.gzip', 'rb') as f:
    dataframe = PandasManager.read_numpy_from_memory(f)

Command Line

Carball comes with a command line tool to analyze replays. To use carball from the command line:

carball -i 9EB5E5814D73F55B51A1BD9664D4CBF3.replay --json analysis.json

To get the analysis in both json and protobuf and also the compressed replay frame data frame:

carball -i 9EB5E5814D73F55B51A1BD9664D4CBF3.replay --json analysis.json --proto analysis.pts --gzip frames.gzip

Command Line Arguments

usage: carball [-h] -i INPUT [--proto PROTO] [--json JSON] [--gzip GZIP] [-sd]
               [-v] [-s]

Rocket League replay parsing and analysis.

optional arguments:
  -h, --help            show this help message and exit
  -i INPUT, --input INPUT
                        Path to replay file that will be analyzed. Carball
                        expects a raw replay file unless --skip-decompile is
                        provided.
  --proto PROTO         The result of the analysis will be saved to this file
                        in protocol buffers format.
  --json JSON           The result of the analysis will be saved to this file
                        in json file format.
  --gzip GZIP           The pandas dataframe will be saved to this file in a
                        compressed gzip format.
  -v, --verbose         Set the logging level to INFO. To set the logging
                        level to DEBUG use -vv.
  -s, --silent          Disable logging altogether.

Pipeline

pipeline is in Parserformat.png

If you want to add a new stat it is best to do it in the advanced stats section of the pipeline. You should look at:

Stat base classes

Where you add a new stat

If you want to see the output format of the stats created you can look here

Compile the proto files by running in this directory setup.bat (Windows) or setup.sh (Linux/mac)

Build Status codecov

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sprocket_carball-1.2.2.tar.gz (151.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sprocket_carball-1.2.2-py3-none-any.whl (213.3 kB view details)

Uploaded Python 3

File details

Details for the file sprocket_carball-1.2.2.tar.gz.

File metadata

  • Download URL: sprocket_carball-1.2.2.tar.gz
  • Upload date:
  • Size: 151.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sprocket_carball-1.2.2.tar.gz
Algorithm Hash digest
SHA256 f53ad98825c1d1a689442b453738e94cf50c8c81215fee2837bd7bc6dc4b70bf
MD5 a72cbb343aeaffb3e7bab96cfccd927c
BLAKE2b-256 bcc11c29e45474409dbfb351cb36af6a12e658f42bdfcf087961b996f54a0774

See more details on using hashes here.

Provenance

The following attestation bundles were made for sprocket_carball-1.2.2.tar.gz:

Publisher: build-and-publish.yml on SprocketBot/carball

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sprocket_carball-1.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for sprocket_carball-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e25d539c735f566ddde082e401a317ad1f7864a3abdd1e860bc3fa7922c873f0
MD5 72e24de47dfa40f2a74069027a7477fb
BLAKE2b-256 58abdbc9b2bfb0279304bd3268d38ad0577b3b102e0ed33bee445756f25bacaa

See more details on using hashes here.

Provenance

The following attestation bundles were made for sprocket_carball-1.2.2-py3-none-any.whl:

Publisher: build-and-publish.yml on SprocketBot/carball

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page