Crate boxcars [−] [src]
Boxcars
Boxcars is a Rocket League replay parser written in Rust with serde support for serialization oftentimes into JSON. The focus is correctness and performance with boxcar users able to dictate what sections of the replay to parse. For instance, parsing just the header (where tidbits like goals and scores are stored) completes in under 50 microseconds. However, if you want to check against replay corruption and parse the network data, it would cost you 30 milliseconds (~1000x increase). While a 1000x increase in time sounds significant; keep in mind, 30ms is phenomenal compared to current state of the art Rocket League Replay parsers.
extern crate boxcars; extern crate serde_json; extern crate failure; use std::fs::File; use std::io::{self, Read}; fn run(filename: &str) -> Result<(), ::failure::Error> { let mut f = File::open(filename)?; let mut buffer = vec![]; f.read_to_end(&mut buffer)?; let replay = boxcars::ParserBuilder::new(&buffer) .on_error_check_crc() .parse()?; serde_json::to_writer(&mut io::stdout(), &replay)?; Ok(()) }
Modules
crc |
Structs
CacheProp |
A mapping between an object (that's an attribute)'s index and what its id will be when encoded in the network data |
ClassIndex |
A mapping between an object's name and its index. Largely redundant |
ClassNetCache |
Contains useful information when decoding the network stream, which we aren't |
DebugInfo |
Debugging info stored in the replay if debugging is enabled. |
Frame |
Contains the time and any new information that occurred during a frame |
KeyFrame |
Keyframes as defined by the video compression section in the wikipedia article, are the main frames that are derived from in the following frame data. The key frames decoded will match up with the frames decoded from the network data. |
NetworkFrames |
The frames decoded from the network data |
NewActor |
Information for a new actor that appears in the game |
ParserBuilder |
The main entry point to parsing replays in boxcars. Allows one to customize parsing options, such as only parsing the header and forgoing crc (corruption) checks. |
Replay |
The structure that a rocket league replay is parsed into. |
Rotation |
An object's current rotation |
TickMark |
In Rocket league replays, there are tickmarks that typically represent a significant event in the game (eg. a goal). The tick mark is placed before the event happens so there is a ramp-up time. For instance, a tickmark could be at frame 396 for a goal at frame 441. At 30 fps, this would be 1.5 seconds of ramp up time. |
Trajectory |
Contains the optional location and rotation of an object when it spawns |
UpdatedAttribute |
Notifies that an actor has had one of their properties updated (most likely their rigid body state (location / rotation) has changed) |
Vector |
An object's current vector |
Enums
CrcCheck |
Determines under what circumstances the parser should perform the crc check for replay corruption. Since the crc check is the most time consuming check for parsing (causing microseconds to turn into milliseconds), clients should choose under what circumstances a crc check is performed. |
HeaderProp |
All the interesting data are stored as properties in the header, properties such as: |
NetworkParse |
Determines how the parser should handle the network data, which is the most intensive and volatile section of the replay. |