Boxcars
Boxcars is a Rocket League replay parser library written in Rust.
Features
- ✔ Safe: Stable Rust with no unsafe
- ✔ Fast: Parse a hundred replays per second per CPU core
- ✔ Fuzzed: Extensively fuzzed against potential malicious input
- ✔ Ergonomic: Serialization support is provided through serde
See where Boxcars in used:
- Inside the rrrocket CLI app to turn Rocket League Replays into JSON
- Compiled to WebAssembly and embedded in a web page
- Underpins the python analyzer of the popular calculated.gg site
Quick Start
Below is an example to output the replay structure to json:
use ;
use error;
use fs;
use ;
# let filename = "assets/replays/good/rumble.replay";
# run.unwrap;
The above example will parse both the header and network data of a replay file, and return an error if there is an issue either header or network data. Since the network data will often change with each Rocket League patch, the default behavior is to ignore any errors from the network data and still be able to return header information.
Variations
If you're only interested the header (where tidbits like goals and scores are stored) then you can achieve an 1000x speedup by directing boxcars to only parse the header.
- By skipping network data one can parse and aggregate thousands of replays in under a second to provide an immediate response to the user. Then a full parsing of the replay data can provide additional insights when given time.
- By ignoring network data errors, boxcars can still provide details about newly patched replays based on the header.
Boxcars will also check for replay corruption on error, but this can be configured to always check for corruption or never check.