Workflow Status Version Maintenance

subtr-actor

subtr-actor

subtr-actor is a versatile library designed to facilitate the process of working with and extracting data from Rocket League replays. Utilizing the powerful boxcars library for parsing, subtr-actor simplifies the underlying actor-based structure of replay files, making them more accessible and easier to manipulate.

Overview of Key Components

Collector implementations

subtr-actor also includes implementations of the Collector trait:

each entity in the game is grouped together.

Example

In the following example, we demonstrate how to use boxcars, NDArrayCollector and FrameRateDecorator to write a function that takes a replay filepath and collections of features adders and returns a ReplayMetaWithHeaders along with a ::ndarray::Array2. The resulting ::ndarray::Array2 would be appropriate for use in a machine learning context. Note that ReplayProcessor is also used implicitly here in the Collector::process_replay

```rust use subtr_actor::*;

fn getndarraywithinfofromreplayfilepath( filepath: std::path::PathBuf, featureadders: FeatureAdders, playerfeatureadders: PlayerFeatureAdders, fps: Option, ) -> anyhow::Result<(ReplayMetaWithHeaders, ::ndarray::Array2)> { let data = std::fs::read(filepath.aspath())?; let replay = boxcars::ParserBuilder::new(&data) .mustparsenetworkdata() .onerrorcheckcrc() .parse()?;

let mut collector = NDArrayCollector::new(feature_adders, player_feature_adders);

FrameRateDecorator::new_from_fps(fps.unwrap_or(10.0), &mut collector)
    .process_replay(&replay)
    .map_err(|e| e.variant)?;

Ok(collector.get_meta_and_ndarray().map_err(|e| e.variant)?)

} ```